Windows Driver Basic Series, reproduced please indicate the source: http://blog.csdn.net/ikerpeng/article/details/38865317
The main purpose of the camera driver is to capture video signals through hardware.
WDM Camera Driver Framework.
Mainly includes two kinds of drive classdriver (provided by Windows, for uniform standards), minidriver (implemented by programmers)
Class Driver:
Interacts with the operating system, including processing synchronization, to raise enough standard interfaces.
Mini Driver:
It is primarily called by class-driven and is responsible for specific hardware-related operations.
Look at their relationship through a graph:
Where SRB is the Stream Request Block.
Initialization
1. Plug and Play device, after inserting call mini driver DriverEntry routines;
2 Mini Driver fills the hw_initialization_data in its own driverentry, then returns Streamclassregisterminidriver;
3. A srb_initialize_device type of SRB is initialized in Class Driver, and the commanddata.configinfo in this SRB records information about the camera hardware;
This SRB is passed on to the small drive, where the small driver gets some hardware information and returns, and tells the class driver that the small drive has been initialized.
4. The class driver then sends a srb:srb_get_stream_info to the small drive, resulting in information such as hw_stream_header data information and hw_stream_information, including the information provided in the camera driver. The size of the video image, the format of the image and other information;
5. Then class-driven to send a hw_stream_information SRB, after this request, the small driver should do all the initialization and return to the driver.
• Each minidriver must provide a routine:
Strminicancelpacket: A callback function to cancel the HW_SRB packet;
Strminireceivedevicepacket: Gets the callback function of the HW_SRB packet;
Strminirequesttimeout: callback function for timeout processing of HW_SRB packets;
Strminievent: Enables a small drive to support an event;
Strminiinterrupt: The callback function that is called when the driver encounters an interrupt;
· MiniDriver routines provided for each individual stream:
Strminireceivestreamdatapacket: callback function for fetching a data stream
Strminireceivestreamcontrolpacket: For callback functions that control data flow
strminievent: enables data flow to support an event
Strminiclock: callback function for the digital stream clock control.
Let's take a look at the driver's workflow:
1. Device plugged in, detected by Plug and Play Device Manager;
2. The PDO is created and the corresponding IRP is generated;
3. The I/O subsystem loads the minidriver and enters into the driverentry;
4. Initialize in DriverEntry: HW_INITIALIZATION_DATA data structure (including hwreceivepacketto control SRB);
5. The class driver constructs the SRB and sets its command to Srb_initialization_device;
6,. This SRB is used as a parameter to invoke Hwreceivepacket;
7, so similar constructs: open close and so on SRB, call Hwreceivepacket.
The end of this section.
Bibliography:
A detailed description of the Windows driver Development technology
Windows Camera Driver Research (i)