This module allows users to plug in their own
functions for signal, wait and query.
const SyncGeneric.NO_WAIT |
![](../../../Arrow_up.png) |
Used to specify no waiting
XDCscript usage |
meta-domain |
const SyncGeneric.NO_WAIT = 0;
#define SyncGeneric_NO_WAIT (UInt)0
const SyncGeneric.Q_BLOCKING |
![](../../../Arrow_up.png) |
Blocking quality
XDCscript usage |
meta-domain |
const SyncGeneric.Q_BLOCKING = 1;
#define SyncGeneric_Q_BLOCKING (Int)1
DETAILS
Implementations with this "quality" may cause the calling thread to
block;
const SyncGeneric.WAIT_FOREVER |
![](../../../Arrow_up.png) |
Used to wait forever
XDCscript usage |
meta-domain |
const SyncGeneric.WAIT_FOREVER = ~(0);
#define SyncGeneric_WAIT_FOREVER (UInt)~(0)
enum SyncGeneric.WaitStatus |
![](../../../Arrow_up.png) |
Error codes returned by Semaphore_pend
XDCscript usage |
meta-domain |
values of type SyncGeneric.WaitStatus
const SyncGeneric.WaitStatus_ERROR;
const SyncGeneric.WaitStatus_TIMEOUT;
const SyncGeneric.WaitStatus_SUCCESS;
typedef enum SyncGeneric_WaitStatus {
SyncGeneric_WaitStatus_ERROR,
SyncGeneric_WaitStatus_TIMEOUT,
SyncGeneric_WaitStatus_SUCCESS
} SyncGeneric_WaitStatus;
typedef SyncGeneric.QueryFunc |
![](../../../Arrow_up.png) |
typedef for user specified wait function
typedef Bool (*SyncGeneric_QueryFunc)(Int);
typedef SyncGeneric.SignalFunc |
![](../../../Arrow_up.png) |
typedef for user specified signal function
typedef Void (*SyncGeneric_SignalFunc)(UArg);
typedef SyncGeneric.WaitFunc |
![](../../../Arrow_up.png) |
typedef for user specified wait function
typedef Bool (*SyncGeneric_WaitFunc)(UArg,UInt);
metaonly config SyncGeneric.common$ // module-wide |
![](../../../Arrow_up.png) |
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.
module-wide built-ins |
![](../../../Arrow_up.png) |
// 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
per-instance object types |
![](../../../Arrow_up.png) |
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
per-instance config parameters |
![](../../../Arrow_up.png) |
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
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 // per-instance |
![](../../../Arrow_up.png) |
user signal function arg
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.signalArg = UArg null;
config SyncGeneric.userQuery // per-instance |
![](../../../Arrow_up.png) |
user query function
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.userQuery = Bool(*)(Int) null;
config SyncGeneric.userSignal // per-instance |
![](../../../Arrow_up.png) |
user signal function
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.userSignal = Void(*)(UArg) null;
config SyncGeneric.userWait // per-instance |
![](../../../Arrow_up.png) |
user wait function
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.userWait = Bool(*)(UArg,UInt) null;
config SyncGeneric.waitArg // per-instance |
![](../../../Arrow_up.png) |
user wait function arg
XDCscript usage |
meta-domain |
var params = new SyncGeneric.Params;
...
params.waitArg = UArg null;
per-instance creation |
![](../../../Arrow_up.png) |
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
// 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)
per-instance deletion |
![](../../../Arrow_up.png) |
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
// Finalize the instance object inside the provided structure
SyncGeneric.query( ) // per-instance |
![](../../../Arrow_up.png) |
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( ) // per-instance |
![](../../../Arrow_up.png) |
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( ) // per-instance |
![](../../../Arrow_up.png) |
Called to wait/poll for completion of an activity
ARGUMENTS
handle
handle of a previously-created SyncGeneric instance object
timeout
Timeout
eb
Hist Pointer to Error.Block
RETURNS
Refer to description above
DETAILS
This function can block. Non-blocking implementations should return
false to indicate a timeout.
per-instance convertors |
![](../../../Arrow_up.png) |
// unconditionally move one level up the inheritance hierarchy
// conditionally move one level down the inheritance hierarchy; NULL upon failure
per-instance built-ins |
![](../../../Arrow_up.png) |
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