summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-01-07 22:21:41 +0000
committerThomas Martitz <kugel@rockbox.org>2010-01-07 22:21:41 +0000
commitdc07c792634a95a4906784790460ab570be32fc0 (patch)
treef5bac9dc07e1badcf0e838df41327faa7c49dfca /firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
parent5fd54dee4ff3e0299c8b5d6c12e5633728396c72 (diff)
downloadrockbox-dc07c792634a95a4906784790460ab570be32fc0.tar.gz
rockbox-dc07c792634a95a4906784790460ab570be32fc0.zip
Sansa AMS: Time has shown that switching between 16 and 32bit mode costs much time (due to the micro delay needed), so do 32bit transfers unconditionally for lcd updates at the cost of updating slightly larger rectangles (gives upto 15% speed up, nearly at maximum now).
Unify this optimized dbop transfer function and re-use it more often (it still handles 16bit transfers). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24198 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c')
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c50
1 files changed, 6 insertions, 44 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
index f4d1a7cf56..54aa22e398 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
@@ -120,19 +120,11 @@ static void as3525_dbop_init(void)
120 /* TODO: The OF calls some other functions here, but maybe not important */ 120 /* TODO: The OF calls some other functions here, but maybe not important */
121} 121}
122 122
123static void lcd_write_value16(unsigned short value) 123static void lcd_write_cmd(short cmd)
124{
125 DBOP_CTRL &= ~(1<<14|1<<13);
126 lcd_delay(10);
127 DBOP_DOUT16 = value;
128 while ((DBOP_STAT & (1<<10)) == 0);
129}
130
131static void lcd_write_cmd(int cmd)
132{ 124{
133 /* Write register */ 125 /* Write register */
134 DBOP_TIMPOL_23 = 0xa167006e; 126 DBOP_TIMPOL_23 = 0xa167006e;
135 lcd_write_value16(cmd); 127 dbop_write_data(&cmd, 1);
136 128
137 /* Wait for fifo to empty */ 129 /* Wait for fifo to empty */
138 while ((DBOP_STAT & (1<<10)) == 0); 130 while ((DBOP_STAT & (1<<10)) == 0);
@@ -144,43 +136,13 @@ static void lcd_write_cmd(int cmd)
144 DBOP_TIMPOL_23 = 0xa167e06f; 136 DBOP_TIMPOL_23 = 0xa167e06f;
145} 137}
146 138
147void lcd_write_data(const fb_data* p_bytes, int count)
148{
149 const long *data;
150 if ((int)p_bytes & 0x3)
151 { /* need to do a single 16bit write beforehand if the address is
152 * not word aligned */
153 lcd_write_value16(*p_bytes);
154 count--;p_bytes++;
155 }
156 /* from here, 32bit transfers are save
157 * set it to transfer 4*(outputwidth) units at a time,
158 * if bit 12 is set it only does 2 halfwords though */
159 DBOP_CTRL |= (1<<13|1<<14);
160 data = (long*)p_bytes;
161 while (count > 1)
162 {
163 DBOP_DOUT32 = *data++;
164 count -= 2;
165
166 /* Wait if push fifo is full */
167 while ((DBOP_STAT & (1<<6)) != 0);
168 }
169 /* While push fifo is not empty */
170 while ((DBOP_STAT & (1<<10)) == 0);
171
172 /* due to the 32bit alignment requirement or uneven count,
173 * we possibly need to do a 16bit transfer at the end also */
174 if (count > 0)
175 lcd_write_value16(*(fb_data*)data);
176}
177 139
178static void lcd_write_reg(int reg, int value) 140static void lcd_write_reg(int reg, int value)
179{ 141{
180 fb_data data = value; 142 unsigned short data = value;
181 143
182 lcd_write_cmd(reg); 144 lcd_write_cmd(reg);
183 lcd_write_value16(data); 145 dbop_write_data(&data, 1);
184} 146}
185 147
186/*** hardware configuration ***/ 148/*** hardware configuration ***/
@@ -486,7 +448,7 @@ void lcd_update(void)
486 448
487 lcd_write_cmd(R_WRITE_DATA_2_GRAM); 449 lcd_write_cmd(R_WRITE_DATA_2_GRAM);
488 450
489 lcd_write_data((fb_data*)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); 451 dbop_write_data((fb_data*)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT);
490} 452}
491 453
492/* Update a fraction of the display. */ 454/* Update a fraction of the display. */
@@ -526,7 +488,7 @@ void lcd_update_rect(int x, int y, int width, int height)
526 488
527 do 489 do
528 { 490 {
529 lcd_write_data(ptr, width); 491 dbop_write_data(ptr, width);
530 ptr += LCD_WIDTH; 492 ptr += LCD_WIDTH;
531 } 493 }
532 while (--height > 0); 494 while (--height > 0);