Page | 108
IOCTL Code
Descriptions
IOCTL_GPIO_SETBIT
The GPIO pin will be set as 1
IOCTL_GPIO_CLRBIT
The GPIO pin will be cleared
IOCTL_GPIO_GETBIT
Read the GPIO pin status
IOCTL_GPIO_SETMODE
Set the working mode of the GPIO pin
IOCTL_GPIO_GETMODE
Read the working mode of the GPIO pin
IOCTL_GPIO_GETIRQ
Read the corresponding IRQ number of the
GPIO pin
The tables below contain examples of GPIO applications;
1.
Enable the GPIO device;
HANDLE
hFile
=
CreateFile(_T("GIO1:"),
(GENERIC_READ|GENERIC_WRITE),
(FILE_SHARE_READ|FILE_SHARE_WRITE), 0, OPEN_EXISTING, 0, 0);
2.
Set the working mode as reading GPIO;
DWORD id = 0, mode = 0;
3.
Set the working mode of the GPIO;
DWORD pInBuffer[2];
pInBuffer[0] = id;
pInBuffer[1] = mode;
DeviceIoControl(hFile,
IOCTL_GPIO_SETMODE,
pInBuffer,
sizeof(pInBuffer), NULL, 0, NULL, NULL);
4.
Read the working mode of the GPIO;
DeviceIoControl(hFile,
IOCTL_GPIO_GETMODE,
&id,
sizeof(DWORD), &mode, sizeof(DWORD), NULL, NULL);
Summary of Contents for SBC8140
Page 1: ...SBC8140 Single Board Computer User Manual Version 1 1 22nd Jan 2014...
Page 12: ...Page 6 1 4 Interfaces on the SBC8140 Figure 4 SBC8140 Interfaces...
Page 13: ...Page 7 1 5 System Block Diagram Figure 5 SBC8140 system block diagram...
Page 15: ...Page 9 1 6 2 Expansion Board Figure 8 Expansion board dimensions...
Page 128: ...Page 122...
Page 131: ...Page 125...
Page 139: ...Page 133 Appendix 5 FAQ Please visit http www elinux org SBC8600_FAQ...