diff options
author | Rob Purchase <shotofadds@rockbox.org> | 2008-04-08 20:43:04 +0000 |
---|---|---|
committer | Rob Purchase <shotofadds@rockbox.org> | 2008-04-08 20:43:04 +0000 |
commit | 2fee08aff39e1e095006448427fc8ebc529e2d62 (patch) | |
tree | c54245c80be2aefbebe692d4eb8824c5aba8c08b | |
parent | de65d065ef538ba10471110c3fb100f952eef37c (diff) |
D2: Implement power-off by putting the PCF50606 to sleep (and reduce timeout to 10 ticks). Set PCF outputs on init as per OF. Fix erroneous BOOTDIR definition and make HW Info screen show some more useful info.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17039 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/export/config-cowond2.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/tcc780x/cowond2/button-target.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/tcc780x/cowond2/power-cowond2.c | 21 | ||||
-rw-r--r-- | firmware/target/arm/tcc780x/debug-tcc780x.c | 45 |
4 files changed, 38 insertions, 32 deletions
diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h index 1eef8f8ee5..78becb3161 100644 --- a/firmware/export/config-cowond2.h +++ b/firmware/export/config-cowond2.h @@ -136,6 +136,6 @@ #define BOOTFILE_EXT "iaudio" #define BOOTFILE "rockbox." BOOTFILE_EXT -#define BOOTDIR "/" +#define BOOTDIR "/.rockbox" #endif /* SIMULATOR */ diff --git a/firmware/target/arm/tcc780x/cowond2/button-target.h b/firmware/target/arm/tcc780x/cowond2/button-target.h index 1ce602a30d..3ccf70cffd 100644 --- a/firmware/target/arm/tcc780x/cowond2/button-target.h +++ b/firmware/target/arm/tcc780x/cowond2/button-target.h @@ -49,6 +49,6 @@ int button_read_device(void); /* Software power-off */ #define POWEROFF_BUTTON BUTTON_POWER -#define POWEROFF_COUNT 40 +#define POWEROFF_COUNT 10 #endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c index 96fe211a64..92969de203 100644 --- a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c @@ -20,33 +20,38 @@ #include "kernel.h" #include "system.h" #include "power.h" +#include "pcf50606.h" +#include "cpu.h" #ifndef SIMULATOR void power_init(void) { - #warning function not implemented + /* Set outputs as per OF - further investigation required. */ + pcf50606_write(PCF5060X_DCDEC1, 0xe4); + pcf50606_write(PCF5060X_IOREGC, 0xf5); + pcf50606_write(PCF5060X_D1REGC1, 0xf5); + pcf50606_write(PCF5060X_D2REGC1, 0xe9); + pcf50606_write(PCF5060X_D3REGC1, 0xf8); /* WM8985 3.3v */ + pcf50606_write(PCF5060X_DCUDC1, 0xe7); + pcf50606_write(PCF5060X_LPREGC1, 0x0); + pcf50606_write(PCF5060X_LPREGC2, 0x2); } void ide_power_enable(bool on) { - #warning function not implemented (void)on; } bool ide_powered(void) { - #warning function not implemented return true; } void power_off(void) { - /* Disable interrupts on this core */ - disable_interrupt(IRQ_FIQ_STATUS); - - /* Shutdown: stop XIN oscillator */ - CLKCTRL &= ~(1 << 31); + /* Forcibly cut power to SoC & peripherals by putting the PCF to sleep */ + pcf50606_write(PCF5060X_OOCC1, GOSTDBY | CHGWAK | EXTONWAK); } #else /* SIMULATOR */ diff --git a/firmware/target/arm/tcc780x/debug-tcc780x.c b/firmware/target/arm/tcc780x/debug-tcc780x.c index 10345ed7df..14aa8c1c10 100644 --- a/firmware/target/arm/tcc780x/debug-tcc780x.c +++ b/firmware/target/arm/tcc780x/debug-tcc780x.c @@ -27,19 +27,20 @@ #include "sprintf.h" #include "font.h" #include "debug-target.h" +#include "adc.h" + +/* IRQ status registers of debug interest only */ +#define STS (*(volatile unsigned long *)0xF3001008) +#define SRC (*(volatile unsigned long *)0xF3001010) bool __dbg_ports(void) { return false; } -//extern char r_buffer[5]; -//extern int r_button; - bool __dbg_hw_info(void) { - int line = 0, button, oldline; - int *address=0x0; + int line = 0, i, button, oldline; bool done=false; char buf[100]; @@ -50,8 +51,6 @@ bool __dbg_hw_info(void) /* Put all the static text before the while loop */ lcd_puts(0, line++, "[Hardware info]"); - /* TODO: ... */ - line++; oldline=line; while(!done) @@ -61,26 +60,28 @@ bool __dbg_hw_info(void) button &= ~BUTTON_REPEAT; - if (button == BUTTON_MENU) + if (button == BUTTON_POWER) done=true; - if(button==BUTTON_DOWN) - address+=0x01; - else if (button==BUTTON_UP) - address-=0x01; - /*snprintf(buf, sizeof(buf), "Buffer: 0x%02x%02x%02x%02x%02x", - r_buffer[0], r_buffer[1], r_buffer[2], r_buffer[3],r_buffer[4] ); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Button: 0x%08x, HWread: 0x%08x", - (unsigned int)button, r_button); lcd_puts(0, line++, buf);*/ snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", - (unsigned int)address, *address); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", - (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", - (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x", + (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x", + (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "GPIOE: 0x%08x", + (unsigned int)GPIOE); lcd_puts(0, line++, buf); + for (i = 0; i<4; i++) + { + snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i)); + lcd_puts(0, line++, buf); + } + + snprintf(buf, sizeof(buf), "STS: 0x%08x SRC: 0x%08x", + (unsigned int)STS, (unsigned int)SRC); lcd_puts(0, line++, buf); + lcd_update(); } return false; |