| Description | The UnInit function is used for uninitialization of the device. It will be called automatically by the USB Host Core when device is disconnected form the USB Host controller bus. The argument ctrl specifies the controller index. The argument dev_idx specifies the device instance index. Uninitialization function has to do device specific uninitialization if any is needed, it also has to set Init bit in Device Class Instance (USBH_DCI) structure to 0 after uninitialization is successful. You can modify this function to suit different class driver. This function will need to be changed for class that does not have driver provided. |
| Example |
/* MSC Class Driver Control Block */
USBH_DCD usbh_dcd_cls = {
USB_DEVICE_CLASS_STORAGE,
Config,
UnConfig,
Init,
UnInit,
GetLastError
};
static BOOL UnInit (U8 ctrl, U8 dev_idx) {
USBH_DCI *ptrDCI;
ptrDCI = &usbh_dci_msc[ctrl*usbh_msc_num+dev_idx];
ptrDCI->Init = 0;
return (__TRUE);
}
|