freebsd-skq/tools/test
Ian Lepore ff3468ac94 Provide userland notification of gpio pin changes ("userland gpio interrupts").
This is an import of the Google Summer of Code 2018 project completed by
Christian Kramer (and, sadly, ignored by us for two years now).  The goals
stated for that project were:

    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.

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.
     -	poll()/select()
     -	kqueue()
     -	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.

I added some fixes (mostly to locking) and feature enhancements on top of
the original gsoc code.  The feature ehancements allow the user to choose
between detailed and summary event reporting.  Detailed reporting provides
a record describing each pin change event.  Summary reporting provides the
time of the first and last change of each pin, and a count of how many times
it changed state since the last read(2) call.  Another enhancement allows
the recording of multiple state change events on multiple pins between each
call to read(2) (the original code would track only a single event at a time).

The phabricator review for these changes timed out without approval, but I
cite it below anyway, because the review contains a series of diffs that
show how I evolved the code from its original state in Christian's github
repo for the gsoc project to what is being commited here.  (In effect,
the phab review extends the VC history back to the original code.)

Submitted by:	Christian Kramer
Obtained from:	https://github.com/ckraemer/freebsd/tree/gsoc2018
Differential Revision:	https://reviews.freebsd.org/D27398
2020-12-12 18:34:15 +00:00
..
auxinfo Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
bsnmp
callout_free
devrandom
gpioevents Provide userland notification of gpio pin changes ("userland gpio interrupts"). 2020-12-12 18:34:15 +00:00
hwpmc
iconv Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
malloc Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
net Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
netfibs Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
popss
ppsapi
pthread_vfork
ptrace Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
sort
testfloat
upsdl
vm86
README Provide userland notification of gpio pin changes ("userland gpio interrupts"). 2020-12-12 18:34:15 +00:00

$FreeBSD$

This directory is for standalone test programs.  For the FreeBSD
Test Suite, which uses Kyua, please see /usr/src/tests/

A test program is one that exercises a particular bit of the system
and either tries to break it or measures its performance.

Please make a subdir per program, and add a brief description to this file.

auxinfo		Return information on page sizes, CPUs, and OS release date.
devrandom	Programs to test /dev/*random.
gpioevents	Test delivery of gpio pin-change events to userland.
hwpmc		Automatically trigger every event in hwpmc(4).
iconv		Character set conversion tests.
malloc		A program to test and benchmark malloc().
net		A set of generic test programs for networking.
netfibs		Programs to test multi-FIB network stacks.
posixshm	A program to test POSIX shared memory.
ppsapi		Test 1 Pulse Per Second (1PPS) input for time control.
pthread_vfork	Check that vfork and pthreads work together.
ptrace		Verify that ptrace works with syscalls, vfork etc.
sort		Tests for the sort command, including a full regression.
testfloat	Programs to test floating-point implementations
upsdl		Test of mmap functionality.