diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-07-03 18:50:07 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-07-03 18:50:07 +0000 |
commit | 9a471e603ebe77a3aae4692d80ceb32da50c88eb (patch) | |
tree | f0ebfffd2460de1be4255080b361e64bdc901ddb /firmware/target/arm/as3525 | |
parent | 12b89c11e31cab842af081e8fc238e47c2711653 (diff) | |
download | rockbox-9a471e603ebe77a3aae4692d80ceb32da50c88eb.tar.gz rockbox-9a471e603ebe77a3aae4692d80ceb32da50c88eb.zip |
Clip+ LCD: support devices with a different controller
The new controller framebuffer (different from what is in clipv1/clipv2 and some clip+) has 128 columns, the old has 132 columns and is centered on the screen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27257 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525')
7 files changed, 25 insertions, 19 deletions
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c index 09f2638ff7..e0e0715311 100644 --- a/firmware/target/arm/as3525/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/lcd-ssd1303.c | |||
@@ -68,6 +68,7 @@ | |||
68 | /** globals **/ | 68 | /** globals **/ |
69 | 69 | ||
70 | static bool display_on; /* used by lcd_enable */ | 70 | static bool display_on; /* used by lcd_enable */ |
71 | static int offset; /* column offset */ | ||
71 | 72 | ||
72 | /*** hardware configuration ***/ | 73 | /*** hardware configuration ***/ |
73 | 74 | ||
@@ -135,10 +136,8 @@ bool lcd_active(void) | |||
135 | void lcd_init_device(void) | 136 | void lcd_init_device(void) |
136 | { | 137 | { |
137 | int i; | 138 | int i; |
138 | #define LCD_FULLSCREEN (128+4) | ||
139 | fb_data p_bytes[LCD_FULLSCREEN]; /* framebuffer used to clear the screen */ | ||
140 | 139 | ||
141 | lcd_hw_init(); | 140 | lcd_hw_init(&offset); |
142 | 141 | ||
143 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ | 142 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ |
144 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); | 143 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); |
@@ -181,12 +180,12 @@ void lcd_init_device(void) | |||
181 | lcd_write_command (LCD_SET_HIGHER_COLUMN_ADDRESS /*| 0*/); | 180 | lcd_write_command (LCD_SET_HIGHER_COLUMN_ADDRESS /*| 0*/); |
182 | lcd_write_command (LCD_SET_LOWER_COLUMN_ADDRESS /*| 0*/); | 181 | lcd_write_command (LCD_SET_LOWER_COLUMN_ADDRESS /*| 0*/); |
183 | 182 | ||
183 | fb_data p_bytes[LCD_WIDTH + 2 * offset]; | ||
184 | memset(p_bytes, 0, sizeof(p_bytes)); /* fills with 0 : pixel off */ | 184 | memset(p_bytes, 0, sizeof(p_bytes)); /* fills with 0 : pixel off */ |
185 | |||
186 | for(i = 0; i < 8; i++) | 185 | for(i = 0; i < 8; i++) |
187 | { | 186 | { |
188 | lcd_write_command (LCD_SET_PAGE_ADDRESS | (i /*& 0xf*/)); | 187 | lcd_write_command (LCD_SET_PAGE_ADDRESS | (i /*& 0xf*/)); |
189 | lcd_write_data(p_bytes, LCD_FULLSCREEN /* overscan */); | 188 | lcd_write_data(p_bytes, LCD_WIDTH + 2 * offset); |
190 | } | 189 | } |
191 | 190 | ||
192 | lcd_enable(true); | 191 | lcd_enable(true); |
@@ -208,8 +207,8 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width, | |||
208 | while (bheight--) | 207 | while (bheight--) |
209 | { | 208 | { |
210 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); | 209 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); |
211 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2)>>4) & 0xf)); | 210 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset)>>4) & 0xf)); |
212 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf)); | 211 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf)); |
213 | 212 | ||
214 | lcd_write_data(data, width); | 213 | lcd_write_data(data, width); |
215 | data += stride; | 214 | data += stride; |
@@ -234,8 +233,8 @@ void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, | |||
234 | while (bheight--) | 233 | while (bheight--) |
235 | { | 234 | { |
236 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); | 235 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); |
237 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2)>>4) & 0xf)); | 236 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset)>>4) & 0xf)); |
238 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf)); | 237 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf)); |
239 | 238 | ||
240 | lcd_grey_data(values, phases, width); | 239 | lcd_grey_data(values, phases, width); |
241 | 240 | ||
@@ -261,8 +260,8 @@ void lcd_update(void) | |||
261 | for (y = 0; y < LCD_FBHEIGHT; y++) | 260 | for (y = 0; y < LCD_FBHEIGHT; y++) |
262 | { | 261 | { |
263 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); | 262 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); |
264 | lcd_write_command (LCD_CNTL_HIGHCOL | ((2 >> 4) & 0xf)); | 263 | lcd_write_command (LCD_CNTL_HIGHCOL | ((offset >> 4) & 0xf)); |
265 | lcd_write_command (LCD_CNTL_LOWCOL | (2 & 0xf)); | 264 | lcd_write_command (LCD_CNTL_LOWCOL | (offset & 0xf)); |
266 | 265 | ||
267 | lcd_write_data (lcd_framebuffer[y], LCD_WIDTH); | 266 | lcd_write_data (lcd_framebuffer[y], LCD_WIDTH); |
268 | } | 267 | } |
@@ -292,8 +291,8 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
292 | for (; y <= ymax; y++) | 291 | for (; y <= ymax; y++) |
293 | { | 292 | { |
294 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); | 293 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); |
295 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2) >> 4) & 0xf)); | 294 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset) >> 4) & 0xf)); |
296 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf)); | 295 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf)); |
297 | 296 | ||
298 | lcd_write_data (&lcd_framebuffer[y][x], width); | 297 | lcd_write_data (&lcd_framebuffer[y][x], width); |
299 | } | 298 | } |
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-clip.c b/firmware/target/arm/as3525/sansa-clip/lcd-clip.c index 29d9259b52..775988cc0e 100644 --- a/firmware/target/arm/as3525/sansa-clip/lcd-clip.c +++ b/firmware/target/arm/as3525/sansa-clip/lcd-clip.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | 28 | ||
29 | void lcd_hw_init(void) | 29 | void lcd_hw_init(int *offset) |
30 | { | 30 | { |
31 | /* DBOP initialisation, do what OF does */ | 31 | /* DBOP initialisation, do what OF does */ |
32 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; | 32 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; |
@@ -45,6 +45,8 @@ void lcd_hw_init(void) | |||
45 | GPIOA_PIN(0) = (1<<0); | 45 | GPIOA_PIN(0) = (1<<0); |
46 | GPIOA_PIN(4) = 0; | 46 | GPIOA_PIN(4) = 0; |
47 | GPIOB_PIN(6) = (1<<6); | 47 | GPIOB_PIN(6) = (1<<6); |
48 | |||
49 | *offset = 2; | ||
48 | } | 50 | } |
49 | 51 | ||
50 | #define LCD_DELAY 1 | 52 | #define LCD_DELAY 1 |
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-clip.h b/firmware/target/arm/as3525/sansa-clip/lcd-clip.h index 7863b853d5..3d4fe60311 100644 --- a/firmware/target/arm/as3525/sansa-clip/lcd-clip.h +++ b/firmware/target/arm/as3525/sansa-clip/lcd-clip.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "ascodec.h" | 23 | #include "ascodec.h" |
24 | 24 | ||
25 | void lcd_hw_init(void) INIT_ATTR; | 25 | void lcd_hw_init(int *offset) INIT_ATTR; |
26 | static inline void lcd_enable_power(bool onoff) | 26 | static inline void lcd_enable_power(bool onoff) |
27 | { | 27 | { |
28 | ascodec_write(AS3514_DCDC15, onoff ? 1 : 0); | 28 | ascodec_write(AS3514_DCDC15, onoff ? 1 : 0); |
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c index 7be0199df1..3faa92da31 100644 --- a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c +++ b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | 28 | ||
29 | void lcd_hw_init(void) | 29 | void lcd_hw_init(int *offset) |
30 | { | 30 | { |
31 | bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE); | 31 | bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE); |
32 | 32 | ||
@@ -37,8 +37,11 @@ void lcd_hw_init(void) | |||
37 | 37 | ||
38 | GPIOA_DIR |= (1<<5); | 38 | GPIOA_DIR |= (1<<5); |
39 | GPIOB_DIR |= (1<<2) | (1<<7); | 39 | GPIOB_DIR |= (1<<2) | (1<<7); |
40 | GPIOB_DIR &= ~(1<<3); | ||
40 | GPIOB_PIN(7) = 0; | 41 | GPIOB_PIN(7) = 0; |
41 | GPIOA_PIN(5) = (1<<5); | 42 | GPIOA_PIN(5) = (1<<5); |
43 | |||
44 | *offset = GPIOB_PIN(3) ? 0 : 2; | ||
42 | } | 45 | } |
43 | 46 | ||
44 | void lcd_write_command(int byte) | 47 | void lcd_write_command(int byte) |
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h index ae0309a949..70bafe4212 100644 --- a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h +++ b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | 23 | ||
24 | void lcd_hw_init(void) INIT_ATTR; | 24 | void lcd_hw_init(int *offset) INIT_ATTR; |
25 | static inline void lcd_enable_power(bool onoff) | 25 | static inline void lcd_enable_power(bool onoff) |
26 | { | 26 | { |
27 | (void) onoff; | 27 | (void) onoff; |
diff --git a/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h b/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h index ae0309a949..70bafe4212 100644 --- a/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h +++ b/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | 23 | ||
24 | void lcd_hw_init(void) INIT_ATTR; | 24 | void lcd_hw_init(int *offset) INIT_ATTR; |
25 | static inline void lcd_enable_power(bool onoff) | 25 | static inline void lcd_enable_power(bool onoff) |
26 | { | 26 | { |
27 | (void) onoff; | 27 | (void) onoff; |
diff --git a/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c b/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c index f8cfb0b1cf..015eebfd87 100644 --- a/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c +++ b/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | 28 | ||
29 | void lcd_hw_init(void) | 29 | void lcd_hw_init(int *offset) |
30 | { | 30 | { |
31 | /* DBOP initialisation, do what OF does */ | 31 | /* DBOP initialisation, do what OF does */ |
32 | CCU_IO |= (1<<12); /* ?? */ | 32 | CCU_IO |= (1<<12); /* ?? */ |
@@ -38,6 +38,8 @@ void lcd_hw_init(void) | |||
38 | 38 | ||
39 | GPIOB_DIR |= (1<<2)|(1<<5); | 39 | GPIOB_DIR |= (1<<2)|(1<<5); |
40 | GPIOB_PIN(5) = (1<<5); | 40 | GPIOB_PIN(5) = (1<<5); |
41 | |||
42 | *offset = 2; | ||
41 | } | 43 | } |
42 | 44 | ||
43 | #define LCD_DELAY 10 | 45 | #define LCD_DELAY 10 |