summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/crt0-pp.S18
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/lcd-e200.c58
2 files changed, 71 insertions, 5 deletions
diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S
index d847d9d943..17b1e8a4a3 100644
--- a/firmware/target/arm/crt0-pp.S
+++ b/firmware/target/arm/crt0-pp.S
@@ -47,14 +47,28 @@ start:
47 .equ SLEEP, 0x80000000 47 .equ SLEEP, 0x80000000
48 .equ WAKE, 0x0 48 .equ WAKE, 0x0
49 .equ SLEEPING, 0x80000000 49 .equ SLEEPING, 0x80000000
50 .equ CACHE_CTRL, 0x6000c000
50#endif 51#endif
51 52
52 msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */ 53 msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */
53 54
54#ifndef BOOTLOADER 55#ifndef BOOTLOADER
55 b pad_skip 56 b pad_skip
56.space 50*4 /* (more than enough) space for exception vectors */ 57
58#if defined(SANSA_E200)
59/* mi4tool writes junk between 0xe0 and 0xeb. Avoid this. */
60.space 60*4 /* (more than enough) space for exception vectors */
61#else
62.space 50*4
63#endif
64
57pad_skip: 65pad_skip:
66#ifdef SANSA_E200
67 /* On the Sansa, copying the vectors fails if the cache is initialised */
68 ldr r1, =CACHE_CTRL
69 mov r2, #0x0
70 str r2, [r1]
71#endif
58 /* We need to remap memory from wherever SDRAM is mapped natively, to 72 /* We need to remap memory from wherever SDRAM is mapped natively, to
59 base address 0, so we can put our exception vectors there. We don't 73 base address 0, so we can put our exception vectors there. We don't
60 want to do this remapping while executing from SDRAM, so we copy the 74 want to do this remapping while executing from SDRAM, so we copy the
@@ -126,7 +140,7 @@ remap_end:
126 ldr r0, =fiq_handler 140 ldr r0, =fiq_handler
127 str r0, [r1, #28] 141 str r0, [r1, #28]
128#endif 142#endif
129 143
130#ifndef STUB 144#ifndef STUB
131 /* Zero out IBSS */ 145 /* Zero out IBSS */
132 ldr r2, =_iedata 146 ldr r2, =_iedata
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
index 2ee191faa5..c2829d11da 100644
--- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
@@ -21,9 +21,7 @@
21 * 21 *
22 ****************************************************************************/ 22 ****************************************************************************/
23#include "config.h" 23#include "config.h"
24#include "cpu.h"
25#include "lcd.h" 24#include "lcd.h"
26#include "kernel.h"
27#include "system.h" 25#include "system.h"
28 26
29#define LCD_DATA_IN_GPIO GPIOB_INPUT_VAL 27#define LCD_DATA_IN_GPIO GPIOB_INPUT_VAL
@@ -108,6 +106,29 @@ static inline void lcd_write_reg(unsigned int reg, unsigned int data)
108 lcd_send_msg(0x72, data); 106 lcd_send_msg(0x72, data);
109} 107}
110 108
109static inline void cache_flush(void)
110{
111#ifndef BOOTLOADER
112 outl(inl(0xf000f044) | 0x2, 0xf000f044);
113 while ((inl(0x6000c000) & 0x8000) != 0)
114 {
115 }
116#endif
117}
118
119/* The LCD controller gets passed the address of the framebuffer, but can only
120 use the physical, not the remapped, address. This is a quick and dirty way
121 of correcting it */
122static unsigned long phys_fb_address(unsigned long address)
123{
124 if(address < 0x10000000)
125 {
126 return address + 0x10000000;
127 } else {
128 return address;
129 }
130}
131
111inline void lcd_init_device(void) 132inline void lcd_init_device(void)
112{ 133{
113/* All this is magic worked out by MrH */ 134/* All this is magic worked out by MrH */
@@ -158,7 +179,7 @@ inline void lcd_init_device(void)
158 LCD_REG_6 |= (1 << 4); 179 LCD_REG_6 |= (1 << 4);
159 180
160 LCD_REG_5 &= ~(1 << 7); 181 LCD_REG_5 &= ~(1 << 7);
161 LCD_FB_BASE_REG = (unsigned long)lcd_framebuffer; 182 LCD_FB_BASE_REG = phys_fb_address((unsigned long)lcd_framebuffer);
162 183
163 udelay(100000); 184 udelay(100000);
164 185
@@ -228,6 +249,7 @@ inline void lcd_init_device(void)
228 249
229inline void lcd_update(void) 250inline void lcd_update(void)
230{ 251{
252 cache_flush();
231 if(!(LCD_REG_6 & 1)) 253 if(!(LCD_REG_6 & 1))
232 LCD_REG_6 |= 1; 254 LCD_REG_6 |= 1;
233} 255}
@@ -262,3 +284,33 @@ void lcd_set_flip(bool yesno)
262 /* TODO: Implement lcd_set_flip() */ 284 /* TODO: Implement lcd_set_flip() */
263 (void)yesno; 285 (void)yesno;
264} 286}
287
288/* Blitting functions */
289
290void lcd_blit(const fb_data* data, int x, int by, int width,
291 int bheight, int stride)
292{
293 /* TODO: Implement lcd_blit() */
294 (void)data;
295 (void)x;
296 (void)by;
297 (void)width;
298 (void)bheight;
299 (void)stride;
300}
301
302void lcd_yuv_blit(unsigned char * const src[3],
303 int src_x, int src_y, int stride,
304 int x, int y, int width, int height)
305{
306 /* TODO: Implement lcd_blit() */
307 (void)src;
308 (void)src_x;
309 (void)src_y;
310 (void)stride;
311 (void)x;
312 (void)y;
313 (void)width;
314 (void)height;
315}
316