void Usb_Updater(void) { #if FW_UPDATE USBDCDTerm(0); CpuTimer0Regs.TCR.all = 0x0000; // Use write-only instruction to set TSS bit = 0 CpuTimer1Regs.TCR.all = 0x0000; // Use write-only instruction to set TSS bit = 0 EALLOW; DINT; IER = 0; IFR = 0; PieCtrlRegs.PIEIER1.bit.INTx4 = 0; // Enable PIE Group 1 INT4 XINT PieCtrlRegs.PIEIER1.bit.INTx7 = 0; // Enable PIE Group 1 INT7 TINT0 DELAY_US(5L); PieCtrlRegs.PIEIER3.bit.INTx1 = 0; // Enable PIE Group 3 INT1 PWM1 PieCtrlRegs.PIEIER3.bit.INTx2 = 0; // Enable PIE Group 3 INT2 PWM2 PieCtrlRegs.PIEIER3.bit.INTx4 = 0; // Enable PIE Group 3 INT4 PWM4 PieCtrlRegs.PIEIER3.bit.INTx6 = 0; // Enable PIE Group 3 INT4 PWM6 DELAY_US(5L); PieCtrlRegs.PIEIER8.bit.INTx1 = 0; // Enable PIE Group 8 INT1 I2CA NONE FIFO INT DELAY_US(5L); IER = 0; IFR = 0; PieCtrlRegs.PIEACK.all = 0x0fff; Usb0Regs.USBPOWER.bit.SOFT_CONN = 0; *(Uint32*)pAppSig = FW_UPDATE; GpioCtrlRegs.GPACTRL2.bit.USB0IOEN = 0; SysCtrlRegs.PCLKCR3.bit.USB0ENCLK = 0; DisablePeripherals(); EDIS; if((unsigned long)pBootEntry != 0xFFFFFFFF && (unsigned long)pBootEntry != 0x00000000) ((void (*)(void))pBootEntry)(); #endif }
//***************************************************************************** // //! Shut down the bulk device. //! //! \param pvInstance is the pointer to the device instance structure as //! returned by USBDBulkInit(). //! //! This function terminates device operation for the instance supplied and //! removes the device from the USB bus. This function should not be called //! if the bulk device is part of a composite device and instead the //! USBDCompositeTerm() function should be called for the full composite //! device. //! //! Following this call, the \e pvInstance instance should not me used in any //! other calls. //! //! \return None. // //***************************************************************************** void USBDBulkTerm(void *pvInstance) { tBulkInstance *psInst; int index; ASSERT(pvInstance); // // Get a pointer to our instance data. // psInst = ((tUSBDBulkDevice *)pvInstance)->psPrivateBulkData; // // Terminate the requested instance. // USB_BASE_TO_INDEX(psInst->ulUSBBase, index); USBDCDTerm(index); psInst->ulUSBBase = 0; psInst->psDevInfo = (tDeviceInfo *)0; psInst->psConfDescriptor = (tConfigDescriptor *)0; return; }
void myUSBDMSCTerm(void *pvInstance) { const tUSBDMSCDevice *psDevice; ASSERT(pvInstance != 0); // // Cleanly exit device mode. // USBDCDTerm(0); // // Create a device instance pointer. // psDevice = pvInstance; // // If the media was opened the close it out. // if(psDevice->psPrivateData->pvMedia != 0) { psDevice->psPrivateData->pvMedia = 0; psDevice->sMediaFunctions.Close(0); } psDevice->psPrivateData->bConnected = 0; }
//***************************************************************************** // //! Shuts down the audio device. //! //! \param pvAudioDevice is the pointer to the device instance structure as //! returned by USBDAudioInit(). //! //! This function terminates audio interface for the instance supplied. This //! function should not be called if the audio device is part of a composite //! device and instead the USBDCompositeTerm() function should be called for //! the full composite device. //! Following this call, the \e pvAudioDevice instance should not me used in //! any other calls. //! //! \return None. // //***************************************************************************** void USBDAudioTerm(void *pvAudioDevice) { ASSERT(pvAudioDevice != 0); // // Cleanly exit device mode. // USBDCDTerm(0); }
//***************************************************************************** // //! Shut down the bulk device. //! //! \param pvBulkDevice is the pointer to the device instance structure as //! returned by USBDBulkInit(). //! //! This function terminates device operation for the instance supplied and //! removes the device from the USB bus. This function should not be called //! if the bulk device is part of a composite device and instead the //! USBDCompositeTerm() function should be called for the full composite //! device. //! //! Following this call, the \e pvBulkDevice instance should not me used in any //! other calls. //! //! \return None. // //***************************************************************************** void USBDBulkTerm(void *pvBulkDevice) { tBulkInstance *psInst; ASSERT(pvBulkDevice); // // Get a pointer to the bulk device instance data pointer // psInst = &((tUSBDBulkDevice *)pvBulkDevice)->sPrivateData; // // Terminate the requested instance. // USBDCDTerm(USBBaseToIndex(psInst->ui32USBBase)); psInst->ui32USBBase = 0; return; }