beautypg.com

NEXCOM NDiS 127 User Manual

Page 66

background image

Copyright © 2012 NEXCOM International Co., Ltd. All Rights Reserved.

41

NDiS 127 User Manual

Appendix A: Watchdog Timer

outportb(INDEXP,reg);

outportb(DATAP,val); }

//1.Initialize Watchdog device

short SIOWTD_Setup(short irq)

{

//Start programming Watchdog

STARTPROG

//Activate the Watchdog Device

SELEDEV(7) //Select Logical device7

WRITEREG(0x30,0x01) //Activate the device

//end programming watchdog

ENDPROG

return 0;

}

//2.start Watchdog to count

short SIOWTD_Enable(short time,short unit)

/*unit=0:second,=1:minutes */

{

if(time<1 || time>255) return -1;

if(unit<0 || unit>1) return -1;

//start programming watchdog

STARTPROG

SELEDEV(7) //logical device 7

/ /lect Watchdog Timer clock

switch(unit)

{

case 0:

//BIT7=1,secondes;BIT6=1 enable,BIT6=0 disable

WRITEREG(0x72,0xC0)

break;

case 1:

//BIT7=0,minutes BIT6=1 enable,BIT6=0 disable

WRITEREG(0x72,0x40)

break;

default:

break;

}

WRITEREG(0x73,time) //t timeout value

//end programming watchdog

ENDPROG

return 0;

}