7. Watchdog Timer
50
NMI Handler
Because an NMI may originate from a source such as a RAM Error Correction Code (ECC)
error, the NMI handler cannot assume that an NMI occurred due to a watchdog timeout.
Therefore, the NMI handler must check the watchdog status register before taking watchdog-
related emergency action. When the NMI handler completes handling the emergency, it
invokes the original NMI Handler (discussed above). The code to do this might look like the
following:
#define WD_NMI_DETECT_BIT_SET
0x40
// Bit indicates an NMI occurred, set.
//
void
WatchdogIsr(void){
//
//
//
// Did the watchdog cause the NMI?
//
if(inb(WD_CSR_IO_ADDRESS)
& WD_NMI_DETECT_BIT_SET){
//
TripAlarm();
// Take care of essential tasks.
//
TurnOffTheGas();
//
}
//
_chain_intr(OldNmiIsr);
//
Invoke the originally installed ISR.
}
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com