*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> i386/gpioctl (8)              



NAME    [Toc]    [Back]

     gpioctl - control GPIO devices

SYNOPSIS    [Toc]    [Back]

     gpioctl [-hq] [-d device] [pin] [0 | 1 | 2]
     gpioctl [-hq] [-d device] -c pin [flags]

DESCRIPTION    [Toc]    [Back]

     The gpioctl program allows  manipulation  of  GPIO  (General
Purpose Input/Output)
 device pins.  Such devices can be either part of
the chipset
     or embedded CPU, or a separate chip.  The usual way of using
GPIO is to
     connect some simple devices such as LEDs, 1-wire termal sensors, etc., to
     its pins.

     Each GPIO device has an associated device file in  the  /dev
directory.  By
     default  gpioctl  uses  /dev/gpio0, which corresponds to the
first found
     GPIO device in the system.  If more than one GPIO device  is
present, an
     alternative  device file can be specified with the -d option
in order to
     access a particular GPIO device.

     When executed without any arguments, gpioctl reads  information about the
     GPIO device and displays it.

     GPIO  pins  can  be  either ``read'' or ``written'' with the
values of logical
 0 or 1.  If only a pin number is specified on  the  command line, the
     pin  state  will  be  read from the GPIO controller and displayed.  To write
     to a pin, a value must be specified after  the  pin  number.
Values can be
     either  0  or  1.   A  value  of 2 has a special meaning: it
``toggles'' the
     pin, i.e. changes its state to the opposite.

     Each pin can be configured with different flags with the  -c
option.  The
     following  configuration  flags  are  supported  by the GPIO

           in       input direction
           out      output direction
           inout    bi-directional
           od       open-drain output
           pp       push-pull output
           tri      tri-state (output disabled)
           pu       internal pull-up enabled

     Note that not all the flags can be supported by the particular GPIO controller.
   The  list  of supported flags is always displayed
when executing
     gpioctl with the -c option.  If only a pin number is  specified on the
     command  line,  the current pin flags will be displayed.  To
change pin
     flags, a new flags set separated by spaces must be specified
after the
     pin number.

FILES    [Toc]    [Back]

     /dev/gpiou  GPIO device unit u file.

EXAMPLES    [Toc]    [Back]

     Configure pin 20 to have push-pull output:

           # gpioctl -c 20 out pp

     Write logical 1 to pin 20:

           # gpioctl 20 1

SEE ALSO    [Toc]    [Back]

     gpio(4), gscpcib(4), nsclpcsio(4)

HISTORY    [Toc]    [Back]

     The gpioctl command first appeared in OpenBSD 3.6.

AUTHORS    [Toc]    [Back]

     The gpioctl program was written by Alexander Yurchenko

OpenBSD      3.6                            May      3,      2004
[ Back ]
 Similar pages
Name OS Title
ioctl Tru64 Control devices
losetup Linux set up and control loop devices
digictl FreeBSD control Digiboard devices
iopctl OpenBSD a program to control IOP devices
scsicontrol IRIX probe and control scsi devices
conscontrol FreeBSD control physical console devices
swapon FreeBSD control devices for interleaved paging/swapping
swapoff FreeBSD control devices for interleaved paging/swapping
hcsecd FreeBSD control link keys and PIN codes for Bluetooth devices
usbhidctl FreeBSD manipulate USB HID devices
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service