Date: Mon, 27 May 2019 18:17:45 +0300 From: Andriy Gapon <avg@FreeBSD.org> To: FreeBSD Hackers <freebsd-hackers@FreeBSD.org> Subject: gpio interrupt on x86 Message-ID: <2c99a77c-a423-c2ea-1b2c-b2eefbae13c1@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
I would like to run some code when an input pin changes its state. A GPIO controller that handles that pin is capable of generating an interrupt. I can configure the type of a signal change that would trigger the interrupt. The GPIO controller would generate the interrupt on that change. I would be able to query the controller for a specific pin (if interrupts for multiple pins are enabled). All is good. Now, the question is how to _properly_ hook my code to the gpiobus hanging off the controller. I see that embedded (or not so embedded) platforms typically define a "slave" interrupt controller. I guess that it defines a new interrupt number (and interrupt source, etc) for each interrupt capable pin. And then hooking to that pin is a matter of just installing an interrupt handler for a specific interrupt and enabling it. But I am not sure if the same approach would work on x86. Is there any other alternative approach? Perhaps even a more light-weight one? Any code examples? Thank you. -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2c99a77c-a423-c2ea-1b2c-b2eefbae13c1>