IALG - Algorithm Instance Interface
In some cases, an implementation of IALG does not require any processing for a particular method.
Rather than require the implementation to implement functions that simply return to the caller,
implementations are allowed to set function pointer to NULL. This allows the client to avoid unnecessarily
calling functions that do nothing and avoids the code space overhead of these functions.
1. Instance object creation, initialization, and deletion
2. Algorithmic processing
3. Instance object control and relocation
The functions defined in IALG_Fxns fall into several categories. Instance object creation is complicated by
removing memory allocation from the algorithm. In order for an algorithm to be used in a variety of
applications, decisions about memory overlays and preemption must be made by the client rather than the
algorithm. Thus, it is important to give the client as much control over memory management as possible.
The functions algAlloc(), algInit(), and algFree( ) allow the algorithm to communicate its memory
requirements to the client, let the algorithm initialize the memory allocated by the client, and allow the
algorithm to communicate the memory to be freed when an instance is no longer required. Note that these
operations are not called in time-critical sections of an application.Please note that the following
enhancement affecting allocation, management, and sharing of memory resources is introduced in the
current revision of this document (SPRU360C).
• The algorithm may now provide the client, during the algAlloc() call, the base address of any statically
initialized IALG_WRITEONCE persistent buffer it is requesting. If the algorithm provides a base
address, the client may simply use it to initialize the instance object without allocating any additional
memory; otherwise, the client allocates and grants the memory as if it is a standard memory request.
However, the client may arrange sharing of write-once persistent buffers by granting multiple instances
of the same algorithm created with identical parameters, the same set of write-once persistent buffers.
This enhancement provides a simple mechanism for sharing run-time relocatable read-only look-up
tables.
Once an algorithm instance object is created, it can be used to process data in real-time. The sub-classes
of IALG define other entry points to algorithmic processing supported by eXpressDSP-compliant
algorithms. Prior to invoking any of these methods, clients are required to activate the instance object via
the algActivate( ) method. The algActivate( ) method provides a notification to the algorithm instance that
one or more algorithm processing methods is about to be run zero or more times in succession. After the
processing methods have been run, the client calls the algDeactivate method prior to reusing any of the
instance's scratch memory. The algActivate( ) and algDeactivate( ) methods give the algorithm a chance
to initialize and save scratch memory that is outside the main algorithm-processing loop defined by its
extensions of the IALG interface.
The final two methods defined by the IALG interface are algControl( ) and algMoved( ). The algControl( )
operation provides a standard way to control an algorithm instance and receive status information from the
algorithm in real-time. The algMoved( ) operation allows the client to move an algorithm instance to
physically different memory. Since the algorithm instance object may contain references to the internal
buffer that may be moved by the client, the client is required to call the algMoved( ) method whenever the
client moves an object instance.
The following figure summarizes the only valid sequences of execution of the IALG_Fxns functions for a
particular algorithm instance.
16 Algorithm Interfaces SPRU360E – February 2005 – Revised February 2007
Submit Documentation Feedback