本文介绍了Fintek F71869A GPIO控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想控制Jetway Atom PC JBC373F38上的GPIO()。我发现该PC上的GPIO是超级IO芯片Fintek F71869A的一部分(GPIO3)。我已经编写了一个小代码来使用0x2E / 0x2F端口在Linux上控制这些GPIO引脚,但是它不起作用。可以让任何人有解决此问题的示例,或者告诉我代码中的错误是什么。这是我的代码:

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


推荐答案

您可以通过以下方式启用配置两次编写 0x87 ,但是您是否通过发送 WriteByte(AddrPort,0xAA); 来禁用配置模式

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.

您的AddrPort和DataPort也显示为错误;它们应该是0x4E和0x4F。

Your AddrPort and DataPort appear incorrect as well; they should be 0x4E and 0x4F.

请参见。

它指出:

-o 4e 87
-o 4e 87 (enable configuration)
-o 4e aa (disable configuration)


这篇关于Fintek F71869A GPIO控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 08:36