Reputation: 1
I want to control the GPIO on the Jetway Atom PC JBC373F38 (http://www.jetwaycomputer.com/JBC373F38.html). I have found that the GPIO on that PC is part (GPIO3) of the super IO chip Fintek F71869A. I has make a small code to control these GPIO pin on Linux using 0x2E/0x2F ports but it does not work. May any one have working example for this problem or tell me what is my mistake in my code. This is my code:
#define AddrPort 0x2E
#define DataPort 0x2F
#define WriteByte(port, val) outb(val, port)
#define ReadByte(port) inb(port)
#define PORT_INDEX 0xC0
#define PORT_DATA 0xC1
//Enable
WriteByte(AddrPort, 0x87);
WriteByte(AddrPort, 0x87); //Must write twice to entering Extended mode
//< Select Logic Device >
WriteByte(AddrPort, 0x07); // Enter selecting mode
WriteByte(DataPort, 0x06); // Select logic device 06h: GPIO
//<Output Mode Selection> //Set GP30-37 to output Mode
WriteByte(AddrPort, PORT_INDEX); // Select configuration register C0h
WriteByte(DataPort, 0xFF);
//<Output Value>
WriteByte(AddrPort, PORT_DATA); // Select configuration register C1h
WriteByte(DataPort, 0xFF); //Set all bits HIGH
Upvotes: 0
Views: 2345
Reputation: 11
You are enabling configuration by writing the 0x87
twice, but are you disabling the configuration mode by sending WriteByte(AddrPort, 0xAA);
when you are done.
Your AddrPort and DataPort appear incorrect as well; they should be 0x4E and 0x4F.
See Section 6 of this documentation.
It states:
Following is a example to enable configuration and disable configuration by using debug.
-o 4e 87 -o 4e 87 (enable configuration) -o 4e aa (disable configuration)
Upvotes: 1