This module allows the user to create instances which modify a data stream
by applying a function to each point produced or consumed by an underlying
driver. The number of transformer instances in the system is limited only
by the availability of memory;
This module implements
ti.sdo.io.IConverter interface and as such is
only usable with
ti.sdo.io.Stream. IConverter instances are added to
a table within Stream and they can be linked together to form an IO
stack/chain.
For example, is "/scale" is a Transformer instance in the stream table
and "/adc" is a driver in
ti.sdo.io.DriverTable then the name
"/scale/adc" can be used to create a Stream instance.
For every Transformer instance the user can supply a tranfer function.
Transformer provides three of these functions -
multiply,
fix2flt and
flt2fix.
const Transformer_Q_TERMINATING |
|
Terminating quality
#define Transformer_Q_TERMINATING (Int)1
DETAILS
Implementations with this "quality" can be at the bottom of the IO
stack
typedef Transformer_DoneFxn |
|
Typedef for callback function
typedef Void (*Transformer_DoneFxn)(UArg);
DETAILS
The IConverter instance lower in the stack will invoke this callback
whenever an I/O operation completes.
typedef Transformer_TransFunc |
|
typedefs for transformer function
typedef Void (*Transformer_TransFunc)(Ptr,SizeT,UArg);
DETAILS
Functions of this type get passed the buffer, buffer size and a
function specific argument. The function should NOT act on the buffer
if buffer is NULL or buffer size is zero.
Transformer_fix2flt() // module-wide |
|
fix2flt converts each data point from fixed point to floating point
Void Transformer_fix2flt(Ptr addr, SizeT size, UArg scaleFactor);
DETAILS
This function ignores the scaleFactor.
Transformer_flt2fix() // module-wide |
|
flt2fix converts each data point from floating point to fixed point
Void Transformer_flt2fix(Ptr addr, SizeT size, UArg scalePtr);
DETAILS
This function ignores the scaleFactor.
Transformer_multiply() // module-wide |
|
multiply function mutiples each data point with a scale value
Void Transformer_multiply(Ptr addr, SizeT size, UArg scaleFactor);
DETAILS
This function casts the scaleFactor to a UInt before using it.
If arg is NULL a scaleFactor of 1 is used.
Module-Wide Built-Ins |
|
// Get this module's unique id
Bool Transformer_Module_startupDone();
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool Transformer_Module_hasMask();
// Test whether this module has a diagnostics mask
Bits16 Transformer_Module_getMask();
// Returns the diagnostics mask for this module
Void Transformer_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types |
|
typedef struct Transformer_Object Transformer_Object;
// Opaque internal representation of an instance object
// Client reference to an instance object
typedef struct Transformer_Struct Transformer_Struct;
// Opaque client structure large enough to hold an instance object
// Convert this instance structure pointer into an instance handle
// Convert this instance handle into an instance structure pointer
Instance Config Parameters |
|
typedef struct Transformer_Params {
// Instance config-params structure
// Common per-instance configs
UArg arg;
// Arg to be used with transform functions
} Transformer_Params;
// Initialize this config-params structure with supplier-specified defaults before instance creation
config Transformer_arg // instance |
|
Arg to be used with transform functions
config Transformer_fxn // instance |
|
Function can be multiply, fix2flt
or flt2fix or a user specific function
Transformer_close() // instance |
|
Close an IConverter Instance
ARGUMENTS
handle
handle of a previously-created Transformer instance object
eb
error block
Transformer_control() // instance |
|
Send a control command
ARGUMENTS
handle
handle of a previously-created Transformer instance object
cmd
control cmd
cmdArg
control cmd arg
eb
error block
DETAILS
The IConverter will respond to command meant for it and pass down all
others.
Transformer_issue() // instance |
|
Issue a packet for IO
ARGUMENTS
handle
handle of a previously-created Transformer instance object
packet
IO packet
eb
Error Block
DETAILS
The IConverter might work on the buffer of data if the mode is
ti.sdo.io.DriverTypes.OUTPUT and call the issue function for the
IConverter lower in the stack. Some IConverters may be the last in
the IO stack. issue() always results in a callback.
Transformer_open() // instance |
|
Opens the IConverter Instance
ARGUMENTS
handle
handle of a previously-created Transformer instance object
name
remaining name
mode
DriverTypes_INPUT/OUTPUT
chanParams
channel params for driver at the bottom of stack
cbFxn
callback function
cbArg
callback function arg
eb
error block
DETAILS
This is called at runtime after the IConverter instance has been
created. This function opens the IConverter instance lower in the
stack and gives its callback function and arg.
Transformer_query() // instance |
|
Query for qualities supported
ARGUMENTS
handle
handle of a previously-created Transformer instance object
qual
quality to be tested
Transformer_reclaim() // instance |
|
Reclaim a previously issued packet
ARGUMENTS
handle
handle of a previously-created Transformer instance object
packetp
pointer to returned packet
eb
Error Block
DETAILS
The IConverter will call the reclaim function for the
IConverter lower in the stack. It may work on the buffer of data
returned if the mode is
ti.sdo.io.DriverTypes.INPUT.
Instance Convertors |
|
// unconditionally move one level up the inheritance hierarchy
// conditionally move one level down the inheritance hierarchy; NULL upon failure
Instance Built-Ins |
|
Int Transformer_Object_count();
// The number of statically-created instance objects
// The handle of the i-th statically-created instance object (array == NULL)
// The handle of the first dynamically-created instance object, or NULL
// The handle of the next dynamically-created instance object, or NULL
// The heap used to allocate dynamically-created instance objects
// The label associated with this instance object
// The name of this instance object