Texas Instruments TMS320DM357 Switch User Manual


 
www.ti.com
Introduction
Example3.ProgrammingtheUSBEndpointsinHostMode(continued)
usbRegs->TXFIFOSZ=fifosize|((double_buffer&1)<<4);
usbRegs->TXFIFOADDR=fifo_start_address+(1<<(fifosize+double_buffer));
usbRegs->RXMAXP=FIFO_MAXP;
usbRegs->TXMAXP=FIFO_MAXP;
//Configuretheendpoint
switch(device_speed){
caseLOW_SPEED:type=(3<<6)|((device_protocol&3)<<4)|(device_ep&0xf);break;
caseFULL_SPEED:type=(2<<6)|((device_protocol&3)<<4)|(device_ep&0xf);break;
caseHIGH_SPEED:type=(1<<6)|((device_protocol&3)<<4)|(device_ep&0xf);break;
default:error++;
}
usbRegs->EPCSR[CHAN_NUM+1].HOST_TYPE0=type;//TXTYPE
usbRegs->EPCSR[CHAN_NUM+1].HOST_RXTYPE=type;
//SetNAKlimit/Pollinginterval(Interrupt&Isoprotocols)
if((device_protocol==INT)||(device_protocol==ISO)){
usbRegs->EPCSR[CHAN_NUM+1].HOST_NAKLIMIT0=TXINTERVAL;//TXPollinginterval
usbRegs->EPCSR[CHAN_NUM+1].HOST_RXINTERVAL=RXINTERVAL;//RXPollinginterval
}else{
usbRegs->EPCSR[CHAN_NUM+1].HOST_NAKLIMIT0=2;//FramestotimeoutfromNAKs
usbRegs->EPCSR[CHAN_NUM+1].HOST_RXINTERVAL=2;//FramestotimeoutfromNAKs
}
//SettheaddressfortransactionsafterSETADDRESSsuccessfullycompleted
usbRegs->EPTRG[CHAN_NUM+1].TXFUNCADDR=device_address;
usbRegs->EPTRG[CHAN_NUM+1].RXFUNCADDR=device_address;
SPRUGH3November2008UniversalSerialBus(USB)Controller19
SubmitDocumentationFeedback