Currently, many high-end ARM chips, such as Apple, Samsung, and Huawei, use ARM chips as smartphone chips.
This article introduces the interrupt Analysis of the ARM-based wince operating system driver. There are two types of Wince drivers. Here we introduce stream drivers, which are relatively simple.
The following figure shows the status of the streaming driver:
We can see the figure above from the right to the left, and the rightmost is the application. The program should use the createfile, writefile, readfile, ioctrl, closefile functions to access the driver, which is the same as other operating systems, such as Windows XP and Linux.
A stream driver is a library (DLL) that implements a number of functions, including xxx_init and xxx_deinit. The above diagram is listed.
Before using the driver, you need to load the driver (activate the driver), that is, make the driver ready for application access. The ActivateDeviceEx function is used for activation. ActivateDeviceEx receives a registry path as a parameter. Therefore, we need to write the driver information to the registry according to the format. The following is an example of the gpio registry:
[HKEY_LOCAL_MACHINE \ drivers \ builtin \ gpio]
"DLL" = "maid"
"Prefix" = "gio"
"Order" = DWORD: 63
"Index" = DWORD: 1
"Friendlyname" = "gpio driver"
If the driver is interrupted, perform the following steps:
1. When the driver is initialized, the physical interrupt number obtains the virtual interrupt number and calls the kerneliocontrol (ioctl_hal_request_sysintr…) function ...)
2. During driver initialization, the event handle is bound to the virtual interrupt number, and the function interruptinitialize is used to create an ist thread and waiting the event.
3. interrupt handling: If a hardware interrupt occurs, the wait event in the IST thread will return. Next, handle the interrupt and call the interruptdone function. This means that the interrupt processing is complete.
4. Call interruptdisable before exiting the driver to disable the current interrupt, which is opposite to interruptinitialize.
5. Release the virtual interrupt Number Resource kerneliocontrol (ioctl_hal_release_sysintr...) before exiting the driver ...)
If you develop an Ethernet driver, how do you know the hardware interrupt Number of the Ethernet chip? The answer is: Ask the BSP developer or hardware developer. Unlike windows drivers, the interrupt Number of the Windows Driver is sent to the driver by messages.
Driver interrupt number for a Windows XP operating system