Specifications
TME-104-CLR-LX800-R1V3.doc Rev. 1.3 44(53)
4.2 Programming GPIO Signals
The Cool LiteRunner-LX800 general purpose I/O signals (GPIO) are part of the ITE8712 SuperI/O.
They are located in Logical Device 7 of the Super I/O and can be programmed using in/out
statements on Index/Data registers 2Eh/2Fh. GPIO's 1x belong to GPIO set #1, GPIO's 2x to set #2
and so on, up to set #5. The following lines show an example how to program GPIO Bank 3, whose
signals are located on the SUPERVISORY connector.
The code is meant to be compiled using gcc under Linux.
#include <sys/io.h>
#include <stdio.h>
#define CONF_ADDR 0x2E
#define CONF_DATA 0x2F
#define GPIO_ADDR 0x1220 //port address
//**************************************************************
// InitGPIO: initialize GPIO Bank #3
// Parameter: mode: bit=1 -> set to GPIO
// dir: bit=1/0 -> set to output/input
// (char = 8 bit)
// Returns: -
//*************************************************************
void InitGPIO(char mode,char dir)
{
// To set the SuperI/O into configuration mode, the sequence
// 0x87, 0x01, 0x55, 0x55 must be written to the configuration address.
outb(0x87, CONF_ADDR);
outb(0x01, CONF_ADDR);
outb(0x55, CONF_ADDR);
outb(0x55, CONF_ADDR);
// Enable Logical Device 7 for programming by writing 07h to
// register 07h of the SuperI/O:
outb(7, CONF_ADDR); //Set to logic device
outb(7, CONF_DATA); //Number of logic device
// Set GPIO-Set 3 Multifunction Pin Selection Register 27 to GPIO function
// and enable the "simple I/O" function
// Input: mode – each set bit represents a GPIO function
outb(0x27, CONF_ADDR); // set bank #3 to GPIO
outb(mode, CONF_DATA); // BIT: 1=GPIO , 0=other function
// Define the GPIO's data direction
// Input: dir – each set bit represents an output
outb(0xCA, CONF_ADDR); // set direction: output/input
outb(dir, CONF_DATA); // BIT: 1=output, 0=input
outb(0xBA, CONF_ADDR); // enable pull-ups if acting as output
outb(dir, CONF_DATA); // BIT: 1=pull up, 0=no pull up
}
int main()
{
char value1=0x55,value2; //8 bit values
iopl(3); //get all I/O rights
InitGPIO(0xff,0xff); //Initialize GPIO:
//set all to GPIO and all to output
outb(value1, GPIO_ADDR); //write out value1
printf("Write=%x", value1);
value2 = inb(GPIO_ADDR); //read in value2
printf(", Read=%x\n", value2);
return 0;
}
For a more detailed description about programming the ITE8712 super I/O, please refer to chapter 8
of the datasheet.