Texas Instruments TMS320DM643x DMP Switch User Manual


 
www.ti.com
2.5.2TransmitandReceiveDescriptorQueues
PeripheralArchitecture
TheEMACmoduleprocessesdescriptorsinlinkedlistchainsasdiscussedinSection2.5.1.Thelists
controlledbytheEMACaremaintainedbytheapplicationsoftwarethroughtheuseoftheheaddescriptor
pointerregisters(HDP).SincetheEMACsupportseightchannelsforbothtransmitandreceive,thereare
eightheaddescriptorpointerregistersforboth.Theyare:
TXnHDP-TransmitChannelnDMAHeadDescriptorPointerRegister
RXnHDP-ReceiveChannelnDMAHeadDescriptorPointerRegister
AfteranEMACresetandbeforeenablingtheEMACforsendorreceive,all16headdescriptorpointer
registersmustbeinitializedto0.
TheEMACusesasimplesystemtodetermineifadescriptoriscurrentlyownedbytheEMACorbythe
applicationsoftware.ThereisaflaginthebufferdescriptorflagscalledOWNER.Whenthisflagisset,the
packetthatisreferencedbythedescriptorisconsideredtobeownedbytheEMAC.Notethatownership
isdoneonapacketbasedgranularity,notondescriptorgranularity,soonlySOPdescriptorsmakeuseof
theOWNERflag.Aspacketsareprocessed,theEMACpatchestheSOPdescriptorofthecorresponding
packetandclearstheOWNERflag.ThisisanindicationthattheEMAChasfinishedprocessingall
descriptorsuptoandincludingthefirstwiththeEOPflagset,indicatingtheendofthepacket(notethis
mayonlybeonedescriptorwithboththeSOPandEOPflagsset).
ToaddadescriptororalinkedlistofdescriptorstoanEMACdescriptorqueueforthefirsttime,the
softwareapplicationsimplywritesthepointertothedescriptororfirstdescriptorofalisttothe
correspondingHDPregister.Notethatthelastdescriptorinthelistmusthaveits“next”pointerclearedto
0.ThisistheonlywaytheEMAChasofdetectingtheendofthelist.Sointhecasewhereonlyasingle
descriptorisadded,its“nextdescriptor”pointermustbeinitializedto0.
TheHDPmustneverbewrittentoasecondtimewhileapreviouslistisactive.Toaddadditional
descriptorstoadescriptorlistalreadyownedbytheEMAC,theNULL“next”pointerofthelastdescriptor
ofthepreviouslistispatchedwithapointertothefirstdescriptorinthenewlist.Thelistofnew
descriptorstobeappendedtotheexistinglistmustitselfbeNULLterminatedbeforethepointerpatchis
performed.
ThereisapotentialraceconditionwheretheEMACmayreadthe“next”pointerofadescriptorasNULLin
theinstantbeforeanapplicationappendsadditionaldescriptorstothelistbypatchingthepointer.This
caseishandledbythesoftwareapplicationalwaysexaminingthebufferdescriptorflagsofallEOP
packets,lookingforaspecialflagcalledendofqueue(EOQ).TheEOQflagissetbytheEMAConthe
lastdescriptorofapacketwhenthedescriptor’s“next”pointerisNULL.ThisisthewaytheEMAC
indicatestothesoftwareapplicationthatitbelievesithasreachedtheendofthelist.Whenthesoftware
applicationseestheEOQflagset,andtherearemoredescriptorstoprocess,theapplicationmayatthat
timesubmitthenewlist,ortheportionoftheappendedlistthatwasmissed,bywritingthenewlistpointer
tothesameHDPthatstartedtheprocess.
Thisprocessapplieswhenaddingpacketstoatransmitlist,andemptybufferstoareceivelist.
18EthernetMediaAccessController(EMAC)/SPRU941AApril2007
ManagementDataInput/Output(MDIO)
SubmitDocumentationFeedback