Texas Instruments TMS320DM357 Switch User Manual


 
USBControllerHostandPeripheralModesOperation
www.ti.com
Thesoftwareenablespacketreceptiononagivenchannelbywritingtheaddressofthefirstbuffer
descriptorinthequeue(nonzerovalue)tothechannel’sheaddescriptorpointer(RCCPIDMASTATEW1)
inthechannel’sRxDMAstate.Whenpacketreceptionbeginsonagivenchannel,theDMAcontrollerfills
eachRxbufferwithdatainorderstartingwiththefirstbufferandproceedingthroughtheRxqueue.Ifthe
BufferOffsetintheRxDMAStateisnonzero,thenthecontrollerwillbeginwritingdataaftertheoffset
numberofbytesintheSOPbuffer.TheDMAcontrollerperformsthefollowingoperationsattheendof
eachpacketreception:
Overwritethebufferlengthinthepacket’sEOPbufferdescriptorwiththenumberofbytesactually
receivedinthepacket’slastbuffer.Thesoftwareinitializedvalueisthebuffersize.Theoverwritten
valuewillbelessthanorequaltothesoftwareinitializedvalue.
SettheEOPbitinthepacket’sEOPbufferdescriptor.
SettheEOQbitinthepacket’sEOPbufferdescriptorifthecurrentpacketisthelastpacketinthe
queue.
Overwritethepacket’sSOPbufferdescriptorBufferOffsetwiththeRxDMAstatevalue(thesoftware
initializedthebufferdescriptorBufferOffsetvaluetozero).AllnonSOPbufferdescriptorsmusthavea
zeroBufferOffsetinitializedbythehost.
Overwritethepacket’sSOPbufferdescriptorbufferlengthwiththenumberofvaliddatabytesinthe
buffer.Ifthebufferisfilledup,thebufferlengthwillbethebuffersizeminusbufferoffset.
SettheSOPbitinthepacket’sSOPbufferdescriptor.
WritetheSOPbufferdescriptorPacketLengthfield.
CleartheOwnershipbitinthepacket’sSOPbufferdescriptor.
IssueanRxDMAinterrupttothehostprocessorbywritingtheaddressofthepacket’slastbuffer
descriptortothequeue’sRxDMAStateCompletionPointer(RCPPICOMPPTRregister).
OninterruptthesoftwareprocessestheRxbufferqueuedetectingreceivedpacketsbythestatusof
theOwnershipbitineachpacket’sSOPbufferdescriptor.IftheOwnershipbitisclearedthenthe
packethasbeencompletelyreceivedandisavailabletobeprocessedbythesoftware.Thesoftware
maycontinueRxqueueprocessinguntiltheendofthequeueoruntilabufferdescriptorisreadthat
containsasetOwnershipbitindicatingthatthenextpacket’sreceptionisnotcomplete.Thesoftware
determinesthattheRxqueueisemptywhenthelastpacketinthequeuehasaclearedOwnershipbit
intheSOPbufferdescriptor,asetEndofQueuebitintheEOPbufferdescriptor,andtheNext
DescriptorPointerintheEOPbufferdescriptoriszero.
Thesoftwareacknowledgesaninterruptbywritingtheaddressofthelastbufferdescriptortothe
queue’sassociatedRxCompletionPointer(RCPPICOMPPTRregister).
IfthesoftwarewrittenbufferaddressvalueinRCCPICOMPPTRregisterisdifferentfromthebuffer
addresswrittenbytheDMAcontrollerafterRxcompletion,thentheinterruptfortheRxChannel
remainsasserted.Ifthesoftwarewrittenbufferaddressvaluematcheswiththebufferaddresswritten
bytheDMAcontroller,theRxChannelinterruptgetsdeasserted.
AmisqueuedbuffermayoccurwhenthesoftwareaddsbufferstoaqueueastheDMAcontroller
finishesthereceptionofthepreviouslastpacketinthequeue.Themisqueuedbufferisdetectedbythe
softwarewhenqueueprocessingdetectsaclearedOwnershipbitintheSOPbufferdescriptor,aset
EndofQueuebitintheEOPbufferdescriptor,andanonzeroNextDescriptorPointerintheEOP
bufferdescriptor.AmisqueuedbuffermeansthattheDMAcontrollerreadthelastEOPbuffer
descriptorbeforethesoftwareaddedbufferdescriptor(s)tothequeue,sotheDMAcontroller
determinedqueueemptyjustbeforethesoftwareaddedmorebufferdescriptor(s).Receiveoverrun
conditionmayoccurinthemisqueuedbuffercase.Ifanewpacketreceptionisbegunduringthetime
thattheDMAcontrollerhasdeterminedtheendofqueuecondition,thenthereceivedpacketwill
overrun(startofpacketoverrun).Ifthemisqueuedbufferoccursduringthemiddleofapacket
receptionthenmiddleofpacketoverrunmayoccur.Ifthemisqueuedbufferoccursafterthelastpacket
hascompleted,andiscorrectedbeforethenextpacketreceptionbegins,thenoverrunwillnotoccur.
Thesoftwareactsonthemisqueuedbufferconditionbywritingtheaddedbufferdescriptoraddressto
theappropriateRxDMAStateHeadDescriptorPointerinRCPPIDMASTATEW1register.
UniversalSerialBus(USB)Controller 66SPRUGH3November2008
SubmitDocumentationFeedback