Does exist a virtual GPIO driver to be used for a programming needs?
I have to develop a software on my Linux PC, and then try it on some embedded systems with physical GPIOs (C.H.I.P., OpenWRT, and so on...)?
Thank you!
Does exist a virtual GPIO driver to be used for a programming needs?
I have to develop a software on my Linux PC, and then try it on some embedded systems with physical GPIOs (C.H.I.P., OpenWRT, and so on...)?
Thank you!
The solution exists and is available since kernel 4.10 as GPIO mockup driver.
Some references for you:
At time of writing the current in-kernel option is the gpio-sim, which obsoletes the gpio-mockup module as of Linux 5.17.
gpio-sim supports creating, controlling and destroying gpiochips on the fly. The created gpiochips appear identical to those created by hardware drivers, and so can be used for testing userspace code without requiring any actual hardware. Testing can be performed in purely virtual environments.
There are several libraries available to drive gpio-sims, or to provide examples of how to drive it yourself via configfs and sysfs:
You can try this https://github.com/maquefel/virtual_gpio_basic also.
In such case gpios are indistinguishable from real hardware.
Also latest qemu versions have gpio support with interrupts.
© 2022 - 2024 — McMap. All rights reserved.