Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gpioow(4) [netbsd man page]

GPIOOW(4)						   BSD Kernel Interfaces Manual 						 GPIOOW(4)

NAME
gpioow -- 1-Wire bus bit-banging through GPIO pin SYNOPSIS
gpioow* at gpio? offset 0 mask 0x1 gpioow* at gpio? onewire* at gpioow? DESCRIPTION
The gpioow driver allows bit-banging a 1-Wire bus as a master using one GPIO pin. The pin is used as a data signal. The GPIO pin must be able to drive an output and read an input. The pin number is specified in the kernel configuration with the offset locator. The mask locator should always be 0x1. The offset and mask can also be specified when gpioow is attached at runtime using the GPIOATTACH ioctl(2) on the gpio(4) device. SEE ALSO
gpio(4), intro(4), onewire(4) HISTORY
The gpioow driver first appeared in OpenBSD 4.0 and NetBSD 4.0. AUTHORS
The gpioow driver was written by Alexander Yurchenko <grange@openbsd.org> and was ported to NetBSD by Jeff Rizzo <riz@NetBSD.org>. BSD
July 19, 2009 BSD

Check Out this Related Man Page

GPIO(4) 						   BSD Kernel Interfaces Manual 						   GPIO(4)

NAME
gpio -- General Purpose Input/Output SYNOPSIS
gpio* at elansc? gpio* at epgpio? gpio* at gcscpcib? gpio* at gpiosim? gpio* at gscpcib? gpio* at ichlpcib? gpio* at nsclpcsio? gpio* at ppbus? #include <sys/types.h> #include <sys/gpio.h> #include <sys/ioctl.h> DESCRIPTION
The gpio device attaches to the GPIO controller and provides a uniform programming interface to its pins. Each GPIO controller with an attached gpio device has an associated device file under the /dev directory, e.g. /dev/gpio0. Access from user- land is performed through ioctl(2) calls on these devices. Whether the layout of the GPIO device can be configured is subject to authorization by the kauth(9) framework. If for example secmodel_securelevel(9) is active, the layout of the GPIO device is defined at a securelevel less than 1, i.e. typically dur- ing system boot, and cannot be changed later. GPIO pins can be configured and given a symbolic name and device drivers that use GPIO pins can be attached to the gpio device at a securelevel less than 1. All other pins will not be accessible once the runlevel has been raised. IOCTL INTERFACE
The following structures and constants are defined in the <sys/gpio.h> header file: GPIOINFO (struct gpio_info) Returns information about the GPIO controller in the gpio_info structure: struct gpio_info { int gpio_npins; /* total number of pins available */ }; GPIOREAD (struct gpio_req) Returns the input pin value in the gpio_pin_op structure: #define GPIOMAXNAME 64 struct gpio_req { char gp_name[GPIOMAXNAME]; /* pin name */ int gp_pin; /* pin number */ int gp_value; /* value */ }; The gp_name or gp_pin field must be set before calling. GPIOWRITE (struct gpio_req) Writes the output value to the pin. The value set in the gp_value field must be either GPIO_PIN_LOW (logical 0) or GPIO_PIN_HIGH (log- ical 1). On return, the gp_value field contains the old pin state. GPIOTOGGLE (struct gpio_req) Toggles the pin output value, i.e. changes it to the opposite. gp_value field is ignored and on return contains the old pin state. GPIOSET (struct gpio_set) Changes pin configuration flags with the new ones provided in the gpio_set structure: #define GPIOMAXNAME 64 struct gpio_set { char gp_name[GPIOMAXNAME]; /* pin name */ int gp_pin; /* pin number */ int gp_caps; /* pin capabilities (ro) */ int gp_flags; /* pin configuration flags */ char gp_name2[GPIOMAXNAME]; /* new name */ }; The gp_flags field is a combination of the following flags: GPIO_PIN_INPUT input direction GPIO_PIN_OUTPUT output direction GPIO_PIN_INOUT bi-directional GPIO_PIN_OPENDRAIN open-drain output GPIO_PIN_PUSHPULL push-pull output GPIO_PIN_TRISTATE output disabled GPIO_PIN_PULLUP internal pull-up enabled GPIO_PIN_PULLDOWN internal pull-down enabled GPIO_PIN_INVIN invert input GPIO_PIN_INVOUT invert output GPIO_PIN_PULSATE pulsate output Note that the GPIO controller may not support all of these flags. On return the gp_caps field contains flags that are supported. If no flags are specified, the pin configuration stays unchanged. Only GPIO pins that have been set using GPIOSET will be accessible at securelevels greater than 0. GPIOUNSET (struct gpio_set) Unset the specified pin, i.e. clear its name and make it unaccessible at securelevels greater than 0. GPIOATTACH (struct gpio_attach) Attach the device described in the gpio_attach structure on this gpio device. struct gpio_attach { char ga_dvname[16]; /* device name */ int ga_offset; /* pin number */ uint32_t ga_mask; /* binary mask */ uint32_t ga_flags; /* driver dependent */ }; The drvctl(8) command can be used to detach a device from a gpio pin. FILES
/dev/gpiou GPIO device unit u file. SEE ALSO
ioctl(2), drvctl(8), gpioctl(8) HISTORY
The gpio device first appeared in OpenBSD 3.6 and NetBSD 4.0. AUTHORS
The gpio driver was written by Alexander Yurchenko <grange@openbsd.org>. gpio and was ported to NetBSD by Jared D. McNeill <jmcneill@NetBSD.org>. Runtime device attachment was added by Marc Balmer <marc@msys.ch>. BUGS
Event capabilities are not supported. BSD
November 13, 2011 BSD
Man Page