Now panicf() shuts off the hard drive and lowers the CPU frequency, it also reboots if ON is pressed.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7510 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-09-12 10:34:27 +00:00
parent 4a2feaa30d
commit e6c6d22240
2 changed files with 29 additions and 1 deletions

View file

@ -36,6 +36,7 @@ void cpu_boost(bool on_off);
void cpu_idle_mode(bool on_off);
#else
#define FREQ CPU_FREQ
#define set_cpu_frequency(frequency)
#define cpu_boost(on_off)
#define cpu_idle_mode(on_off)
#endif

View file

@ -17,6 +17,7 @@
*
****************************************************************************/
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
@ -25,6 +26,8 @@
#include "font.h"
#include "debug.h"
#include "led.h"
#include "power.h"
#include "system.h"
static char panic_buf[128];
@ -76,6 +79,13 @@ void panicf( const char *fmt, ...)
/* no LCD */
#endif
DEBUGF(panic_buf);
set_cpu_frequency(0);
#ifdef HAVE_ATA_POWER_OFF
ide_power_enable(false);
#endif
while (1)
{
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
@ -83,7 +93,24 @@ void panicf( const char *fmt, ...)
led (state);
state = state?false:true;
for (i = 0; i < 400000; ++i);
for (i = 0; i < 240000; ++i);
#endif
#ifdef IRIVER_H100_SERIES
/* check for the ON button (and !hold) */
if ((GPIO1_READ & 0x22) == 0)
system_reboot();
#elif CONFIG_CPU == SH7034
/* try to restart firmware if ON is pressed */
#if CONFIG_KEYPAD == PLAYER_PAD
if (!(PADR & 0x0020))
#elif CONFIG_KEYPAD == RECORDER_PAD
#ifdef HAVE_FMADC
if (!(PCDR & 0x0008))
#else
if (!(PBDR & 0x0100))
#endif
#endif
system_reboot();
#endif
}
}