diff options
author | Dave Chapman <dave@dchapman.com> | 2008-10-19 14:11:01 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-10-19 14:11:01 +0000 |
commit | 08c41d42bb699a1be99c9696b4d4fb7b40e8723a (patch) | |
tree | 2834231979d52b81a7860fd4a5e19ed79b3ffee7 /firmware/target/arm/as3525/sansa-e200v2 | |
parent | 14ee31865e366dc19fb87caf4877a8d93305a01b (diff) | |
download | rockbox-08c41d42bb699a1be99c9696b4d4fb7b40e8723a.tar.gz rockbox-08c41d42bb699a1be99c9696b4d4fb7b40e8723a.zip |
Add e200v2 and m200v2 targets. Move the telechips lcd-ssd1815.c (currently used by Logik DAX and m200v1 ports) driver up in the target tree and share with the m200v2 - as2525 parts contributed by Rafael Carre. Includes the start (but is still very incomplete) of an LCD driver for the e200v2. m200v2 is not yet fully supported by mkamsboot - that will come soon. Also some minor cleanups for the Clip.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18836 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sansa-e200v2')
7 files changed, 670 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/adc-target.h b/firmware/target/arm/as3525/sansa-e200v2/adc-target.h new file mode 100644 index 0000000000..bea0272496 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-e200v2/adc-target.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | #endif /* _ADC_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/as3525/sansa-e200v2/backlight-target.h b/firmware/target/arm/as3525/sansa-e200v2/backlight-target.h new file mode 100644 index 0000000000..9533d0a6b5 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-e200v2/backlight-target.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef BACKLIGHT_TARGET_H | ||
22 | #define BACKLIGHT_TARGET_H | ||
23 | |||
24 | static inline bool _backlight_init(void) | ||
25 | { | ||
26 | return true; | ||
27 | } | ||
28 | |||
29 | static inline void _backlight_on(void) | ||
30 | { | ||
31 | } | ||
32 | |||
33 | static inline void _backlight_off(void) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | #endif | ||
diff --git a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c new file mode 100644 index 0000000000..fc2715216c --- /dev/null +++ b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c | |||
@@ -0,0 +1,98 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | /* Taken from button-h10.c by Barry Wardell and reverse engineering by MrH. */ | ||
23 | |||
24 | #include "system.h" | ||
25 | #include "button.h" | ||
26 | #include "backlight.h" | ||
27 | #include "powermgmt.h" | ||
28 | |||
29 | #define WHEEL_REPEAT_INTERVAL 300000 | ||
30 | #define WHEEL_FAST_ON_INTERVAL 20000 | ||
31 | #define WHEEL_FAST_OFF_INTERVAL 60000 | ||
32 | #define WHEELCLICKS_PER_ROTATION 48 /* wheelclicks per full rotation */ | ||
33 | |||
34 | /* Clickwheel */ | ||
35 | #ifndef BOOTLOADER | ||
36 | static unsigned int old_wheel_value = 0; | ||
37 | static unsigned int wheel_repeat = BUTTON_NONE; | ||
38 | static unsigned int wheel_click_count = 0; | ||
39 | static unsigned int wheel_delta = 0; | ||
40 | static int wheel_fast_mode = 0; | ||
41 | static unsigned long last_wheel_usec = 0; | ||
42 | static unsigned long wheel_velocity = 0; | ||
43 | static long last_wheel_post = 0; | ||
44 | static long next_backlight_on = 0; | ||
45 | /* Buttons */ | ||
46 | static bool hold_button = false; | ||
47 | static bool hold_button_old = false; | ||
48 | #define _button_hold() hold_button | ||
49 | #else | ||
50 | #define _button_hold() false /* FIXME */ | ||
51 | #endif /* BOOTLOADER */ | ||
52 | static int int_btn = BUTTON_NONE; | ||
53 | |||
54 | void button_init_device(void) | ||
55 | { | ||
56 | } | ||
57 | |||
58 | bool button_hold(void) | ||
59 | { | ||
60 | return _button_hold(); | ||
61 | } | ||
62 | |||
63 | /* clickwheel */ | ||
64 | #ifndef BOOTLOADER | ||
65 | void clickwheel_int(void) | ||
66 | { | ||
67 | } | ||
68 | #endif /* BOOTLOADER */ | ||
69 | |||
70 | /* device buttons */ | ||
71 | void button_int(void) | ||
72 | { | ||
73 | unsigned char state; | ||
74 | |||
75 | int_btn = BUTTON_NONE; | ||
76 | |||
77 | } | ||
78 | |||
79 | /* | ||
80 | * Get button pressed from hardware | ||
81 | */ | ||
82 | int button_read_device(void) | ||
83 | { | ||
84 | #ifdef BOOTLOADER | ||
85 | /* Read buttons directly in the bootloader */ | ||
86 | button_int(); | ||
87 | #else | ||
88 | /* light handling */ | ||
89 | if (hold_button != hold_button_old) | ||
90 | { | ||
91 | hold_button_old = hold_button; | ||
92 | backlight_hold_changed(hold_button); | ||
93 | } | ||
94 | #endif /* BOOTLOADER */ | ||
95 | |||
96 | /* The int_btn variable is set in the button interrupt handler */ | ||
97 | return int_btn; | ||
98 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-e200v2/button-target.h b/firmware/target/arm/as3525/sansa-e200v2/button-target.h new file mode 100644 index 0000000000..969f91b143 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-e200v2/button-target.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef _BUTTON_TARGET_H_ | ||
23 | #define _BUTTON_TARGET_H_ | ||
24 | |||
25 | #include <stdbool.h> | ||
26 | #include "config.h" | ||
27 | |||
28 | #define HAS_BUTTON_HOLD | ||
29 | |||
30 | bool button_hold(void); | ||
31 | void button_init_device(void); | ||
32 | int button_read_device(void); | ||
33 | #ifndef BOOTLOADER | ||
34 | void clickwheel_int(void); | ||
35 | #endif | ||
36 | void button_int(void); | ||
37 | |||
38 | /* Sandisk Sansa E200 button codes */ | ||
39 | |||
40 | /* Main unit's buttons */ | ||
41 | #define BUTTON_REC 0x00000001 | ||
42 | #define BUTTON_DOWN 0x00000002 | ||
43 | #define BUTTON_RIGHT 0x00000004 | ||
44 | #define BUTTON_LEFT 0x00000008 | ||
45 | #define BUTTON_SELECT 0x00000010 | ||
46 | #define BUTTON_UP 0x00000020 | ||
47 | #define BUTTON_POWER 0x00000040 | ||
48 | |||
49 | #define BUTTON_SCROLL_BACK 0x00000080 | ||
50 | #define BUTTON_SCROLL_FWD 0x00000100 | ||
51 | |||
52 | #define BUTTON_MAIN 0x00000fff | ||
53 | |||
54 | /* No Remote control */ | ||
55 | #define BUTTON_REMOTE 0 | ||
56 | |||
57 | #define POWEROFF_BUTTON BUTTON_POWER | ||
58 | #define POWEROFF_COUNT 10 | ||
59 | |||
60 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c new file mode 100644 index 0000000000..e14ad21681 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c | |||
@@ -0,0 +1,385 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2004 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | |||
23 | #include "cpu.h" | ||
24 | #include "lcd.h" | ||
25 | #include "kernel.h" | ||
26 | #include "thread.h" | ||
27 | #include <string.h> | ||
28 | #include <stdlib.h> | ||
29 | #include "file.h" | ||
30 | #include "debug.h" | ||
31 | #include "system.h" | ||
32 | #include "font.h" | ||
33 | #include "bidi.h" | ||
34 | |||
35 | static bool display_on = false; /* is the display turned on? */ | ||
36 | static bool display_flipped = false; | ||
37 | static int xoffset = 0; /* needed for flip */ | ||
38 | |||
39 | /* register defines */ | ||
40 | #define R_START_OSC 0x00 | ||
41 | #define R_DRV_OUTPUT_CONTROL 0x01 | ||
42 | #define R_DRV_WAVEFORM_CONTROL 0x02 | ||
43 | #define R_ENTRY_MODE 0x03 | ||
44 | #define R_COMPARE_REG1 0x04 | ||
45 | #define R_COMPARE_REG2 0x05 | ||
46 | |||
47 | #define R_DISP_CONTROL1 0x07 | ||
48 | #define R_DISP_CONTROL2 0x08 | ||
49 | #define R_DISP_CONTROL3 0x09 | ||
50 | |||
51 | #define R_FRAME_CYCLE_CONTROL 0x0b | ||
52 | #define R_EXT_DISP_IF_CONTROL 0x0c | ||
53 | |||
54 | #define R_POWER_CONTROL1 0x10 | ||
55 | #define R_POWER_CONTROL2 0x11 | ||
56 | #define R_POWER_CONTROL3 0x12 | ||
57 | #define R_POWER_CONTROL4 0x13 | ||
58 | |||
59 | #define R_RAM_ADDR_SET 0x21 | ||
60 | #define R_WRITE_DATA_2_GRAM 0x22 | ||
61 | |||
62 | #define R_GAMMA_FINE_ADJ_POS1 0x30 | ||
63 | #define R_GAMMA_FINE_ADJ_POS2 0x31 | ||
64 | #define R_GAMMA_FINE_ADJ_POS3 0x32 | ||
65 | #define R_GAMMA_GRAD_ADJ_POS 0x33 | ||
66 | |||
67 | #define R_GAMMA_FINE_ADJ_NEG1 0x34 | ||
68 | #define R_GAMMA_FINE_ADJ_NEG2 0x35 | ||
69 | #define R_GAMMA_FINE_ADJ_NEG3 0x36 | ||
70 | #define R_GAMMA_GRAD_ADJ_NEG 0x37 | ||
71 | |||
72 | #define R_GAMMA_AMP_ADJ_RES_POS 0x38 | ||
73 | #define R_GAMMA_AMP_AVG_ADJ_RES_NEG 0x39 | ||
74 | |||
75 | #define R_GATE_SCAN_POS 0x40 | ||
76 | #define R_VERT_SCROLL_CONTROL 0x41 | ||
77 | #define R_1ST_SCR_DRV_POS 0x42 | ||
78 | #define R_2ND_SCR_DRV_POS 0x43 | ||
79 | #define R_HORIZ_RAM_ADDR_POS 0x44 | ||
80 | #define R_VERT_RAM_ADDR_POS 0x45 | ||
81 | |||
82 | #define LCD_CMD (*(volatile unsigned short *)0xf0000000) | ||
83 | #define LCD_DATA (*(volatile unsigned short *)0xf0000002) | ||
84 | |||
85 | #define R_ENTRY_MODE_HORZ 0x7030 | ||
86 | #define R_ENTRY_MODE_VERT 0x7038 | ||
87 | |||
88 | /* TODO: Implement this function */ | ||
89 | static void lcd_delay(int x) | ||
90 | { | ||
91 | (void)x; | ||
92 | } | ||
93 | |||
94 | /* DBOP initialisation, do what OF does */ | ||
95 | static void ams3525_dbop_init(void) | ||
96 | { | ||
97 | |||
98 | /* TODO: More... */ | ||
99 | |||
100 | DBOP_TIMPOL_01 = 0xe167e167; | ||
101 | DBOP_TIMPOL_23 = 0xe167006e; | ||
102 | DBOP_CTRL = 0x41008; | ||
103 | |||
104 | GPIOB_AFSEL = 0xfc; | ||
105 | GPIOC_AFSEL = 0xff; | ||
106 | |||
107 | DBOP_TIMPOL_23 = 0x6000e; | ||
108 | DBOP_CTRL = 0x51008; | ||
109 | DBOP_TIMPOL_01 = 0x6e167; | ||
110 | DBOP_TIMPOL_23 = 0xa167e06f; | ||
111 | |||
112 | /* TODO: More... */ | ||
113 | } | ||
114 | |||
115 | static void lcd_write_reg(int reg, int value) | ||
116 | { | ||
117 | DBOP_CTRL &= ~(1<<14); | ||
118 | |||
119 | DBOP_TIMPOL_23 = 0xa167006e; | ||
120 | |||
121 | DBOP_DOUT = reg; | ||
122 | |||
123 | /* Wait for fifo to empty */ | ||
124 | while ((DBOP_STAT & (1<<10)) == 0); | ||
125 | |||
126 | DBOP_TIMPOL_23 = 0xa167e06f; | ||
127 | |||
128 | |||
129 | DBOP_DOUT = value; | ||
130 | |||
131 | /* Wait for fifo to empty */ | ||
132 | while ((DBOP_STAT & (1<<10)) == 0); | ||
133 | } | ||
134 | |||
135 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
136 | { | ||
137 | (void)p_bytes; | ||
138 | (void)count; | ||
139 | } | ||
140 | |||
141 | |||
142 | /*** hardware configuration ***/ | ||
143 | |||
144 | void lcd_set_contrast(int val) | ||
145 | { | ||
146 | (void)val; | ||
147 | } | ||
148 | |||
149 | void lcd_set_invert_display(bool yesno) | ||
150 | { | ||
151 | (void)yesno; | ||
152 | } | ||
153 | |||
154 | static void flip_lcd(bool yesno) | ||
155 | { | ||
156 | (void)yesno; | ||
157 | } | ||
158 | |||
159 | |||
160 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
161 | void lcd_set_flip(bool yesno) | ||
162 | { | ||
163 | display_flipped = yesno; | ||
164 | xoffset = yesno ? 4 : 0; | ||
165 | |||
166 | if (display_on) | ||
167 | flip_lcd(yesno); | ||
168 | } | ||
169 | |||
170 | static void _display_on(void) | ||
171 | { | ||
172 | /* Initialisation the display the same way as the original firmware */ | ||
173 | |||
174 | lcd_write_reg(R_START_OSC, 0x0001); /* Start Oscilation */ | ||
175 | |||
176 | lcd_write_reg(R_DRV_OUTPUT_CONTROL, 0x011b); /* 220 lines, GS=0, SS=1 */ | ||
177 | |||
178 | /* B/C = 1: n-line inversion form | ||
179 | * EOR = 1: polarity inversion occurs by applying an EOR to odd/even | ||
180 | * frame select signal and an n-line inversion signal. | ||
181 | * FLD = 01b: 1 field interlaced scan, external display iface */ | ||
182 | lcd_write_reg(R_DRV_WAVEFORM_CONTROL, 0x0700); | ||
183 | |||
184 | /* Address counter updated in horizontal direction; left to right; | ||
185 | * vertical increment horizontal increment. | ||
186 | * data format for 8bit transfer or spi = 65k (5,6,5) */ | ||
187 | lcd_write_reg(R_ENTRY_MODE, 0x0030); | ||
188 | |||
189 | /* Replace data on writing to GRAM */ | ||
190 | lcd_write_reg(R_COMPARE_REG1, 0); | ||
191 | lcd_write_reg(R_COMPARE_REG2, 0); | ||
192 | |||
193 | lcd_write_reg(R_DISP_CONTROL1, 0x0000); /* GON = 0, DTE = 0, D1-0 = 00b */ | ||
194 | |||
195 | /* Front porch lines: 2; Back porch lines: 2; */ | ||
196 | lcd_write_reg(R_DISP_CONTROL2, 0x0203); | ||
197 | |||
198 | /* Scan cycle = 0 frames */ | ||
199 | lcd_write_reg(R_DISP_CONTROL3, 0x0000); | ||
200 | |||
201 | /* 16 clocks */ | ||
202 | lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0000); | ||
203 | |||
204 | /* 18-bit RGB interface (one transfer/pixel) | ||
205 | * internal clock operation; | ||
206 | * System interface/VSYNC interface */ | ||
207 | lcd_write_reg(R_EXT_DISP_IF_CONTROL, 0x0000); | ||
208 | |||
209 | |||
210 | /* zero everything*/ | ||
211 | lcd_write_reg(R_POWER_CONTROL1, 0x0000); /* STB = 0, SLP = 0 */ | ||
212 | |||
213 | lcd_delay(10); | ||
214 | |||
215 | /* initialise power supply */ | ||
216 | |||
217 | /* DC12-10 = 000b: Step-up1 = clock/8, | ||
218 | * DC02-00 = 000b: Step-up2 = clock/16, | ||
219 | * VC2-0 = 010b: VciOUT = 0.87 * VciLVL */ | ||
220 | lcd_write_reg(R_POWER_CONTROL2, 0x0002); | ||
221 | |||
222 | /* VRH3-0 = 1000b: Vreg1OUT = REGP * 1.90 */ | ||
223 | lcd_write_reg(R_POWER_CONTROL3, 0x0008); | ||
224 | |||
225 | lcd_delay(40); | ||
226 | |||
227 | lcd_write_reg(R_POWER_CONTROL4, 0x0000); /* VCOMG = 0 */ | ||
228 | |||
229 | /* This register is unknown */ | ||
230 | lcd_write_reg(0x56, 0x80f); | ||
231 | |||
232 | |||
233 | lcd_write_reg(R_POWER_CONTROL1, 0x4140); | ||
234 | |||
235 | lcd_delay(10); | ||
236 | |||
237 | lcd_write_reg(R_POWER_CONTROL2, 0x0000); | ||
238 | lcd_write_reg(R_POWER_CONTROL3, 0x0013); | ||
239 | |||
240 | lcd_delay(20); | ||
241 | |||
242 | lcd_write_reg(R_POWER_CONTROL4, 0x6d0e); | ||
243 | |||
244 | lcd_delay(20); | ||
245 | |||
246 | lcd_write_reg(R_POWER_CONTROL4, 0x6d0e); | ||
247 | |||
248 | lcd_write_reg(R_GAMMA_FINE_ADJ_POS1, 0x0002); | ||
249 | lcd_write_reg(R_GAMMA_FINE_ADJ_POS2, 0x0707); | ||
250 | lcd_write_reg(R_GAMMA_FINE_ADJ_POS3, 0x0182); | ||
251 | lcd_write_reg(R_GAMMA_GRAD_ADJ_POS, 0x0203); | ||
252 | lcd_write_reg(R_GAMMA_FINE_ADJ_NEG1, 0x0706); | ||
253 | lcd_write_reg(R_GAMMA_FINE_ADJ_NEG2, 0x0006); | ||
254 | lcd_write_reg(R_GAMMA_FINE_ADJ_NEG3, 0x0706); | ||
255 | lcd_write_reg(R_GAMMA_GRAD_ADJ_NEG, 0x0000); | ||
256 | lcd_write_reg(R_GAMMA_AMP_ADJ_RES_POS, 0x030f); | ||
257 | lcd_write_reg(R_GAMMA_AMP_AVG_ADJ_RES_NEG, 0x0f08); | ||
258 | |||
259 | |||
260 | lcd_write_reg(R_RAM_ADDR_SET, 0); | ||
261 | lcd_write_reg(R_GATE_SCAN_POS, 0); | ||
262 | lcd_write_reg(R_VERT_SCROLL_CONTROL, 0); | ||
263 | |||
264 | lcd_write_reg(R_1ST_SCR_DRV_POS, 219 << 8); | ||
265 | lcd_write_reg(R_2ND_SCR_DRV_POS, 219 << 8); | ||
266 | |||
267 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 175 << 8); | ||
268 | lcd_write_reg(R_VERT_RAM_ADDR_POS, 219 << 8); | ||
269 | |||
270 | |||
271 | lcd_write_reg(R_DISP_CONTROL1, 0x0037); | ||
272 | |||
273 | display_on=true; /* must be done before calling lcd_update() */ | ||
274 | lcd_update(); | ||
275 | } | ||
276 | |||
277 | /* LCD init */ | ||
278 | void lcd_init_device(void) | ||
279 | { | ||
280 | ams3525_dbop_init(); | ||
281 | |||
282 | /* Init GPIOs the same as the OF */ | ||
283 | |||
284 | GPIOA_DIR |= (1<<5); | ||
285 | GPIOA_PIN(5) = 0; | ||
286 | |||
287 | GPIOA_PIN(3) = (1<<3); | ||
288 | |||
289 | GPIOA_DIR |= (3<<3); | ||
290 | |||
291 | GPIOA_PIN(3) = (1<<3); | ||
292 | |||
293 | GPIOA_PIN(4) = 0; //c80b0040 := 0; | ||
294 | |||
295 | GPIOA_DIR |= (1<<7); | ||
296 | GPIOA_PIN(7) = 0; | ||
297 | |||
298 | CCU_IO &= ~(1<<2); | ||
299 | CCU_IO &= ~(1<<3); | ||
300 | |||
301 | GPIOD_DIR |= (1<<7); | ||
302 | |||
303 | #if 0 | ||
304 | /* TODO: This code is conditional on a variable in the OF init, we need to | ||
305 | work out what it means */ | ||
306 | |||
307 | GPIOD_PIN(7) = (1<<7); | ||
308 | GPIOD_DIR |= (1<<7); | ||
309 | #endif | ||
310 | |||
311 | lcd_delay(1); | ||
312 | |||
313 | GPIOA_PIN(5) = (1<<5); | ||
314 | |||
315 | lcd_delay(1); | ||
316 | |||
317 | _display_on(); | ||
318 | } | ||
319 | |||
320 | void lcd_enable(bool on) | ||
321 | { | ||
322 | if(display_on!=on) | ||
323 | { | ||
324 | if(on) | ||
325 | { | ||
326 | _display_on(); | ||
327 | lcd_call_enable_hook(); | ||
328 | } | ||
329 | else | ||
330 | { | ||
331 | /* TODO: Implement off sequence */ | ||
332 | display_on=false; | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | |||
337 | bool lcd_enabled(void) | ||
338 | { | ||
339 | return display_on; | ||
340 | } | ||
341 | |||
342 | /*** update functions ***/ | ||
343 | |||
344 | /* Performance function to blit a YUV bitmap directly to the LCD | ||
345 | * src_x, src_y, width and height should be even | ||
346 | * x, y, width and height have to be within LCD bounds | ||
347 | */ | ||
348 | void lcd_blit_yuv(unsigned char * const src[3], | ||
349 | int src_x, int src_y, int stride, | ||
350 | int x, int y, int width, int height) | ||
351 | { | ||
352 | (void)src; | ||
353 | (void)src_x; | ||
354 | (void)src_y; | ||
355 | (void)stride; | ||
356 | (void)x; | ||
357 | (void)y; | ||
358 | (void)width; | ||
359 | (void)height; | ||
360 | } | ||
361 | |||
362 | /* Update the display. | ||
363 | This must be called after all other LCD functions that change the display. */ | ||
364 | void lcd_update(void) ICODE_ATTR; | ||
365 | void lcd_update(void) | ||
366 | { | ||
367 | if(display_on){ | ||
368 | /* TODO */ | ||
369 | } | ||
370 | } | ||
371 | |||
372 | |||
373 | /* Update a fraction of the display. */ | ||
374 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; | ||
375 | void lcd_update_rect(int x, int y, int width, int height) | ||
376 | { | ||
377 | (void)x; | ||
378 | (void)y; | ||
379 | (void)width; | ||
380 | (void)height; | ||
381 | |||
382 | if(display_on) { | ||
383 | /* TODO */ | ||
384 | } | ||
385 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-e200v2/system-target.h b/firmware/target/arm/as3525/sansa-e200v2/system-target.h new file mode 100644 index 0000000000..b712d1c124 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-e200v2/system-target.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef SYSTEM_TARGET_H | ||
22 | #define SYSTEM_TARGET_H | ||
23 | |||
24 | #include "system-arm.h" | ||
25 | |||
26 | #define CPUFREQ_MAX 250000000 | ||
27 | |||
28 | #endif /* SYSTEM_TARGET_H */ | ||
diff --git a/firmware/target/arm/as3525/sansa-e200v2/timer-target.h b/firmware/target/arm/as3525/sansa-e200v2/timer-target.h new file mode 100644 index 0000000000..b81da57885 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-e200v2/timer-target.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef TIMER_TARGET_H | ||
22 | #define TIMER_TARGET_H | ||
23 | |||
24 | bool __timer_set(long cycles, bool set); | ||
25 | bool __timer_register(void); | ||
26 | void __timer_unregister(void); | ||
27 | |||
28 | #define __TIMER_SET(cycles, set) \ | ||
29 | __timer_set(cycles, set) | ||
30 | |||
31 | #define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \ | ||
32 | int_prio, timer_callback) \ | ||
33 | __timer_register() | ||
34 | |||
35 | #define __TIMER_UNREGISTER(...) \ | ||
36 | __timer_unregister() | ||
37 | |||
38 | #endif /* TIMER_TARGET_H */ | ||