diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-04-06 05:08:39 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-04-06 05:08:39 +0000 |
commit | 22c8a25f5f18b7d76d1e185696e5e06b062fbefc (patch) | |
tree | 2e31a3fc29ae3a4f56d9343053f71ace36c1d335 | |
parent | 05099149f193cac0c81b0129c17feb78b1a9681a (diff) | |
download | rockbox-22c8a25f5f18b7d76d1e185696e5e06b062fbefc.tar.gz rockbox-22c8a25f5f18b7d76d1e185696e5e06b062fbefc.zip |
e200: Get the UNCACHED_ADDR macro and phys_fb_address use out of the lcd driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16982 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/sandisk/sansa-e200/lcd-e200.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c index 15263b5533..acdb2c9956 100644 --- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c | |||
@@ -106,12 +106,11 @@ static unsigned short r_drv_output_control = R_DRV_OUTPUT_CONTROL_NORMAL; | |||
106 | #define R_HORIZ_RAM_ADDR_POS 0x44 | 106 | #define R_HORIZ_RAM_ADDR_POS 0x44 |
107 | #define R_VERT_RAM_ADDR_POS 0x45 | 107 | #define R_VERT_RAM_ADDR_POS 0x45 |
108 | 108 | ||
109 | /* We don't know how to receive a DMA finished signal from the LCD controller | 109 | /* We don't know how to receive a DMA finished signal from the LCD controller. |
110 | * To avoid problems with flickering, we double-buffer the framebuffer and turn | 110 | * To avoid problems with flickering, we double-buffer the framebuffer. |
111 | * off DMA while updates are taking place | 111 | * Align as in lcd-16bit.c and not cached. */ |
112 | * At least the alignment as in lcd-16bit.c and cache interference free */ | ||
113 | static fb_data lcd_driver_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] | 112 | static fb_data lcd_driver_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] |
114 | CACHEALIGN_AT_LEAST_ATTR(16); | 113 | __attribute__((aligned(16))) NOCACHEBSS_ATTR; |
115 | 114 | ||
116 | #ifdef BOOTLOADER | 115 | #ifdef BOOTLOADER |
117 | static void lcd_init_gpio(void) | 116 | static void lcd_init_gpio(void) |
@@ -173,21 +172,6 @@ static void lcd_write_reg(unsigned int reg, unsigned int data) | |||
173 | lcd_send_msg(0x72, data); | 172 | lcd_send_msg(0x72, data); |
174 | } | 173 | } |
175 | 174 | ||
176 | /* The LCD controller gets passed the address of the framebuffer, but can only | ||
177 | use the physical, not the remapped, address. This is a quick and dirty way | ||
178 | of correcting it */ | ||
179 | static inline unsigned long phys_fb_address(typeof (lcd_driver_framebuffer) fb) | ||
180 | { | ||
181 | if ((unsigned long)fb < 0x10000000) | ||
182 | { | ||
183 | return (unsigned long)fb + 0x10000000; | ||
184 | } | ||
185 | else | ||
186 | { | ||
187 | return (unsigned long)fb; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | /* Run the powerup sequence for the driver IC */ | 175 | /* Run the powerup sequence for the driver IC */ |
192 | static void lcd_power_on(void) | 176 | static void lcd_power_on(void) |
193 | { | 177 | { |
@@ -413,7 +397,8 @@ void lcd_init_device(void) | |||
413 | LCD_REG_6 |= (1 << 4); | 397 | LCD_REG_6 |= (1 << 4); |
414 | 398 | ||
415 | LCD_REG_5 &= ~(1 << 7); | 399 | LCD_REG_5 &= ~(1 << 7); |
416 | LCD_FB_BASE_REG = phys_fb_address(lcd_driver_framebuffer); | 400 | /* lcd_driver_framebuffer is uncached therefore at the physical address */ |
401 | LCD_FB_BASE_REG = (long)lcd_driver_framebuffer; | ||
417 | 402 | ||
418 | udelay(100000); | 403 | udelay(100000); |
419 | 404 | ||
@@ -428,7 +413,8 @@ void lcd_init_device(void) | |||
428 | #else | 413 | #else |
429 | /* Power and display already ON - switch framebuffer address and reset | 414 | /* Power and display already ON - switch framebuffer address and reset |
430 | settings */ | 415 | settings */ |
431 | LCD_FB_BASE_REG = phys_fb_address(lcd_driver_framebuffer); | 416 | /* lcd_driver_framebuffer is uncached therefore at the physical address */ |
417 | LCD_FB_BASE_REG = (long)lcd_driver_framebuffer; | ||
432 | 418 | ||
433 | power_on = true; | 419 | power_on = true; |
434 | display_on = true; | 420 | display_on = true; |
@@ -512,9 +498,7 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
512 | if (height <= 0) | 498 | if (height <= 0) |
513 | return; /* nothing left to do */ | 499 | return; /* nothing left to do */ |
514 | 500 | ||
515 | /* TODO: It may be faster to swap the addresses of lcd_driver_framebuffer | 501 | dst = &lcd_driver_framebuffer[y][x]; |
516 | * and lcd_framebuffer */ | ||
517 | dst = UNCACHED_ADDR(&lcd_driver_framebuffer[y][x]); | ||
518 | src = &lcd_framebuffer[y][x]; | 502 | src = &lcd_framebuffer[y][x]; |
519 | 503 | ||
520 | /* Copy part of the Rockbox framebuffer to the second framebuffer */ | 504 | /* Copy part of the Rockbox framebuffer to the second framebuffer */ |
@@ -535,10 +519,8 @@ void lcd_update(void) | |||
535 | if (!display_on) | 519 | if (!display_on) |
536 | return; | 520 | return; |
537 | 521 | ||
538 | /* TODO: It may be faster to swap the addresses of lcd_driver_framebuffer | ||
539 | * and lcd_framebuffer */ | ||
540 | /* Copy the Rockbox framebuffer to the second framebuffer */ | 522 | /* Copy the Rockbox framebuffer to the second framebuffer */ |
541 | lcd_copy_buffer_rect(UNCACHED_ADDR(&lcd_driver_framebuffer[0][0]), | 523 | lcd_copy_buffer_rect(&lcd_driver_framebuffer[0][0], |
542 | &lcd_framebuffer[0][0], LCD_WIDTH*LCD_HEIGHT, 1); | 524 | &lcd_framebuffer[0][0], LCD_WIDTH*LCD_HEIGHT, 1); |
543 | } | 525 | } |
544 | 526 | ||
@@ -646,7 +628,7 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
646 | height >>= 1; | 628 | height >>= 1; |
647 | 629 | ||
648 | y = LCD_WIDTH - 1 - y; | 630 | y = LCD_WIDTH - 1 - y; |
649 | fb_data *dst = UNCACHED_ADDR(&lcd_driver_framebuffer[x][y]); | 631 | fb_data *dst = &lcd_driver_framebuffer[x][y]; |
650 | 632 | ||
651 | z = stride*src_y; | 633 | z = stride*src_y; |
652 | yuv_src[0] = src[0] + z + src_x; | 634 | yuv_src[0] = src[0] + z + src_x; |