Analysis of the key points of USB loadable streaming interface driver?

Last Update Time: 2020-10-28 10:58:21

      In order to support different types of peripheral devices, the WinCE platform provides a stream interface driver model with a custom interface. Because most USB peripheral devices are more suitable for the structure of the stream interface driver, they generally use a loadable stream interface driver model to develop USB device drivers.

    (1) Analysis of USB system structure

     The USB system software under WinCE consists of two layers: a higher USB device driver layer and a lower USB function layer. The lower USB function layer itself is composed of two parts: a higher universal serial bus driver (USBD) module and a lower host controller driver (HCD) module. Through the function of the HCD module and the USBD module to implement a high-level USBD interface function, the USB device driver can communicate with peripheral devices.

     In the process of data transmission, the operation flow is usually performed in the following order: 

      ① The USB device driver initializes the data transmission, that is, sends a data transmission request to the USBD module through the USBD interface function. 

      ② The USBD module divides the request into separate transactions. 

      ③ The HCD module discharges the order of transactions. 

      ④ The main controller hardware executes the transaction. What needs to be reminded here is that all transactions are sent from the host, and peripheral devices are completely passive.

    (2) USB device driver entry point function

      From the structural analysis, we can know that all USB device drivers must set a certain entry point in their DLL library to properly interact with the USBD module. Setting the entry point function has two functions: one is to enable the USBD module to interact with external devices; the other is to enable the driver to create and manage any registration keys that may be needed.

      The following briefly introduces the functions of related functions: USBDeviceAttach runs when a USB device is connected to the host computer. The USBD module will call this function to initialize the USB device, obtain USB device information and configure the USB device, and apply for the necessary resources. USBInstallDrive is called first when the USB device driver is loaded for the first time. It enables the driver to create the required registration keys for writing the registry information required by a driver to HKEY_LOCAL_MACHINE \ Drivers \ USB \ Client Drivers Directory, such as the device name. It should be noted that the USB device driver does not use standard registry functions, but uses the Register Client Driver ID and Register Client Set TIngs functions to register the corresponding device information.

      USB Uninstall Driver is called when the user deletes the USB device driver and is responsible for deleting the registration key and releasing other related resources. It deletes all registration keys created by the driver's USB Install Driver function by calling the UnRegister Client Set TIngs and UnRegister Client Driver ID functions. Therefore, we need to strictly implement the prototype of these three functions in the driver program, otherwise it will not be recognized by the device manager.

 

If you want to know more, our website has product specifications for the interface you can go to ALLICDATA ELECTRONICS LIMITED to get more information