void power_off(void) { int(*reboot_point)(void); reboot_point=(void*)(unsigned char*) 0x00000000; /* turn off backlight and wait for 1 second */ _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 * because the shutdown routine is not set up properly. So far the * shutdown routines tried leave the player consuming excess power * so we rely on the OF to shut everything down instead. (mmu apears to be * reset when the sleep bit is set) */ CLKCON |=(1<<3); reboot_point(); }
/* Update state of buttonlight according to timeout setting */ static void buttonlight_update_state(void) { buttonlight_timer = buttonlight_timeout; /* Buttonlight == OFF in the setting? */ if (buttonlight_timer < 0) { buttonlight_timer = 0; /* Disable the timeout */ _buttonlight_off(); } else _buttonlight_on(); }