summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2006-07-18 18:16:38 +0000
committerChristian Gmeiner <christian.gmeiner@gmail.com>2006-07-18 18:16:38 +0000
commita59b3eb91936ed71871ba2c95ebebb8b16fd84db (patch)
treead71c195998ac37334c4d02fa179cc604acbf24d
parent19f8ae7609a158ba09becd94230bbd5c867f1165 (diff)
downloadrockbox-a59b3eb91936ed71871ba2c95ebebb8b16fd84db.zip
rockbox-a59b3eb91936ed71871ba2c95ebebb8b16fd84db.tar.gz
rockbox-a59b3eb91936ed71871ba2c95ebebb8b16fd84db.tar.bz2
rockbox-a59b3eb91936ed71871ba2c95ebebb8b16fd84db.tar.xz
simplification of lcd driver code - based on patch #5474 by Rani Hod
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10235 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-x5.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 9b4a54f..75ec246 100755
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -32,6 +32,9 @@
static bool display_on=false; /* is the display turned on? */
+#define LCD_CMD *(volatile unsigned short *)0xf0008000
+#define LCD_DATA *(volatile unsigned short *)0xf0008002
+
/* register defines for the Renesas HD66773R */
#define R_HORIZ_RAM_ADDR_POS 0x16
#define R_VERT_RAM_ADDR_POS 0x17
@@ -91,17 +94,17 @@ const short high8to9[] ICONST_ATTR = {
/* called very frequently - inline! */
inline void lcd_write_reg(int reg, int val)
{
- *(volatile unsigned short *)0xf0008000 = (reg >> 8) << 1;
- *(volatile unsigned short *)0xf0008000 = (reg & 0xff) << 1;
- *(volatile unsigned short *)0xf0008002 = (val >> 8) << 1;
- *(volatile unsigned short *)0xf0008002 = (val & 0xff) << 1;
+ LCD_CMD = (reg >> 8) << 1;
+ LCD_CMD = (reg & 0xff) << 1;
+ LCD_DATA = (val >> 8) << 1;
+ LCD_DATA = (val & 0xff) << 1;
}
/* called very frequently - inline! */
inline void lcd_begin_write_gram(void)
{
- *(volatile unsigned short *)0xf0008000 = (R_WRITE_DATA_2_GRAM >> 8) << 1;
- *(volatile unsigned short *)0xf0008000 = (R_WRITE_DATA_2_GRAM & 0xff) << 1;
+ LCD_CMD = (R_WRITE_DATA_2_GRAM >> 8) << 1;
+ LCD_CMD = (R_WRITE_DATA_2_GRAM & 0xff) << 1;
}
/* called very frequently - inline! */
@@ -119,16 +122,16 @@ inline void lcd_write_data(const unsigned short* p_bytes, int count)
count >>= 1;
while(count--) {
tmp = *ptr++;
- *(volatile unsigned short *)0xf0008002 = high8to9[tmp >> 24];
- *(volatile unsigned short *)0xf0008002 = tmp>>15;
- *(volatile unsigned short *)0xf0008002 = high8to9[(tmp >> 8)&255];
- *(volatile unsigned short *)0xf0008002 = tmp<<1;
+ LCD_DATA = high8to9[tmp >> 24];
+ LCD_DATA = tmp>>15;
+ LCD_DATA = high8to9[(tmp >> 8)&255];
+ LCD_DATA = 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;
+ LCD_DATA = high8to9[read >> 8];
+ LCD_DATA = read<<1;
}
}