Texas Instruments TMS320DM357 Switch User Manual


 
3.3.1.7DMAChannelTearDown
3.3.2DMAReceiveOperation
3.3.2.1ReceiveBuffer
USBControllerHostandPeripheralModesOperation
www.ti.com
RNDISModeSetup
ThesetupofRNDISmodeDMAissimilartothedefaultTransparentModeasmentionedintheprevious
section.ThefollowingstepsneedtobetakenforsettingupRNDISmodeTxDMA:
AfterresetthesoftwaremustwritezeroestoallTxDMAStateregisters(TCPPIDMASTATEW0,
TCPPIDMASTATEW1,TCPPIDMASTATEW2,TCPPIDMASTATEW3,TCPPIDMASTATEW4,
TCPPIDMASTATEW5).
Thesoftwareconstructstransmitqueueinmemory(oneormoreDMAPacketsinfortransmission).
EnableDMAfortheendpointinthePERI_TXCSRorHOST_TXCSRbysettingtheDMAENbit.
EnabletheDMAportsbysettingTCPPI_ENABLEbitofTCPPICRregister.
SetRNDISbitofCTRLRregisterforenablingRNDISmodeforallchannelsorsetTXnENbitof
RNDISRregisterforspecificDMAchanneln.
WritetheheadofthequeuedescriptorpointertotheTCPPIDMASTATEW0registertostarttheDMA.
TheUSBcontrollerwillstarttransmittingdata.
IftheDMApacketsizeisexactmultipleofUSBMaxPktSize,azerobytepacketistransmittedand
interruptassociatedwiththeDMAchannelisasserted.
IftheDMApacketsizeisnotexactmultipleofUSBMaxPktSize,thelastUSBpackettransmittedisa
shortpacketandinterruptassociatedwiththeDMAchannelisasserted.
TransparentModeSetup
TransparentDMAconfigurationisidenticaltoRNDISDMAconfigurationwiththeexceptionofthe
followings:EachpacketisdefinedbyasinglebufferdescriptorwithSOPandEOPbitfieldsset.Packet
sizeisnotboundedtobeamultipleof64bytebutbymaxpacketsize.CTRLR.RNDISbitfieldshouldbe
clearedtozero.
TheDMAalsosupportsateardownoperationonTXchannels.Teardownallowssoftwaretoterminatethe
currentTxqueuebynotifyingtheDMA.TheDMAwillstopthecurrentTxDMAforthatchannel,and
updatethechannelparameterstoremoveallTxdescriptorsfromthatqueue.Thenthesoftwareisfreeto
reclaimthebufferswithoutworryofinterruptingtheDMAinprogress.
TeardownofTxchannelsisdoneusingtheTCPPITDRregister.IftheREADYbitofTCPPITDRregisteris
set,itsignifiesthattheTxchannelcanbetorndown.Thechannelnumbershouldbewritteninthe
CHANNELfieldofTCPPITDRregistertoteardownthechannel.
NotethatthesoftwaremustalsoteardownthecoreaftertheDMA.Softwareshouldspecifythatthe
followingstepsareallcompletedbeforeassumingteardownhascompletedsuccessfully.
1.Aftertearingdownthechannel,DMAinterruptshouldbegeneratedandtheTCPPICOMPPTRregister
willbeFFFFFFFCh.ThisindicatesthattheDMAhascompletedtheteardownandallthedatabuffers
canbereclaimed.
2.ThesoftwaremustsettheFLUSHFIFObitofthePERI_TXCSRorHOST_TXCSRregisterforthe
endpointtobetorndown.
AfterboththeDMAandthecorearetorndown,theDMAchannelandendpointcanberestartedcleanly.
Afailuretoperformeitherofthesestepscouldresultindatalossorspuriousdatauponrestart.
Forreceiveoperation,thesoftwarehastoprogramtheDMAchannelwithachainofreceivebuffers.
Areceivebufferisacontiguousblockofmemoryusedtostorereceiveddata.EachRxbufferhasa
correspondingRxbufferdescriptor.EachRxbuffercanbelinkedtogetherwithotherRxbufferstomakea
DMApacketoraqueueofDMApackets.
Receivebuffersarebytealignedstructureslocatedinprocessor’smainmemory.Rxbuffersizemayvary
from1to65,535bytes.
UniversalSerialBus(USB)Controller 62SPRUGH3November2008
SubmitDocumentationFeedback