summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.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-fuze/lcd-fuze.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-fuze/lcd-fuze.c')
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c59
1 files changed, 10 insertions, 49 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
index 3332e0c78c..bdf1c704e0 100644
--- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
+++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
@@ -124,66 +124,23 @@ static void as3525_dbop_init(void)
124 /* TODO: The OF calls some other functions here, but maybe not important */ 124 /* TODO: The OF calls some other functions here, but maybe not important */
125} 125}
126 126
127static void lcd_write_value16(unsigned short value) 127static void lcd_write_cmd(short cmd)
128{
129 DBOP_CTRL &= ~(1<<14|1<<13);
130 lcd_delay(10);
131 DBOP_DOUT16 = value;
132 while ((DBOP_STAT & (1<<10)) == 0);
133}
134
135static void lcd_write_cmd(int cmd)
136{ 128{
137 /* Write register */ 129 /* Write register */
138 DBOP_TIMPOL_23 = 0xa167006e; 130 DBOP_TIMPOL_23 = 0xa167006e;
139 lcd_write_value16(cmd); 131 dbop_write_data(&cmd, 1);
140
141 /* Wait for fifo to empty */
142 while ((DBOP_STAT & (1<<10)) == 0);
143 132
144 lcd_delay(4); 133 lcd_delay(4);
145 134
146 DBOP_TIMPOL_23 = 0xa167e06f; 135 DBOP_TIMPOL_23 = 0xa167e06f;
147} 136}
148 137
149void lcd_write_data(const fb_data* p_bytes, int count)
150{
151 const long *data;
152 if ((int)p_bytes & 0x3)
153 { /* need to do a single 16bit write beforehand if the address is
154 * not word aligned */
155 lcd_write_value16(*p_bytes);
156 count--;p_bytes++;
157 }
158 /* from here, 32bit transfers are save
159 * set it to transfer 4*(outputwidth) units at a time,
160 * if bit 12 is set it only does 2 halfwords though */
161 DBOP_CTRL |= (1<<13|1<<14);
162 lcd_delay(10);
163 data = (long*)p_bytes;
164 while (count > 1)
165 {
166 DBOP_DOUT32 = *data++;
167 count -= 2;
168
169 /* Wait if push fifo is full */
170 while ((DBOP_STAT & (1<<6)) != 0);
171 }
172 /* While push fifo is not empty */
173 while ((DBOP_STAT & (1<<10)) == 0);
174
175 /* due to the 32bit alignment requirement or uneven count,
176 * we possibly need to do a 16bit transfer at the end also */
177 if (count > 0)
178 lcd_write_value16(*(fb_data*)data);
179}
180
181static void lcd_write_reg(int reg, int value) 138static void lcd_write_reg(int reg, int value)
182{ 139{
183 fb_data data = value; 140 int16_t data = value;
184 141
185 lcd_write_cmd(reg); 142 lcd_write_cmd(reg);
186 lcd_write_value16(data); 143 dbop_write_data(&data, 1);
187} 144}
188 145
189/*** hardware configuration ***/ 146/*** hardware configuration ***/
@@ -437,7 +394,7 @@ void lcd_update(void)
437 394
438 lcd_write_cmd(R_WRITE_DATA_2_GRAM); 395 lcd_write_cmd(R_WRITE_DATA_2_GRAM);
439 396
440 lcd_write_data((fb_data*)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); 397 dbop_write_data((fb_data*)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT);
441} 398}
442 399
443/* Update a fraction of the display. */ 400/* Update a fraction of the display. */
@@ -470,6 +427,10 @@ void lcd_update_rect(int x, int y, int width, int height)
470 427
471 lcd_write_reg(R_ENTRY_MODE, r_entry_mode); 428 lcd_write_reg(R_ENTRY_MODE, r_entry_mode);
472 429
430 /* we need to make x and width even to enable 32bit transfers */
431 width = (width + (x & 1) + 1) & ~1;
432 x &= ~1;
433
473 lcd_window_x(x, x + width - 1); 434 lcd_window_x(x, x + width - 1);
474 lcd_window_y(y, y + height -1); 435 lcd_window_y(y, y + height -1);
475 436
@@ -479,7 +440,7 @@ void lcd_update_rect(int x, int y, int width, int height)
479 440
480 do 441 do
481 { 442 {
482 lcd_write_data(ptr, width); 443 dbop_write_data(ptr, width);
483 ptr += LCD_WIDTH; 444 ptr += LCD_WIDTH;
484 } 445 }
485 while (--height > 0); 446 while (--height > 0);