handler.c
602 Bytes
#include <PR/bcp.h>
#include "util.h"
/* must make sure all this code is run kseg1 */
static char msg[] = "ENTERING_EXCEPTION HANDLER!!!\n";
void __c_exception_handler(void (*kseg1_message)(char *))
{
u32 a = (u32)&msg;
kseg1_message((char *)(a | 0xa0000000));
/* power-down */
#ifdef DEBUG
/* only light led, but spin here */
IO_WRITE(PI_GPIO_REG, ((PI_GPIO_POWER_BIT|PI_GPIO_ERROR_BIT)<<
PI_GPIO_ENABLE_SHIFT)|PI_GPIO_POWER_BIT);
#else
IO_WRITE(PI_GPIO_REG, ((PI_GPIO_POWER_BIT|PI_GPIO_ERROR_BIT)<<
PI_GPIO_ENABLE_SHIFT));
#endif
while(1){}
}