<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi everyone,<br>
<br>
I did not find any existing driver for the GPIO port of the Jetway
NF98 mini-itx board, so I would like to write a module for that,
using the gpiolib interface.<br>
<br>
Since the board documentation does not include any information about
the GPIOs, I contacted the Jetway support team. However, the only
answer was the attached code for Windows (NF98GPIO.c).<br>
As you can see, it seems clear how to set the pin states for output,
but not how to read them in input mode. I asked again and the
response was (literally):<br>
<blockquote type="cite">
<div><tt><font style="font-size: 10pt;" color="#193200">input
sample code:</font></tt></div>
<div><tt><font style="font-size: 10pt;" color="#193200">{</font></tt></div>
<div><tt><font style="font-size: 10pt;" color="#193200">data=
ISA_RW(GPIO_BASE[pin]+0x2,highlow<<pin,1,~(1<<pin));</font></tt></div>
<div><tt><font style="font-size: 10pt;" color="#193200">}</font></tt></div>
<div><tt><font style="font-size: 10pt;" color="#193200">//final
exit SIO</font></tt></div>
<div><tt><font style="font-size: 10pt;" color="#193200">outp(INDEX_PORT,0xaa);</font></tt></div>
<div><tt><font style="font-size: 10pt;" color="#193200">return
data;</font></tt></div>
</blockquote>
It makes no sense, and it is very upsetting.<br>
I would try to read from the same address used for output, but this
is just an idea to be tested.<br>
<br>
Since I have not written any kernel module before, after reading the
pertinent documentation about memory management, i/o port access,
and gpiolib, I have some questions.<br>
<br>
1. How should I request/release the ports mentioned in the attached
file? Should I use the request_region/release_region functions from
linux/ioport.h? In such case, what should I do with the returned
struct resource?<br>
<br>
2. I suppose that I should use the same addresses given by the
support team, although their code is for windows. Is it ok?<br>
<br>
3. Should/could I use the test_bit, set_bit, clear_bit functions to
get, set the bit in the needed read/write functions I am writing? Or
should I use the sequence 'inb - mask the value properly - outb' ?<br>
<br>
<br>
The second file attached is an skeleton of the module I am trying to
write, any comments or suggestions are welcome.<br>
<br>
Thanks in advance!<br>
<pre class="moz-signature" cols="72">--
Joan Pau Beltran
</pre>
</body>
</html>