GPIOIRQ(4)

GPIOIRQ(4) | Device Drivers Manual | GPIOIRQ(4)

# NAME

`gpioirq` —
Install an interrupt handler on a GPIO pin

# SYNOPSIS

`gpioirq* at gpio? offset 0 mask 0x1 flag 0x00`

# DESCRIPTION

The `gpioirq` driver attaches an interrupt handler to a single GPIO pin.

The pin number is specified in the kernel configuration file with the offset locator. The mask locator should always be 0x1.

The flag locator specifies the interrupt mode to use:

`0x01`
  Interrupt on the positive (rising) edge of the pin.
`0x02`
  Interrupt on the negative (falling) edge of the pin.
`0x04`
  Interrupt on both edges of the pin.
`0x08`
  Assert the intrerrupt as long as the pin is high.
`0x10`
  Assert the interrupt as long as the pin is low.

Note that the interrupts modes are mutually-exclusive, and exactly one interrupt mode must be specified. These flags correspond to the `GPIO_INTR` mode bits defined in sys/gpio.h. In addition to the interrupt mode, setting `0x1000` in flags will enable the printing of a message to the console whenever the interrupt handler is called.

The offset, mask, and flag locators can also be specified when `gpioirq` is attached at runtime using the `GPIOATTACH` ioctl(2) on the gpio(4) device.

# SEE ALSO

gpio(4), drvctl(8), gpioctl(8)

# HISTORY

The `gpioirq` driver first appeared in NetBSD 9.0.

# AUTHORS

The `gpioirq` driver was written by Brad Spencer <brad@anduin.eldar.org>.

May 11, 2018 | NetBSD 9.4