Go to: http://blog.sina.com.cn/s/blog_455851af0100ctr8.html
Recently, a gpio driver has been integrated in my spare time. Through application calling, the gpio driver can be called through the application program, and then LED lights on and off the hardware can be turned on and off. The entire process is recorded here for cainiao to learn.
I. Write the driver
1. copy the BSP package provided by the hardware vendor to D: \ wince500 \ platform, for example, smdk2440; in D: \ wince500 \ platform \ smdk2440 \ drivers creates a folder for storing the driver. Create the corresponding file. Here I name it flowled and the corresponding file names are:
Flowled. c
Flowled. h
Flowled. Def
Makefile sources
2. The code for the above file is as follows:
// The following code is flowled. C:
# Include
// # Include "ceddk. H"
# Include "s2440.h"
# Define io_ctl_led_detail on 0x01
# Define io_ctl_led_2_on 0x02
# Define io_ctl_led_3_on 0x03
# Define io_ctl_led_4_on 0x04
# Define io_ctl_led_all_on 0x05
# Define io_ctl_led_0000off 0x06
# Define io_ctl_led_2_off 0x07
# Define io_ctl_led_3_off 0x08
# Define IO_CTL_LED_4_OFF 0x09
# Define IO_CTL_LED_ALL_OFF 0x0a
BOOL mInitialized;
Volatile IOPreg * s2440IOP = (IOPreg *) IOP_BASE;
Void Virtual_Alloc ()
{
// GPIO Virtual alloc
S2440IOP = (volatile IOPreg *) VirtualAlloc (0, sizeof (IOPreg), MEM_RESERVE, PAGE_NOACCESS );
If (s2440IOP = NULL)
{
RETAILMSG (1, (TEXT ("For s2440IOP: VirtualAlloc faiLED! \ R \ n ")));
}
Else if (! VirtualCopy (PVOID) s2440IOP, (PVOID) (IOP_BASE), sizeof (IOPreg), PAGE_READWRITE | PAGE_NOCACHE ))
{
RETAILMSG (1, (TEXT ("For s2440IOP: VirtualCopy faiLED! \ R \ n ")));
}
Else
{
Retailmsg (1, (text ("For s2440iop: virtualalloc success! \ R \ n ")));
}
}
Bool ledgpioinit () // Why is gpfup not configured?
{
Retailmsg (1, (text ("led_gpio_setting ---- \ r \ n ")));
S2440iop-> rgpfcon = (s2440iop-> rgpfcon &~ (3 <8) | (1 <8); // gpf4 = output.
S2440iop-> rgpfcon = (s2440iop-> rgpfcon &~ (3 <10) | (1 <10); // gpf5 = output.
S2440iop-> rgpfcon = (s2440iop-> rgpfcon &~ (3 <12) | (1 <12); // gpf6 = output.
S2440iop-> rgpfcon = (s2440iop-> rgpfcon &~ (3 <14) | (1 <14); // gpf7 = output.
Return true;
}
Bool winapi dllentry (handle hinstdll, DWORD dwreason, lpvoid lpvreserved)
{
Switch (dwreason)
{Case DLL_PROCESS_ATTACH:
RETAILMSG (1, (TEXT ("LED: DLL_PROCESS_ATTACH. \ r \ n ")));
RETAILMSG (1, (TEXT ("Hello, this is my first driver! _ ^ _ \ R \ n ")));
// DisableThreadLibraryCallS (HMODULE) hInstDll );
Break;
Case DLL_PROCESS_DETACH: RETAILMSG (1, (TEXT ("LED: DLL_PROCESS_DETACH. \ r \ n ")));
Break;
}
Return (TRUE );
}
DWORD LED_Init (DWORD dwContext)
{
RETAILMSG (1, (TEXT ("LED_Init ---- \ r \ n ")));
// 1. Virtual Alloc
Virtual_Alloc ();
LEDGpioInit ();
MInitialized = TRUE; return TRUE;
}
BOOL LED_Deinit (DWORD hDeviceContext)
{
BOOL bRet = TRUE;
RETAILMSG (1, (TEXT ("USERLED: LED_Deinit \ r \ n ")));
Return TRUE;
}
DWORD LED_Open (DWORD hDeviceContext, DWORD AccessCode, DWORD reply Mode)
{
RETAILMSG (1, (TEXT ("USERLED: LED_Open \ r \ n ")));
Return TRUE;
}
BOOL LED_Close (DWORD hOpenContext)
{
S2440IOP-> rGPBDAT = s2440IOP-> rGPBDAT & (0xF <5 );
RETAILMSG (1, (TEXT ("USERLED: LED_Close \ r \ n ")));
Return TRUE;
}
BOOL LED_IOControl (DWORD hOpenContext, DWORD dwCode, PBYTE pBufIn, DWORD dwLenIn, PBYTE pBufOut, DWORD dwLenOut, PDWORD pdwActualOut)
{
Switch (dwCode)
{
Case IO_CTL_LED_1_ON: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT &~ (0x1 <4 );
Case IO_CTL_LED_2_ON: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT &~ (0x1 <5); break;
Case IO_CTL_LED_3_ON: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT &~ (0x1 <6); break;
Case IO_CTL_LED_4_ON: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT &~ (0x1 <7); break;
Case IO_CTL_LED_ALL_ON: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT &~ (0xF <4); break;
Case io_ctl_led_0000off: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT | (0x1 <4); break;
Case IO_CTL_LED_2_OFF: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT | (0x1 <5); break;
Case IO_CTL_LED_3_OFF: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT | (0x1 <6); break;
Case IO_CTL_LED_4_OFF: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT | (0x1 <7); break;
Case IO_CTL_LED_ALL_OFF: s2440IOP-> rGPFDAT = s2440IOP-> rGPFDAT | (0xF <4); break;
Default: break;
}
RETAILMSG (1, (TEXT ("LED: IOCTL code = 0x % x \ r \ n"), dwCode ));
RETAILMSG (1, (TEXT ("GPFDAT = 0x % x \ r \ n"), s2440IOP-> rGPFDAT ));
Return TRUE;
}
DWORD LED_Read (DWORD hOpenContext, LPVOID pBuffer, DWORD Count)
{
RETAILMSG (1, (TEXT ("USERLED: LED_Read \ r \ n ")));
Return TRUE;
}
DWORD LED_Write (DWORD hOpenContext, LPCVOID pSourceBytes, DWORD NumberOfBytes)
{
RETAILMSG (1, (TEXT ("USERLED: LED_Write \ r \ n ")));
Return 0;
}
DWORD LED_Seek (DWORD hOpenContext, long Amount, DWORD Type)
{
RETAILMSG (1, (TEXT ("USERLED: LED_Seek \ r \ n ")));
Return 0;
}
Void LED_PowerUp (DWORD hDeviceContext)
{
RETAILMSG (1, (TEXT ("USERLED: LED_PowerUp \ r \ n ")));
}
Void LED_PowerDown (DWORD hDeviceContext)
{
RETAILMSG (1, (TEXT ("USERLED: LED_PowerDown \ r \ n ")));
}
// The following code is FlowLED. def:
LIBRARY FlowLED
EXPORTS
LED_Init
LED_Deinit
LED_Open
LED_Close
LED_Read
LED_Write
LED_Seek
LED_IOControl
LED_PowerDown
LED_PowerUp
// The following is the sources code:
TARGETNAME = FlowLED
RELEASETYPE = PLATFORM
TARGETTYPE = DYNLINK
TARGETLIBS = $ (_ COMMONSDKROOT) \ lib \ $ (_ CPUINDPATH) \ coredll. lib
DEFFILE = $ (TARGETNAME). def
DLLENTRY = DllEntry SOURCES = FlowLED. c
The makefile code can be copied directly to another driver. Do not change it!
2. Load the driver in D: \ WINCE500 \ PLATFORM \ smdk2440 \ DRIVERS. Find the dirs file and open add driver. The added code is as follows:
DIRS =
\ FlowLED
\ Drvlib
\ Serial
\ Wavedev
\ Wavclick
\ Display
\ Backlite
\ Usb
\ Pcmcia
\ Keybd
\ Touchp
\ Nandflsh
\ Camera
\ Pwrbtn_pcf
\ Cs8900
\ CANBus
\ Dm9000
\ Atapi
Add the written driver to platform. bib. The added code is as follows:
; Fly for IDE Hard disk IF BSP_IDE; atapi. dll
$ (_ FLATRELEASEDIR) \ atapi. dll NK SH
ENDIF
Flowled. dll $ (_ flatreleasedir) \ flowled. dll NK sh
; Wghdriver. dll $ (_ flatreleasedir) \ wghdriver. dll NK sh files
; Name path memory type
Add the driver registry to platform. Reg. The code to be added is as follows:
; Flowled [HKEY_LOCAL_MACHINE \ drivers \ builtin \ led]
"Prefix" = "led" "DLL" = "flowled. dll"
"Friendlyname" = "flow led"
"Index" = DWORD: 0
"Order" = DWORD: 0
Note that after the platform. bib and platform. Reg are modified by Pb, they may not be updated in the release. You must copy the changed ones to the release! Copy from D: \ wince500 \ platform \ smdk2440 \ files to D: \ wince500 \ pbworkspaces \ lqm \ reldir \ smdk2440_armv4i_release! Otherwise, even if the driver has been added to the Pb, the generated NK will not have the driver program!
3. Compile the driver to be loaded and generate NK. Right-click the loaded driver and click build current project. Then, click make run-time image in the build OS menu bar, that is, NK is generated.
4. Download the generated nk to the development board. 5. Write the application in the evc4.0 environment.
1. Create a dialog box for GPIO control. Here, four buttons are created:
A: Enable the GPIO driver.
B: Disable the GPIO driver.
C: Light up LED lights
D: Turn off the LED light.
2. the dialog box implementation code is as follows:
// GPIOControlDlg. cpp: implementation file
//
# Include "stdafx. h"
# Include "GPIOControl. h"
# Include "GPIOControlDlg. h"
# Include "GPIO. h"
HANDLE hFile = INVALID_HANDLE_VALUE;
# Ifdef _ DEBUG
# Define new DEBUG_NEW
# Undef THIS_FILE
Static char THIS_FILE [] = _ FILE __; # endif
//////////////////////////////////////// /////////////////////////////////////
// CGPIOControlDlg dialog CGPIOControlDlg: CGPIOControlDlg (CWnd * pParent): CDialog (CGPIOControlDlg: IDD, pParent)
{
// {AFX_DATA_INIT (CGPIOControlDlg)
// NOTE: the ClassWizard will add member initialization here
//} AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
M_hIcon = AfxGetApp ()-> LoadIcon (IDR_MAINFRAME );
}
Void CGPIOControlDlg: DoDataExchange (CDataExchange * pDX)
{
CDialog: DoDataExchange (pDX );
// {AFX_DATA_MAP (CGPIOControlDlg)
// NOTE: the ClassWizard will add DDX and DDV cballs here
//} AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP (CGPIOControlDlg, CDialog)
// {AFX_MSG_MAP (CGPIOControlDlg)
ON_BN_CLICKED (IDC_OPEN_GPIO, OnOpenGpio)
ON_BN_CLICKED (IDC_LED_OFF, OnLedOff)
ON_BN_CLICKED (IDC_CLOSE_GPIO, OnCloseGpio)
ON_BN_CLICKED (IDC_LED_ON, OnLedOn)
//} AFX_MSG_MAP
END_MESSAGE_MAP ()
//////////////////////////////////////// /////////////////////////////////////
// CGPIOControlDlg message handlers
BOOL CGPIOControlDlg: OnInitDialog ()
{CDialog: OnInitDialog ();
// Set the icon for this dialog. The framework does this automatically
// When the application's main window is not a dialog
SetIcon (m_hIcon, TRUE); // Set big icon
SetIcon (m_hIcon, FALSE); // Set small icon
CenterWindow (getshorttopwindow ());
// Center to the hpc screen
// TODO: Add extra initialization here
Return TRUE;
// Return TRUE unless you set the focus to a control}
// Enable the GPIO driver. Here, LED0 indicates the name of the driver to be called. If an error occurs, the driver cannot be enabled!
Void CGPIOControlDlg: OnOpenGpio ()
{
HFile = CreateFile (TEXT ("LED0:"), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0 );
If (hFile = INVALID_HANDLE_VALUE)
{
MessageBox (_ T ("failed to enable GPIO driver! "));
}
Else
{
MessageBox (_ T ("GPIO driver enabled successfully! "));
}
}
// Disable the GPIO driver
Void CGPIOControlDlg: OnCloseGpio ()
{
If (hFile! = INVALID_HANDLE_VALUE)
{
CloseHandle (hFile );
MessageBox (_ T ("GPIO Driver disabled successfully! "));
}
Else
{
MessageBox (_ T ("An error occurred while disabling the GPIO driver! "));
}
}
//
Void CGPIOControlDlg: OnLedOff ()
{
BOOL ret;
Ret =: DeviceIoControl (hFile, IO_CTL_LED_ALL_OFF, NULL, 1, NULL, 0, NULL, NULL );
If (ret! = TRUE)
{
MessageBox (_ T ("An error occurred while disabling the LED! "));
MessageBox (_ T ("Please enable the GPIO driver! "));
}
}
Void CGPIOControlDlg: OnLedOn ()
{
BOOL ret; ret =: DeviceIoControl (hFile, IO_CTL_LED_ALL_ON, NULL, 1, NULL, 0, NULL, NULL );
If (ret! = TRUE)
{MessageBox (_ T ("failed to light the LED! "));
MessageBox (_ T ("Please enable the GPIO driver! "));}}
3. The GPIO. h header file is used here. The specific content is as follows:
# Ifndef _ GPIO_H __
# Define _ GPIO_H __
# Ifdef _ cplusplus extern "C"
{# Endif
// Define the working status of the four lights, corresponding to the LED_IOControl in the driver
# Define io_ctl_led_detail on 0x01
# Define IO_CTL_LED_2_ON 0x02
# Define IO_CTL_LED_3_ON 0x03
# Define io_ctl_led_4_on 0x04
# Define io_ctl_led_all_on 0x05
# Define io_ctl_led_0000off 0x06
# Define io_ctl_led_2_off 0x07
# Define io_ctl_led_3_off 0x08
# Define io_ctl_led_4_off 0x09
# Define io_ctl_led_all_off 0x0a
# Define gpio_a 0x00 # define gpio_ B 0x01
# Define gpio_c 0x02 # define gpio_d 0x03
# Define gpio_e 0x04 # define gpio_f 0x05
# Define gpio_g 0x06 # define gpio_h 0x07
# Define ioctl_gpio_fun_mask 0x00000f0
# Define ioctl_gpx_mask 0x000000f
# Define ioctl_gpio_set_pin_out 0x0000010
# Define ioctl_gpa_set_pin_out 0x0000010
# Define ioctl_gpb_set_pin_out 0x0000011
# Define ioctl_gpc_set_pin_out 0x0000012
# Define ioctl_gpd_set_pin_out 0x0000013
# Define IOCTL_GPE_SET_PIN_OUT 0x0000014
# Deprecision IOCTL_GPF_SET_PIN_OUT 0x0000015
# Define ioctrochelle gpg_set_pin_out 0x0000016
# Define IOCTL_GPH_SET_PIN_OUT 0x0000017
# Define IOCTL_GPIO_SET_MULTI_PIN_OUT 0x0000020
# Define IOCTL_GPA_SET_MULTI_PIN_OUT 0x0000020
# Define IOCTL_GPB_SET_MULTI_PIN_OUT 0x0000021
# Define IOCTL_GPC_SET_MULTI_PIN_OUT 0x0000022
# Define IOCTL_GPD_SET_MULTI_PIN_OUT 0x0000023
# Define IOCTL_GPE_SET_MULTI_PIN_OUT 0x0000024
# Define IOCTL_GPF_SET_MULTI_PIN_OUT 0x0000025
# Define IOCTL_GPG_SET_MULTI_PIN_OUT 0x0000026
# Define IOCTL_GPH_SET_MULTI_PIN_OUT 0x0000027
# Define IOCTL_GPIO_SET_PIN_IN 0x0000030
# Define IOCTL_GPA_SET_PIN_IN 0x0000030
# Define IOCTL_GPB_SET_PIN_IN 0x0000031
# Define ioctl_gpc_set_pin_in 0x0000032
# Define ioctl_gpd_set_pin_in 0x0000033
# Define ioctl_gpe_set_pin_in 0x0000034
# Define ioctl_gpf_set_pin_in 0x0000035
# Define ioctl_gpg_set_pin_in 0x0000036
# Define ioctl_gph_set_pin_in 0x0000037
# Define ioctl_gpio_set_multi_pin_in 0x0000040
# Define ioctl_gpa_set_multi_pin_in 0x0000040
# Define ioctl_gpb_set_multi_pin_in 0x0000041
# Define ioctl_gpc_set_multi_pin_in 0x0000042
# Define ioctl_gpd_set_multi_pin_in 0x0000043
# Define ioctl_gpe_set_multi_pin_in 0x0000044
# Define ioctl_gpf_set_multi_pin_in 0x0000045
# Define ioctl_gpg_set_multi_pin_in 0x0000046
# Define ioctl_gph_set_multi_pin_in 0x0000047
# Define ioctl_gpio_set_pin 0x0000050
# Define ioctl_gpa_set_pin 0x0000050
# Define IOCTL_GPB_SET_PIN 0x0000051
# Define IOCTL_GPC_SET_PIN 0x0000052
# Define IOCTL_GPD_SET_PIN 0x0000053
# Define IOCTL_GPE_SET_PIN 0x0000054
# Define IOCTL_GPF_SET_PIN 0x0000055
# Define IOCTL_GPG_SET_PIN 0x0000056
# Define IOCTL_GPH_SET_PIN 0x0000057
# Define ioctl_gpo_set_multi_pin 0x0000060
# Define IOCTL_GPA_SET_MULTI_PIN 0x0000060
# Define IOCTL_GPB_SET_MULTI_PIN 0x0000061
# Define IOCTL_GPC_SET_MULTI_PIN 0x0000062
# Define IOCTL_GPD_SET_MULTI_PIN 0x0000063
# Define IOCTL_GPE_SET_MULTI_PIN 0x0000064
# Define IOCTL_GPF_SET_MULTI_PIN 0x0000065
# Define IOCTL_GPG_SET_MULTI_PIN 0x0000066
# Define IOCTL_GPH_SET_MULTI_PIN 0x0000067
# Define IOCTL_GPIO_CLR_PIN 0x0000070
# Define IOCTL_GPA_CLR_PIN 0x0000070
# Define IOCTL_GPB_CLR_PIN 0x0000071
# Define IOCTL_GPC_CLR_PIN 0x0000072
# Define IOCTL_GPD_CLR_PIN 0x0000073
# Define IOCTL_GPE_CLR_PIN 0x0000074
# Define IOCTL_GPF_CLR_PIN 0x0000075
# Define IOCTL_GPG_CLR_PIN 0x0000076
# Define IOCTL_GPH_CLR_PIN 0x0000077
# Define IOCTL_GPIO_CLR_MULTI_PIN 0x0000080
# Deprecision IOCTL_GPA_CLR_MULTI_PIN 0x0000080
# Deprecision IOCTL_GPB_CLR_MULTI_PIN 0x0000081
# Deprecision IOCTL_GPC_CLR_MULTI_PIN 0x0000082
# Deprecision IOCTL_GPD_CLR_MULTI_PIN 0x0000083
# Define IOCTL_GPE_CLR_MULTI_PIN 0x0000084
# Define IOCTL_GPF_CLR_MULTI_PIN 0x0000085
# Define IOCTL_GPG_CLR_MULTI_PIN 0x0000086
# Deprecision IOCTL_GPH_CLR_MULTI_PIN 0x0000087
# Define IOCTL_GPIO_READ_PIN 0x0000090
# Define IOCTL_GPA_READ_PIN 0x0000090
# Define IOCTL_GPB_READ_PIN 0x0000091
# Define IOCTL_GPC_READ_PIN 0x0000092
# Deprecision IOCTL_GPD_READ_PIN 0x0000093
# Deprecision IOCTL_GPE_READ_PIN 0x0000094
# Deprecision IOCTL_GPF_READ_PIN 0x0000095
# Deprecision IOCTL_GPG_READ_PIN 0x0000096
# Define IOCTL_GPH_READ_PIN 0x0000097
# Define IOCTL_GPIO_READ_ALL_PIN 0x00000A0
# Define IOCTL_GPA_READ_ALL_PIN 0x00000A0
# Define IOCTL_GPB_READ_ALL_PIN 0x00000A1
# Define IOCTL_GPC_READ_ALL_PIN 0x00000A2
# Define IOCTL_GPD_READ_ALL_PIN 0x00000A3
# Define IOCTL_GPE_READ_ALL_PIN 0x00000A4
# Define IOCTL_GPF_READ_ALL_PIN 0x00000A5
# Define IOCTL_GPG_READ_ALL_PIN 0x00000A6
# Define IOCTL_GPH_READ_ALL_PIN 0x00000A7
# Define IOCTL_GPIO_EN_PULLUP 0x00000B0
# Define IOCTL_GPA_EN_PULLUP 0x00000B0
# Define IOCTL_GPB_EN_PULLUP 0x00000B1
# Define IOCTL_GPC_EN_PULLUP 0x00000B2
# Define IOCTL_GPD_EN_PULLUP 0x00000B3
# Define IOCTL_GPE_EN_PULLUP 0x00000B4
# Define IOCTL_GPF_EN_PULLUP 0x00000B5
# Define IOCTL_GPG_EN_PULLUP 0x00000B6
# Define IOCTL_GPH_EN_PULLUP 0x00000B7
# Define IOCTL_GPIO_EN_MULTI_PIN_PULLUP 0x00000C0
# Define IOCTL_GPA_EN_MULTI_PIN_PULLUP 0x00000C0
# Define IOCTL_GPB_EN_MULTI_PIN_PULLUP 0x00000C1
# Define IOCTL_GPC_EN_MULTI_PIN_PULLUP 0x00000C2
# Define IOCTL_GPD_EN_MULTI_PIN_PULLUP 0x00000C3
# Define IOCTL_GPE_EN_MULTI_PIN_PULLUP 0x00000C4
# Define ioctl_gpf_en_multi_pin_pullup 0x00000c5
# Define ioctl_gpg_en_multi_pin_pullup 0x00000c6
# Define ioctl_gph_en_multi_pin_pullup 0x00000c7
# Define ioctl_gpio_dis_pullup 0x00000d0
# Define ioctl_gpa_dis_pullup 0x00000d0
# Define ioctl_gpb_dis_pullup 0x00000d1
# Define ioctl_gpc_dis_pullup 0x00000d2
# Define ioctl_gpd_dis_pullup 0x00000d3
# Define ioctl_gpe_dis_pullup 0x00000d4
# Define ioctl_gpf_dis_pullup 0x00000d5
# Define ioctl_gpg_dis_pullup 0x00000d6
# Define ioctl_gph_dis_pullup 0x00000d7
# Define ioctl_gpio_dis_multi_pin_pullup 0x00000e0
# Define ioctl_gpa_dis_multi_pin_pullup 0x00000e0
# Define ioctl_gpb_dis_multi_pin_pullup 0x00000e1
# Define ioctl_gpc_dis_multi_pin_pullup 0x00000e2
# Define IOCTL_GPD_DIS_MULTI_PIN_PULLUP 0x00000E3
# Define IOCTL_GPE_DIS_MULTI_PIN_PULLUP 0x00000E4
# Define IOCTL_GPF_DIS_MULTI_PIN_PULLUP 0x00000E5
# Define IOCTL_GPG_DIS_MULTI_PIN_PULLUP 0x00000E6
# Define IOCTL_GPH_DIS_MULTI_PIN_PULLUP 0x00000E7
# Define IOCTL_GPIO_READ_PORT 0x00000F0
# Define IOCTL_GPA_READ_PORT 0x00000F0
# Define IOCTL_GPB_READ_PORT 0x00000F1
# Define IOCTL_GPC_READ_PORT 0x00000F2
# Define IOCTL_GPD_READ_PORT 0x00000F3
# Define IOCTL_GPE_READ_PORT 0x00000F4
# Define IOCTL_GPF_READ_PORT 0x00000F5
# Define IOCTL_GPG_READ_PORT 0x00000F6
# Define IOCTL_GPH_READ_PORT 0x00000F7
# Ifdef _ cplusplus
}
# Endif
# Endif
// _ GPIO_H __
4. Synchronize the PC with the Development Board, compile the code under EVC4.0, download the generated executable file to the Development Board, and run the generated executable file. We can see that the four lights on the Development Board have been heard by you!