Example Code For Wdt - WinSystems SYS-ITX-N-3800 Product Manual

Industrial nano-itx embedded computer with intel atom e3800 processor
Table of Contents

Advertisement

v1.0

7.4.1 Example Code for WDT

The SYS-ITX-N-3800 features a programmable WDT. The following WDT
code example is written in C++. Use this example as a guide to program
the WDT.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <dos.h>
#define EC_DATA
#define EC_CMD
#define EC_CMD_READ 0x80
#define EC_CMD_WRITE 0x81
#define WDT_MODE
#define WDT_MIN
#define WDT_SEC
// Use port 62 and port 66 to access EC command / data.
static int IBF_Check()
{
unsigned char IBF_status;
do
{
pw_udelay (20);
IBF_status = inportb (EC_CMD);
} while (IBF_status & 0x02);
return 1;
}
static int OBF_Check ()
{
unsigned char OBF_status;
do
{
pw_udelay (20);
OBP_status = inportb (EC_CMD);
} while (!(OBF_status & 0x01));
return 1;
}
static void Write_EC (unsigned char index, unsigned char data)
{
IBF_Check ();
outportb (EC_CMD, EC_CMD_WRITE);
IBF_Check ();
outportb (EC_DATA, index);
IBF_Check ();
outportb (EC_DATA, data);
}
www.winsystems.com
0x62
0x66
0x06
// WDT Select mode.
0x07
// Minute mode counter
0x08
// Second mode counter
// delay 20 us
// delay 20 us
SYS-ITX-N-3800/Setup
Page 11

Advertisement

Table of Contents
loading

Table of Contents