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
This commit is contained in:
Rob Purchase 2008-04-08 20:43:04 +00:00
parent de65d065ef
commit 2fee08aff3
4 changed files with 38 additions and 32 deletions

View file

@ -136,6 +136,6 @@
#define BOOTFILE_EXT "iaudio"
#define BOOTFILE "rockbox." BOOTFILE_EXT
#define BOOTDIR "/"
#define BOOTDIR "/.rockbox"
#endif /* SIMULATOR */

View file

@ -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_ */

View file

@ -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 */

View file

@ -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;