summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-04-11 21:51:24 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-04-11 21:51:24 +0000
commit9efbc9d48741709785afae9c17f1227b9b9d4d33 (patch)
tree1ef20c705b5446791c62572cfe0fb3a7f01b6afa
parentc9ca7ef23d05dd08369e31d94a4988f80c9b94ca (diff)
downloadrockbox-9efbc9d48741709785afae9c17f1227b9b9d4d33.tar.gz
rockbox-9efbc9d48741709785afae9c17f1227b9b9d4d33.zip
20% faster and one annoying lookup table cut out
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9624 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-x5.c70
1 files changed, 20 insertions, 50 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 95c0bc85a5..0f070ed2fe 100755
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -39,12 +39,12 @@ static bool display_on=false; /* is the display turned on? */
#define R_WRITE_DATA_2_GRAM 0x22
/*****************************************************
-The tables below were generated by the following script:
+The table below was generated by the following script:
#!/usr/bin/perl
-# low byte table
-print "short low8to9[] = {\n";
+# high byte table
+print "short high8to9[] = {\n";
$str = " ";
for my $m (0 .. 255) {
# RRRRRGGG => RRRRR0GGG
@@ -57,25 +57,10 @@ for my $m (0 .. 255) {
}
print "$str\n};\n";
-$str = " ";
-# high byte table
-print "short high8to9[] = {\n";
-
-# high byte table
-for my $m (0 .. 255) {
- # GGGBBBBB = GGGBBBBB0
- my $v = (($m & 0xFF) << 1);
- if(length($str) > 75) {
- print "$str\n";
- $str=" ";
- }
- $str .= sprintf("0x%03x, ", $v);
-}
-print "$str\n};\n";
-
*****************************************************/
-/* Lookup tables for 16->18bit conversion */
+/* Lookup table for 16->18bit conversion, high byte. The low byte is just
+ shifted. */
const short high8to9[] ICONST_ATTR = {
0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x010, 0x011, 0x012,
0x013, 0x014, 0x015, 0x016, 0x017, 0x020, 0x021, 0x022, 0x023, 0x024, 0x025,
@@ -102,32 +87,6 @@ const short high8to9[] ICONST_ATTR = {
0x1e2, 0x1e3, 0x1e4, 0x1e5, 0x1e6, 0x1e7, 0x1f0, 0x1f1, 0x1f2, 0x1f3, 0x1f4,
0x1f5, 0x1f6, 0x1f7,
};
-const short low8to9[] ICONST_ATTR = {
- 0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e, 0x010, 0x012, 0x014,
- 0x016, 0x018, 0x01a, 0x01c, 0x01e, 0x020, 0x022, 0x024, 0x026, 0x028, 0x02a,
- 0x02c, 0x02e, 0x030, 0x032, 0x034, 0x036, 0x038, 0x03a, 0x03c, 0x03e, 0x040,
- 0x042, 0x044, 0x046, 0x048, 0x04a, 0x04c, 0x04e, 0x050, 0x052, 0x054, 0x056,
- 0x058, 0x05a, 0x05c, 0x05e, 0x060, 0x062, 0x064, 0x066, 0x068, 0x06a, 0x06c,
- 0x06e, 0x070, 0x072, 0x074, 0x076, 0x078, 0x07a, 0x07c, 0x07e, 0x080, 0x082,
- 0x084, 0x086, 0x088, 0x08a, 0x08c, 0x08e, 0x090, 0x092, 0x094, 0x096, 0x098,
- 0x09a, 0x09c, 0x09e, 0x0a0, 0x0a2, 0x0a4, 0x0a6, 0x0a8, 0x0aa, 0x0ac, 0x0ae,
- 0x0b0, 0x0b2, 0x0b4, 0x0b6, 0x0b8, 0x0ba, 0x0bc, 0x0be, 0x0c0, 0x0c2, 0x0c4,
- 0x0c6, 0x0c8, 0x0ca, 0x0cc, 0x0ce, 0x0d0, 0x0d2, 0x0d4, 0x0d6, 0x0d8, 0x0da,
- 0x0dc, 0x0de, 0x0e0, 0x0e2, 0x0e4, 0x0e6, 0x0e8, 0x0ea, 0x0ec, 0x0ee, 0x0f0,
- 0x0f2, 0x0f4, 0x0f6, 0x0f8, 0x0fa, 0x0fc, 0x0fe, 0x100, 0x102, 0x104, 0x106,
- 0x108, 0x10a, 0x10c, 0x10e, 0x110, 0x112, 0x114, 0x116, 0x118, 0x11a, 0x11c,
- 0x11e, 0x120, 0x122, 0x124, 0x126, 0x128, 0x12a, 0x12c, 0x12e, 0x130, 0x132,
- 0x134, 0x136, 0x138, 0x13a, 0x13c, 0x13e, 0x140, 0x142, 0x144, 0x146, 0x148,
- 0x14a, 0x14c, 0x14e, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15a, 0x15c, 0x15e,
- 0x160, 0x162, 0x164, 0x166, 0x168, 0x16a, 0x16c, 0x16e, 0x170, 0x172, 0x174,
- 0x176, 0x178, 0x17a, 0x17c, 0x17e, 0x180, 0x182, 0x184, 0x186, 0x188, 0x18a,
- 0x18c, 0x18e, 0x190, 0x192, 0x194, 0x196, 0x198, 0x19a, 0x19c, 0x19e, 0x1a0,
- 0x1a2, 0x1a4, 0x1a6, 0x1a8, 0x1aa, 0x1ac, 0x1ae, 0x1b0, 0x1b2, 0x1b4, 0x1b6,
- 0x1b8, 0x1ba, 0x1bc, 0x1be, 0x1c0, 0x1c2, 0x1c4, 0x1c6, 0x1c8, 0x1ca, 0x1cc,
- 0x1ce, 0x1d0, 0x1d2, 0x1d4, 0x1d6, 0x1d8, 0x1da, 0x1dc, 0x1de, 0x1e0, 0x1e2,
- 0x1e4, 0x1e6, 0x1e8, 0x1ea, 0x1ec, 0x1ee, 0x1f0, 0x1f2, 0x1f4, 0x1f6, 0x1f8,
- 0x1fa, 0x1fc, 0x1fe,
-};
/* called very frequently - inline! */
inline void lcd_write_reg(int reg, int val)
@@ -149,11 +108,22 @@ 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)
{
- unsigned short tmp;
+ /* 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;
+
+ if(count&1)
+ count++;
+ count >>= 1;
while(count--) {
- tmp = *p_bytes++;
- *(volatile unsigned short *)0xf0008002 = high8to9[tmp >> 8];
- *(volatile unsigned short *)0xf0008002 = low8to9[tmp&255];
+ 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;
}
}