FreeBSD already has support for interrupts implemented in the GPIO controller drivers of several SoCs, but there are no interfaces to take advantage of them out of user space yet. The goal of this work is to implement such an interface by providing descriptors which integrate with the common I/O system calls and multiplexing mechanisms.
This is an import of the Google Summer of Code 2018 project completed by Christian Krämer (and, sadly, ignored by us for two years now).
The initial imported code supports the following functionality:
- A kernel driver that provides an interface to the user space; the existing gpioc(4) driver was enhanced with this functionality.
- Implement support for the most common I/O system calls / multiplexing mechanisms.
- read() Places the pin number on which the interrupt occurred in the buffer. Blocking and non-blocking behaviour supported.
- signal driven I/O. Posting SIGIO when the O_ASYNC was set.
- Many-to-many relationship between pins and file descriptors.
- A file descriptor can monitor several GPIO pins.
- A GPIO pin can be monitored by multiple file descriptors.
- Integration with gpioctl and libgpio.