Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

.\" $NetBSD: gpioirq.4,v 1.2 2018/05/20 12:08:46 wiz Exp $
.\"
.\" Copyright (c) 2016 Brad Spencer <brad@anduin.eldar.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd May 11, 2018
.Dt GPIOIRQ 4
.Os
.Sh NAME
.Nm gpioirq
.Nd Install an interrupt handler on a GPIO pin
.Sh SYNOPSIS
.Cd "gpioirq* at gpio? offset 0 mask 0x1 flag 0x00"
.Sh DESCRIPTION
The
.Nm
driver attaches an interrupt handler to a single GPIO pin.
.Pp
The pin number is specified in the kernel configuration file with the
.Ar offset
locator.
The
.Ar mask
locator should always be 0x1.
.Pp
The
.Ar flag
locator specifies the interrupt mode to use:
.Bl -tag -width "XXXXXXXX"
.It Dv 0x01
Interrupt on the positive
.Pq rising
edge of the pin.
.It Dv 0x02
Interrupt on the negative
.Pq falling
edge of the pin.
.It Dv 0x04
Interrupt on both edges of the pin.
.It Dv 0x08
Assert the intrerrupt as long as the pin is high.
.It Dv 0x10
Assert the interrupt as long as the pin is low.
.El
.Pp
Note that the interrupts modes are mutually-exclusive, and exactly one
interrupt mode must be specified.
These flags correspond to the
.Dv GPIO_INTR
mode bits defined in
.Pa sys/gpio.h .
In addition to the interrupt mode, setting
.Dv 0x1000
in
.Ar flags
will enable the printing of a message to the console whenever the
interrupt handler is called.
.Pp
The
.Ar offset ,
.Ar mask ,
and
.Ar flag
locators can also be specified when
.Nm
is attached at runtime using the
.Dv GPIOATTACH
.Xr ioctl 2
on the
.Xr gpio 4
device.
.Sh SEE ALSO
.Xr gpio 4 ,
.Xr drvctl 8 ,
.Xr gpioctl 8
.Sh HISTORY
The
.Nm
driver first appeared in
.Nx 9.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
.An Brad Spencer Aq Mt brad@anduin.eldar.org .