Programming Gpio Signals - Lippert 702-0008-10 Technical Manual

Cool literunner pc/104 cpu board
Table of Contents

Advertisement

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
//**************************************************************
// InitGPIO: initialize GPIO Bank #3
// Parameter: mode: bit=1 -> set to GPIO
//
//
// 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);
outb(7, CONF_DATA);
// 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);
outb(mode, CONF_DATA);
// Define the GPIO's data direction
// Input: dir – each set bit represents an output
outb(0xCA, CONF_ADDR);
outb(dir, CONF_DATA);
outb(0xBA, CONF_ADDR);
outb(dir, CONF_DATA);
}
int main()
{
char value1=0x55,value2;
iopl(3);
InitGPIO(0xff,0xff);
outb(value1, GPIO_ADDR);
printf("Write=%x", value1);
value2 = inb(GPIO_ADDR);
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.
TME-104-CLR-LX800-R1V3.doc
//port address
dir:
bit=1/0 -> set to output/input
(char = 8 bit)
//Set to logic device
//Number of logic device
// set bank #3 to GPIO
// BIT: 1=GPIO , 0=other function
// set direction: output/input
// BIT: 1=output, 0=input
// enable pull-ups if acting as output
// BIT: 1=pull up, 0=no pull up
//8 bit values
//get all I/O rights
//Initialize GPIO:
//set all to GPIO and all to output
//write out value1
//read in value2
Rev. 1.3
44(53)

Advertisement

Table of Contents
loading

This manual is also suitable for:

802-0008-10Clr-lx800902-0008-10

Table of Contents