gpioctl(8) - NetBSD Manual Pages

Command: Section: Arch: Collection:  
GPIOCTL(8)              NetBSD System Manager's Manual              GPIOCTL(8)


NAME
gpioctl -- control GPIO devices
SYNOPSIS
gpioctl [-hq] [-d device] [pin] [0 | 1 | 2] gpioctl [-hq] [-d device] -c pin [flags]
DESCRIPTION
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 thermal 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 logi- cal 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 framework: 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 pd internal pull-down enabled iin invert input iout invert output Note that not all the flags can be supported by the particular GPIO con- troller. 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. The -q option causes gpioctl to operate quietly i.e. nothing is printed to stdout. The -h option displays a usage summary.
FILES
/dev/gpiou GPIO device unit u file.
EXAMPLES
Configure pin 20 to have push-pull output: # gpioctl -c 20 out pp Write logical 1 to pin 20: # gpioctl 20 1
SEE ALSO
elansc(4), gcscpcib(4), gpio(4), gscpcib(4), nsclpcsio(4)
HISTORY
The gpioctl command first appeared in OpenBSD 3.6 and NetBSD 4.0.
AUTHORS
The gpioctl program was written by Alexander Yurchenko <grange@openbsd.org>. NetBSD 5.0 January 9, 2008 NetBSD 5.0
Powered by man-cgi (2020-09-24). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.