diff options
Diffstat (limited to 'firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c')
-rw-r--r-- | firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c index 5eca87c6d8..3e0eca1d6f 100644 --- a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c +++ b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | ||
9 | * | 8 | * |
10 | * Copyright (C) 2011 Marcin Bukat | 9 | * Copyright (C) 2011 Marcin Bukat |
11 | * | 10 | * |
@@ -37,17 +36,6 @@ static inline void delay_nop(int cycles) | |||
37 | } | 36 | } |
38 | 37 | ||
39 | 38 | ||
40 | /* converts RGB565 pixel into internal lcd bus format */ | ||
41 | static unsigned int lcd_pixel_transform(unsigned short rgb565) | ||
42 | { | ||
43 | unsigned int r, g, b; | ||
44 | b = rgb565 & 0x1f; | ||
45 | g = (rgb565 >> 5) & 0x3f; | ||
46 | r = (rgb565 >> 11) & 0x1f; | ||
47 | |||
48 | return r<<19 | g<<10 | b<<3; | ||
49 | } | ||
50 | |||
51 | /* not tested */ | 39 | /* not tested */ |
52 | static void lcd_sleep(bool sleep) | 40 | static void lcd_sleep(bool sleep) |
53 | { | 41 | { |
@@ -71,7 +59,7 @@ static void lcd_sleep(bool sleep) | |||
71 | lcd_cmd(GRAM_WRITE); | 59 | lcd_cmd(GRAM_WRITE); |
72 | } | 60 | } |
73 | 61 | ||
74 | static void lcd_display_init(void) | 62 | void lcd_display_init(void) |
75 | { | 63 | { |
76 | unsigned int x, y; | 64 | unsigned int x, y; |
77 | 65 | ||
@@ -173,31 +161,34 @@ static void lcd_display_init(void) | |||
173 | lcd_sleep(false); | 161 | lcd_sleep(false); |
174 | } | 162 | } |
175 | 163 | ||
176 | void lcd_init_device(void) | 164 | void lcd_set_gram_area(int x, int y, int width, int height) |
177 | { | 165 | { |
178 | lcdif_init(LCDIF_18BIT); | 166 | lcdctrl_bypass(1); |
179 | lcd_display_init(); | 167 | LCDC_CTRL |= RGB24B; |
180 | } | ||
181 | |||
182 | void lcd_update_rect(int x, int y, int width, int height) | ||
183 | { | ||
184 | int px = x, py = y; | ||
185 | int pxmax = x + width, pymax = y + height; | ||
186 | 168 | ||
187 | /* addresses setup */ | 169 | /* addresses setup */ |
188 | lcd_write_reg(WINDOW_H_START, y); | 170 | lcd_write_reg(WINDOW_H_START, y); |
189 | lcd_write_reg(WINDOW_H_END, pymax-1); | 171 | lcd_write_reg(WINDOW_H_END, height-1); |
190 | lcd_write_reg(WINDOW_V_START, x); | 172 | lcd_write_reg(WINDOW_V_START, x); |
191 | lcd_write_reg(WINDOW_V_END, pxmax-1); | 173 | lcd_write_reg(WINDOW_V_END, width-1); |
192 | lcd_write_reg(GRAM_H_ADDR, y); | 174 | lcd_write_reg(GRAM_H_ADDR, y); |
193 | lcd_write_reg(GRAM_V_ADDR, x); | 175 | lcd_write_reg(GRAM_V_ADDR, x); |
194 | 176 | ||
195 | lcd_cmd(GRAM_WRITE); | 177 | lcd_cmd(GRAM_WRITE); |
178 | LCDC_CTRL &= ~RGB24B; | ||
179 | } | ||
180 | |||
181 | void lcd_update_rect(int x, int y, int width, int height) | ||
182 | { | ||
183 | int px = x, py = y; | ||
184 | int pxmax = x + width, pymax = y + height; | ||
185 | |||
186 | lcd_set_gram_area(x, y, pxmax, pymax); | ||
196 | 187 | ||
197 | for (py=y; py<pymax; py++) | 188 | for (py=y; py<pymax; py++) |
198 | { | 189 | { |
199 | for (px=x; px<pxmax; px++) | 190 | for (px=x; px<pxmax; px++) |
200 | LCD_DATA = lcd_pixel_transform(*FBADDR(px,py)); | 191 | LCD_DATA = *FBADDR(px,py); |
201 | } | 192 | } |
202 | } | 193 | } |
203 | 194 | ||