Operating System Abstraction Layer API. More...
#include <stdlib.h>#include <pthread.h>#include <clCommon.h>#include <clTimerApi.h>#include <clHeapApi.h>#include <clArchHeaders.h>#include <semaphore.h>Go to the source code of this file.
Macros | |
| #define | CL_OSAL_MIN_STACK_SIZE 196608 |
| This is required while Thread or Task creation. | |
| #define | CL_OSAL_NAME_MAX 32 |
| The maximum length of thread/task names. | |
| #define | CL_OSAL_SHM_EXCEPTION_LENGTH 2048 |
| Shared memory area definition. | |
Typedefs | |
| typedef ClOsalCondT * | ClOsalCondIdT |
| The type of an identifier to the OSAL condition ID. | |
| typedef pthread_cond_t | ClOsalCondT |
| The thread condition type wrapped. | |
| typedef ClOsalMutexT * | ClOsalMutexIdT |
| The type of an identifier to the OSAL Mutex ID. | |
| typedef ClUint32T | ClOsalPidT |
| The type of an identifier to the OSAL Process ID. | |
| typedef void(* | ClOsalProcessFuncT )(void *) |
| CAllback type of callback function invoked when a process is created. | |
| typedef ClHandleT | ClOsalSemIdT |
| The type of an identifier to the OSAL Semaphore ID. | |
| typedef enum ClOsalSharedMutexFlags | ClOsalSharedMutexFlagsT |
| The mutex type to be initialized. | |
| typedef ClUint32T | ClOsalShmIdT |
| The type of an identifier to the OSAL Shared Memory ID. | |
| typedef ClPtrT | ClOsalTaskDataT |
| The type of an identifier to the OSAL Task Data type. | |
| typedef ClUint64T | ClOsalTaskIdT |
| The type of an identifier to the OSAL Task ID. | |
| typedef void(* | ClOsalTaskKeyDeleteCallBackT )(void *) |
| CAllback type of callback function invoked when the task specific private key is destruyed. | |
Enumerations | |
| enum | ClOsalProcessFlagT { CL_OSAL_PROCESS_WITH_NEW_SESSION = CL_BIT(0), CL_OSAL_PROCESS_WITH_NEW_GROUP = CL_BIT(1) } |
| Process creation flags. More... | |
| enum | ClOsalSchedulePolicyT { CL_OSAL_SCHED_OTHER = SCHED_OTHER, CL_OSAL_SCHED_FIFO = SCHED_FIFO, CL_OSAL_SCHED_RR = SCHED_RR } |
| The following enumeration type contains schedule policy of the tasks that will be created. More... | |
| enum | ClOsalSharedMutexFlags |
| The mutex type to be initialized. | |
| enum | ClOsalShmSecurityModeFlagT { CL_OSAL_SHM_MODE_READ_USER = 0x0100, CL_OSAL_SHM_MODE_READ_GROUP = 0x0020, CL_OSAL_SHM_MODE_READ_OTHERS = 0x0004, CL_OSAL_SHM_MODE_WRITE_USER = 0x0080, CL_OSAL_SHM_MODE_WRITE_GROUP = 0x0010, CL_OSAL_SHM_MODE_WRITE_OTHERS = 0x0002 } |
| Shared memory security options. More... | |
| enum | ClOsalThreadPriorityT { CL_OSAL_THREAD_PRI_NOT_APPLICABLE = 0, CL_OSAL_THREAD_PRI_HIGH = 160, CL_OSAL_THREAD_PRI_MEDIUM = 80, CL_OSAL_THREAD_PRI_LOW = 1 } |
| The following enumeration type contains the various thread priorities. More... | |
Functions | |
| ClRcT | clOsalCondBroadcast (ClOsalCondIdT conditionId) |
| Broadcasts a condition. | |
| ClRcT | clOsalCondCreate (ClOsalCondIdT *pConditionId) |
| Creates a condition variable. | |
| ClRcT | clOsalCondDelete (ClOsalCondIdT conditionId) |
| Deletes a condition variable. | |
| ClRcT | clOsalCondDestroy (ClOsalCondT *pCond) |
| Destroys a condition variable. | |
| ClRcT | clOsalCondInit (ClOsalCondT *pCond) |
| Initializes a condition variable. | |
| ClRcT | clOsalCondSignal (ClOsalCondIdT conditionId) |
| Signals a condition. | |
| ClRcT | clOsalCondWait (ClOsalCondIdT conditionId, ClOsalMutexIdT mutexId, ClTimerTimeOutT time) |
| Waits for a condition. | |
| ClRcT | clOsalFinalize (void) |
| ClRcT | clOsalInitialize (const ClPtrT pConfig) |
| Initializes the Operating System Abstraction Layer (OSAL). | |
| ClRcT | clOsalMutexCreate (ClOsalMutexIdT *pMutexId) |
| Creates a mutex. | |
| ClRcT | clOsalMutexCreateAndLock (ClOsalMutexIdT *pMutexId) |
| Creates a mutex in locked state. | |
| ClRcT | clOsalMutexDelete (ClOsalMutexIdT mutexId) |
| Deletes a mutex. | |
| ClRcT | clOsalMutexDestroy (ClOsalMutexT *pMutex) |
| Destroys a mutex. | |
| ClRcT | clOsalMutexInit (ClOsalMutexT *pMutex) |
| Initializes a mutex. | |
| ClRcT | clOsalMutexLock (ClOsalMutexIdT mutexId) |
| Locks a mutex. | |
| ClRcT | clOsalMutexUnlock (ClOsalMutexIdT mutexId) |
| Unlocks a mutex. | |
| ClRcT | clOsalNanoTimeGet (ClNanoTimeT *pTime) |
| Returns the time since Epoch, with a best resolution of 1 nanosecond. | |
| ClRcT | clOsalPageSizeGet (ClInt32T *pSize) |
| ClRcT | clOsalPrintf (const ClCharT *fmt,...) |
| Prints to the standard output. | |
| ClRcT | clOsalProcessCreate (ClOsalProcessFuncT fpFunction, void *functionArg, ClOsalProcessFlagT creationFlags, ClOsalPidT *pProcessId) |
| Creates a process. | |
| ClRcT | clOsalProcessDelete (ClOsalPidT processId) |
| Deletes a process. | |
| ClRcT | clOsalProcessSelfIdGet (ClOsalPidT *pProcessId) |
| Retrieves the processId. | |
| ClRcT | clOsalProcessSharedCondInit (ClOsalCondT *pCond) |
| Initializes a condition variable that can be used in multiple processes. | |
| ClRcT | clOsalProcessSharedMutexInit (ClOsalMutexT *pMutex, ClOsalSharedMutexFlagsT flags, ClUint8T *pKey, ClUint32T keyLen, ClInt32T value) |
| Initializes a process-shared mutex. | |
| ClRcT | clOsalProcessWait (ClOsalPidT processId) |
| Waits for a process to exit. | |
| ClRcT | clOsalRecursiveMutexInit (ClOsalMutexT *pMutex) |
| Initializes a mutex. | |
| ClRcT | clOsalSelfTaskIdGet (ClOsalTaskIdT *pTaskId) |
| Retrieves task id. | |
| ClRcT | clOsalSemCreate (ClUint8T *pName, ClUint32T value, ClOsalSemIdT *pSemId) |
| Creates a semaphore. | |
| ClRcT | clOsalSemDelete (ClOsalSemIdT semId) |
| Deletes a semaphore. | |
| ClRcT | clOsalSemIdGet (ClUint8T *pName, ClOsalSemIdT *pSemId) |
| Retrieves the semaphore id. | |
| ClRcT | clOsalSemLock (ClOsalSemIdT semId) |
| Locks a semaphore. | |
| ClRcT | clOsalSemTryLock (ClOsalSemIdT semId) |
| Locks a semaphore if it is available. | |
| ClRcT | clOsalSemUnlock (ClOsalSemIdT semId) |
| Unlocks a semaphore. | |
| ClRcT | clOsalSemValueGet (ClOsalSemIdT semId, ClUint32T *pSemValue) |
| Retrieves the value of a semaphore. | |
| ClRcT | clOsalShmAttach (ClOsalShmIdT shmId, void *pInMem, void **ppOutMem) |
| Attaches a shared memory. | |
| ClRcT | clOsalShmCreate (ClUint8T *pName, ClUint32T size, ClOsalShmIdT *pShmId) |
| Creates a shared memory. | |
| ClRcT | clOsalShmDelete (ClOsalShmIdT shmId) |
| Deletes a shared memory. | |
| ClRcT | clOsalShmDetach (void *pMem) |
| Detaches a shared memory. | |
| ClRcT | clOsalShmIdGet (ClUint8T *pName, ClOsalShmIdT *pShmId) |
| Retrieves a shared memory Id. | |
| ClRcT | clOsalShmSecurityModeGet (ClOsalShmIdT shmId, ClUint32T *pMode) |
| Retrieves permissions of shared memory. | |
| ClRcT | clOsalShmSecurityModeSet (ClOsalShmIdT shmId, ClUint32T mode) |
| Sets permissions to shared memory. | |
| ClRcT | clOsalShmSizeGet (ClOsalShmIdT shmId, ClUint32T *pSize) |
| Retrieves the size of shared memory. | |
| void | clOsalSigHandlerInitialize (void) |
| Installs and initializes the signal handler. | |
| ClTimeT | clOsalStopWatchTimeGet (void) |
| Retrieves the time since the machine is up. | |
| ClRcT | clOsalTaskCreateAttached (const ClCharT *taskName, ClOsalSchedulePolicyT schedulePolicy, ClUint32T priority, ClUint32T stackSize, void *(*fpTaskFunction)(void *), void *pTaskFuncArgument, ClOsalTaskIdT *pTaskId) |
| Creates a task. | |
| ClRcT | clOsalTaskCreateDetached (const ClCharT *taskName, ClOsalSchedulePolicyT schedulePolicy, ClUint32T priority, ClUint32T stackSize, void *(*fpTaskFunction)(void *), void *pTaskFuncArgument) |
| Creates a task. | |
| ClRcT | clOsalTaskDataGet (ClUint32T key, ClOsalTaskDataT *pThreadData) |
| Retrieves the thread-specific data. | |
| ClRcT | clOsalTaskDataSet (ClUint32T key, ClOsalTaskDataT threadData) |
| Sets the thread-specific data. | |
| ClRcT | clOsalTaskDelay (ClTimerTimeOutT timeOut) |
| Delays a task. | |
| ClRcT | clOsalTaskDelete (ClOsalTaskIdT taskId) |
| Deletes a task. | |
| ClRcT | clOsalTaskDetach (ClOsalTaskIdT taskId) |
| No longer interested in the task's alive/dead state. | |
| ClRcT | clOsalTaskJoin (ClOsalTaskIdT taskId) |
| Joins a task. | |
| ClRcT | clOsalTaskKeyCreate (ClUint32T *pKey, ClOsalTaskKeyDeleteCallBackT pCallbackFunc) |
| Creates a key for thread-specific data. | |
| ClRcT | clOsalTaskKeyDelete (ClUint32T key) |
| Deletes the key for thread-specific data. | |
| ClRcT | clOsalTaskKill (ClOsalTaskIdT taskId, ClInt32T sig) |
| Kills a task by sending a signal. | |
| ClRcT | clOsalTaskNameGet (ClOsalTaskIdT taskId, ClCharT **ppTaskName) |
| Retrieves task name. | |
| ClRcT | clOsalTaskPriorityGet (ClOsalTaskIdT taskId, ClUint32T *pTaskPriority) |
| Retrieves the priority of the task. | |
| ClRcT | clOsalTaskPrioritySet (ClOsalTaskIdT taskId, ClUint32T taskPriority) |
| Sets the priority of the task. | |
| ClRcT | clOsalTimeOfDayGet (ClTimerTimeOutT *pTime) |
| Retrieves the current time. | |
Variables | |
| ClOsalShmIdT | gClCompUniqueShmId |
| Shared memory ID associated with the component. | |
| ClOsalShmAreaDefT * | gpClShmArea |
| Shared memory associated with the component. | |
Operating System Abstraction Layer API.