shithub: 9ferno

ref: b502a62da2ec6058923db94f87ecc2d29db2fa77
dir: /man/3/gpio/

View raw version
.TH GPIO 3 SA1100
gpio \- access to GPIO registers
.B bind -a
.B #G
.B /dev
.B /dev/gpioclear
.B /dev/gpioctl
.B /dev/gpioedge
.B /dev/gpioset
.B /dev/gpiostatus
The GPIO interface
serves a one-level directory with five files
that give access to the GPIO registers in the SA1100.
See the SA1100 handbook for details of the function
of the various registers.
The control file
.B gpioctl
accepts commands to set individual bits in the edge detect
Each control message has three space-separated fields:
.I "reg pin value"
.I reg
is a single character
denoting a register,
.I pin
a bit within it, and
.I val
the value (0 or 1) for that bit.
Valid choices for
.I reg
.B d
.B r
.B f
.B a
For example, the control message
d 10 1
sets bit 10 (following the handbook's bit-numbering conventions) in the GPIO pin
direction register GPDR.
The read-only file
.B gpiostatus
shows the names and values (in hexadecimal) of all GPIO registers.
The remaining data files
allow bits to be read by
.B Sys->read
and set by
.B Sys->write
When read, each file returns the value of a given
register as a single 8 digit hexadecimal number:
.B gpioset
.B gpioclear
both give the value of the level register, GPLR;
.B gpioedge
gives the value of the edge dectect register, GEDR.
Each write request
should present a single number in textual form, which
is assumed to be hexadecimal by default.
The value is written to a GPIO register:
.B gpioset
corresponds to GPSR,
.B gpioclear
corresponds to GPCR, and
.B gpioedge
corresponds to GEDR.
.B /os/sa1100/devgpio.c