Texas Instruments TMS320C645x DSP Network Card User Manual


 
www.ti.com
2.5.2TransmitandReceiveDescriptorQueues
EMACFunctionalArchitecture
TheEMACmoduleprocessesdescriptorsinlinkedlistchains(Section2.5.1).Thelistscontrolledbythe
EMACaremaintainedbytheapplicationsoftwareviatheheaddescriptorpointer(HDP)registers.Since
theEMACsupportseightchannelsforbothtransmitandreceive,thereareeightheaddescriptorpointer
registersforboth.
Theyaredesignatedasfollows:
TXnHDP:TransmitChannelnDMAHeadDescriptorPointerRegister
RXnHDP:ReceiveChannelnDMAHeadDescriptorPointerRegister
AfteranEMACreset,andbeforeenablingtheEMACforsendorreceive,youmustinitializeall16head
descriptorpointerregisterstozero.
TheEMACusesasimplesystemtodetermineownershipofadescriptor(eithertheEMACorthe
applicationsoftware).ThereisaflaginthedescriptorflagsfieldcalledOWNER.Whenthisflagisset,the
EMACownsthereferencedpacket.
Note:Ownershipisassignedonapacket-basedgranularity,notondescriptorgranularity.Thus,
onlySOPdescriptorsmakeuseoftheOWNERflag.TheEMACpatchestheSOP
descriptorofthecorrespondingpacketandclearstheOWNERflagaspacketsare
processed.ThismeansthattheEMACisfinishedprocessingalldescriptorsuptoand
includingthefirstwiththeEOPflagset.Thisindicatesthatyouhavereachedtheendof
thepacket.ThismayonlybeonedescriptorwithboththeSOPandEOPflagsset.
ToaddadescriptororalinkedlistofdescriptorstoanEMACdescriptorqueueforthefirsttime,the
softwareapplicationwritesthepointertothedescriptororfirstdescriptorofalisttothecorresponding
HDPregister.NotethatthelastdescriptorinthelistmusthaveitsnextpointerclearedsothattheEMAC
candetecttheendofthelist.Ifonlyasingledescriptorisadded,itsnextdescriptorpointermustbe
initializedtozero.
TheHDPregistermustneverbewrittentoasecondtimewhileapreviouslistisactive.Toaddadditional
descriptorstoadescriptorlistalreadyownedbytheEMAC,theNULLnextpointerofthelastdescriptorof
thepreviouslistispatchedwithapointertothefirstdescriptorinthenewlist.Thelistofnewdescriptors
tobeappendedtotheexistinglistmustitselfbeNULLterminatedbeforethepointerpatchisperformed.
IftheEMACreadsthenextpointerofadescriptorasNULLintheinstantbeforeanapplicationappends
additionaldescriptorstothelistbypatchingthepointer,thismayresultinaracecondition.Thus,the
softwareapplicationmustalwaysexaminetheFlagsfieldofallEOPpackets,lookingforaspecialflag
calledendofqueue(EOQ).TheEOQflagissetbytheEMAConthelastdescriptorofapacketwhenthe
descriptor’snextpointerisNULL,allowingtheEMACtoindicatetothesoftwareapplicationthatithas
reachedtheendofthelist.WhenthesoftwareapplicationseestheEOQflagset,andtherearemore
descriptorstoprocess,theapplicationmaythensubmitthenewlistormissedlistportionbywritingthe
newlistpointertothesameHDPregisterthatstartedtheprocess.
Thisprocessapplieswhenaddingpacketstoatransmitlist,andemptybufferstoareceivelist.
EthernetMediaAccessController(EMAC)/ManagementDataInput/Output(MDIO) 28SPRU975BAugust2006
SubmitDocumentationFeedback