summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/dbop-as3525.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/dbop-as3525.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/dbop-as3525.c')
-rw-r--r--firmware/target/arm/as3525/dbop-as3525.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/dbop-as3525.c b/firmware/target/arm/as3525/dbop-as3525.c
index 938eee2fb1..b54ad17a6c 100644
--- a/firmware/target/arm/as3525/dbop-as3525.c
+++ b/firmware/target/arm/as3525/dbop-as3525.c
@@ -20,6 +20,7 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "config.h" 22#include "config.h"
23#include <inttypes.h>
23#include "as3525.h" 24#include "as3525.h"
24#include "dbop-as3525.h" 25#include "dbop-as3525.h"
25 26
@@ -75,3 +76,50 @@ unsigned short dbop_debug(void)
75{ 76{
76 return dbop_input_value; 77 return dbop_input_value;
77} 78}
79
80static inline void dbop_set_mode(int mode)
81{
82 int delay = 10;
83 if (mode == 32 && (!(DBOP_CTRL & (1<<13|1<<14))))
84 DBOP_CTRL |= (1<<13|1<<14);
85 else if (mode == 16 && (DBOP_CTRL & (1<<13|1<<14)))
86 DBOP_CTRL &= ~(1<<14|1<<13);
87 else
88 return;
89 while(delay--) asm volatile("nop");
90}
91
92void dbop_write_data(const int16_t* p_bytes, int count)
93{
94
95 const int32_t *data;
96 if ((intptr_t)p_bytes & 0x3 || count == 1)
97 { /* need to do a single 16bit write beforehand if the address is
98 * not word aligned or count is 1, switch to 16bit mode if needed */
99 dbop_set_mode(16);
100 DBOP_DOUT16 = *p_bytes++;
101 if (!(--count))
102 return;
103 }
104 /* from here, 32bit transfers are save
105 * set it to transfer 4*(outputwidth) units at a time,
106 * if bit 12 is set it only does 2 halfwords though (we never set it)
107 * switch to 32bit output if needed */
108 dbop_set_mode(32);
109 data = (int32_t*)p_bytes;
110 while (count > 1)
111 {
112 DBOP_DOUT32 = *data++;
113 count -= 2;
114
115 /* Wait if push fifo is full */
116 while ((DBOP_STAT & (1<<6)) != 0);
117 }
118 /* While push fifo is not empty */
119 while ((DBOP_STAT & (1<<10)) == 0);
120
121 /* due to the 32bit alignment requirement or uneven count,
122 * we possibly need to do a 16bit transfer at the end also */
123 if (count > 0)
124 dbop_write_data((int16_t*)data, 1);
125}