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

26
Programming Watchdog Timer
Embedded and Industrial Computing
Appendix A
write_w83627_reg(0x08, 0x30, tmp);
/* active GPIO2 group */
tmp=read_w83627_reg(0x09, 0x30);
tmp |= 2;
write_w83627_reg(0x09, 0x30, tmp);
/* Set GPIO22, 23, 24 and 27 to output mode */
tmp=read_w83627_reg(0x09, 0xe4);
tmp
&=
~(SIO_GPIO_22_BIT+SIO_GPIO_23_
BIT+SIO_GPIO_24_BIT+SIO_GPIO_27_BIT) ;
write_w83627_reg(0x09, 0xe4, tmp);
/* active GPIO3 group */
tmp=read_w83627_reg(0x07, 0x30);
tmp |= 1;
write_w83627_reg(0x07, 0x30, tmp);
/* Set GPIO30 and 31 to output mode */
tmp=read_w83627_reg(0x07, 0xe0);
tmp &= ~(SIO_GPIO_30_BIT + SIO_GPIO_31_BIT) ;
write_w83627_reg(0x07, 0xe0, tmp);
/* active GPIO6 group */
tmp=read_w83627_reg(0x08, 0x30);
tmp |= 0x4;
write_w83627_reg(0x08, 0x30, tmp);
/* Set GPIO60 to output mode */
tmp=read_w83627_reg(0x08, 0xe4);
tmp &= ~(SIO_GPIO_60_BIT) ;
write_w83627_reg(0x08, 0xe4, tmp);
return ret;
}
void set_bypass_enable_when_system_off(unsigned long
pair_no)
{
int reg_no, ldn_no;
unsigned char bit_mask;
unsigned char en_data;
unsigned char tmp;
reg_no=ldn_no=bit_mask=en_data=tmp=0;
switch(pair_no) {
case BYPASS_PAIR_1:
ldn_no = OFFMODE_BYPASS_
PAIR1_LDN;
reg_no = OFFMODE_BYPASS_
PAIR1_REG;
bit_mask = OFFMODE_BYPASS_
PAIR1_BIT;
en_data = OFFMODE_BYPASS_
PAIR1_ENABLE;
break;
case BYPASS_PAIR_2:
ldn_no = OFFMODE_BYPASS_
PAIR2_LDN;
reg_no = OFFMODE_BYPASS_
PAIR2_REG;
bit_mask = OFFMODE_BYPASS_
PAIR2_BIT;
en_data = OFFMODE_BYPASS_
PAIR2_ENABLE;
break;
default:
/*un-support pair no, return */
return;
}
tmp=read_w83627_reg(ldn_no, reg_no);
tmp &= ~(bit_mask) ;
tmp |= en_data;
write_w83627_reg(ldn_no, reg_no, tmp);
return;
}