module ti.sdo.xdcruntime.linux.SemProcessSupport
C synopsis target-domain sourced in ti/sdo/xdcruntime/linux/SemProcessSupport.xdc
#include <ti/sdo/xdcruntime/linux/SemProcessSupport.h>
Functions
Void
Void
Void
Void
Functions common to all ISemaphore modules
Int 
Bool 
Functions common to all target instances
Functions common to all target modules
Defines
#define
Typedefs
typedef enum
typedef struct
typedef struct
typedef enum
typedef struct
Constants
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Error_Id 
extern const Log_Event 
extern const Log_Event 
extern const Int 
 
const SemProcessSupport_FOREVER

Used as the timeout value to specify wait forever

C synopsis target-domain
#define SemProcessSupport_FOREVER (UInt)~(0)
enum SemProcessSupport_Mode

Types of semaphores

C synopsis target-domain
typedef enum SemProcessSupport_Mode {
    SemProcessSupport_Mode_COUNTING,
    // Counting semaphore
    SemProcessSupport_Mode_BINARY
    // Binary Semaphore
} SemProcessSupport_Mode;
enum SemProcessSupport_PendStatus

Error codes returned by Semaphore_pend

C synopsis target-domain
typedef enum SemProcessSupport_PendStatus {
    SemProcessSupport_PendStatus_ERROR,
    SemProcessSupport_PendStatus_TIMEOUT,
    SemProcessSupport_PendStatus_SUCCESS
} SemProcessSupport_PendStatus;
config SemProcessSupport_A_POSIX_Error  // module-wide
C synopsis target-domain
extern const Assert_Id SemProcessSupport_A_POSIX_Error;
config SemProcessSupport_A_invalidKey  // module-wide

Asserted in SemProcess_create

C synopsis target-domain
extern const Assert_Id SemProcessSupport_A_invalidKey;
config SemProcessSupport_A_unsupportedTimeout  // module-wide

Asserted in SemProcess_pend

C synopsis target-domain
extern const Assert_Id SemProcessSupport_A_unsupportedTimeout;
config SemProcessSupport_E_POSIX_Error  // module-wide
C synopsis target-domain
extern const Error_Id SemProcessSupport_E_POSIX_Error;
config SemProcessSupport_L_create  // module-wide
C synopsis target-domain
extern const Log_Event SemProcessSupport_L_create;
config SemProcessSupport_L_extant  // module-wide
C synopsis target-domain
extern const Log_Event SemProcessSupport_L_extant;
config SemProcessSupport_perms  // module-wide

unix-style RW perms for the underlying sem

C synopsis target-domain
extern const Int SemProcessSupport_perms;
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId SemProcessSupport_Module_id();
// Get this module's unique id
 
Bool SemProcessSupport_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle SemProcessSupport_Module_heap();
// The heap from which this module allocates memory
 
Bool SemProcessSupport_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 SemProcessSupport_Module_getMask();
// Returns the diagnostics mask for this module
 
Void SemProcessSupport_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types

C synopsis target-domain
typedef struct SemProcessSupport_Object SemProcessSupport_Object;
// Opaque internal representation of an instance object
 
typedef SemProcessSupport_Object *SemProcessSupport_Handle;
// Client reference to an instance object
 
typedef struct SemProcessSupport_Struct SemProcessSupport_Struct;
// Opaque client structure large enough to hold an instance object
 
SemProcessSupport_Handle SemProcessSupport_handle(SemProcessSupport_Struct *structP);
// Convert this instance structure pointer into an instance handle
 
SemProcessSupport_Struct *SemProcessSupport_struct(SemProcessSupport_Handle handle);
// Convert this instance handle into an instance structure pointer
Instance Config Parameters

C synopsis target-domain
typedef struct SemProcessSupport_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
    ISemaphore_Mode mode;
    // Semaphore mode. Default is COUNTING
} SemProcessSupport_Params;
 
Void SemProcessSupport_Params_init(SemProcessSupport_Params *params);
// Initialize this config-params structure with supplier-specified defaults before instance creation
config SemProcessSupport_mode  // instance

Semaphore mode. Default is COUNTING

C synopsis target-domain
      ...
    ISemaphore_Mode mode;
DETAILS
When mode is BINARY , the semaphore has only two states, available and unavailable. When mode is COUNTING, the semaphore keeps track of number of times a semaphore is posted.
Instance Creation

C synopsis target-domain
SemProcessSupport_Handle SemProcessSupport_create(Int count, Int key, const SemProcessSupport_Params *params, Error_Block *eb);
// Allocate and initialize a new instance object and return its handle
 
Void SemProcessSupport_construct(SemProcessSupport_Struct *structP, Int count, Int key, const SemProcessSupport_Params *params, Error_Block *eb);
// Initialize a new instance object inside the provided structure
ARGUMENTS
count — initial semaphore count
key — globally unique key
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)
DETAILS
This function creates a new SemProcess object which is initialized to count. All semaphores created with the same key reference the same underlying synchronization object and work between processes. The underlying synchronization object should be automatically deleted when all references to it have been deleted, and the reference count should be maintained consistently across process forks or similar operations. An implementation for a platform on which this is technically impossible (e.g. an operating system that does not support multiple processes) may provide a 'toy' implementation with behavior matching that of ISemProcessSupport.
Instance Deletion

C synopsis target-domain
Void SemProcessSupport_delete(SemProcessSupport_Handle *handleP);
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
 
Void SemProcessSupport_destruct(SemProcessSupport_Struct *structP);
// Finalize the instance object inside the provided structure
SemProcessSupport_pend()  // instance

Wait for the semaphore to become available

C synopsis target-domain
Int SemProcessSupport_pend(SemProcessSupport_Handle handle, UInt timeout, Error_Block *eb);
ARGUMENTS
handle — handle of a previously-created SemProcessSupport instance object
timeout — timeout in microseconds
eb — error block
DETAILS
RETURNS
refer to description above
SemProcessSupport_post()  // instance

Increment the semaphore count

C synopsis target-domain
Bool SemProcessSupport_post(SemProcessSupport_Handle handle, Error_Block *eb);
ARGUMENTS
handle — handle of a previously-created SemProcessSupport instance object
eb — error block
RETURNS
true for success, false for error in error block
Instance Convertors

C synopsis target-domain
ISemProcessSupport_Handle SemProcessSupport_Handle_upCast(SemProcessSupport_Handle handle);
// unconditionally move one level up the inheritance hierarchy
 
SemProcessSupport_Handle SemProcessSupport_Handle_downCast(ISemProcessSupport_Handle handle);
// conditionally move one level down the inheritance hierarchy; NULL upon failure
 
ISemaphore_Handle SemProcessSupport_Handle_upCast2(SemProcessSupport_Handle handle);
// unconditionally move 2 levels up the inheritance hierarchy
 
SemProcessSupport_Handle SemProcessSupport_Handle_downCast2(ISemaphore_Handle handle);
// conditionally move 2 levels down the inheritance hierarchy; NULL upon failure
Instance Built-Ins

C synopsis target-domain
Int SemProcessSupport_Object_count();
// The number of statically-created instance objects
 
SemProcessSupport_Handle SemProcessSupport_Object_get(SemProcessSupport_Object *array, Int i);
// The handle of the i-th statically-created instance object (array == NULL)
 
SemProcessSupport_Handle SemProcessSupport_Object_first();
// The handle of the first dynamically-created instance object, or NULL
 
SemProcessSupport_Handle SemProcessSupport_Object_next(SemProcessSupport_Handle handle);
// The handle of the next dynamically-created instance object, or NULL
 
IHeap_Handle SemProcessSupport_Object_heap();
// The heap used to allocate dynamically-created instance objects
 
Types_Label *SemProcessSupport_Handle_label(SemProcessSupport_Handle handle, Types_Label *buf);
// The label associated with this instance object
 
String SemProcessSupport_Handle_name(SemProcessSupport_Handle handle);
// The name of this instance object
 
XDCscript usage meta-domain sourced in ti/sdo/xdcruntime/linux/SemProcessSupport.xdc
var SemProcessSupport = xdc.useModule('ti.sdo.xdcruntime.linux.SemProcessSupport');
module-wide constants & types
        const SemProcessSupport.PendStatus_ERROR;
        const SemProcessSupport.PendStatus_TIMEOUT;
        const SemProcessSupport.PendStatus_SUCCESS;
module-wide config parameters
        msg: "A_POSIX_Error: a POSIX function returned failure"
    };
        msg: "A_invalidKey: params key has not been set"
    };
        msg: "A_unsupportedTimeout: Only SemProcess_FOREVER is supported"
    };
        msg: "E_POSIX_Error: a POSIX function returned failure, errno is %d"
    };
        mask: Diags.LIFECYCLE,
        msg: "--- SemProcess(%d) DNE, creating"
    };
        mask: Diags.LIFECYCLE,
        msg: "--- SemProcess(%d) already exists, incrementing reference count"
    };
per-instance config parameters
    var params = new SemProcessSupport.Params// Instance config-params object;
per-instance creation
    var inst = SemProcessSupport.create// Create an instance-object(Int count, Int key, params);
 
const SemProcessSupport.FOREVER

Used as the timeout value to specify wait forever

XDCscript usage meta-domain
const SemProcessSupport.FOREVER = ~(0);
C SYNOPSIS
enum SemProcessSupport.Mode

Types of semaphores

XDCscript usage meta-domain
values of type SemProcessSupport.Mode
    const SemProcessSupport.Mode_COUNTING;
    // Counting semaphore
    const SemProcessSupport.Mode_BINARY;
    // Binary Semaphore
C SYNOPSIS
enum SemProcessSupport.PendStatus

Error codes returned by Semaphore_pend

XDCscript usage meta-domain
values of type SemProcessSupport.PendStatus
    const SemProcessSupport.PendStatus_ERROR;
    const SemProcessSupport.PendStatus_TIMEOUT;
    const SemProcessSupport.PendStatus_SUCCESS;
C SYNOPSIS
config SemProcessSupport.A_POSIX_Error  // module-wide
XDCscript usage meta-domain
SemProcessSupport.A_POSIX_Error = Assert.Desc {
    msg: "A_POSIX_Error: a POSIX function returned failure"
};
C SYNOPSIS
config SemProcessSupport.A_invalidKey  // module-wide

Asserted in SemProcess_create

XDCscript usage meta-domain
SemProcessSupport.A_invalidKey = Assert.Desc {
    msg: "A_invalidKey: params key has not been set"
};
C SYNOPSIS
config SemProcessSupport.A_unsupportedTimeout  // module-wide

Asserted in SemProcess_pend

XDCscript usage meta-domain
SemProcessSupport.A_unsupportedTimeout = Assert.Desc {
    msg: "A_unsupportedTimeout: Only SemProcess_FOREVER is supported"
};
C SYNOPSIS
config SemProcessSupport.E_POSIX_Error  // module-wide
XDCscript usage meta-domain
SemProcessSupport.E_POSIX_Error = Error.Desc {
    msg: "E_POSIX_Error: a POSIX function returned failure, errno is %d"
};
C SYNOPSIS
config SemProcessSupport.L_create  // module-wide
XDCscript usage meta-domain
SemProcessSupport.L_create = Log.EventDesc {
    mask: Diags.LIFECYCLE,
    msg: "--- SemProcess(%d) DNE, creating"
};
C SYNOPSIS
config SemProcessSupport.L_extant  // module-wide
XDCscript usage meta-domain
SemProcessSupport.L_extant = Log.EventDesc {
    mask: Diags.LIFECYCLE,
    msg: "--- SemProcess(%d) already exists, incrementing reference count"
};
C SYNOPSIS
config SemProcessSupport.perms  // module-wide

unix-style RW perms for the underlying sem

XDCscript usage meta-domain
SemProcessSupport.perms = Int 0666;
C SYNOPSIS
metaonly config SemProcessSupport.common$  // module-wide

Common module configuration parameters

XDCscript usage meta-domain
SemProcessSupport.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.
Instance Config Parameters

XDCscript usage meta-domain
var params = new SemProcessSupport.Params;
// Instance config-params object
    params.mode = ISemaphore.Mode ISemaphore.Mode_COUNTING;
    // Semaphore mode. Default is COUNTING
config SemProcessSupport.mode  // instance

Semaphore mode. Default is COUNTING

XDCscript usage meta-domain
var params = new SemProcessSupport.Params;
  ...
DETAILS
When mode is BINARY , the semaphore has only two states, available and unavailable. When mode is COUNTING, the semaphore keeps track of number of times a semaphore is posted.
C SYNOPSIS
Instance Creation

XDCscript usage meta-domain
var params = new SemProcessSupport.Params;
// Allocate instance config-params
params.config =   ...
// Assign individual configs
 
var inst = SemProcessSupport.create(Int count, Int key, params);
// Create an instance-object
ARGUMENTS
count — initial semaphore count
key — globally unique key
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)
DETAILS
This function creates a new SemProcess object which is initialized to count. All semaphores created with the same key reference the same underlying synchronization object and work between processes. The underlying synchronization object should be automatically deleted when all references to it have been deleted, and the reference count should be maintained consistently across process forks or similar operations. An implementation for a platform on which this is technically impossible (e.g. an operating system that does not support multiple processes) may provide a 'toy' implementation with behavior matching that of ISemProcessSupport.
generated on Fri, 29 Oct 2010 00:26:49 GMT