This module allows users to plug in their own
functions for signal, wait and query.
const SyncGeneric_NO_WAIT |
|
Used to specify no waiting
#define SyncGeneric_NO_WAIT (UInt)0
const SyncGeneric_Q_BLOCKING |
|
Blocking quality
#define SyncGeneric_Q_BLOCKING (Int)1
DETAILS
Implementations with this "quality" may cause the calling thread to
block;
const SyncGeneric_WAIT_FOREVER |
|
Used to wait forever
#define SyncGeneric_WAIT_FOREVER (UInt)~(0)
enum SyncGeneric_WaitStatus |
|
Error codes returned by ISync_wait
typedef enum SyncGeneric_WaitStatus {
SyncGeneric_WaitStatus_ERROR,
SyncGeneric_WaitStatus_TIMEOUT,
SyncGeneric_WaitStatus_SUCCESS
} SyncGeneric_WaitStatus;
typedef SyncGeneric_QueryFunc |
|
typedef for user specified wait function
typedef Bool (*SyncGeneric_QueryFunc)(Int);
typedef SyncGeneric_SignalFunc |
|
typedef for user specified signal function
typedef Void (*SyncGeneric_SignalFunc)(UArg);
typedef SyncGeneric_WaitFunc |
|
typedef for user specified wait function
typedef Bool (*SyncGeneric_WaitFunc)(UArg,UInt);
Module-Wide Built-Ins |
|
// Get this module's unique id
Bool SyncGeneric_Module_startupDone();
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool SyncGeneric_Module_hasMask();
// Test whether this module has a diagnostics mask
Bits16 SyncGeneric_Module_getMask();
// Returns the diagnostics mask for this module
Void SyncGeneric_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types |
|
typedef struct SyncGeneric_Object SyncGeneric_Object;
// Opaque internal representation of an instance object
// Client reference to an instance object
typedef struct SyncGeneric_Struct SyncGeneric_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 SyncGeneric_Params {
// Instance config-params structure
// Common per-instance configs
UArg signalArg;
// user signal function arg
// user query function
// user signal function
// user wait function
UArg waitArg;
// user wait function arg
} SyncGeneric_Params;
// Initialize this config-params structure with supplier-specified defaults before instance creation
config SyncGeneric_signalArg // instance |
|
user signal function arg
config SyncGeneric_userQuery // instance |
|
user query function
config SyncGeneric_userSignal // instance |
|
user signal function
config SyncGeneric_userWait // instance |
|
user wait function
config SyncGeneric_waitArg // instance |
|
user wait function arg
Instance Creation |
|
// Allocate and initialize a new instance object and return its handle
// Initialize a new instance object inside the provided structure
ARGUMENTS
params
per-instance config params, or NULL to select default values (target-domain only)
eb
active error-handling block, or NULL to select default policy (target-domain only)
Instance Deletion |
|
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
// Finalize the instance object inside the provided structure
SyncGeneric_query() // instance |
|
Query for a particular quality
ARGUMENTS
handle
handle of a previously-created SyncGeneric instance object
qual
quality
RETURNS
TRUE or FALSE.
DETAILS
FALSE is returned if quality not supported.
SyncGeneric_signal() // instance |
|
Called at completion of an activity
ARGUMENTS
handle
handle of a previously-created SyncGeneric instance object
DETAILS
This function is non-blocking. It is also required that the underlying
sync be binary in nature.
This function does not take an Error.Block intentionally because
it can be called from ISR context.
SyncGeneric_wait() // instance |
|
Called to wait/poll for completion of an activity
ARGUMENTS
handle
handle of a previously-created SyncGeneric instance object
timeout
Timeout in microseconds
eb
Hist Pointer to Error.Block
RETURNS
Refer to description above
DETAILS
This function can block. Non-blocking implementations should return
WaitStatus_TIMEOUT to indicate a timeout.
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 SyncGeneric_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
const SyncGeneric.NO_WAIT |
|
Used to specify no waiting
XDCscript usage |
meta-domain |
const SyncGeneric.NO_WAIT = 0;
C SYNOPSIS
const SyncGeneric.Q_BLOCKING |
|
Blocking quality
XDCscript usage |
meta-domain |
const SyncGeneric.Q_BLOCKING = 1;
DETAILS
Implementations with this "quality" may cause the calling thread to
block;
C SYNOPSIS
const SyncGeneric.WAIT_FOREVER |
|
Used to wait forever
XDCscript usage |
meta-domain |
const SyncGeneric.WAIT_FOREVER = ~(0);
C SYNOPSIS
enum SyncGeneric.WaitStatus |
|
Error codes returned by ISync_wait
XDCscript usage |
meta-domain |
values of type SyncGeneric.WaitStatus
const SyncGeneric.WaitStatus_ERROR;
const SyncGeneric.WaitStatus_TIMEOUT;
const SyncGeneric.WaitStatus_SUCCESS;
C SYNOPSIS
metaonly config SyncGeneric.common$ // module-wide |
|
Common module configuration parameters
XDCscript usage |
meta-domain |
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.
Instance Config Parameters |
|
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
// Instance config-params object
params.signalArg = UArg null;
// user signal function arg
params.userQuery = Bool(*)(Int) null;
// user query function
params.userSignal = Void(*)(UArg) null;
// user signal function
params.userWait = Bool(*)(UArg,UInt) null;
// user wait function
params.waitArg = UArg null;
// user wait function arg
config SyncGeneric.signalArg // instance |
|
user signal function arg
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.signalArg = UArg null;
C SYNOPSIS
config SyncGeneric.userQuery // instance |
|
user query function
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.userQuery = Bool(*)(Int) null;
C SYNOPSIS
config SyncGeneric.userSignal // instance |
|
user signal function
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.userSignal = Void(*)(UArg) null;
C SYNOPSIS
config SyncGeneric.userWait // instance |
|
user wait function
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.userWait = Bool(*)(UArg,UInt) null;
C SYNOPSIS
config SyncGeneric.waitArg // instance |
|
user wait function arg
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.waitArg = UArg null;
C SYNOPSIS
Instance Creation |
|
XDCscript usage |
meta-domain |
var params =
new SyncGeneric.
Params;
// Allocate instance config-params
params.config = ...
// Assign individual configs
var inst = SyncGeneric.create(params);
// Create an instance-object
ARGUMENTS
params
per-instance config params, or NULL to select default values (target-domain only)
eb
active error-handling block, or NULL to select default policy (target-domain only)