diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 11 | ||||
-rw-r--r-- | firmware/target/arm/as3525/lcd-ssd1303.c (renamed from firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c) | 162 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/lcd-clip.c | 89 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/lcd-clip.h | 28 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c | 66 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h | 26 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h | 26 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c | 85 |
8 files changed, 332 insertions, 161 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index c347ad7903..5ecad19bba 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1208,7 +1208,8 @@ target/arm/tcc77x/c100/audio-c100.c | |||
1208 | 1208 | ||
1209 | #ifdef SANSA_CLIPPLUS | 1209 | #ifdef SANSA_CLIPPLUS |
1210 | #ifndef SIMULATOR | 1210 | #ifndef SIMULATOR |
1211 | target/arm/as3525/sansa-clip/lcd-ssd1303.c | 1211 | target/arm/as3525/lcd-ssd1303.c |
1212 | target/arm/as3525/sansa-clipplus/lcd-clip-plus.c | ||
1212 | target/arm/as3525/sansa-clipplus/lcd-as-clip-plus.S | 1213 | target/arm/as3525/sansa-clipplus/lcd-as-clip-plus.S |
1213 | target/arm/as3525/sansa-clipplus/button-clip.c | 1214 | target/arm/as3525/sansa-clipplus/button-clip.c |
1214 | target/arm/as3525/sansa-clipplus/backlight-clip.c | 1215 | target/arm/as3525/sansa-clipplus/backlight-clip.c |
@@ -1221,8 +1222,9 @@ target/arm/as3525/sansa-clip/powermgmt-clip.c | |||
1221 | 1222 | ||
1222 | #ifdef SANSA_CLIPV2 | 1223 | #ifdef SANSA_CLIPV2 |
1223 | #ifndef SIMULATOR | 1224 | #ifndef SIMULATOR |
1224 | target/arm/as3525/sansa-clip/lcd-ssd1303.c | 1225 | target/arm/as3525/lcd-ssd1303.c |
1225 | target/arm/as3525/sansa-clip/lcd-as-clip.S | 1226 | target/arm/as3525/sansa-clipv2/lcd-clipv2.c |
1227 | target/arm/as3525/sansa-clip/lcd-as-clip.S /* TODO for clipv2 */ | ||
1226 | target/arm/as3525/sansa-clipv2/button-clip.c | 1228 | target/arm/as3525/sansa-clipv2/button-clip.c |
1227 | target/arm/as3525/sansa-clipv2/backlight-clip.c | 1229 | target/arm/as3525/sansa-clipv2/backlight-clip.c |
1228 | #ifndef BOOTLOADER | 1230 | #ifndef BOOTLOADER |
@@ -1234,7 +1236,8 @@ target/arm/as3525/sansa-clip/powermgmt-clip.c | |||
1234 | 1236 | ||
1235 | #ifdef SANSA_CLIP | 1237 | #ifdef SANSA_CLIP |
1236 | #ifndef SIMULATOR | 1238 | #ifndef SIMULATOR |
1237 | target/arm/as3525/sansa-clip/lcd-ssd1303.c | 1239 | target/arm/as3525/lcd-ssd1303.c |
1240 | target/arm/as3525/sansa-clip/lcd-clip.c | ||
1238 | target/arm/as3525/sansa-clip/lcd-as-clip.S | 1241 | target/arm/as3525/sansa-clip/lcd-as-clip.S |
1239 | target/arm/as3525/sansa-clip/button-clip.c | 1242 | target/arm/as3525/sansa-clip/button-clip.c |
1240 | target/arm/as3525/sansa-clip/backlight-clip.c | 1243 | target/arm/as3525/sansa-clip/backlight-clip.c |
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c index dba5b9c3d7..e4437e70ca 100644 --- a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/lcd-ssd1303.c | |||
@@ -22,21 +22,13 @@ | |||
22 | ****************************************************************************/ | 22 | ****************************************************************************/ |
23 | #include "config.h" | 23 | #include "config.h" |
24 | 24 | ||
25 | #include "hwcompat.h" | ||
26 | #include "kernel.h" | 25 | #include "kernel.h" |
27 | #include "lcd.h" | 26 | #include "lcd.h" |
28 | #include "system.h" | 27 | #include "system.h" |
29 | #include "cpu.h" | 28 | #include "cpu.h" |
30 | #include "string.h" | 29 | #include "string.h" |
31 | 30 | ||
32 | /*** AS3525 specifics ***/ | 31 | #include "lcd-clip.h" |
33 | #ifdef SANSA_CLIPV2 | ||
34 | #include "as3525v2.h" | ||
35 | #else | ||
36 | #include "as3525.h" | ||
37 | #endif | ||
38 | |||
39 | #include "ascodec.h" | ||
40 | 32 | ||
41 | /*** definitions ***/ | 33 | /*** definitions ***/ |
42 | 34 | ||
@@ -73,125 +65,6 @@ | |||
73 | #define LCD_CNTL_HIGHCOL 0x10 /* Upper column address */ | 65 | #define LCD_CNTL_HIGHCOL 0x10 /* Upper column address */ |
74 | #define LCD_CNTL_LOWCOL 0x00 /* Lower column address */ | 66 | #define LCD_CNTL_LOWCOL 0x00 /* Lower column address */ |
75 | 67 | ||
76 | |||
77 | static void lcd_hw_init(void) | ||
78 | { | ||
79 | #if defined(SANSA_CLIP) | ||
80 | /* DBOP initialisation, do what OF does */ | ||
81 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; | ||
82 | |||
83 | GPIOB_AFSEL = 0x08; /* DBOP on pin 3 */ | ||
84 | GPIOC_AFSEL = 0x0f; /* DBOP on pins 3:0 */ | ||
85 | |||
86 | DBOP_CTRL = 0x51008; | ||
87 | DBOP_TIMPOL_01 = 0x6E167; | ||
88 | DBOP_TIMPOL_23 = 0xA167E06F; | ||
89 | #elif defined(SANSA_CLIPV2) | ||
90 | /* DBOP initialisation, do what OF does */ | ||
91 | CCU_IO |= (1<<12); /* ?? */ | ||
92 | CGU_DBOP |= /*(1<<3)*/ 0x18 | AS3525_DBOP_DIV; | ||
93 | |||
94 | DBOP_CTRL = 0x51004; | ||
95 | DBOP_TIMPOL_01 = 0x36A12F; | ||
96 | DBOP_TIMPOL_23 = 0xE037E037; | ||
97 | #elif defined(SANSA_CLIPPLUS) | ||
98 | CGU_PERI |= CGU_SSP_CLOCK_ENABLE; | ||
99 | |||
100 | SSP_CPSR = AS3525_SSP_PRESCALER; /* OF = 0x10 */ | ||
101 | SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */ | ||
102 | SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */ | ||
103 | SSP_IMSC = 0; /* No interrupts */ | ||
104 | #endif | ||
105 | } | ||
106 | |||
107 | #ifdef SANSA_CLIP | ||
108 | #define LCD_DELAY 1 | ||
109 | #else /* SANSA_CLIPV2 */ | ||
110 | #define LCD_DELAY 10 | ||
111 | #endif | ||
112 | |||
113 | #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) | ||
114 | void lcd_write_command(int byte) | ||
115 | { | ||
116 | volatile int i = 0; | ||
117 | while(i<LCD_DELAY) i++; | ||
118 | |||
119 | /* unset D/C# (data or command) */ | ||
120 | #ifdef SANSA_CLIP | ||
121 | GPIOA_PIN(5) = 0; | ||
122 | #else /* SANSA_CLIPV2 */ | ||
123 | GPIOB_PIN(2) = 0; | ||
124 | DBOP_TIMPOL_23 = 0xE0370036; | ||
125 | #endif | ||
126 | |||
127 | /* Write command */ | ||
128 | /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */ | ||
129 | DBOP_DOUT = (byte << 8) | byte; | ||
130 | |||
131 | /* While push fifo is not empty */ | ||
132 | while ((DBOP_STAT & (1<<10)) == 0) | ||
133 | ; | ||
134 | |||
135 | #ifdef SANSA_CLIPV2 | ||
136 | DBOP_TIMPOL_23 = 0xE037E037; | ||
137 | #endif | ||
138 | } | ||
139 | #elif defined(SANSA_CLIPPLUS) | ||
140 | void lcd_write_command(int byte) | ||
141 | { | ||
142 | while(SSP_SR & (1<<4)) /* BSY flag */ | ||
143 | ; | ||
144 | |||
145 | GPIOB_PIN(2) = 0; | ||
146 | SSP_DATA = byte; | ||
147 | |||
148 | while(SSP_SR & (1<<4)) /* BSY flag */ | ||
149 | ; | ||
150 | } | ||
151 | #endif | ||
152 | |||
153 | #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) | ||
154 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
155 | { | ||
156 | volatile int i = 0; | ||
157 | while(i<LCD_DELAY) i++; | ||
158 | /* set D/C# (data or command) */ | ||
159 | #ifdef SANSA_CLIP | ||
160 | GPIOA_PIN(5) = (1<<5); | ||
161 | #else /* SANSA_CLIPV2 */ | ||
162 | GPIOB_PIN(2) = (1<<2); | ||
163 | #endif | ||
164 | |||
165 | while (count--) | ||
166 | { | ||
167 | /* Write pixels */ | ||
168 | /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */ | ||
169 | DBOP_DOUT = (*p_bytes << 8) | *p_bytes; | ||
170 | |||
171 | p_bytes++; /* next packed pixels */ | ||
172 | |||
173 | /* Wait if push fifo is full */ | ||
174 | while ((DBOP_STAT & (1<<6)) != 0); | ||
175 | } | ||
176 | /* While push fifo is not empty */ | ||
177 | while ((DBOP_STAT & (1<<10)) == 0); | ||
178 | } | ||
179 | #elif defined(SANSA_CLIPPLUS) | ||
180 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
181 | { | ||
182 | GPIOB_PIN(2) = (1<<2); | ||
183 | |||
184 | while (count--) | ||
185 | { | ||
186 | while(!(SSP_SR & (1<<1))) /* wait until transmit FIFO is not full */ | ||
187 | ; | ||
188 | |||
189 | SSP_DATA = *p_bytes++; | ||
190 | } | ||
191 | } | ||
192 | #endif | ||
193 | |||
194 | |||
195 | /** globals **/ | 68 | /** globals **/ |
196 | 69 | ||
197 | static bool display_on; /* used by lcd_enable */ | 70 | static bool display_on; /* used by lcd_enable */ |
@@ -240,21 +113,14 @@ void lcd_enable(bool enable) | |||
240 | 113 | ||
241 | if( (display_on = enable) ) /* simple '=' is not a typo ! */ | 114 | if( (display_on = enable) ) /* simple '=' is not a typo ! */ |
242 | { | 115 | { |
243 | #ifdef SANSA_CLIP | 116 | lcd_enable_power(enable); |
244 | /* Enable DC-DC AS3525 for some Clip v1 that need it */ | ||
245 | ascodec_write(AS3514_DCDC15, 1); | ||
246 | #endif | ||
247 | |||
248 | lcd_write_command(LCD_SET_DISPLAY_ON); | 117 | lcd_write_command(LCD_SET_DISPLAY_ON); |
249 | send_event(LCD_EVENT_ACTIVATION, NULL); | 118 | send_event(LCD_EVENT_ACTIVATION, NULL); |
250 | } | 119 | } |
251 | else { | 120 | else |
121 | { | ||
252 | lcd_write_command(LCD_SET_DISPLAY_OFF); | 122 | lcd_write_command(LCD_SET_DISPLAY_OFF); |
253 | 123 | lcd_enable_power(enable); | |
254 | #ifdef SANSA_CLIP | ||
255 | /* Disable DC-DC AS3525 */ | ||
256 | ascodec_write(AS3514_DCDC15, 0); | ||
257 | #endif | ||
258 | } | 124 | } |
259 | } | 125 | } |
260 | 126 | ||
@@ -274,24 +140,6 @@ void lcd_init_device(void) | |||
274 | 140 | ||
275 | lcd_hw_init(); | 141 | lcd_hw_init(); |
276 | 142 | ||
277 | #if defined(SANSA_CLIP) | ||
278 | GPIOA_DIR |= 0x33; /* pins 5:4 and 1:0 out */ | ||
279 | GPIOB_DIR |= 0x40; /* pin 6 out */ | ||
280 | |||
281 | GPIOA_PIN(1) = (1<<1); | ||
282 | GPIOA_PIN(0) = (1<<0); | ||
283 | GPIOA_PIN(4) = 0; | ||
284 | GPIOB_PIN(6) = (1<<6); | ||
285 | #elif defined(SANSA_CLIPV2) | ||
286 | GPIOB_DIR |= (1<<2)|(1<<5); | ||
287 | GPIOB_PIN(5) = (1<<5); | ||
288 | #elif defined(SANSA_CLIPPLUS) | ||
289 | GPIOA_DIR |= (1<<5); | ||
290 | GPIOB_DIR |= (1<<2) | (1<<7); | ||
291 | GPIOB_PIN(7) = 0; | ||
292 | GPIOA_PIN(5) = (1<<5); | ||
293 | #endif | ||
294 | |||
295 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ | 143 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ |
296 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); | 144 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); |
297 | lcd_write_command(0x10); | 145 | lcd_write_command(0x10); |
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-clip.c b/firmware/target/arm/as3525/sansa-clip/lcd-clip.c new file mode 100644 index 0000000000..9df006ac69 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clip/lcd-clip.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 François Dinel | ||
11 | * Copyright (C) 2008-2009 Rafaël Carré | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | #include "config.h" | ||
23 | |||
24 | #include "lcd.h" | ||
25 | #include "system.h" | ||
26 | #include "cpu.h" | ||
27 | |||
28 | void lcd_hw_init(void) | ||
29 | { | ||
30 | /* DBOP initialisation, do what OF does */ | ||
31 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; | ||
32 | |||
33 | GPIOB_AFSEL = 0x08; /* DBOP on pin 3 */ | ||
34 | GPIOC_AFSEL = 0x0f; /* DBOP on pins 3:0 */ | ||
35 | |||
36 | DBOP_CTRL = 0x51008; | ||
37 | DBOP_TIMPOL_01 = 0x6E167; | ||
38 | DBOP_TIMPOL_23 = 0xA167E06F; | ||
39 | |||
40 | GPIOA_DIR |= 0x33; /* pins 5:4 and 1:0 out */ | ||
41 | GPIOB_DIR |= 0x40; /* pin 6 out */ | ||
42 | |||
43 | GPIOA_PIN(1) = (1<<1); | ||
44 | GPIOA_PIN(0) = (1<<0); | ||
45 | GPIOA_PIN(4) = 0; | ||
46 | GPIOB_PIN(6) = (1<<6); | ||
47 | } | ||
48 | |||
49 | #define LCD_DELAY 1 | ||
50 | |||
51 | void lcd_write_command(int byte) | ||
52 | { | ||
53 | volatile int i = 0; | ||
54 | while(i<LCD_DELAY) i++; | ||
55 | |||
56 | /* unset D/C# (data or command) */ | ||
57 | GPIOA_PIN(5) = 0; | ||
58 | |||
59 | /* Write command */ | ||
60 | /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */ | ||
61 | DBOP_DOUT = (byte << 8) | byte; | ||
62 | |||
63 | /* While push fifo is not empty */ | ||
64 | while ((DBOP_STAT & (1<<10)) == 0) | ||
65 | ; | ||
66 | } | ||
67 | |||
68 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
69 | { | ||
70 | volatile int i = 0; | ||
71 | while(i<LCD_DELAY) i++; | ||
72 | |||
73 | /* set D/C# (data or command) */ | ||
74 | GPIOA_PIN(5) = (1<<5); | ||
75 | |||
76 | while (count--) | ||
77 | { | ||
78 | /* Write pixels */ | ||
79 | /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */ | ||
80 | DBOP_DOUT = (*p_bytes << 8) | *p_bytes; | ||
81 | |||
82 | p_bytes++; /* next packed pixels */ | ||
83 | |||
84 | /* Wait if push fifo is full */ | ||
85 | while ((DBOP_STAT & (1<<6)) != 0); | ||
86 | } | ||
87 | /* While push fifo is not empty */ | ||
88 | while ((DBOP_STAT & (1<<10)) == 0); | ||
89 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-clip.h b/firmware/target/arm/as3525/sansa-clip/lcd-clip.h new file mode 100644 index 0000000000..3dbb416076 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clip/lcd-clip.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008-2009 Rafaël Carré | ||
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 | #include "ascodec.h" | ||
23 | |||
24 | void lcd_hw_init(void); | ||
25 | static inline void lcd_enable_power(bool onoff) | ||
26 | { | ||
27 | ascodec_write(AS3514_DCDC15, onoff ? 1 : 0); | ||
28 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c new file mode 100644 index 0000000000..66e4de98ed --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 François Dinel | ||
11 | * Copyright (C) 2008-2009 Rafaël Carré | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | #include "config.h" | ||
23 | |||
24 | #include "lcd.h" | ||
25 | #include "system.h" | ||
26 | #include "cpu.h" | ||
27 | |||
28 | void lcd_hw_init(void) | ||
29 | { | ||
30 | CGU_PERI |= CGU_SSP_CLOCK_ENABLE; | ||
31 | |||
32 | SSP_CPSR = AS3525_SSP_PRESCALER; /* OF = 0x10 */ | ||
33 | SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */ | ||
34 | SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */ | ||
35 | SSP_IMSC = 0; /* No interrupts */ | ||
36 | |||
37 | GPIOA_DIR |= (1<<5); | ||
38 | GPIOB_DIR |= (1<<2) | (1<<7); | ||
39 | GPIOB_PIN(7) = 0; | ||
40 | GPIOA_PIN(5) = (1<<5); | ||
41 | } | ||
42 | |||
43 | void lcd_write_command(int byte) | ||
44 | { | ||
45 | while(SSP_SR & (1<<4)) /* BSY flag */ | ||
46 | ; | ||
47 | |||
48 | GPIOB_PIN(2) = 0; | ||
49 | SSP_DATA = byte; | ||
50 | |||
51 | while(SSP_SR & (1<<4)) /* BSY flag */ | ||
52 | ; | ||
53 | } | ||
54 | |||
55 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
56 | { | ||
57 | GPIOB_PIN(2) = (1<<2); | ||
58 | |||
59 | while (count--) | ||
60 | { | ||
61 | while(!(SSP_SR & (1<<1))) /* wait until transmit FIFO is not full */ | ||
62 | ; | ||
63 | |||
64 | SSP_DATA = *p_bytes++; | ||
65 | } | ||
66 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h new file mode 100644 index 0000000000..753759638e --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008-2009 Rafaël Carré | ||
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 | void lcd_hw_init(void); | ||
23 | static inline void lcd_enable_power(bool onoff) | ||
24 | { | ||
25 | (void) onoff; | ||
26 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h b/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h new file mode 100644 index 0000000000..753759638e --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008-2009 Rafaël Carré | ||
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 | void lcd_hw_init(void); | ||
23 | static inline void lcd_enable_power(bool onoff) | ||
24 | { | ||
25 | (void) onoff; | ||
26 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c b/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c new file mode 100644 index 0000000000..e405036b63 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 François Dinel | ||
11 | * Copyright (C) 2008-2009 Rafaël Carré | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | #include "config.h" | ||
23 | |||
24 | #include "lcd.h" | ||
25 | #include "system.h" | ||
26 | #include "cpu.h" | ||
27 | |||
28 | void lcd_hw_init(void) | ||
29 | { | ||
30 | /* DBOP initialisation, do what OF does */ | ||
31 | CCU_IO |= (1<<12); /* ?? */ | ||
32 | CGU_DBOP |= /*(1<<3)*/ 0x18 | AS3525_DBOP_DIV; | ||
33 | |||
34 | DBOP_CTRL = 0x51004; | ||
35 | DBOP_TIMPOL_01 = 0x36A12F; | ||
36 | DBOP_TIMPOL_23 = 0xE037E037; | ||
37 | |||
38 | GPIOB_DIR |= (1<<2)|(1<<5); | ||
39 | GPIOB_PIN(5) = (1<<5); | ||
40 | } | ||
41 | |||
42 | #define LCD_DELAY 10 | ||
43 | |||
44 | void lcd_write_command(int byte) | ||
45 | { | ||
46 | volatile int i = 0; | ||
47 | while(i<LCD_DELAY) i++; | ||
48 | |||
49 | /* unset D/C# (data or command) */ | ||
50 | GPIOB_PIN(2) = 0; | ||
51 | DBOP_TIMPOL_23 = 0xE0370036; | ||
52 | |||
53 | /* Write command */ | ||
54 | /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */ | ||
55 | DBOP_DOUT = (byte << 8) | byte; | ||
56 | |||
57 | /* While push fifo is not empty */ | ||
58 | while ((DBOP_STAT & (1<<10)) == 0) | ||
59 | ; | ||
60 | |||
61 | DBOP_TIMPOL_23 = 0xE037E037; | ||
62 | } | ||
63 | |||
64 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
65 | { | ||
66 | volatile int i = 0; | ||
67 | while(i<LCD_DELAY) i++; | ||
68 | |||
69 | /* set D/C# (data or command) */ | ||
70 | GPIOB_PIN(2) = (1<<2); | ||
71 | |||
72 | while (count--) | ||
73 | { | ||
74 | /* Write pixels */ | ||
75 | /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */ | ||
76 | DBOP_DOUT = (*p_bytes << 8) | *p_bytes; | ||
77 | |||
78 | p_bytes++; /* next packed pixels */ | ||
79 | |||
80 | /* Wait if push fifo is full */ | ||
81 | while ((DBOP_STAT & (1<<6)) != 0); | ||
82 | } | ||
83 | /* While push fifo is not empty */ | ||
84 | while ((DBOP_STAT & (1<<10)) == 0); | ||
85 | } | ||