46 #include "dev/watchdog.h" 52 #ifdef CONTIKI_WATCHDOG_CONF_TIMER_TOP 53 #define CONTIKI_WATCHDOG_TIMER_TOP CONTIKI_WATCHDOG_CONF_TIMER_TOP 55 #define CONTIKI_WATCHDOG_TIMER_TOP 0xFFFFF 58 #ifdef CONTIKI_WATCHDOG_CONF_LOCK_CONFIG 59 #define CONTIKI_WATCHDOG_LOCK_CONFIG CONTIKI_WATCHDOG_CONF_LOCK_CONFIG 61 #define CONTIKI_WATCHDOG_LOCK_CONFIG 1 64 #define LOCK_INTERRUPTS_DISABLED 0x01 65 #define LOCK_REGISTERS_UNLOCKED 0x02 73 if(CONTIKI_WATCHDOG_LOCK_CONFIG) {
74 int_status = ti_lib_int_master_disable();
76 if(ti_lib_watchdog_lock_state()) {
77 ret |= LOCK_REGISTERS_UNLOCKED;
78 ti_lib_watchdog_unlock();
81 ret |= (
int_status) ? (0) : (LOCK_INTERRUPTS_DISABLED);
88 lock_config(uint32_t status)
90 if(CONTIKI_WATCHDOG_LOCK_CONFIG) {
92 if(status & LOCK_REGISTERS_UNLOCKED) {
93 ti_lib_watchdog_lock();
95 if(status & LOCK_INTERRUPTS_DISABLED) {
96 ti_lib_int_master_enable();
110 ti_lib_watchdog_reload_set(CONTIKI_WATCHDOG_TIMER_TOP);
111 lock_config(LOCK_REGISTERS_UNLOCKED);
120 uint32_t lock_status = unlock_config();
123 ti_lib_watchdog_reset_enable();
125 lock_config(lock_status);
134 ti_lib_watchdog_reload_set(CONTIKI_WATCHDOG_TIMER_TOP);
135 ti_lib_watchdog_int_clear();
144 uint32_t lock_status = unlock_config();
146 ti_lib_watchdog_reset_disable();
148 lock_config(lock_status);
Header file with macros which rename TI CC26xxware functions.
void watchdog_init(void)
Initialises the CC26xx WDT.
static uint8_t int_status(void)
Check whether a data or wake on motion interrupt has occurred.
void watchdog_start(void)
Starts the CC26xx WDT.
void watchdog_periodic(void)
Refreshes the CC26xx WDT.
void watchdog_reboot(void)
Manually trigger a WDT reboot.
void watchdog_stop(void)
Stops the WDT such that it won't timeout and cause MCU reset.