46 #include "dev/watchdog.h" 53 #ifdef CONTIKI_WATCHDOG_CONF_TIMER_TOP 54 #define CONTIKI_WATCHDOG_TIMER_TOP CONTIKI_WATCHDOG_CONF_TIMER_TOP 56 #define CONTIKI_WATCHDOG_TIMER_TOP 1100 59 #ifdef CONTIKI_WATCHDOG_CONF_LOCK_CONFIG 60 #define CONTIKI_WATCHDOG_LOCK_CONFIG CONTIKI_WATCHDOG_CONF_LOCK_CONFIG 62 #define CONTIKI_WATCHDOG_LOCK_CONFIG 1 66 #define WATCHDOG_TIMER_TOP_TICK ((48000 / 32) * CONTIKI_WATCHDOG_TIMER_TOP) 68 #define LOCK_INTERRUPTS_DISABLED 0x01 69 #define LOCK_REGISTERS_UNLOCKED 0x02 77 if(CONTIKI_WATCHDOG_LOCK_CONFIG) {
78 int_status = ti_lib_int_master_disable();
80 if(ti_lib_watchdog_lock_state()) {
81 ret |= LOCK_REGISTERS_UNLOCKED;
82 ti_lib_watchdog_unlock();
85 ret |= (
int_status) ? (0) : (LOCK_INTERRUPTS_DISABLED);
92 lock_config(uint32_t status)
94 if(CONTIKI_WATCHDOG_LOCK_CONFIG) {
96 if(status & LOCK_REGISTERS_UNLOCKED) {
97 ti_lib_watchdog_lock();
99 if(status & LOCK_INTERRUPTS_DISABLED) {
100 ti_lib_int_master_enable();
114 ti_lib_watchdog_reload_set(WATCHDOG_TIMER_TOP_TICK);
115 lock_config(LOCK_REGISTERS_UNLOCKED);
124 uint32_t lock_status = unlock_config();
127 ti_lib_watchdog_reset_enable();
129 lock_config(lock_status);
138 ti_lib_watchdog_reload_set(WATCHDOG_TIMER_TOP_TICK);
139 ti_lib_watchdog_int_clear();
148 uint32_t lock_status = unlock_config();
150 ti_lib_watchdog_reset_disable();
152 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.