//***************************************************************************** // // This is the callback from the MSC driver. // // \param ulInstance is the driver instance which is needed when communicating // with the driver. // \param ulEvent is one of the events defined by the driver. // \param pvData is a pointer to data passed into the initial call to register // the callback. // // This function handles callback events from the MSC driver. The only events // currently handled are the MSC_EVENT_OPEN and MSC_EVENT_CLOSE. This allows // the main routine to know when an MSC device has been detected and // enumerated and when an MSC device has been removed from the system. // // \return Returns \e true on success or \e false on failure. // //***************************************************************************** void MSCCallback(unsigned long ulInstance, unsigned long ulEvent, void *pvData) { // // Determine the event. // switch(ulEvent) { // // Called when the device driver has successfully enumerated an MSC // device. // case MSC_EVENT_OPEN: { // // Mount the USB flash stick as logical drive 1 in the file system. // FileMountUSB(true); // // Proceed to the enumeration state. // g_eState = STATE_DEVICE_ENUM; break; } // // Called when the device driver has been unloaded due to error or // the device is no longer present. // case MSC_EVENT_CLOSE: { // // Remove the USB stick from the file system. // FileMountUSB(false); // // Close our MSC drive instance. // USBHMSCDriveClose(g_ulMSCInstance); g_ulMSCInstance = 0; // // Go back to the "no device" state and wait for a new connection. // g_eState = STATE_NO_DEVICE; RendererSetAlert("USB drive\nremoved.", 200); break; } default: { break; } } }
//***************************************************************************** // // Clean up and release all USB hardware resources. // //***************************************************************************** void ScopeUSBHostTerm(void) { // // If necessary, unmount the USB flash drive. // if((g_eState == STATE_DEVICE_ENUM) || (g_eState == STATE_DEVICE_READY)) { FileMountUSB(false); } // // Nothing is connected any more. // g_eState = STATE_NO_DEVICE; // // Close our MSC drive instance. // USBHMSCDriveClose(g_ulMSCInstance); g_ulMSCInstance = 0; // // Tell the USB library that we are finished using the host controller. // USBHCDTerm(0); }
//***************************************************************************** // // Clean up and release all USB hardware resources. // //***************************************************************************** void ScopeUSBHostTerm(void) { // // If necessary, unmount the USB flash drive. // if((g_eState == STATE_DEVICE_ENUM) || (g_eState == STATE_DEVICE_READY)) { FileMountUSB(false); } // // Nothing is connected any more. // g_eState = STATE_NO_DEVICE; // // Close our MSC drive instance. // USBHMSCDriveClose(g_ulMSCInstance); g_ulMSCInstance = 0; // // Tell the USB library that we are finished using the host controller. // USBHCDTerm(0); // // Turn off USB Phy clock. // SysCtlUSBPLLDisable(); // // Disable the USB peripheral // SysCtlPeripheralDisable(SYSCTL_PERIPH_USB0); }