RTEMS | dev/gpio: A generic GPIO API as a device node and ioctl (!1499)

Christian Mauderer (@c-mauderer) gitlab at rtems.org
Wed Sep 23 05:46:56 UTC 2026



Merge request https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1499 was reviewed by Christian Mauderer

--
  
Christian Mauderer commented on a discussion on cpukit/include/dev/gpio/gpio.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1499#note_159813

 > +   */
 > +  RTEMS_GPIO_DIRECTION_OUTPUT
 > +} rtems_gpio_direction;

Two values would make it possible to distinguish between not yet initialized pins and pins explicitly set to low power mode. But I haven't found a sensible use case for that yet.

--
  
Christian Mauderer commented on a discussion on cpukit/include/dev/gpio/gpio.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1499#note_159814

 > + * @retval -1 An error occurred.  The errno is set to indicate the error.
 > + */
 > +int rtems_gpio_pin_irq_enable(int fd, uint32_t pin,

An interrupt API is quite useful for GPIO pins if you ask me. It makes it simpler to have drivers for peripherals which are either directly connected to a normal interrupt or to some GPIO construction. For slow GPIOs (connected via I2C or SPI), it would most likely be a call that is executed from within an interrupt server.

It would be even simpler if the interrupts would use the default RTEMS interrupt API. That would be a model that is more similar to Linux or FreeBSD where most interrupt capable GPIO controllers are also interrupt controllers. For example the controller in the Beagle has a device tree binding for that:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/gpio/ti,omap-gpio.yaml#n37

But I think it's a bit tricky to add additional interrupt controllers (maybe even dynamically) to our interrupt API. Therefore, I would just go for a similar but separate API in the GPIO drivers.


-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1499
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/49/sent_notifications/5-27lkbu3rwm2p57frl90q72tcg-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260923/8112072f/attachment.htm>


More information about the bugs mailing list