21
Programming Watchdog Timer
Embedded and Industrial Computing
Appendix F
}
printf(“\t\t Lanner Electronics Inc. 2010-01-06\n”);
printf(“\t\t Watchdog timer reset for VES-403\n\n”);
init_Pin_init();
time = atoi(argv[1]);
printf(“\t\t Setting WatchDog time out for System
Reset....\n”);
set_uhg_watchdog(time);
return 0;
}
int set_uhg_watchdog(int time)
{
int temp;
temp = time;
write_w83627uhg_reg(0x08, 0xf6, temp);
delay(10);
return 0;
}
init_Pin_init()
{
outportb(index_port, 0x87);
delay(10);
outportb(index_port, 0x87);
delay(10);
//w83627uhg not setting place
write_w83627uhg_
reg(0x8, 0x2b, read_w83627_reg(0x8, 0x2b) & 0xF3); //
rx2b[3-2]=01
//w83627uhg not setting place
write_w83627uhg_
reg(0x8, 0x2b, read_w83627_reg(0x8, 0x2b) | 0x04); //
rx2b[3-2]=01
write_w83627uhg_reg(0x08,
0x30,
read_
w83627uhg_reg(0x08, 0x30) | 0x01);
delay(10);
write_w83627uhg_reg(0x08, 0xf6, 0x00);
delay(10);
}
int write_w83627uhg_reg(int ldn, int reg, int value)
{
outportb(index_port,0x07);
delay(10);
outportb(data_port, ldn);
delay(10);
outportb(index_port, reg);
delay(10);
outportb(data_port, value);
delay(10);
return 0;
}
int read_w83627uhg_reg(int ldn, int reg)
{
outportb(index_port, 0x07);
delay(10);
outportb(data_port, ldn);
delay(10);
outportb(index_port, reg);
delay(10);
return inportb(data_port);
}