Add in the needed crt0.S code for the wakeup alarm also

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19094 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Karl Kurbjun 2008-11-12 03:57:32 +00:00
parent 68c686957b
commit d42041043b
12 changed files with 284 additions and 32 deletions

View file

@ -49,8 +49,8 @@ vectors:
/* Add some strings to detect the bootloader in flash and give it a version
* number. (0x040A0028, 0x040A002C)
*/
.string "ROCKBOX"
.word 0x0001
.string "ROCKBOX\0"
.string "R 03.00\0"
/*
* Function: word_copy
@ -99,6 +99,18 @@ start:
cmp r0, #0xA0000
bne poweron
/* Did an RTC event wake the player up? */
mov r2, #0x4A000000
ldr r1, [r2]
ands r1, r1, #0x40000000
/* Woke up with the alarm - store a flag in GSTATUS3 */
ldrne r2, =0x560000b8
movne r1, #0x01
strne r1, [r2]
bne poweron
/* Set GPG up to read power and menu status */
ldr r2, =0x56000050
ldr r1, [r2, #0x18]

View file

@ -32,7 +32,44 @@
bool __dbg_hw_info(void)
{
return false;
char buf[50];
int line, button;
char reg=0, value=0;
lcd_clear_display();
lcd_setfont(FONT_SYSFIXED);
while(1)
{
line=0;
snprintf(buf, sizeof(buf), "reg: %08x value: %08x", reg, value);
lcd_puts(0, line++, buf);
button = button_get_w_tmo(HZ/10);
if (button == BUTTON_UP)
reg++;
if (button == BUTTON_DOWN)
reg--;
if (button == BUTTON_VOL_UP)
value++;
if (button == BUTTON_VOL_DOWN)
value--;
if (button == BUTTON_A)
{
// LCD_SPI_start();
// LCD_SPI_setreg(reg, value);
// LCD_SPI_stop();
}
lcd_update();
if (button == (DEBUG_CANCEL|BUTTON_REL))
return false;
}
}
bool __dbg_ports(void)

View file

@ -244,7 +244,7 @@ static void LCD_SPI_init(void)
/* LCD init */
void lcd_init_device(void)
{
#ifdef BOOTLOADER
#if 0//def BOOTLOADER
int i;
/* When the Rockbox bootloader starts, we are changing framebuffer address,
but we don't want what's shown on the LCD to change until we do an

View file

@ -70,6 +70,11 @@ void power_off(void)
_backlight_off();
_buttonlight_off();
sleep(HZ);
/* Do this to allow the drive to properly reset when player restarts
* immediately without running OF shutdown.
*/
GPGCON&=~0x00300000;
/* Rockbox never properly shutdown the player. When the sleep bit is set
* the player actually wakes up in some type of "zombie" state
@ -81,6 +86,122 @@ void power_off(void)
CLKCON |=(1<<3);
reboot_point();
#if 0
GPBCON=0x00015450;
GPBDAT=0x403;
GPBUP=0x3FD;
GPCCON =0xAAA054A8;
GPCDAT =0x0000038C;
GPCUP =0xFFFF;
GPDCON =0xAAA0AAA5;
GPDDAT =0x00000300;
GPDUP =0xFCFF;
GPECON =0xAA8002AA;
GPEDAT =0x0000FFED;
GPEUP =0x3817;
GPFCON =0x00000a00;
GPFDAT =0x000000F1;
GPFUP =0x000000FF;
GPGCON =0x01401002;
GPGDAT =0x00000180;
GPGUP =0x0000FF7F;
GPHCON =0x001540A5;
GPHDAT =0x000006FD;
GPHUP =0x00000187;
// mine
INTMSK =0xFFFFFFFF;
EINTMASK=0x0FFFFEF0;
EXTINT0 =0xFFFFFECF;
EXTINT1 =0x07;
//
// INTMSK=0xFFFFFFFF;
// EINTMASK=0x00200000;
// GPHDAT=0x00000004;
// EXTINT0=~0x00000130;
// INTMSK=(~0x00000130)+0x00000100;
// GPGUP=0xFFFFFFFF;
//mine
INTMSK =0xFFFFFFDE;
//
SRCPND=0xFFFFFFFF;
INTPND=0xFFFFFFFF;
GSTATUS1=0x00000600;
ADCCON=0x00000004;
// MISCCR=MISCCR&(~0x703000)|0x603000;
LCDCON1=0x00000000;
LOCKTIME=0xFFFFFFFF;
// REFRESH=REFRESH|0x00400000;
// MISCCR=MISCCR|0x000E0000;
// CLKCON=CLKCON|0x00004018;
/*
* This next piece of code was taken from the linux 2.6.17 sources:
* linux/arch/arm/mach-s3c2410/sleep.S
*
* Copyright (c) 2004 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
*
* Based on PXA/SA1100 sleep code by:
* Nicolas Pitre, (c) 2002 Monta Vista Software Inc
* Cliff Brake, (c) 2001
*/
asm volatile
(
/* get REFRESH, MISCCR, and CLKCON (and ensure in TLB) */
"ldr r4, =0x48000024 \n"
"ldr r5, =0x56000080 \n"
"ldr r6, =0x4C00000C \n"
"ldr r7, [ r4 ] \n"
"ldr r8, [ r5 ] \n"
"ldr r9, [ r6 ] \n"
/* Setup register writes */
"ldr r2, =0x006E3000 \n"
"ldr r3, =0x00004018 \n"
"orr r7, r7, #0x00400000 \n" /* SDRAM sleep command */
"orr r8, r8, r2 \n" /* SDRAM power-down signals */
"orr r9, r9, r3 \n" /* power down command */
/* first as a trial-run to load cache */
"teq pc, #0 \n"
"bl s3c2410_do_sleep \n"
/* now do it for real */
"teq r0, r0 \n"
"b s3c2410_do_sleep \n"
/* align next bit of code to cache line */
".align 8 \n"
"s3c2410_do_sleep: \n"
"streq r7, [ r4 ] \n" /* SDRAM sleep command */
"streq r8, [ r5 ] \n" /* SDRAM power-down config */
"streq r3, [ r6 ] \n" /* CPU sleep */
"1: \n"
"beq 1b \n"
"bx lr \n"
);
#endif
}
#else /* SIMULATOR */

View file

@ -113,9 +113,14 @@ void system_reboot(void)
static void set_page_tables(void)
{
map_section(0, 0, 0x1000, CACHE_NONE); /* map every memory region to itself */
map_section(0x30000000, 0, 32, CACHE_ALL); /* map RAM to 0 and enable caching for it */
map_section((int)FRAME, (int)FRAME, 1, BUFFERED); /* enable buffered writing for the framebuffer */
/* map every memory region to itself */
map_section(0, 0, 0x1000, CACHE_NONE);
/* map RAM to 0 and enable caching for it */
map_section(0x30000000, 0, 32, CACHE_ALL);
/* enable buffered writing for the framebuffer */
map_section((int)FRAME, (int)FRAME, 1, BUFFERED);
}
void memory_init(void) {
@ -145,7 +150,7 @@ void s3c_regclr(volatile int *reg, unsigned int mask)
void system_init(void)
{
INTMSK = 0xFFFFFFFF;
INTMOD = 0;
INTMOD = 0;
SRCPND = 0xFFFFFFFF;
INTPND = 0xFFFFFFFF;
INTSUBMSK = 0xFFFFFFFF;