Static class to provide the ability to enable and manage the watchdog timer core of the MityDSP. More...
#include <core/DspWatchdog.h>
Public Types | |
typedef void(* | tfWatchdogCallback )(void) |
Prototype for the tcDspWatchdog ISR callback. | |
typedef void(* | tfWatchdogCallbackWithArg )(void *) |
Static Public Member Functions | |
static bool | enable (bool abEnableNmi, bool abEnableRst, unsigned int anTimeoutMsec=15000, unsigned int anNmiTimeoutMsec=100) |
This routine is used to enable or disable the MityDSP watchdog, which is disabled by default. | |
static void | reset (unsigned int anResetTicks=0, bool abClearConditions=true) |
This routine must be called periodically by application software to reset the MityDSP watchdog timer. | |
static void | register_callback (tfWatchdogCallback apCallback=NULL) |
This routine registers an ISR callback for the watchdog NMI interrupt. | |
static void | register_callback (tfWatchdogCallbackWithArg apCallback=NULL, void *apUserArg=NULL) |
This routine registers an ISR callback for the watchdog NMI interrupt. | |
static void | nmi_handler (void) |
This routine is installed as an NMI handler whenever the MityDSP watchdog timer's NMI interrupt is enabled. |
Static class to provide the ability to enable and manage the watchdog timer core of the MityDSP.
The MityDSP watchdog timer can be configured to reset the MityDSP processor if the timer is not reset periodically.
typedef void(* MityDSP::tcDspWatchdog::tfWatchdogCallback)(void) |
Prototype for the tcDspWatchdog ISR callback.
typedef void(* MityDSP::tcDspWatchdog::tfWatchdogCallbackWithArg)(void *) |
bool tcDspWatchdog::enable | ( | bool | abEnableNmi, | |
bool | abEnableRst, | |||
unsigned int | anTimeoutMsec = 15000 , |
|||
unsigned int | anNmiTimeoutMsec = 100 | |||
) | [static] |
This routine is used to enable or disable the MityDSP watchdog, which is disabled by default.
The watchdog may be configured to raise either NMI, or RST. NMI allows an application-specific callback to be activated (for post-mortem data collection possibly). RST will cause the MityDSP to be reset. If both are enabled, NMI is raised after the first timeout, and RST after the second.
Timeouts are provided for normal watchdog reset, and a second timeout (possibly shorter) to apply in the NMI handler if the watchdog RST is also enabled.
[in] | abEnableNmi | Enable watchdog NMI after a timeout. |
[in] | abEnableRst | Enable watchdog RST after a timeout. |
[in] | anTimeoutMsec | Watchdog timer reset value (100-6553600 msec). |
[in] | anNmiTimeoutMsec | Watchdog timer reset value between an NMI and a RST event (100-6553600 msec). |
void tcDspWatchdog::reset | ( | unsigned int | anResetTicks = 0 , |
|
bool | abClearConditions = true | |||
) | [static] |
This routine must be called periodically by application software to reset the MityDSP watchdog timer.
Called with no parameters, the watchdog countdown value is reset to the value computed when the watchdog functionality was enabled. If a non-zero value is provided, the countdown register is set to the provided value.
[in] | anResetTicks | Value to set the watchdog countdown timer to (default: 0 - use configured setting) |
[in] | abClearConditions | Indicates whether any NMI/RST conditions should be cleared (default: true) |
void tcDspWatchdog::register_callback | ( | tfWatchdogCallback | afCallback = NULL |
) | [static] |
This routine registers an ISR callback for the watchdog NMI interrupt.
It assumes that no other NMI handlers are in use in the system.
[in] | afCallback | The NMI callback function (NULL for none). |
void tcDspWatchdog::register_callback | ( | tfWatchdogCallbackWithArg | afCallback = NULL , |
|
void * | apUserArg = NULL | |||
) | [static] |
This routine registers an ISR callback for the watchdog NMI interrupt.
It assumes that no other NMI handlers are in use in the system.
[in] | afCallback | The NMI callback function (NULL for none). |
[in] | apUserArg | An argument to be supplied with the callback. |
void tcDspWatchdog::nmi_handler | ( | void | ) | [static] |
This routine is installed as an NMI handler whenever the MityDSP watchdog timer's NMI interrupt is enabled.
If an application-specific callback has been previously registered, this routine is first called. Following this call, the watchdog timer is reset. If the watchdog is also configured to assert RST, the special "final" timeout value is used to reset the watchdog, otherwise the normal reset timeout is used.
This allows a RST to be triggered quickly after the NMI, if desired.