【发布时间】:2014-10-21 18:29:30
【问题描述】:
我想控制 Jetway Atom PC JBC373F38 (http://www.jetwaycomputer.com/JBC373F38.html) 上的 GPIO。我发现那台 PC 上的 GPIO 是超级 IO 芯片 Fintek F71869A 的一部分(GPIO3)。我编写了一个小代码来使用 0x2E/0x2F 端口在 Linux 上控制这些 GPIO 引脚,但它不起作用。可能有人有这个问题的工作示例,或者告诉我我的代码中的错误是什么。这是我的代码:
#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
【问题讨论】:
标签: embedded-linux gpio