www.ti.com
3.1.1ExternalIdentifiers
InterfacesandModules
Rule7
Allheaderfilesmustsupportmultipleinclusionswithinasinglesourcefile.
ThegeneraltechniqueforinsuringthisbehaviorforCheaderfilesisillustratedintheCodebelow.
/*
*========fir.h========
*/
#ifndefFIR_
#defineFIR_
0
#endif/*FIR_*/
Asimilartechniqueshouldbeemployedforassemblylanguageheaders.
;
;========fir.h54========
;
.if($isdefed("FIR_")=0)
FIR_.set1
0
.endif
SincemultiplealgorithmsandsystemcontrolCodeareoftenintegratedintoasingleexecutable,theonly
externalidentifiersdefinedbyanalgorithmimplementation(i.e.,symbolsintheobjectCode)shouldbe
thosespecifiedbythealgorithmAPIdefinition.Unfortunately,duetolimitationsoftraditionallinkers,itis
sometimesnecessaryforanidentifiertohaveexternalscopeeventhoughthisidentifierisnotpartofthe
algorithmAPI.Thus,inordertoavoidnamespacecollisions,itisimportantthatvendorselectednamesdo
notconflict.
Rule8
AllexternaldefinitionsmustbeeitherAPIidentifiersorAPIandvendorprefixed.
Allexternalidentifiersdefinedbyamodule'simplementationmustbeprefixedby"<module>_<vendor>_",
where
<module>isthenameofthemodule(containingcharactersfromtheset[A-Z0-9]),
<vendor>isthenameofthevendor(containingcharactersfromtheset[A-Z0-9]).
Forexample,TI'simplementationoftheFIRmodulemustonlycontainexternalidentifiersoftheform
FIR_TI_[a-zA-Z0-9]+.Ontheotherhand,externalidentifiersthatarecommontoallimplementationsdo
nothavethe"vendor"componentofthename.Forexample,iftheFIRmoduleinterfacedefineda
constantstructurethatisusedbyallimplementations,itsnamesimplyhastheformFIR_[A-Z0-9]+.
Inadditiontothesymbolsdefinedbyamodule,wemustalsostandardizethesymbolsreferencedbyall
modules.AlgorithmscancallHWIdisableandHWIrestorefunctionsasspecifiedintheDSP/BIOSAPI
ReferencesGuides(SPRU403andSPRU404).Theseoperationscanbeusedtocreatecriticalsections
withinanalgorithmandprovideaprocessor-independentwayofcontrollingpreemptionwhenusedina
DSP/BIOSframework.Tousethesamealgorithminanon-DSP/BIOSbasedapplication,an
implementationoftheseHWIfunctionscanbeprovidedbytheframework.
Rule9
AllundefinedreferencesmustrefereithertotheoperationsspecifiedinAppendixB(asubsetofC
runtimesupportlibraryfunctionsandasubsetoftheDSP/BIOSHWIAPIfunctions)orTI’sDSPLIBor
IMGLIBfunctions,orothereXpressDSP-compliantmodules.
SPRU352G–June2005–RevisedFebruary2007AlgorithmComponentModel27
SubmitDocumentationFeedback