From 5f0395d577eddb867eeee30f89f19864ff04baf4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 27 Apr 2006 21:11:18 +0000 Subject: [PATCH] While waiting further and better improvements, this fixes the bug to lcd_update_rect() I introduced previously. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9822 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/coldfire/iaudio/x5/lcd-x5.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c index 0f070ed2fe..9b4a54fdd6 100755 --- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c +++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c @@ -108,15 +108,14 @@ inline void lcd_begin_write_gram(void) inline void lcd_write_data(const unsigned short* p_bytes, int count) ICODE_ATTR; inline void lcd_write_data(const unsigned short* p_bytes, int count) { - /* Ok, by doing 32bit reads we gain a tad bit so I decided to leave this - code in for now, even though when called with an odd 'count' we will - actually output one pixel "too many". */ - unsigned int tmp; unsigned int *ptr = (unsigned int *)p_bytes; + bool extra; + + /* if there's on odd number of pixels, remmber this and output the + trailing pixel after the loop */ + extra = (count&1)?true:false; - if(count&1) - count++; count >>= 1; while(count--) { tmp = *ptr++; @@ -125,6 +124,12 @@ inline void lcd_write_data(const unsigned short* p_bytes, int count) *(volatile unsigned short *)0xf0008002 = high8to9[(tmp >> 8)&255]; *(volatile unsigned short *)0xf0008002 = tmp<<1; } + if(extra) { + /* the final "spare" pixel */ + unsigned short read = *(unsigned short *)ptr; + *(volatile unsigned short *)0xf0008002 = high8to9[read >> 8]; + *(volatile unsigned short *)0xf0008002 = read<<1; + } } /*** hardware configuration ***/