www.ti.com
5.3.6InterruptLatency
5.4TMS320C54xxRulesandGuidelines
5.4.1DataModels
5.4.2ProgramModels
TMS320C54xxRulesandGuidelines
CSRFieldUseType
ENCurrentCPUendianmode.Read-only(global)
PWRDPower-DownmodesNotaccessible(global)
PCCProgramCacheControlNotaccessible(global)
DCCDataCacheControl.Notaccessible(global)
NotethattheGIEandPGIEareread-onlyregisters.Algorithmsthatneedtocreatenon-interruptible
sectionsmustusetheDSP/BIOSoperationsHWI_disable()andHWI_restore().Theymustneverdirectly
manipulatetheGIEorPGIEbits.
AlthoughtherearenoadditionalrulesforC6xalgorithmsthatdealwithinterruptlatency,itisimportantto
notethatallinstructionsinthedelayslotsofbranchesarenon-interruptible;i.e.,oncefetched,interrupts
areblockeduntilthebranchcompletes.Sincethesedelayslotsmaycontainotherbranchinstructions,
caremustbetakentoavoidlongchainsofnon-interruptibleinstructions.Inparticular,tightlycodedloops
oftenresultinunacceptablylongnon-interruptiblesequences.
NotethattheCcompilerhasoptionstolimitthedurationofloops.Evenifthisoptionisused,youmustbe
carefultolimitthelengthofloopswhoselengthisnotasimpleconstant.
ThissectiondescribestherulesandguidelinesthatarespecifictotheTMS320C5400familyofDSPs.
TheC54xhasjustonedatamodel,sotherearenospecialdatamemoryrequirementsforthisprocessor.
SomevariantsoftheTMS320C54xxsupportanextendedprogramaddressspace.Sincecodecanbe
compiledforeitherstandardorextended(nearorfar)addresses,itispossibletohaveincompatible
mixturesofcode.
Weneedtoensurethatcallsmadefromanalgorithmtoexternalsupportfunctionswillbecompatible,and
thatcallsmadefromtheapplicationtoanalgorithmwillbecompatible.Wealsoneedtoensurethatcalls
toindependentlyrelocatableobjectmoduleswithinanalgorithmwillbecompatible.
Rule28
Onprocessorsthatsupportlargeprogrammodelcompilation,allfunctionaccessestoindependently
relocatableobjectmodulesmustbefarreferences.Forexample,intersectionfunctionreferenceswithin
algorithmandexternalfunctionreferencestoothereXpressDSP-compliantmodulesmustbefaronthe
C54x;i.e.,thecallingfunctionmustpushboththeXPCandthecurrentPC.
Rule29
Onprocessorsthatsupportlargeprogrammodelcompilation,allindependentlyrelocatableobject
modulefunctionsmustbedeclaredasfarfunctions;forexample,ontheC54x,callersmustpushboth
theXPCandthecurrentPCandthealgorithmfunctionsmustperformafarreturn.
Thisrequiresthatthetop-levelinterfacetothealgorithmfunctionsbedeclaredas"far."Notethatfunction
callswithinthealgorithmmaybenearcalls.Still,callswithinthealgorithmtoindependentlyrelocatable
objectmodulesmustbefarcalls,sinceanyrelocatableobjectmodulemaybeloadedina'far'pageof
memory.
Whataboutexistingapplicationsthatdonotsupportfarcallstoalgorithms?Notethatitispossibleforan
existingapplicationtodoanearcallintoafaralgorithm;createasmall"nearstub"thattheapplication
callsusinganearcall,thestubthendoestheappropriatefarcallandanearreturntotheapplication.
SPRU352G–June2005–RevisedFebruary2007DSP-SpecificGuidelines49
SubmitDocumentationFeedback