Answered by:
Access Processor GPIO pins from application directly without any client driver

Question
-
Dear Folks,
Processor: Skylake
OS: windows 10
Our aim is to access Processor GPIO pins and make it high/low.
To achieve this I have gone through the following and related links,
https://docs.microsoft.com/en-us/windows-hardware/drivers/gpio/gpio-driver-suppor t-overview
My Questions are as follows,
1. In windows is that possible to get/toggle the Processor GPIO pin access directly from application? (like inb/outb in linux)
2. Is it possible to get the HANDLE of the GPIO controller driver with out any KMDF driver in middle? ie. That is directly passing IOCTL_GPIO_READ_PINS/IOCTL_GPIO_WRITE_PINS to GPIO controller driver from user mode application.
If it is possible, please share the examples/samples.
Is there any other ways without using the peripheral client driver? We are totally blocked. Please suggest.
If I am posting to wrong forum, redirect me to the exact forum.
Regards,
Vignesh
- Moved by Sean LimingMVP Friday, May 12, 2017 2:32 PM GPIO question
Friday, May 12, 2017 1:20 PM
Answers
-
Hi All,
Thanks for all your support. We found the solution.
We have created a dummy device entry in the BIOS. We have exposed required GPIO pins in the CRS method.
GpioIo (Shared, PullDefault, 0, 0, , "",,, GDI3) {0}
We have received the gpio resources in the preparehardware callback of the peripheral device driver of the dummy device.
We were able to do the toggling in the gpio pins.
Thanks,
Vignesh
- Marked as answer by Sean LimingMVP Friday, January 26, 2018 3:27 PM
Monday, October 30, 2017 10:03 AM
All replies
-
With Windows 10 IoT Core, it is possible to access the GPIO ports. For Windows 10 Enterprise, I am not sure if the API has been extended to this skew. I am going to move the post to a hardware forum that could possible address the question.
Sean Liming - Book Author: Starter Guide Windows 10 IoT Enterprise - www.annabooks.com / www.seanliming.com
Friday, May 12, 2017 2:31 PM -
Hi Forum,
We have 4 com ports those can function in 3 modes [RS 232/422/485] . We can change ports to our desired mode by setting the corresponding processor GPIO pins to high/low. Our aim is to set the mode of the serial ports by toggling the processor gpio pins through an application without rebooting the machine.
In Windows
- GPIO I/O pins that are controlled by a GPIO controller driver are available to other drivers as system-managed hardware resources (GPIO I/O resources). That will be given to the peripheral driver as an abstract GPIO resources.- The Peripheral device drivers can be written to manipulate abstract GPIO I/O resources.
Refer this link : https://msdn.microsoft.com/library/windows/hardware/hh406474
- In our case peripheral device is Serial com. Already we have the driver for serial com ("Serenum.sys & Serial.sys" provided by Microsoft)
- So we would like to modify the IO pins, by passing IOCTL_GPIO_READ_PINS/IOCTL_GPIO_WRITE_PINS from the Microsoft Serial port drivers.
So that we can access those pins from application -> Microsoft serial driver -> GPIO Controller driver -> (GPIOClx->) Toggle GPIO pins
Please suggest us how to make changes in the Microsoft Serial com drivers for our need.
Thanks in Advance.
Regards,
Vignesh
Thursday, June 8, 2017 4:33 AM -
Additional inputs:
1. We should be able to dynamically configure the ports, and change from one mode to another without reboot.
2. Our platform is not IoT core. We are working on Windows 10.Please provide the link or update for the hardware forum.
Regards,
Vignesh
Thursday, June 8, 2017 5:31 AM -
It is not possible to open a handle to a GpioClx driver from usermode. Usermode access to GPIO pins is provided by the Windows.Devices.Gpio APIs.
But it sounds like you want to modify the source code of serial.sys so that serial.sys can write GPIO pins?
In that case you need to supply GpioIo resources to your serial driver, for example:
GpioIO(Exclusive, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPIO", 0, ResourceConsumer, , ) { 48 }
And then add code to serial.sys to toggle the pin. An example of accessing GPIO from a driver is here:
https://github.com/Microsoft/Windows-driver-samples/blob/master/gpio/samples/simdevice/simdevice.c
- Proposed as answer by Andre MarschalekMVP Wednesday, July 26, 2017 6:13 PM
Friday, June 9, 2017 4:56 PM -
Hi All,
Thanks for all your support. We found the solution.
We have created a dummy device entry in the BIOS. We have exposed required GPIO pins in the CRS method.
GpioIo (Shared, PullDefault, 0, 0, , "",,, GDI3) {0}
We have received the gpio resources in the preparehardware callback of the peripheral device driver of the dummy device.
We were able to do the toggling in the gpio pins.
Thanks,
Vignesh
- Marked as answer by Sean LimingMVP Friday, January 26, 2018 3:27 PM
Monday, October 30, 2017 10:03 AM -
How can I supply GpioIo resources to serial controller driver?
Can I achieve it using ACPI source code. or is there any other way to do it. I mean where else i can put the GPIO controller/pin index below information in the serial driver so that I can toggle it using Serial Controller driver.GpioIO(Exclusive, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GPIO", 0, ResourceConsumer, , ) { 48 }
I have tried it using ACPI source code. by adding code similar to above under UART controller in the ACPI source.
then compiled and put the ACPITABL.dat in windows\system32 folder and tried to establish the remoteIo target connection so that connection could be established using WdfIoTargetCreate and WdfIoTargetOpen methods as mentioned in "simdevice.c" but its showing error in WdfIoTargetOpen() method.. saying "STATUS_INVALID_PARAMETER".
Could you please help me with detail, like how can I toggle GPIO pins in the GPIO Controller from the UART controller driver.Wednesday, January 10, 2018 2:57 AM -
Last month I looked into this. RHProxy which has been available for IoT Core has been added to Windows 10 16299 Desktop release. To access the GPIO/UART/SPI/I2C from a UWP appplication, the firmware needs to have MSFT8000 for RHPROXY in the ACPI tables. More information in this paper: http://annabooks.com/Articles/Articles_IoT10Core/Windows-10-IoT-microIO-Requirements-on-IA-Rev1.6.pdf
Sean Liming - Book Author: Starter Guide Windows 10 IoT Enterprise - www.annabooks.com / www.seanliming.com
Monday, January 22, 2018 3:25 AM