System Installation
96M4321o User’s Manual
3-12
unsigned char Get_CFG(unsigned char Addr)
{
unsigned char d;
outportb(Superio_Addr, Addr);
delay(2);
d = inportb(Super1);
#ifdef DEBUG
printf("\nGet data %x from CR%x",d,Addr);
#endif /*DEBUG*/
delay(2);
return(d);
}
int main(void)
{
unsigned char d;
printf("\nROBO-8717 GPIO TEST Program R1.0");
enter_Superio_CFG();
/* CR29 B0 = 0 selet GPIO Port 1*/
d = Get_CFG(0x29);
d = d | 0x01;
Set_CFG(0x29, d);
/* IO test loop 1 */
/* Set GPIO Port 1 Enable */
Set_CFG(0x07, 0x07); /* Select logic device 07*/
Set_CFG(0x30, 0x01); /* Enable GPIO Port 1 */
Set_CFG(0xF2, 0x00);
Set_CFG(0xF3, 0x00);
Set_CFG(0xF0, 0xF0); /* GPIO Port 1 B7-4 is input, B3-0 is output */
Set_CFG(0x07, 0x07); /* Select logic device 07*/
Set_CFG(0xF1, 0x0e); /* GP10 -> ~GP14 */
d = Get_CFG(0xF1);
/* get GPIO Port 1 data */
d = d & 0xF0;
if (d != 0xe0 )
{
printf("\nGP10 -> GP14 test fail !!!\n\n");
Set_CFG(0xF0, 0xff); /* GPIO Port 1 is input */
exit(1);
}