module ti.sdo.io.drivers.Generator

Generator module

Using this module clients can simulate a device with an input channel and an output channel. Generator channels are used to generate sequences of constants, sine waves, random noise, or other streams of data defined by a user function. [ more ... ]
C synopsis target-domain sourced in ti/sdo/io/drivers/Generator.xdc
#include <ti/sdo/io/drivers/Generator.h>
Functions
Void
Void 
Functions common to all IDriver modules
Void 
Void 
Ptr 
Generator_open// Open a channel(Generator_Handle handle, String name, UInt mode, UArg chanParams, DriverTypes_DoneFxn cbFxn, UArg cbArg, Error_Block *eb);
UInt 
Functions common to all target instances
Functions common to all target modules
Defines
#define
Typedefs
typedef struct
typedef Void 
typedef struct
typedef struct
typedef struct
Constants
extern const Error_Id 
 
DETAILS
Using this module clients can simulate a device with an input channel and an output channel. Generator channels are used to generate sequences of constants, sine waves, random noise, or other streams of data defined by a user function.
When a channel is opened, the user gets to specify a function to simulate the input channel and a function to simulate the output channel characteristics.
The Generator module can be configured to process the io just like a real driver, where a submit call will return pending and io will be completed in the context of an isr. This mode is called returnPending. However the user has to call simulateIsrFxn in an isr, Swi or a Task to support this mode. In simulateIsr, one pending IO Packet for both channel for all Generator instances is processed.
 
const Generator_NUMCHANS

Number of channels per generator device

C synopsis target-domain
#define Generator_NUMCHANS (Int)2
 
DETAILS
one input and one output channel
 
typedef Generator_GenFunc

typedef for user specified I/O generators

C synopsis target-domain
typedef Void (*Generator_GenFunc)(Ptr,SizeT,UArg);
 
DETAILS
Functions of this type get passed the buffer, buffer size and a function specific argument
 
struct Generator_ChanParams

Channel parameters used along with open

C synopsis target-domain
typedef struct Generator_ChanParams {
    Generator_GenFunc userFxn;
    UArg userArg;
    Bool returnPending;
} Generator_ChanParams;
 
 
config Generator_E_nullParams  // module-wide

Error raised when NULL chanParams is specified

C synopsis target-domain
extern const Error_Id Generator_E_nullParams;
 
 
Generator_simulateIsr()  // module-wide

This function is used to give energy to the Generator driver to process its IO packets. It simulates real ISR

C synopsis target-domain
Void Generator_simulateIsr(UArg arg);
 
DETAILS
The application needs to call this function within a hwi, swi or task thread if any channels are opened in returnPending mode.
The Generator module will process all channels with returnPending set to true within this function. One packet per channel for all generator instances gets processed during a single call to this function.
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId Generator_Module_id();
// Get this module's unique id
 
Bool Generator_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle Generator_Module_heap();
// The heap from which this module allocates memory
 
Bool Generator_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 Generator_Module_getMask();
// Returns the diagnostics mask for this module
 
Void Generator_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types

C synopsis target-domain
typedef struct Generator_Object Generator_Object;
// Opaque internal representation of an instance object
 
typedef Generator_Object *Generator_Handle;
// Client reference to an instance object
 
typedef struct Generator_Struct Generator_Struct;
// Opaque client structure large enough to hold an instance object
 
Generator_Handle Generator_handle(Generator_Struct *structP);
// Convert this instance structure pointer into an instance handle
 
Generator_Struct *Generator_struct(Generator_Handle handle);
// Convert this instance handle into an instance structure pointer
Instance Config Parameters

C synopsis target-domain
typedef struct Generator_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
} Generator_Params;
 
Void Generator_Params_init(Generator_Params *params);
// Initialize this config-params structure with supplier-specified defaults before instance creation
 
Generator_close()  // instance

Close a channel. Raises an error upon failure

C synopsis target-domain
Void Generator_close(Generator_Handle handle, Ptr chanHandle, Error_Block *eb);
 
ARGUMENTS
handle — handle of a previously-created Generator instance object
chanHandle — opaque channel handle
eb — error block
DETAILS
For example, trying to close a channel which is NOT in use could raise an error. The error could be driver specific or generic errors defined by ti.sdo.io.DriverTypes
 
Generator_control()  // instance

Send driver specific command to channel or associated device

C synopsis target-domain
Void Generator_control(Generator_Handle handle, Ptr chanHandle, DriverTypes_ControlCmd cmd, UArg cmdArgs, Error_Block *eb);
 
ARGUMENTS
handle — handle of a previously-created Generator instance object
chanHandle — opaque channel handle
cmd — control command
cmdArgs — command argument
eb — error block
 
Generator_open()  // instance

Open a channel

C synopsis target-domain
Ptr Generator_open(Generator_Handle handle, String name, UInt mode, UArg chanParams, DriverTypes_DoneFxn cbFxn, UArg cbArg, Error_Block *eb);
 
ARGUMENTS
handle — handle of a previously-created Generator instance object
name — name string
mode — open mode for channel
chanParams — driver specific channel parameters
cbFxn — callback function
cbArg — callback function arg
eb — error block
RETURNS
opaque channel handle
DETAILS
Use this function to open a channel. The name parameter allows for driver specific configuration. e.g when a channel id is required. The name will be null for most drivers. The mode is either ti.sdo.io.DriverTypes.INPUT or ti.sdo.io.DriverTypes.OUTPUT. chanParams are driver specific. When chanparams is null driver will use default params which were statically configured. The callback function and arg are used to indicate completion of IO after an async submit call. The driver will raise an error when open fails and the error block will contain a driver specific error or a generic error defined by ti.sdo.io.DriverTypes. open returns a driver specific opaque channel handle. Note that open() can be called at Startup time and the driver has to ensure that open() returns the channel pointer even though the driver startup has not been called.
 
Generator_submit()  // instance

Submit io packet to a channel. This may result in a callback

C synopsis target-domain
UInt Generator_submit(Generator_Handle handle, Ptr chanHandle, DriverTypes_Packet *packet, Error_Block *eb);
 
ARGUMENTS
handle — handle of a previously-created Generator instance object
chanHandle — opaque channel handle
packet — io packet
eb — error block
RETURNS
status (DriverTypes_COMPLETED/PENDING/ERROR)
DETAILS
The driver may be able to complete the IO immediately and will return ti.sdo.io.DriverTypes.COMPLETED status. If the driver requires an async callback then, it will return ti.sdo.io.DriverTypes.PENDING. When the driver raises an error, it will return ti.sdo.io.DriverTypes.ERROR and the caller need to check the error block. In case the return value is ti.sdo.io.DriverTypes.PENDING, the driver will call the function specified during open with the IO packet.
Instance Convertors

C synopsis target-domain
IDriver_Handle Generator_Handle_upCast(Generator_Handle handle);
// unconditionally move one level up the inheritance hierarchy
 
Generator_Handle Generator_Handle_downCast(IDriver_Handle handle);
// conditionally move one level down the inheritance hierarchy; NULL upon failure
Instance Built-Ins

C synopsis target-domain
Int Generator_Object_count();
// The number of statically-created instance objects
 
Generator_Handle Generator_Object_get(Generator_Object *array, Int i);
// The handle of the i-th statically-created instance object (array == NULL)
 
Generator_Handle Generator_Object_first();
// The handle of the first dynamically-created instance object, or NULL
 
Generator_Handle Generator_Object_next(Generator_Handle handle);
// The handle of the next dynamically-created instance object, or NULL
 
IHeap_Handle Generator_Object_heap();
// The heap used to allocate dynamically-created instance objects
 
Types_Label *Generator_Handle_label(Generator_Handle handle, Types_Label *buf);
// The label associated with this instance object
 
String Generator_Handle_name(Generator_Handle handle);
// The name of this instance object
 
XDCscript usage meta-domain sourced in ti/sdo/io/drivers/Generator.xdc
var Generator = xdc.useModule('ti.sdo.io.drivers.Generator');
module-wide constants & types
 
    var obj = new Generator.BasicView// ;
        obj.label = String  ...
 
        obj.userFxn = Void(*)(Ptr,SizeT,UArg)  ...
        obj.userArg = UArg  ...
        obj.returnPending = Bool  ...
 
    var obj = new Generator.GeneratorView// ;
        obj.mode = String  ...
        obj.inUse = Bool  ...
        obj.returnPending = Bool  ...
        obj.callbackFxn = String[]  ...
        obj.callbackArg = UArg  ...
        obj.userFxn = String[]  ...
        obj.userArg = UArg  ...
module-wide config parameters
        msg: "E_nullParams: chanParams is null."
    };
 
per-instance config parameters
    var params = new Generator.Params// Instance config-params object;
 
 
const Generator.NUMCHANS

Number of channels per generator device

XDCscript usage meta-domain
const Generator.NUMCHANS = 2;
 
DETAILS
one input and one output channel
C SYNOPSIS
 
metaonly struct Generator.BasicView
XDCscript usage meta-domain
var obj = new Generator.BasicView;
 
    obj.label = String  ...
 
 
struct Generator.ChanParams

Channel parameters used along with open

XDCscript usage meta-domain
var obj = new Generator.ChanParams;
 
    obj.userFxn = Void(*)(Ptr,SizeT,UArg)  ...
    obj.userArg = UArg  ...
    obj.returnPending = Bool  ...
 
C SYNOPSIS
 
metaonly struct Generator.GeneratorView
XDCscript usage meta-domain
var obj = new Generator.GeneratorView;
 
    obj.mode = String  ...
    obj.inUse = Bool  ...
    obj.returnPending = Bool  ...
    obj.callbackFxn = String[]  ...
    obj.callbackArg = UArg  ...
    obj.userFxn = String[]  ...
    obj.userArg = UArg  ...
 
 
config Generator.E_nullParams  // module-wide

Error raised when NULL chanParams is specified

XDCscript usage meta-domain
Generator.E_nullParams = Error.Desc {
    msg: "E_nullParams: chanParams is null."
};
 
C SYNOPSIS
 
metaonly config Generator.common$  // module-wide

Common module configuration parameters

XDCscript usage meta-domain
Generator.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
 
metaonly config Generator.rovViewInfo  // module-wide
XDCscript usage meta-domain
Generator.rovViewInfo = ViewInfo.Instance ViewInfo.create;
 
Instance Config Parameters

XDCscript usage meta-domain
var params = new Generator.Params;
// Instance config-params object
generated on Sat, 11 Feb 2012 00:37:43 GMT