MityDSP Documentation Index
tcDspWatchdog

Introduction

The tcDspWatchdog static class is used to manage the MityDSP watchdog timer. This timer may be used to raise an NMI and/or reset the MityDSP if it is allowed to expire. When NMI is enabled, this class installs a handler which calls an optional application-provided callback to perform clean-up, debugging, or other application specific activities.

Note:
Due to restrictions placed on code called in an NMI, no DSP/BIOS functions, nor most MityDSP MDK software may be called in the NMI callback.

The application must ensure that the reset() method is always called before the watchdog timer expires to avoid a RST or NMI.

See also:
MityDSP::tcDspWatchdog Class Reference

Example

This is a simple example of tcDspWatchdog usage:

{
// Register watchdog NMI callback
tcDspWatchdog::register_callback(myWatchdogCallback);
// Enable watchdog NMI and RST, with timeouts of 15 sec normally,
// and 100 msec following NMI
tcDspWatchdog::enable(true, true, 15000, 100);
...
while (true)
{
...
// Application must be designed to reset the watchdog
// timer before it expires!
tcDspWatchdog::reset();
}
}
unsigned int nmi_count = 0;
void
tcMyClass::myWatchdogCallback(void)
{
// Do application-specific data collection
// NOTE: Cannot use DSP/BIOS functions, or most MityDSP library calls
// which in turn use DSP/BIOS calls.
nmi_count++;
tcDspFirmware::write_scratchpad(&nmi_count, 0, 1);
return;
}

  
Generated on Mon Apr 22 2013 11:33:02 for MityDSP Core by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.