diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-02-17 02:36:48 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-02-17 02:36:48 +0000 |
commit | be84fcffbd4bcc6e009a2a223b269b61098fdb93 (patch) | |
tree | d4668a7601118d92991ee3f8957dd5f2fd280b3c /firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c | |
parent | 4b0ae103197be83586a0f082eb2d0ee57b579f30 (diff) | |
download | rockbox-be84fcffbd4bcc6e009a2a223b269b61098fdb93.tar.gz rockbox-be84fcffbd4bcc6e009a2a223b269b61098fdb93.zip |
Some Sansa Fuze work: Get Home button working (no keymap changes yet, so it's not very noticeable) and "fix" debug menu from not showing the dbop data (see FIXME), some cleanup in the fuze's button driver
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20027 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c')
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c index b8feeb103e..f9de3c3117 100644 --- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c +++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c | |||
@@ -42,6 +42,8 @@ static bool display_on = false; /* is the display turned on? */ | |||
42 | static bool display_flipped = false; | 42 | static bool display_flipped = false; |
43 | static int xoffset = 20; /* needed for flip */ | 43 | static int xoffset = 20; /* needed for flip */ |
44 | 44 | ||
45 | static volatile int _ystart, _ymax, _xstart, _xmax; | ||
46 | |||
45 | static void as3525_dbop_init(void) | 47 | static void as3525_dbop_init(void) |
46 | { | 48 | { |
47 | CGU_DBOP = (1<<3) | CLK_DIV(AS3525_PCLK_FREQ, AS3525_DBOP_FREQ); | 49 | CGU_DBOP = (1<<3) | CLK_DIV(AS3525_PCLK_FREQ, AS3525_DBOP_FREQ); |
@@ -258,22 +260,20 @@ void lcd_init_device() | |||
258 | } | 260 | } |
259 | 261 | ||
260 | /* Set horizontal window addresses */ | 262 | /* Set horizontal window addresses */ |
261 | static void lcd_window_x(int xmin, int xmax) | 263 | void lcd_window_x(int xmin, int xmax) |
262 | { | 264 | { |
263 | xmin += xoffset; | 265 | xmin += xoffset; |
264 | xmax += xoffset; | 266 | xmax += xoffset; |
265 | |||
266 | lcd_write_reg(0x46, (xmax << 8) | xmin); | 267 | lcd_write_reg(0x46, (xmax << 8) | xmin); |
267 | lcd_write_reg(0x20, xmin); | 268 | lcd_write_reg(0x20, xmin); |
268 | } | 269 | } |
269 | 270 | ||
270 | /* Set vertical window addresses */ | 271 | /* Set vertical window addresses */ |
271 | static void lcd_window_y(int ymin, int ymax) | 272 | void lcd_window_y(int ymin, int ymax) |
272 | { | 273 | { |
273 | lcd_write_reg(0x47, ymax); | 274 | lcd_write_reg(0x47, ymax); |
274 | lcd_write_reg(0x48, ymin); | 275 | lcd_write_reg(0x48, ymin); |
275 | lcd_write_reg(0x21, ymin); | 276 | lcd_write_reg(0x21, ymin); |
276 | lcd_write_cmd(0x22); | ||
277 | } | 277 | } |
278 | 278 | ||
279 | /* Update the display. | 279 | /* Update the display. |
@@ -285,6 +285,8 @@ void lcd_update(void) | |||
285 | 285 | ||
286 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); | 286 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); |
287 | 287 | ||
288 | /* we must disable interrupts because buttondriver also writes to lcd */ | ||
289 | disable_irq(); | ||
288 | lcd_window_x(0, LCD_WIDTH - 1); | 290 | lcd_window_x(0, LCD_WIDTH - 1); |
289 | lcd_window_y(0, LCD_HEIGHT - 1); | 291 | lcd_window_y(0, LCD_HEIGHT - 1); |
290 | 292 | ||
@@ -293,6 +295,7 @@ void lcd_update(void) | |||
293 | 295 | ||
294 | /* Write data */ | 296 | /* Write data */ |
295 | lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); | 297 | lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); |
298 | enable_irq(); | ||
296 | } | 299 | } |
297 | 300 | ||
298 | /* Update a fraction of the display. */ | 301 | /* Update a fraction of the display. */ |
@@ -324,6 +327,8 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
324 | 327 | ||
325 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); | 328 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); |
326 | 329 | ||
330 | /* we must disable interrupts because buttondriver also writes to lcd */ | ||
331 | disable_irq(); | ||
327 | lcd_window_x(x, xmax); | 332 | lcd_window_x(x, xmax); |
328 | lcd_window_y(y, ymax); | 333 | lcd_window_y(y, ymax); |
329 | 334 | ||
@@ -338,4 +343,18 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
338 | ptr += LCD_WIDTH; | 343 | ptr += LCD_WIDTH; |
339 | } | 344 | } |
340 | while (++y <= ymax); | 345 | while (++y <= ymax); |
346 | enable_irq(); | ||
347 | } | ||
348 | |||
349 | /* writes one read pixel outside the visible area, needed for correct dbop reads */ | ||
350 | void lcd_button_support(void) | ||
351 | { | ||
352 | fb_data data = 0xf<<12; | ||
353 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); | ||
354 | /* Set start position and window */ | ||
355 | |||
356 | lcd_window_x(-1, 1); | ||
357 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | ||
358 | |||
359 | lcd_write_data(&data, 1); | ||
341 | } | 360 | } |