3.3.2.6ReceiveAbortHandling
3.3.2.7RNDISModeandTransparentModeReceiveDMAOperation
www.ti.com
USBControllerHostandPeripheralModesOperation
TheDMAcontrollersets‘RxAbort’bitusedtoidentifyRxpacketswhichwereabortedduetolackof
buffers.SoftwaremusttakecaretoinspectanyRxSOPpacketforthisbitandignoreallthebuffersinthat
packetasthepacketisincomplete.Also,forabortedpackets,thepacketlengthmaynotmatchthedata
sizeinthebuffers.
TransparentModeDMAoperationisthedefaultDMAmode(asdescribedinprevioussection)wherean
interruptisgeneratedwheneveraDMApacketisreceived.Inthetransparentmode,DMApacketsize
cannotbegreaterthanUSBMaxPktSizefortheendpoint.Thismeans,forreceivingsaynUSBpackets,
theDMAcontrollershouldbeprogrammedwithaqueueofminimumnDMApackets.RBUFCNTnregister
alsoneedstobewrittenwithvaluen.Thenumbernshouldbegreaterthan3astheRBUFCNTnregister
shouldhaveatleast3packetsfortheRxDMAtoreceivepacketsfromtheendpointFIFO.
RNDISmodeDMAisusedtoreceiveDMApacketswhicharelargerthanUSBMaxPktSize.Thisis
accomplishedbybreakingthelargerpacketintosmallerpackets,notlargerthanUSBMaxPktSize.This
impliesthatmultipleUSBpacketsofMaxPktSizewillbereceivedandtransferredtogetherasasingle
largeDMApacketandtheDMAinterruptisgeneratedonlyattheendofthecompletereceptionofDMA
packet.ThismodeofDMAisusedforRNDIStypetransfersoverUSB.Theprotocoldefinestheendofthe
completetransferbyreceivingashortUSBpacket(smallerthanUSBMaxPktSizeasmentionedinUSB
specification2.0).IftheDMApacketsizeisanexactmultipleofUSBMaxPktSize,theDMAcontroller
waitsforazerobytepacketattheendofcompletetransfertosignifythecompletionofthetransfer.
RNDISModeDMAissupportedonlywhenUSBMaxPktSizeisanintegralmultipleof64bytes.
RNDISModeSetup
ThesetupofRNDISmodeDMAissimilartothedefaultTransparentModeasmentionedintheprevious
section.ThefollowingstepsneedtobetakenforsettingupRNDISmodeRxDMA:
•RNDISmoderequiresthattheassociatedMaxPktSizeandFIFOsizemustbeintegralmultiplesof
64bytes.
•AfterresetthesoftwaremustwritezeroestoallRxDMAStateregisters(RCPPIDMASTATEW0,
RCPPIDMASTATEW1,RCPPIDMASTATEW2,RCPPIDMASTATEW3,RCPPIDMASTATEW4,
RCPPIDMASTATEW5andRCPPIDMASTATEW6).
•Thesoftwareconstructsreceivequeueinmemory.
•EnableDMAfortheendpointinthePERI_RXCSRorHOST_RXCSRbysettingtheDMAENbit.
•EnabletheDMAportsbysettingRCPPI_ENABLEbitofRCPPICRregister.
•SetRNDISbitofCTRLRregisterforenablingRNDISmodeforallchannelsorsetTXnENbitof
RNDISRregisterforspecificDMAchanneln.
•SetthevalueinRBUFCNTnregister(wherenisthechannelnumber)forthenumberofbuffers
availableintheRxqueue.Theminimumvalueshouldbe3fortheRxDMAtostartoperation.The
valueinRBUFCNTndecrementsasDMAcontrollerconsumesthebuffersforreception.
•WritetheheadofthequeuedescriptorpointertotheRCPPIDMASTATEW1registertostarttheDMA.
•TheUSBcontrollerwillsendINtokenandwaitforthedataonthebus.Oncedataisreceived,DMA
controllerwilltransferthedataintheRxqueuefromtheendpointFIFO.OnceacompleteDMApacket
isreceived,theinterruptassociatedwiththeDMAchannelisasserted.
•IftheDMApacketsizeisexactmultipleofUSBMaxPktSize,azerobytepacketisexpectedand
interruptassociatedwiththeDMAchannelisassertedwhenthatzerobytepacketisreceived.
•IftheDMApacketsizeisnotexactmultipleofUSBMaxPktSize,thelastUSBpacketreceivedisa
shortpacketandinterruptassociatedwiththeDMAchannelisasserted.
AnadditionalfeatureofautomaticallygeneratingINtokensisavailable.ThisfeatureisusedinUSBHost
modeoperationoftheUSBcontroller.ThisfeatureisfunctionalinRNDISmodeDMAonly.To
automaticallygeneratetheINtokenswhilereceivingdata,setthefieldRXn_AUTOREQ(wherenisthe
channelnumber)ofAUTOREQregisterwithbinary01.Inthiscase,INtokenswillbegeneratedandsent
tothetargetUSBperipheraldeviceaftereverysuccessfullyreceivedpacket.NoINtokenwillbe
generatedaftertheEndOfDMAPacketisreached.RxDMAinterruptisgeneratedafterthecomplete
reception.
SPRUGH3–November2008UniversalSerialBus(USB)Controller67
SubmitDocumentationFeedback