e200: Better power_off to lock the system down while waiting for PMU to cut power.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13809 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
276ff3bceb
commit
68f975be85
1 changed files with 17 additions and 2 deletions
|
@ -18,6 +18,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
#include "i2c-pp.h"
|
||||
|
||||
|
@ -28,11 +29,25 @@ void power_init(void)
|
|||
void power_off(void)
|
||||
{
|
||||
char byte;
|
||||
|
||||
/* Disable interrupts on this core */
|
||||
set_interrupt_status(IRQ_FIQ_DISABLED, IRQ_FIQ_STATUS);
|
||||
|
||||
/* Mask them on both cores */
|
||||
CPU_INT_CLR = -1;
|
||||
COP_INT_CLR = -1;
|
||||
|
||||
/* Send shutdown command to PMU */
|
||||
byte = i2c_readbyte(0x46, 0x20);
|
||||
byte &= ~0x1;
|
||||
pp_i2c_send(0x46, 0x20, byte);
|
||||
|
||||
while(1); /* Wait for device to power off */
|
||||
/* Halt everything and wait for device to power off */
|
||||
while (1)
|
||||
{
|
||||
CPU_CTL = PROC_SLEEP;
|
||||
COP_CTL = PROC_SLEEP;
|
||||
}
|
||||
}
|
||||
|
||||
bool charger_inserted(void)
|
||||
|
|
Loading…
Reference in a new issue