ADLINK Hurricane-QM57 User Manual
Page 73

TME-EPIC-HURQM-R2V9 Revision
2.9
Page 67 of 74
0 = output
1 = input
“inl 544” returns the current state and with “outl 544 ” you may change it.
Caution
Another time, avoid changing bits you are not interested in!
At GPIO Base Address + 0x48 you find the GPIO-read-write-register. This register is implemented as dual
read/write with dedicated storage each. A write value will be stored in the write register, while a read is coming
from the read register which will always reflect the value of the pin.
0 = low
1 = high
The pins 20:17 are handled in the same way as pins 16:13 except for the addresses to use.
Native/GPIO-Register: GPIO Base Address + 0x00
Input/Output-Register: GPIO Base Address + 0x04
Read/Write-Register: GPIO Base Address + 0x0C
And there is a second difference. The corresponding bits are spread as shown below, rather than be sequential
as the bits for pin 16:13.
This bit-pattern is the same for all three registers.
Linux
Of course GPIO programming in Linux is in principle identical to Windows, only the used tools and commands
differ.
The ‘setpci’ command line tool (from the pciutils package) provides direct PCI config register access. As root:
# setpci -s0:1F.0 48.w
# read base addr (ignore bit 0)
# setpci -s0:1F.0 4C.b=10
# enable GPIO port
The GPIO registers can then be read/written with a simple C program, as shown in this crude sample: