Computer Hardware Algorithm Standard User's Guide

Table Of Contents
www.ti.com
3.1.10 Interface Inheritance
3.1.11 Summary
Interfaces and Modules
module's header file defines a concrete interface; the functions defined in the header uniquely identify a
specific (or concrete) implementation within a system. A special type of interface header is used to define
abstract interfaces; abstract interfaces define functions that are implemented by more than one module in
a system. An abstract interface header is identical to a normal module interface header except that it
declares a structure of function pointers named XYZ_Fxns. A module ABC is said to implement an
abstract interface XYZ if it declares and initializes a static structure of type XYZ_Fxns named ABC_XYZ.
The TMS320 DSP Algorithm Standard API Reference (SPRU360) contains all of the abstract interface
definitions for eXpressDSP-compliant algorithms. All eXpressDSP-compliant algorithm modules, for
example, must implement the IALG interface. Appendix A of the TMS320 DSP Algorithm Standard API
Reference document contains an example of a module that implements the IALG interface.
By convention, all abstract interface headers begin with the letter 'i'. To insure no chance for confusion, we
drop the adjective "concrete" and "abstract" when referring to a module's interfaces.
Although all eXpressDSP-compliant algorithms implement the IALG interface, it is important to note that
almost all of the TMS320 DSP Algorithm Standard modules must implement a more specific algorithm
interface; i.e., they must implement all of the IALG functions as well as methods specific to the algorithm.
For example, a G.729 enCoder algorithm must not only implement IALG; it must also implement an
"enCode" function that is specific to the G.729 algorithm.
In this common case where we want to define a new interface that requires additional methods beyond
those defined by IALG we define a new interface that "derives from" or "inherits from" the IALG
interface. Interface inheritance is implemented by simply defining the new interface's "Fxns" structure so
that its first field is the "Fxns" structure from which the interface is inherited. Thus, any pointer to the new
interface's "Fxns" structure can be treated as a pointer to the inherited interface's "Fxns" structure.
In the case of the G.729 enCoder algorithm, this simply means that the first field of the G729E_Fxns
structure is an IALG_Fxns structure. This ensures that any G.729 enCoder implementation can be treated
as a "generic" eXpressDSP-compliant algorithm.
All interfaces (including those not currently part of the TMS320 DSP Algorithm Standard) that extend IALG
should employ the same technique. The abstract IFIR interface example defined in the TMS320 DSP
Algorithm Standard API Reference illustrates this technique.
The previous sections described the structure shared by all modules. Recall that modules are the most
basic software component of an eXpressDSP-compliant system. The following table summarizes the
common design elements for a module named XYZ.
Element Description Required
XYZ_init() XYZ_exit() Module initialization and finalization yes
functions
xyz.h Module's interface definition yes
Structure type of all module configuration Only if module has global
XYZ_Config
parameters. configuration parameters
Global structure of all module configuration Only if module has global
XYZ
parameters. configuration parameters
Structure type defining all functions Only if the interface is an
XYZ_Fxns
necessary to implement the XYZ interface. abstract interface definition
The next table summarizes the common elements of all modules that manage one or more instance
objects.
32 Algorithm Component Model SPRU352G June 2005 Revised February 2007
Submit Documentation Feedback