
VDX-6318 Windows Embedded Compact 7 - Getting Started Guide
Windows Embedded Compact 7 Getting Started Rev 2.00
Page 109
Sample codes to configure and use WDT1:
void main(void)
{
unsigned char c;
unsigned long lTime;
// Configure WDT1 to trigger in 5 seconds
lTime = 0x20L * 5000L;
outp(0x6c, (lTime >> 16) & 0xff);
outp(0x6b, (lTime >> 8) & 0xff);
outp(0x6a, (lTime >> 0) & 0xff);
// Configure WDT1 to reset system when it trigger
outp(0x69, 0xd0);
// outp(0x69, 0x10) to trigger IRQ3
// outp(0x69, 0x20) to trigger IRQ4
// outp(0x69, 0x30) to trigger IRQ5
// outp(0x69, 0x40) to trigger IRQ6
// outp(0x69, 0x50) to trigger IRQ7
// outp(0x69, 0x60) to trigger IRQ9
// outp(0x69, 0x70) to trigger IRQ10
// outp(0x69, 0x90) to trigger IRQ12
// outp(0x69, 0xa0) to trigger IRQ14
// outp(0x69, 0xb0) to trigger IRQ15
// outp(0x69, 0xc0) to trigger NMI
// outp(0x69, 0xd0) to trigger system reset
// Enable WDT1 watchdog timer
c = inp(0x68);
c |= 0x40;
outp(0x68, c);
printf("Press any key to stop trigger timer.\n");
while(!kbhit())
outp(0x67, 0x00);
printf("System will reboot after 5 seconds.\n");
}
Watchdog Timer DLL: WDT.dll
The WDT.DLL is provided as part of the BSP and include in resulting Compact 7 OS run-time image
when this BSP is in used to develop the OS design.
There are six functions in the WDT.DLL:
// Set watchdog timer
int SetWDT0(unsigned int nTime, unsigned char nEvent);
int SetWDT1(unsigned int nTime, unsigned char nEvent);
// Reset watchdog timer
void ResetWDT0(void);
void ResetWDT1(void);
// Disable watchdog timer
void DisableWDT0(void);
void DisableWDT1(void);
Sample managed code project showing how to use the WDT.DLL is provided on the jump start CD,
under the
\SampleCodes\WatchdogTimer\
folder.