static void good_dog(void) { imx233_rtc_reset_watchdog(WATCHDOG_HW_DELAY * 1000 / HZ); /* ms */ imx233_rtc_enable_watchdog(true); imx233_timrot_setup_simple(TIMER_WATCHDOG, false, WATCHDOG_SW_DELAY * 1000 / HZ, TIMER_SRC_1KHZ, &woof_woof); imx233_timrot_set_priority(TIMER_WATCHDOG, ICOLL_PRIO_WATCHDOG); }
static void good_dog(void) { imx233_rtc_reset_watchdog(WATCHDOG_HW_DELAY * 1000 / HZ); /* ms */ imx233_rtc_enable_watchdog(true); imx233_timrot_setup(TIMER_WATCHDOG, false, WATCHDOG_SW_DELAY * 1000 / HZ, BV_TIMROT_TIMCTRLn_SELECT__1KHZ_XTAL, BV_TIMROT_TIMCTRLn_PRESCALE__DIV_BY_1, false, &woof_woof); imx233_timrot_set_priority(TIMER_WATCHDOG, ICOLL_PRIO_WATCHDOG); }
static void woof_woof(void) { /* stop hardware watchdog, we catched the error */ imx233_rtc_enable_watchdog(false); /* recover current PC and trigger abort, so in the hope to get a useful * backtrace */ uint32_t pc = HW_DIGCTL_SCRATCH0; UIE(pc, 4); }
static void woof_woof(void) { /* stop hadrware watchdog, we catched the error */ imx233_rtc_enable_watchdog(false); uint32_t pc = HW_DIGCTL_SCRATCH0; /* write a "SWI #0xdead" instruction at the faulty instruction so that it * will trigger a proper backtrace */ *(uint32_t *)pc = 0xef00dead; commit_discard_idcache(); }
void imx233_system_prepare_shutdown(void) { /* wait a bit, useful for the user to stop touching anything */ sleep(HZ / 2); /* disable watchdog just in case since we will disable interrupts */ imx233_rtc_enable_watchdog(false); /* disable interrupts, it's probably better to avoid any action so close * to shutdown */ disable_interrupt(IRQ_FIQ_STATUS); #ifdef SANSA_FUZEPLUS /* This pin seems to be important to shutdown the hardware properly */ imx233_pinctrl_acquire(0, 9, "power off"); imx233_pinctrl_set_function(0, 9, PINCTRL_FUNCTION_GPIO); imx233_pinctrl_enable_gpio(0, 9, true); imx233_pinctrl_set_gpio(0, 9, true); #endif }
void system_exception_wait(void) { /* stop hadrware watchdog, IRQs are stopped */ imx233_rtc_enable_watchdog(false); /* make sure lcd and backlight are on */ lcd_update(); backlight_hw_on(); backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING); /* wait until button release (if a button is pressed) * NOTE at this point, interrupts are off so that rules out touchpad and * ADC, so we are pretty much left with PSWITCH only. If other buttons are * wanted, it is possible to implement a busy polling version of button * reading for GPIO and ADC in button-imx233 but this is not done at the * moment. */ while(imx233_power_read_pswitch() != 0) {} while(imx233_power_read_pswitch() == 0) {} while(imx233_power_read_pswitch() != 0) {} }
void system_exception_wait(void) { /* stop hadrware watchdog, IRQs are stopped */ imx233_rtc_enable_watchdog(false); /* make sure lcd and backlight are on */ lcd_update(); backlight_hw_on(); backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING); /* wait until button release (if a button is pressed) */ #ifdef HAVE_BUTTON_DATA int data; while(button_read_device(&data)); /* then wait until next button press */ while(!button_read_device(&data)); #else while(button_read_device()); /* then wait until next button press */ while(!button_read_device()); #endif }
void system_prepare_fw_start(void) { /* keep alive to get enough time, stop watchdog */ imx233_keep_alive(); imx233_rtc_enable_watchdog(false); }