diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c index 7f02a8b894..e25494dddd 100644 --- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c +++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c | |||
@@ -130,15 +130,16 @@ static void ams3525_dbop_init(void) | |||
130 | /* TODO: The OF calls some other functions here, but maybe not important */ | 130 | /* TODO: The OF calls some other functions here, but maybe not important */ |
131 | } | 131 | } |
132 | 132 | ||
133 | #define lcd_write_single_data16(value) do {\ | ||
134 | DBOP_CTRL &= ~(1<<14|1<<13); \ | ||
135 | DBOP_DOUT16 = (fb_data)(value); \ | ||
136 | } while(0) | ||
133 | 137 | ||
134 | static void lcd_write_cmd(int cmd) | 138 | static void lcd_write_cmd(int cmd) |
135 | { | 139 | { |
136 | /* Write register */ | 140 | /* Write register */ |
137 | DBOP_CTRL &= ~(1<<14); | ||
138 | |||
139 | DBOP_TIMPOL_23 = 0xa167006e; | 141 | DBOP_TIMPOL_23 = 0xa167006e; |
140 | 142 | lcd_write_single_data16(cmd); | |
141 | DBOP_DOUT = cmd; | ||
142 | 143 | ||
143 | /* Wait for fifo to empty */ | 144 | /* Wait for fifo to empty */ |
144 | while ((DBOP_STAT & (1<<10)) == 0); | 145 | while ((DBOP_STAT & (1<<10)) == 0); |
@@ -152,13 +153,33 @@ static void lcd_write_cmd(int cmd) | |||
152 | 153 | ||
153 | void lcd_write_data(const fb_data* p_bytes, int count) | 154 | void lcd_write_data(const fb_data* p_bytes, int count) |
154 | { | 155 | { |
155 | while (count--) | 156 | const long *data; |
157 | if ((int)p_bytes & 0x3) | ||
158 | { /* need to do a single 16bit write beforehand if the address is */ | ||
159 | /* not word aligned*/ | ||
160 | lcd_write_single_data16(*p_bytes); | ||
161 | count--;p_bytes++; | ||
162 | } | ||
163 | /* from here, 32bit transfers are save */ | ||
164 | /* set it to transfer 4*(outputwidth) units at a time, */ | ||
165 | /* if bit 12 is set it only does 2 halfwords though */ | ||
166 | DBOP_CTRL |= (1<<13|1<<14); | ||
167 | data = (long*)p_bytes; | ||
168 | while (count > 1) | ||
156 | { | 169 | { |
157 | DBOP_DOUT = *p_bytes++; | 170 | DBOP_DOUT32 = *data++; |
171 | count -= 2; | ||
158 | 172 | ||
159 | /* Wait for fifo to empty */ | 173 | /* TODO: We should normally fill the fifo until it's full |
174 | * instead of waiting after each word, | ||
175 | * but that causes blue lines on the display */ | ||
160 | while ((DBOP_STAT & (1<<10)) == 0); | 176 | while ((DBOP_STAT & (1<<10)) == 0); |
161 | } | 177 | } |
178 | |||
179 | /* due to the 32bit alignment requirement, we possibly need to do a | ||
180 | * 16bit transfer at the end also */ | ||
181 | if (count > 0) | ||
182 | lcd_write_single_data16(*(fb_data*)data); | ||
162 | } | 183 | } |
163 | 184 | ||
164 | static void lcd_write_reg(int reg, int value) | 185 | static void lcd_write_reg(int reg, int value) |
@@ -166,7 +187,7 @@ static void lcd_write_reg(int reg, int value) | |||
166 | fb_data data = value; | 187 | fb_data data = value; |
167 | 188 | ||
168 | lcd_write_cmd(reg); | 189 | lcd_write_cmd(reg); |
169 | lcd_write_data(&data, 1); | 190 | lcd_write_single_data16(data); |
170 | } | 191 | } |
171 | 192 | ||
172 | /*** hardware configuration ***/ | 193 | /*** hardware configuration ***/ |
@@ -555,6 +576,6 @@ bool lcd_button_support(void) | |||
555 | 576 | ||
556 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | 577 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); |
557 | 578 | ||
558 | lcd_write_data(&data, 1); | 579 | lcd_write_single_data16(data); |
559 | return true; | 580 | return true; |
560 | } | 581 | } |