Texas Instruments TMS320DM357 Switch User Manual


 
www.ti.com
USBControllerHostandPeripheralModesOperation
3.1.2.2.1Setup
InconfiguringanRxendpointforBulkOUTtransactions,theRXMAXPregistermustbewrittenwiththe
maximumpacketsize(inbytes)fortheendpoint.ThisvalueshouldbethesameasthewMaxPacketSize
fieldoftheStandardEndpointDescriptorfortheendpoint.Inaddition,therelevantinterruptenablebitin
theINTRRXEregistershouldbeset(ifaninterruptisrequiredforthisendpoint)andthePERI_RXCSR
registershouldbesetasshowninTable3.
Table3.PERI_RXCSRRegisterBitConfigurationforBulkOUTTransactions
BitPositionBitFieldNameConfiguration
Bit14ISOClearedto0toenableBulkprotocol
Bit13DMAENSetto1ifaDMArequestisrequiredforthisendpoint
Bit12DISNYETClearedto0toallownormalPINGflowcontrol.Thiswillaffectonlyhighspeedtransactions.
Bit11DMAMODEAlwayssetthisbitto0
Whentheendpointisfirstconfigured(followingaSET_CONFIGURATIONorSET_INTERFACEcommand
onEndpoint0),thelowerbyteofPERI_RXCSRshouldbewrittentosettheCLRDATATOGbit(bit7).
Thiswillensurethatthedatatoggle(whichishandledautomaticallybytheUSBcontroller)startsinthe
correctstate.
AlsoifthereareanydatapacketsintheFIFO(indicatedbytheRXPKTRDYbit(bit0ofPERI_RXCSR)
beingset),theyshouldbeflushedbysettingtheFLUSHFIFObit(bit4ofPERI_RXCSR).
Note:Itmaybenecessarytosetthisbittwiceinsuccessionifdoublebufferingisenabled.
3.1.2.2.2Operation
WhenadatapacketisreceivedbyaBulkRxendpoint,theRXPKTRDYbit(bit0ofPERI_RXCSR)isset
andaninterruptisgenerated.ThesoftwareshouldreadtheRXCOUNTregisterfortheendpointto
determinethesizeofthedatapacket.ThedatapacketshouldbereadfromtheFIFO,thenthe
RXPKTRDYbitshouldbecleared.
ThepacketsreceivedshouldnotexceedthesizespecifiedintheRXMAXPregister(asthisshouldbethe
valuesetinthewMaxPacketSizefieldoftheendpointdescriptorsenttothehost).Whenablockofdata
largerthanwMaxPacketSizeneedstobesenttothefunction,itwillbesentasmultiplepackets.Allthe
packetswillbewMaxPacketSizeinsize,exceptthelastpacketwhichwillcontaintheresidue.The
softwaremayuseanapplicationspecificmethodofdeterminingthetotalsizeoftheblockandhencewhen
thelastpackethasbeenreceived.Alternativelyitmayinferthattheentireblockhasbeenreceivedwhenit
receivesapacketwhichislessthanwMaxPacketSizeinsize.(Ifthetotalsizeofthedatablockisa
multipleofwMaxPacketSize,anulldatapacketwillbesentafterthedatatosignifythatthetransferis
complete.)
Inthegeneralcase,theapplicationsoftwarewillneedtoreadeachpacketfromtheFIFOindividually.If
largeblocksofdataarebeingtransferred,theoverheadofcallinganinterruptserviceroutinetounload
eachpacketcanbeavoidedbyusingDMA.
SPRUGH3November2008UniversalSerialBus(USB)Controller39
SubmitDocumentationFeedback