
DA-660-8/16-LXUser’s Manual
Programmer’s Guide
5-5
WDT (Watch Dog Timer)
1.
Introduction
The WDT works like a watch dog function. You can enable it or disable it. If the user enables
WDT but the application does not acknowledge it, then the system will reboot. You can set the
acknowledgement time from a minimum of 50 msec to a maximum of 60 seconds.
2.
How the WDT works
The sWatch Dog is enabled when the system boots up. The kernel will auto acknowledge it.
The user application must also acknowledge it. When the user application does not
acknowledge it, the system will reboot.
Kernel boot
.....
....
User application running and enable user acknowledgement
....
....
3.
The user API
The user application must include
<moxadevic.h>
, and
link moxalib.a
. A Makefile example
is shown below:
all:
mxscaleb-gcc –o xxxx xxxx.c -lmoxalib
int swtd_open(void)
Description
Open the file handle to control the sWatch Dog. Keep the file handle to do other
operations.
Input
None
Output
The return value is the file handle. In case of an error, it will return a value < 0.
You can get the error from
errno()
.
int swtd_enable(int fd, unsigned long time)
Description
Enables the Watch Dog for the application. The application must acknowledge this, else
the system will reboot.
Input
int fd - the file handle, from the swtd_open() return value.
unsigned long time - The time you wish to acknowledge the Watch Dog periodically.
You must acknowledge the Watch Dog before timeout. If you do not, the system will be
rebooted automatically. The minimal time is 50 msec, the maximum time is 60 seconds.
The time unit is msec.