hsk-libs-dev
270
High Speed Karlsruhe XC878 library collection
|
HSK Watchdog Timer implementation. More...
Macros | |
#define | BIT_WDTIN 0 |
WDTCON Watchdog Timer Input Frequency Selection bit. More... | |
#define | BIT_WDTEN 2 |
WDTCON WDT Enable bit. More... | |
#define | BIT_WDTRS 1 |
WDTCON WDT Refresh Start bit. More... | |
Functions | |
void | hsk_wdt_init (const uword window) |
Sets up the watchdog timer. More... | |
void | hsk_wdt_enable (void) |
Activates the Watchdog Timer. More... | |
void | hsk_wdt_disable (void) |
Disables the Watchdog Timer. More... | |
void | hsk_wdt_service (void) |
Resets the watchdog timer. More... | |
HSK Watchdog Timer implementation.
The WDT is a 16bit counter that counts up, upon overflow a reset is initiated. When the timer is serviced the higher byte is loaded from the WDTREL SFR.
All registers are in the mapped register area, i.e. RMAP=1 must be set to access them.
#define BIT_WDTEN 2 |
WDTCON WDT Enable bit.
This bit is protected.
#define BIT_WDTIN 0 |
WDTCON Watchdog Timer Input Frequency Selection bit.
Used to select PCLK/128 instead of PCLK/2.
#define BIT_WDTRS 1 |
WDTCON WDT Refresh Start bit.
void hsk_wdt_disable | ( | void | ) |
Disables the Watchdog Timer.
void hsk_wdt_enable | ( | void | ) |
Activates the Watchdog Timer.
void hsk_wdt_init | ( | const uword | window | ) |
Sets up the watchdog timer.
The window time specifies the time available to call hsk_wdt_service() before a reset is triggered. Possible times range from 21.3µs to 350ms.
The window time is rounded up to the next higher possible value. Exceeding the value range causes an overflow that results in shorter window times.
window | The time window in multiples of 10µs |
The WDT runs at PCLK/2 or PCLK/128, i.e. the WDT low byte WDTL overlow occurs either every 21.333µs or every 1365.333ms.
One time unit (10µs) equals 120 PCLK/2 clock ticks. One PCLK/128 time unit (640µs) equals 120 PCLK/128 clock ticks.
void hsk_wdt_service | ( | void | ) |
Resets the watchdog timer.
This function needs to be called to prevent the WDT from resetting the device.