System Installation
WADE-8044 User’s Manual
3-8
Initial SuperIO W_GP20 ,W_GP21
void SetPort2(int Mode, unsigned char Data)
{
unsigned char TempData;
/* Enter to Extension Mode */
outportb(IOADDRESS, 0x87);
outportb(IOADDRESS, 0x87);
/* Set GP20, GP21 as GPIO */
outportb(IOADDRESS, 0x29);
TempData = (inportb(IODATA) | 0x02);
outportb(IODATA, TempData);
/* Select Logical Device 9 */
outportb(IOADDRESS, 0x07);
outportb(IODATA, 0x09);
/* Set CR30[0]:1
Port 2 active */
outportb(IOADDRESS, 0x30);
TempData = (inportb(IODATA) | 0x03);
outportb(IODATA, TempData);
/* Set CRE3[0:1] : 00
Set GP20 as output , GP21 as input pin */
outportb(IOADDRESS, 0xE3);
switch(Mode)
{
case 0: /* GP20, GP21 AS Output*/
TempData = (inportb(IODATA) & ~(0x03));
break;
case 1: /* GP20 As Input, GP21 As Output */
TempData = (inportb(IODATA) | 0x03);
break;
}
outportb(IODATA, TempData);
outportb(IOADDRESS,0xE2);
outportb(IODATA,0x00); /* not inverse */
/* Exit Extension Mode */
outportb(IOADDRESS, 0xAA);
}