Appendix a, Programming watchdog timer – Lanner LEC-3012 User Manual
Page 23

23
Programming Watchdog Timer
Embedded and Industrial Computing
Appendix A
wd_tst --swt xxx” to start the watchdog timer
instead .
Watchdog timer can support two functions,
2.
- system rest or LAN bypass. However, only
one function can be activated at a time. You
should modify the code or switch it to the
desired state/function accordingly.
For more details, refer to the README file
3.
contained within the program.
A sample Watchdog program in C:
*********************************************************
**********************/
#include “../include/config.h”
#include “../include/version.h”
/* standard include file */
#include
#include
#include
#ifdef DJGPP
/* For DOS DJGPP */
#include
#include
#ifndef DIRECT_IO_ACCESS
#error ***Error: define DIRECT_IO_ACCESS in config.h for
DOS ***
#endif
#else
/* For Linux */
#if defined(LINUX_ENV)
#include
#endif
#if defined(FreeBSD_ENV)
#define SET_IOPL() (iofl=open(“/dev/io”,000))
#define RESET_IOPL() close(iofl)
#include
#endif
#include
#include
#include
#include
#include
#include “../include/wd_ioctl.h”
#define delay(x) usleep(x)
#ifdef DIRECT_IO_ACCESS
#warning ***** Note: You build with DIRECT_IO_ACCESS
defined *****
#warning ***** Note: undefine this to build for driver code
*****
#endif
#endif
/* local include file */
#include “../include/ioaccess.h”
#ifndef BYPASS_PAIR_NUMBER
#error “You should defined PAIR_NUMBER in include/
config.h”
#endif
#if BYPASS_PAIR_NUMBER == 1
char pair_str[16]=”[1]”;
#endif
#if BYPASS_PAIR_NUMBER == 2
char pair_str[16]=”[1|2]”;
#endif