Streaming micro-Drive Development Guide (6)

Source: Internet
Author: User

6. Minidriver Control Process
The steps below are generally closely related to Minidriver initialization, calling, and detaching. The commands and structures to be used are described in details in other chapters of DDK.
The steps for initializing, calling, and detaching Minidriver are as follows:
1. The PnP Manager enumerates the hardware adapter insertion supported by Minidriver, and then the PnP Manager parses all the relevant symbolic references by checking the registry, and sends a request to the I/O subsystem.
2. the I/O subsystem loads Minidriver and then calls the DriverEntry routine of Minidriver. In this routine, an hw_initialization_data structure is allocated and initialized. Create a file object based on the information in DriverEntry ).
3. The DriverEntry routine of Minidriver then calls the streamclassregisterminidriver function of the stream class driver and passes the hw_initialization_data structure as a parameter to this function. The hw_initialization_data structure provides the addresses of the functions in the Minidriver used to process the Server Load balancer. In this way, Minidriver will be able to correspond to the Server Load balancer package from the class driver.
4. during initialization, the stream class driver calls the main package receiving function in Minidriver. This function is specified by hwreceivepacket, a member of hw_initialization_data. Hwreceivepacket is a function pointer, see strminireceivedevicepacket ). During the call, the class driver places the srb_initialize_device command in the Command domain of the Server Load balancer package. Minidriver will initialize the hardware adapter after receiving this port family.
5. next, the stream class driver calls the function in Step 4 again. The difference is that the command sent to Minidriver this time is srb_get_stream_info, to obtain information about all streams supported by Minidriver. After receiving this command, Minidriver returns information about all the streams it supports.
6. subsequently, the stream class driver continues to call the function in Step 4. The command is srb_open_stream. As mentioned above, a pointer member streamobject in Server Load balancer points to an hw_stream_object structure, this structure describes the information of the stream object, and the stream is identified by a stream number (this stream number is a member of the hw_stream_object structure ). After receiving this port family, Minidriver executes necessary hardware actions to open the specified stream. Minidriver also tells the class driver which two functions it has arranged to process the receivedatapacket and receivecontrolpacket respectively.
7. at this point, the initialization and opening of the stream have been completed. By sending data requests to the Minidriver, we are responsible for processing the data requests sent by the class driver (another function is dedicated to processing the control requests) the function sends the srb_read_data or srb_write_data command. The class driver can complete the operation of sending data to or receiving data from the stream. This function is directed by the receivedatapacket Member of the hw_stream_object structure.
8. by sending control commands to the functions responsible for processing control requests sent by the class driver to Minidriver, the class driver can complete stream attribute acquisition, stream attribute setting, and other control operations, this function is directed by the receivecontrolpacket Member of the hw_stream_object structure.
9. when the system completes a stream, the stream driver sends the srb_close_stream command to the main package function of Minidriver (this function is directed by hw1_epacket, a member of the hw_initialization_data structure ). Minidriver closes the corresponding stream after receiving the command.
10. When the (uninitialize) adapter is to be uninstalled, the stream driver sends the srb_uninitialize_device command to the main package function of Minidriver (this function is directed by hw1_epacket, a member of the hw_initialization_data structure ). Minidriver uninstalls the device after receiving the command.
7. DriverEntry routine of stream class Minidriver
The DriverEntry routine is used to initialize the Minidriver of a stream class. This routine is required at any time. Its prototype is as follows:
Ulong DriverEntry (in pvoid argument1, in pvoid argument2 );
The parameters argument1 and arguement2 provide two context values, which will be used when Minidriver calls streamclassregisterminidriver. For Windows2000 and later versions, argument1 points to a driver_object structure, while arguement2 points to the registration path.
The returned value of DriverEntry is the returned value of streamclassregisterminidriver.
Streamclassregisterminidriver will execute most of the necessary driver initialization work. The main task of the DriverEntry routine of the stream class Minidriver is to allocate the hw_initialization _ data structure and use the driver specified (Driver-specific) constant and entry point fill ulong numberofpossibleinstances;
Kspin_dataflow dataflow;
Boolean dataaccessible;
Ulong numberofformatarrayentries;
Pksdatarange * streamformatsarray;
Pvoid classreserved [4];
Ulong numstreamproparrayentries;
Pksproperty_set streampropertiesarray;
Ulong numstreameventarrayentries;
Pksevent_set streameventsarray;
Guid * category;
Guid * Name;
Ulong mediumscount;
Const kspin_medium * mediums;
Boolean bridgestream;
This structure. Then DriverEntry should call the streamclassregisterminidriver routine.


8. Multiple Streams)
When the strminireceivedevicepacket routine of Minidriver responds to the srb_get_stream_info command, Minidriver describes information about all the streams it supports. The commanddata. streambuffer Member of the sulfate database points to an hw_stream_descriptor structure. Minidriver needs to backfill this structure with the information of the stream it supports (see page 7th for the definition of hw_stream_descriptor ).
Hw_stream_descriptor starts with an hw_stream_header structure. This structure describes the number of streams supported by Minidriver, followed by an hw_stream_information struct array, each element in the array describes the information of an independent stream. The class driver uses each element in the array to process the kspropsetid_pin attribute set. The subscript of the array is the ID of the pin type.
Hw_stream_header is defined as follows:
Typedef struct _ hw_stream_header
{
Ulong numberofstreams;
Ulong sizeofhwstreaminformation;
Ulong numdevproparrayentries;
Pksproperty_set devicepropertiesarray;
Ulong numdeveventarrayentries;
Pksevent_set deviceeventsarray;
Pkstopology topology;
Phw_event_routine deviceeventroutine
Ulong reserved [2];
} Hw_stream_header, * phw_stream_header;
Hw_stream_information is defined as follows:
Typedef struct _ hw_stream_information
{
Ulong reserved [2];
} Hw_stream_information, * phw_stream_information;
For most Minidriver, the data in the hw_stream_descriptor structure is determined during the compilation period. In this case, Minidriver can allocate static space for the data structure.
Minidriver uses the member variable topology of hw_stream_header to describe the topological connection between streams. The class driver uses this structure to process the kspropsetid_topology attribute set for Minidriver.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.