Home |
Programming with RTUSB-32 |
Programming with RTUSB-32RTUSB-32 notifies USB client software of device attachment and detachment events through callbacks. Any USB client driver which would like to work with USB devices must implement and register such a callback using RTUSB-32 API function RTURegisterCallback. All registered callbacks will be called by RTUSB-32 when a new device is attached. The callbacks can use various RTUSB-32 API functions to query information about the device, open pipes, etc. Attachment and detachment callbacks are also used by RTUSB-32 to uniquely identify a USB client. The class drivers supplied with RTUSB-32 each implement one such callback. If an application wishes to use any of these drivers, the respective callback must be registered at program startup. Of course, applications can implement additional callbacks to implement their own clients using the low-level API. Once all callbacks required by an application are registered, the RTUSB-32 protocol stack can be started by registering one or more USB host controllers installed in the computer. This is done by calling functions RTURegisterUHCI, RTURegisterOHCI, RTURegisterEHCI, and RTURegisterXHCI. The demo programs supplied with RTUSB-32 call the HCI register functions in function FindUSBControllers contained in source file Usbinit.cpp. When a host controller is registered, RTUSB-32 immediately enables its root hubs and enumerates all devices already attached. Applications may (but do not have to) wait with function RTUWaitInitialEnumDone until the initial enumeration process has completed. RTUSB-32 contains two different APIs to support USB devices: class drivers which are complete USB clients, and the low-level API for direct USB device access. USB clients are implemented using the low-level API. The source code of all RTUSB-32 class drivers is supplied in directory Driver\Rtu32.
|