www.ti.com
3.1.10InterfaceInheritance
3.1.11Summary
InterfacesandModules
module'sheaderfiledefinesaconcreteinterface;thefunctionsdefinedintheheaderuniquelyidentifya
specific(orconcrete)implementationwithinasystem.Aspecialtypeofinterfaceheaderisusedtodefine
abstractinterfaces;abstractinterfacesdefinefunctionsthatareimplementedbymorethanonemodulein
asystem.Anabstractinterfaceheaderisidenticaltoanormalmoduleinterfaceheaderexceptthatit
declaresastructureoffunctionpointersnamedXYZ_Fxns.AmoduleABCissaidtoimplementan
abstractinterfaceXYZifitdeclaresandinitializesastaticstructureoftypeXYZ_FxnsnamedABC_XYZ.
TheTMS320DSPAlgorithmStandardAPIReference(SPRU360)containsalloftheabstractinterface
definitionsforeXpressDSP-compliantalgorithms.AlleXpressDSP-compliantalgorithmmodules,for
example,mustimplementtheIALGinterface.AppendixAoftheTMS320DSPAlgorithmStandardAPI
ReferencedocumentcontainsanexampleofamodulethatimplementstheIALGinterface.
Byconvention,allabstractinterfaceheadersbeginwiththeletter'i'.Toinsurenochanceforconfusion,we
droptheadjective"concrete"and"abstract"whenreferringtoamodule'sinterfaces.
AlthoughalleXpressDSP-compliantalgorithmsimplementtheIALGinterface,itisimportanttonotethat
almostalloftheTMS320DSPAlgorithmStandardmodulesmustimplementamorespecificalgorithm
interface;i.e.,theymustimplementalloftheIALGfunctionsaswellasmethodsspecifictothealgorithm.
Forexample,aG.729enCoderalgorithmmustnotonlyimplementIALG;itmustalsoimplementan
"enCode"functionthatisspecifictotheG.729algorithm.
Inthiscommoncase—wherewewanttodefineanewinterfacethatrequiresadditionalmethodsbeyond
thosedefinedbyIALG—wedefineanewinterfacethat"derivesfrom"or"inheritsfrom"theIALG
interface.Interfaceinheritanceisimplementedbysimplydefiningthenewinterface's"Fxns"structureso
thatitsfirstfieldisthe"Fxns"structurefromwhichtheinterfaceisinherited.Thus,anypointertothenew
interface's"Fxns"structurecanbetreatedasapointertotheinheritedinterface's"Fxns"structure.
InthecaseoftheG.729enCoderalgorithm,thissimplymeansthatthefirstfieldoftheG729E_Fxns
structureisanIALG_Fxnsstructure.ThisensuresthatanyG.729enCoderimplementationcanbetreated
asa"generic"eXpressDSP-compliantalgorithm.
Allinterfaces(includingthosenotcurrentlypartoftheTMS320DSPAlgorithmStandard)thatextendIALG
shouldemploythesametechnique.TheabstractIFIRinterfaceexampledefinedintheTMS320DSP
AlgorithmStandardAPIReferenceillustratesthistechnique.
Theprevioussectionsdescribedthestructuresharedbyallmodules.Recallthatmodulesarethemost
basicsoftwarecomponentofaneXpressDSP-compliantsystem.Thefollowingtablesummarizesthe
commondesignelementsforamodulenamedXYZ.
ElementDescriptionRequired
XYZ_init()XYZ_exit()Moduleinitializationandfinalizationyes
functions
xyz.hModule'sinterfacedefinitionyes
StructuretypeofallmoduleconfigurationOnlyifmodulehasglobal
XYZ_Config
parameters.configurationparameters
GlobalstructureofallmoduleconfigurationOnlyifmodulehasglobal
XYZ
parameters.configurationparameters
StructuretypedefiningallfunctionsOnlyiftheinterfaceisan
XYZ_Fxns
necessarytoimplementtheXYZinterface.abstractinterfacedefinition
Thenexttablesummarizesthecommonelementsofallmodulesthatmanageoneormoreinstance
objects.
32AlgorithmComponentModelSPRU352G–June2005–RevisedFebruary2007
SubmitDocumentationFeedback