Static class to provide the ability to enable and manage the watchdog timer core of the MityDSP.
More...
#include <core/DspWatchdog.h>
List of all members.
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.
|
Detailed Description
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.
- See also:
- tcDspWatchdog Page
Member Typedef Documentation
typedef void(* MityDSP::tcDspWatchdog::tfWatchdogCallback)(void) |
typedef void(* MityDSP::tcDspWatchdog::tfWatchdogCallbackWithArg)(void *) |
Member Function Documentation
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.
- Note:
- Attempts to enable reset when running a debug version of the the core library (DspCoreD.lib) will not be honored. This prevents the watchdog timer from resetting the board during debugging.
- Parameters:
-
[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). |
- Returns:
- True if either watchdog NMI or RST is enabled.
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.
- Parameters:
-
[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) |
- Returns:
- None.
This routine registers an ISR callback for the watchdog NMI interrupt.
It assumes that no other NMI handlers are in use in the system.
- Note:
- The callback must not call any DSP/BIOS functions, nor any MityDSP library functions that require DSP/BIOS calls. The routine is called in the context of an NMI.
- Parameters:
-
[in] | afCallback | The NMI callback function (NULL for none). |
- Returns:
- None.
This routine registers an ISR callback for the watchdog NMI interrupt.
It assumes that no other NMI handlers are in use in the system.
- Note:
- The callback must not call any DSP/BIOS functions, nor any MityDSP library functions that require DSP/BIOS calls. The routine is called in the context of an NMI.
- Parameters:
-
[in] | afCallback | The NMI callback function (NULL for none). |
[in] | apUserArg | An argument to be supplied with the callback. |
- Returns:
- None.
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.
- Returns:
- None.