Home |
Initialization |
InitializationRTUSB-32 uses a number of configuration parameters stored in the global structure RTUSBConfig. Parameters included are the maximum number of pipe handles, max number of supported hubs, etc. Applications can change these parameters in RTUSBConfig before host controllers are registered. Before RTUSB-32 starts to look for USB devices, all required attachment/detachment callbacks must be installed using RTURegisterCallback. This includes the callbacks of all required class drivers as well as any custom USB clients of the application. The USB protocol stack is actually started by registering host controllers. Each host controller driver has a single API function: RTURegisterUHCI, RTURegisterOHCI, RTURegisterEHCI, and RTURegisterXHCI. Each host controller driver can be eliminated from an application to save code space by not referencing the respective RTURegister?HCI function. In the supplied demo programs, these functions are called by FindUSBControllers in source file UsbInit.cpp. FindUSBControllers use the RTTarget-32 PCI BIOS functions to locate USB host controllers and their resource requirements. Applications should copy, customize, and use FindUSBControllers. To ensure graceful program termination, RTUSB-32's function RTUShutDown should be called when the application terminates. This is best achieved using the C/C++ run-time system function atexit(). FindUSBControllers installs RTUShutDown as an exit function.
|