Various Nano2g changes - enable the rest of crt0.S (including clock setup) and make the nano2g bootloader do something useful (displaying gpio ports). Also add checks for the fifo-full condition in the LCD driver - required after enabling all the crt0.S inits

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21948 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2009-07-18 11:31:19 +00:00
parent d58e358477
commit 386503502b
5 changed files with 59 additions and 4 deletions

View file

@ -30,6 +30,7 @@
#include "cpu.h" #include "cpu.h"
#include "system.h" #include "system.h"
#include "lcd.h" #include "lcd.h"
#include "i2c-s5l8700.h"
#include "kernel.h" #include "kernel.h"
#include "thread.h" #include "thread.h"
#include "storage.h" #include "storage.h"
@ -49,13 +50,51 @@ char version[] = APPSVERSION;
/* Show the Rockbox logo - in show_logo.c */ /* Show the Rockbox logo - in show_logo.c */
extern int show_logo(void); extern int show_logo(void);
extern int line;
void main(void) void main(void)
{ {
int i;
system_init();
i2c_init();
kernel_init();
enable_irq();
lcd_init(); lcd_init();
show_logo(); _backlight_init();
/* Do nothing... */ lcd_puts_scroll(0,0,"+++ this is a very very long line to test scrolling. ---");
verbose = 0;
i = 0;
while (!button_hold()) {
line = 1;
printf("i=%d",i++);
printf("TBCNT: %08x",TBCNT);
printf("GPIO 0: %08x",PDAT0);
printf("GPIO 1: %08x",PDAT1);
printf("GPIO 2: %08x",PDAT2);
printf("GPIO 3: %08x",PDAT3);
printf("GPIO 4: %08x",PDAT4);
printf("GPIO 5: %08x",PDAT5);
printf("GPIO 6: %08x",PDAT6);
printf("GPIO 7: %08x",PDAT7);
printf("GPIO 10: %08x",PDAT10);
printf("GPIO 11: %08x",PDAT11);
printf("GPIO 13: %08x",PDAT13);
printf("GPIO 14: %08x",PDAT14);
lcd_update();
}
disable_irq();
/* Branch back to iBugger entry point */
asm volatile("ldr pc, =0x08640568");
/* We never reach here */
while(1); while(1);
} }

View file

@ -1303,6 +1303,7 @@ target/arm/s5l8700/udacodec-meizu.c
#ifdef IPOD_NANO2G #ifdef IPOD_NANO2G
target/arm/s5l8700/kernel-s5l8700.c target/arm/s5l8700/kernel-s5l8700.c
target/arm/s5l8700/ipodnano2g/backlight-nano2g.c target/arm/s5l8700/ipodnano2g/backlight-nano2g.c
target/arm/s5l8700/ipodnano2g/button-nano2g.c
target/arm/s5l8700/ipodnano2g/lcd-nano2g.c target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
#endif #endif

View file

@ -19,6 +19,8 @@
* *
****************************************************************************/ ****************************************************************************/
#include <inttypes.h>
#define REG8_PTR_T volatile uint8_t * #define REG8_PTR_T volatile uint8_t *
#define REG16_PTR_T volatile uint16_t * #define REG16_PTR_T volatile uint16_t *
#define REG32_PTR_T volatile uint32_t * #define REG32_PTR_T volatile uint32_t *

View file

@ -82,7 +82,6 @@ newstart2:
// orr r0, r0, r2 // orr r0, r0, r2
// str r0, [r1] // switch backlight on // str r0, [r1] // switch backlight on
#if CONFIG_CPU==S5L8700
ldr r1, =0x3c500000 // CLKCON ldr r1, =0x3c500000 // CLKCON
ldr r0, =0x00800080 ldr r0, =0x00800080
str r0, [r1] str r0, [r1]
@ -90,7 +89,11 @@ newstart2:
mov r0, #0 mov r0, #0
str r0, [r1] str r0, [r1]
ldr r1, =0x3c500004 // PLL0PMS ldr r1, =0x3c500004 // PLL0PMS
#ifdef IPOD_NANO2G
ldr r0, =0x21200
#else
ldr r0, =0x1ad200 ldr r0, =0x1ad200
#endif
str r0, [r1] str r0, [r1]
ldr r1, =0x3c500014 // PLL0LCNT ldr r1, =0x3c500014 // PLL0LCNT
ldr r0, =8100 ldr r0, =8100
@ -226,6 +229,7 @@ newstart2:
mcr 15, 0, r0, c1, c0, 0 // enable protection unit mcr 15, 0, r0, c1, c0, 0 // enable protection unit
#if CONFIG_CPU==S5L8700
/* Copy interrupt vectors to iram */ /* Copy interrupt vectors to iram */
ldr r2, =_intvectstart ldr r2, =_intvectstart
ldr r3, =_intvectend ldr r3, =_intvectend

View file

@ -60,21 +60,28 @@ static int xoffset; /* needed for flip */
static inline void s5l_lcd_write_cmd_data(int cmd, int data) static inline void s5l_lcd_write_cmd_data(int cmd, int data)
{ {
while (LCD_STATUS & 0x10);
LCD_WCMD = cmd >> 8; LCD_WCMD = cmd >> 8;
while (LCD_STATUS & 0x10);
LCD_WCMD = cmd & 0xff; LCD_WCMD = cmd & 0xff;
while (LCD_STATUS & 0x10);
LCD_WDATA = data >> 8; LCD_WDATA = data >> 8;
while (LCD_STATUS & 0x10);
LCD_WDATA = data & 0xff; LCD_WDATA = data & 0xff;
} }
static inline void s5l_lcd_write_cmd(unsigned short cmd) static inline void s5l_lcd_write_cmd(unsigned short cmd)
{ {
while (LCD_STATUS & 0x10);
LCD_WCMD = cmd; LCD_WCMD = cmd;
} }
static inline void s5l_lcd_write_data(int data) static inline void s5l_lcd_write_data(int data)
{ {
while (LCD_STATUS & 0x10);
LCD_WDATA = data >> 8; LCD_WDATA = data >> 8;
while (LCD_STATUS & 0x10);
LCD_WDATA = data & 0xff; LCD_WDATA = data & 0xff;
} }
@ -185,7 +192,9 @@ void lcd_update(void)
for (x = 0; x < LCD_WIDTH; x++) { for (x = 0; x < LCD_WIDTH; x++) {
pixel = *(p++); pixel = *(p++);
while (LCD_STATUS & 0x10);
LCD_WDATA = (pixel & 0xff00) >> 8; LCD_WDATA = (pixel & 0xff00) >> 8;
while (LCD_STATUS & 0x10);
LCD_WDATA = pixel & 0xff; LCD_WDATA = pixel & 0xff;
} }
} }