Texas Instruments TMS320DM357 Switch User Manual


 
1.5SupportedUseCaseExamples
Introduction
www.ti.com
TheUSBsupportsthefollowingusercases:
DetailedinformationaboutthearchitectureandoperationoftheUSBcontrollerfollowsinSection2.
Programmingexamplesarealsoprovidedforeachoftheoperationalmodesofthecontroller.
UserCase1:AnexampleofhowtoinitializetheUSBcontroller
Example1.InitializingtheUSBController
//RoutinetoinitializeUSBcontroller
voidusb_init()
{
//localloopvariable
intI;
//VBUSmustbecontrolledexternally.Thefollowingroutine
//shouldperformwhateveractionsarerequired(ifany)to
//turnoffVBUSinthesystem.
vbus_off();
//ResettheUSBcontroller
usbRegs->CTRLR=0x00000001;
//PoweronPHYandoscillatorbyclearingbits2,1,and0ofUSBPHY_CTL
sysRegs->USB_PHY_CTRL=0x000000D0;
//Clearallpendinginterrupts
usbRegs->INTCLRR=usbRegs->INTSRCR;
//InitializeCPPIDMA
usbRegs->RCPPICR=0;//DisabletheRXDMA
usbRegs->TCPPICR=0;//DisabletheTXDMA
//InitializeCPPIDMAstate
for(I=0;i<4;I++){
usbRegs->CHANNEL[i].TCPPIDMASTATEW0=0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW1=0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW2=0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW3=0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW4=0;
usbRegs->CHANNEL[i].TCPPIDMASTATEW5=0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW0=0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW1=0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW2=0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW3=0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW4=0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW5=0;
usbRegs->CHANNEL[i].RCPPIDMASTATEW6=0;
}
}
UniversalSerialBus(USB)Controller 16SPRUGH3November2008
SubmitDocumentationFeedback