diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2007-08-08 07:57:34 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2007-08-08 07:57:34 +0000 |
| commit | 92abed78cc010a077738b576ffdc36fd29a3c859 (patch) | |
| tree | 1e5517c85909c167dcf8063b6d5f7f53b5d33ef5 | |
| parent | d7d2e69092936a049c4c8ed51cc2c750d8ca2157 (diff) | |
| download | rockbox-92abed78cc010a077738b576ffdc36fd29a3c859.zip rockbox-92abed78cc010a077738b576ffdc36fd29a3c859.tar.gz rockbox-92abed78cc010a077738b576ffdc36fd29a3c859.tar.bz2 rockbox-92abed78cc010a077738b576ffdc36fd29a3c859.tar.xz | |
iPod greyscale LCD driver: Slight speedup and correct greylevels for other targets than 1st/2nd gen. * Code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14240 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/target/arm/ipod/lcd-gray.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c index a7b0112..9a229a4 100644 --- a/firmware/target/arm/ipod/lcd-gray.c +++ b/firmware/target/arm/ipod/lcd-gray.c @@ -30,27 +30,20 @@ #include "system.h" -/* check if number of useconds has past */ -static inline bool timer_check(int clock_start, int usecs) -{ - return ((int)(USEC_TIMER - clock_start)) >= usecs; -} - /*** hardware configuration ***/ #if CONFIG_CPU == PP5002 -#define IPOD_LCD_BASE 0xc0001000 -#define IPOD_LCD_BUSY_MASK 0x80000000 +#define IPOD_LCD_BASE 0xc0001000 #else /* PP502x */ -#define IPOD_LCD_BASE 0x70003000 -#define IPOD_LCD_BUSY_MASK 0x00008000 +#define IPOD_LCD_BASE 0x70003000 #endif -/* LCD command codes for HD66753 */ - +#define LCD_BUSY_MASK 0x00008000 #define LCD_CMD 0x08 #define LCD_DATA 0x10 +/* LCD command codes for HD66753 */ + #define R_START_OSC 0x00 #define R_DRV_OUTPUT_CONTROL 0x01 #define R_DRV_WAVEFORM_CONTROL 0x02 @@ -89,11 +82,10 @@ static const unsigned char dibits[16] ICONST_ATTR = { /* wait for LCD with timeout */ static inline void lcd_wait_write(void) { - int start = USEC_TIMER; + long timeout = USEC_TIMER + 1000; /* 1 ms */ - do { - if ((inl(IPOD_LCD_BASE) & 0x8000) == 0) break; - } while (timer_check(start, 1000) == 0); + while ((inl(IPOD_LCD_BASE) & LCD_BUSY_MASK) + && TIME_BEFORE(USEC_TIMER, timeout)); } @@ -199,9 +191,9 @@ void lcd_set_backlight_inversion(bool yesno) void lcd_set_invert_display(bool yesno) { if (yesno) - lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0023); + lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0017); else - lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0009); + lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015); } #endif |