www.ti.com
Interfaces and Modules
module'sheader 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
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'sinterfaces.
3.1.10 Interface Inheritance
Although all
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"
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.
3.1.11 Summary
The previous sections described the structure shared by all modules. Recall that modules are the most basic software component of an
Element
XYZ_init() XYZ_exit()
xyz.h
XYZ_Config
XYZ
XYZ_Fxns
Description | Required |
Module initialization and finalization | yes |
functions |
|
Module'sinterface definition | yes |
Structure type of all module configuration | Only if module has global |
parameters. | configuration parameters |
Global structure of all module configuration | Only if module has global |
parameters. | configuration parameters |
Structure type defining all functions | Only if the interface is an |
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 |