Appendix a, Programming watchdog timer – Lanner LEC-7105 User Manual

Page 28

Advertising
background image

28

Programming Watchdog Timer

Embedded and Industrial Computing

Appendix A

return;

}

void set_runtime_bypass_disable(unsigned long pair_no)
{

int reg_no, ldn_no;

unsigned char tmp, bit_mask, en_data;

reg_no=ldn_no=tmp=bit_mask=en_data=0;

switch(pair_no) {

case BYPASS_PAIR_1:

ldn_no = RUNTIME_BYPASS_PAIR1_LDN;

reg_no = RUNTIME_BYPASS_PAIR1_REG;

bit_mask = RUNTIME_BYPASS_PAIR1_BIT;

en_data = RUNTIME_BYPASS_PAIR1_

DISABLE;

break;

case BYPASS_PAIR_2:

ldn_no = RUNTIME_BYPASS_PAIR2_LDN;

reg_no = RUNTIME_BYPASS_PAIR2_REG;

bit_mask = RUNTIME_BYPASS_PAIR2_BIT;

en_data = RUNTIME_BYPASS_PAIR2_

DISABLE;

break;

}

tmp=read_w83627_reg(ldn_no, reg_no);

tmp &= ~(bit_mask) ;

tmp |= en_data;

write_w83627_reg(ldn_no, reg_no, tmp);

return;

}

void set_wdto_state_system_reset(void)
{

unsigned char tmp;

/* set GPIO27=1 for reset mode */

tmp=read_w83627_reg(0x9, 0xe5);

tmp |= SIO_GPIO_27_BIT;

write_w83627_reg(0x9, 0xe5, tmp);

return;

}

void set_wdto_state_system_bypass(void)
{

unsigned char tmp;

/* set GPIO27=0 for bypass mode */

tmp=read_w83627_reg(0x9, 0xe5);

tmp &= ~SIO_GPIO_27_BIT;

write_w83627_reg(0x9, 0xe5, tmp);

return;

}

#endif

int main (int argc, char* argv[])
{

try

{

int num = sizeof (id2fun) / sizeof (id2fun[0])

;

//Total function number

//No parameter. Print the help message

if (argc < 2)

RETMSG (-1, PARAMETER_HELP) ;

//Find and call the coresponding function

for (int i = 0 ; i < num ; i++)

if (stricmp (argv[1], id2fun[i].szID)

== 0)

return id2fun[i].function

Advertising