Sample code – ADLINK cPCI-6620 User Manual

Page 44

Advertising
background image

32

Drivers & Utilities

Sample Code

The sample program written in C shown below offers an interactive
way to test the Watchdog Timer under DOS.

#include<stdio.h>

#include<dos.h>

#define IT8783_ID1 0x87

#define IT8783_ID2 0x83

static unsigned int IT8783_ioPort = 0x2e;

//Check index port

void Enter_IT8783_Config(unsigned int flag)

{

if(flag) IT8783_ioPort = 0x4e;

switch(IT8783_ioPort)

{

case 0x2E: //Address port = 0x2E, enter

keys = 0x87, 0x01, 0x55, 0x55

outportb(0x2E, 0x87);

outportb(0x2E, 0x01);

outportb(0x2E, 0x55);

outportb(0x2E, 0x55);

break;

case 0x4E: //Address port = 0x4E, enter

keys = 0x87, 0x01, 0x55, 0xAA

outportb(0x4E, 0x87);

outportb(0x4E, 0x01);

outportb(0x4E, 0x55);

outportb(0x4E, 0xAA);

break;

default:

break;

}

}

//Exit index port

void Exit_IT8783_Config(unsigned int flag)

{

if(flag) IT8783_ioPort = 0x4e;

Advertising