Texas Instruments TMS320 User Manual page 60

Dsp/bios v5.40
Hide thumbs Also See for TMS320:
Table of Contents

Advertisement

Using C++ with DSP/BIOS
Example 2-6. Wrapper Function for a Class Method
2.9.4
Class Constructors and Destructors
2-30
Void wrapper (SampleClass myObject)
{
myObject->method();
}
Any additional parameters that the class method requires can be passed to
the wrapper function.
Any time that a C++ class object is instantiated, the class constructor
executes. Likewise, any time that a class object is deleted, the class
destructor is called. Therefore, when writing constructors and destructors,
you should consider the times at which the functions are expected to execute
and tailor them accordingly. It is important to consider what type of thread will
be running when the class constructor or destructor is invoked.
Various guidelines apply to which DSP/BIOS API functions can be called
from different DSP/BIOS threads (tasks, software interrupts, and hardware
interrupts). For example, memory allocation APIs such as MEM_alloc and
MEM_calloc cannot be called from within the context of a software interrupt.
Thus, if a particular class is instantiated by a software interrupt, its constructor
must avoid performing memory allocation. Similarly, it is important to keep in
mind the time at which a class destructor is expected to run. Not only does a
class destructor execute when an object is explicitly deleted, but also when a
local object goes out of scope. You need to be aware of what type of thread
is executing when the class destructor is called and make only those
DSP/BIOS API calls that are appropriate for that thread. For further
information on function callability, see the TMS320 DSP/BIOS API Reference
Guide for your platform.

Advertisement

Table of Contents
loading

Table of Contents