diff --git a/firmware/target/arm/sandisk/sansa-e200/power-e200.c b/firmware/target/arm/sandisk/sansa-e200/power-e200.c index a01654fced..dfa4211a91 100644 --- a/firmware/target/arm/sandisk/sansa-e200/power-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/power-e200.c @@ -18,6 +18,7 @@ ****************************************************************************/ #include +#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)