From 814ac8fb22784e9eea0cf0d5528276450c85e868 Mon Sep 17 00:00:00 2001 From: qiuyiuestc Date: Thu, 9 Sep 2010 15:36:39 +0000 Subject: [PATCH] fix lcd update issue git-svn-id: https://rt-thread.googlecode.com/svn/trunk@898 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/mini2440/lcd_a70.c | 16 ++++------------ bsp/mini2440/lcd_n35.c | 16 ++++------------ bsp/mini2440/lcd_t35.c | 31 ++++++++++++------------------- 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/bsp/mini2440/lcd_a70.c b/bsp/mini2440/lcd_a70.c index d5563abd5..e03dbe08d 100644 --- a/bsp/mini2440/lcd_a70.c +++ b/bsp/mini2440/lcd_a70.c @@ -172,20 +172,12 @@ void LcdBkLtSet(rt_uint32_t HiRatio) void rt_hw_lcd_update(rtgui_rect_t *rect) { volatile rt_uint16_t *src_ptr, *dst_ptr; - rt_uint32_t pitch, index; + rt_uint32_t i, j; - pitch = 2 * (rect->x2 - rect->x1); - - /* copy from framebuffer to physical framebuffer */ - src_ptr = &_rt_framebuffer[rect->y1][rect->x1]; - dst_ptr = &_rt_hw_framebuffer[rect->y1][rect->x1]; - - for (index = rect->y1; index < rect->y2; index ++) + for (i = rect->y1; i < rect->y2; i ++) { - memcpy((void*)dst_ptr, (void*)src_ptr, pitch); - - src_ptr += (rect->x2 - rect->x1); - dst_ptr += (rect->x2 - rect->x1); + for(j = rect->x1; j < rect->x2; j++) + _rt_hw_framebuffer[i][j] = _rt_framebuffer[i][j]; } } diff --git a/bsp/mini2440/lcd_n35.c b/bsp/mini2440/lcd_n35.c index f4569010f..5976dd44c 100644 --- a/bsp/mini2440/lcd_n35.c +++ b/bsp/mini2440/lcd_n35.c @@ -172,20 +172,12 @@ void LcdBkLtSet(rt_uint32_t HiRatio) void rt_hw_lcd_update(rtgui_rect_t *rect) { volatile rt_uint16_t *src_ptr, *dst_ptr; - rt_uint32_t pitch, index; + rt_uint32_t i, j; - pitch = 2 * (rect->x2 - rect->x1); - - /* copy from framebuffer to physical framebuffer */ - src_ptr = &_rt_framebuffer[rect->y1][rect->x1]; - dst_ptr = &_rt_hw_framebuffer[rect->y1][rect->x1]; - - for (index = rect->y1; index < rect->y2; index ++) + for (i = rect->y1; i < rect->y2; i ++) { - memcpy((void*)dst_ptr, (void*)src_ptr, pitch); - - src_ptr += (rect->x2 - rect->x1); - dst_ptr += (rect->x2 - rect->x1); + for(j = rect->x1; j < rect->x2; j++) + _rt_hw_framebuffer[i][j] = _rt_framebuffer[i][j]; } } diff --git a/bsp/mini2440/lcd_t35.c b/bsp/mini2440/lcd_t35.c index e8d89594c..d258e8744 100644 --- a/bsp/mini2440/lcd_t35.c +++ b/bsp/mini2440/lcd_t35.c @@ -173,20 +173,12 @@ void LcdBkLtSet(rt_uint32_t HiRatio) void rt_hw_lcd_update(rtgui_rect_t *rect) { volatile rt_uint16_t *src_ptr, *dst_ptr; - rt_uint32_t pitch, index; + rt_uint32_t i, j; - pitch = 2 * (rect->x2 - rect->x1); - - /* copy from framebuffer to physical framebuffer */ - src_ptr = &_rt_framebuffer[rect->y1][rect->x1]; - dst_ptr = &_rt_hw_framebuffer[rect->y1][rect->x1]; - - for (index = rect->y1; index < rect->y2; index ++) + for (i = rect->y1; i < rect->y2; i ++) { - memcpy((void*)dst_ptr, (void*)src_ptr, pitch); - - src_ptr += (rect->x2 - rect->x1); - dst_ptr += (rect->x2 - rect->x1); + for(j = rect->x1; j < rect->x2; j++) + _rt_hw_framebuffer[i][j] = _rt_framebuffer[i][j]; } } @@ -229,7 +221,7 @@ void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_ void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t y2) { - rt_uint32_t idy; + rt_uint32_t idy; rt_uint16_t color; /* get color pixel */ @@ -243,7 +235,7 @@ void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y) { - rt_memcpy((void*)&_rt_framebuffer[y][x1], pixels, (x2 - x1) * 2); + rt_memcpy((void*)&_rt_framebuffer[y][x1], pixels, (x2 - x1) * 2); } struct rtgui_graphic_driver _rtgui_lcd_driver = @@ -304,14 +296,15 @@ void rt_hw_lcd_init() LCDCON2 = (LCD_UPPER_MARGIN << 24) | ((LCD_HEIGHT - 1) << 14) | (LCD_LOWER_MARGIN << 6) | (LCD_VSYNC_LEN << 0); LCDCON3 = (LCD_RIGHT_MARGIN << 19) | ((LCD_WIDTH - 1) << 8) | (LCD_LEFT_MARGIN << 0); LCDCON4 = (13 << 8) | (LCD_HSYNC_LEN << 0); + #if !defined(LCD_CON5) - #define LCD_CON5 ((1<<11) | (1 << 9) | (1 << 8) | (1 << 3) | (1 << 0)) +#define LCD_CON5 ((1<<11) | (1 << 9) | (1 << 8) | (1 << 3) | (1 << 0)) #endif - LCDCON5 = LCD_CON5; + LCDCON5 = LCD_CON5; - LCDSADDR1 = ((LCD_ADDR >> 22) << 21) | ((M5D(LCD_ADDR >> 1)) << 0); - LCDSADDR2 = M5D((LCD_ADDR + LCD_WIDTH * LCD_HEIGHT * 2) >> 1); - LCDSADDR3 = LCD_WIDTH; + LCDSADDR1 = ((LCD_ADDR >> 22) << 21) | ((M5D(LCD_ADDR >> 1)) << 0); + LCDSADDR2 = M5D((LCD_ADDR + LCD_WIDTH * LCD_HEIGHT * 2) >> 1); + LCDSADDR3 = LCD_WIDTH; LCDINTMSK |= (3); LPCSEL &= (~7) ; -- GitLab