OpenClovis Logo

clOsalApi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2012 OpenClovis Solutions Inc. All Rights Reserved.
3  *
4  * This file is available under a commercial license from the
5  * copyright holder or the GNU General Public License Version 2.0.
6  *
7  * The source code for this program is not published or otherwise
8  * divested of its trade secrets, irrespective of what has been
9  * deposited with the U.S. Copyright office.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * For more information, see the file COPYING provided with this
17  * material.
18  */
19 
32 /*********************************************************************************/
33 /************************************* OSAL APIs ********************************/
34 /*********************************************************************************/
35 /* */
36 /* clOsalInitialize */
37 /* clOsalFinalize */
38 /* clOsalTaskCreate */
39 /* clOsalTaskDelete */
40 /* clOsalSelfTaskIdGet */
41 /* clOsalTaskNameGet */
42 /* clOsalTaskPriorityGet */
43 /* clOsalTaskPrioritySet */
44 /* clOsalTaskDelay */
45 /* clOsalTimeOfDayGet */
46 /* clOsalMutexCreate */
47 /* clOsalMutexCreateAndLock */
48 /* clOsalMutexLock */
49 /* clOsalMutexUnlock */
50 /* clOsalMutexDelete */
51 /* clOsalNumMemoryAllocGet */
52 /* clOsalNumMemoryDeallocedGet */
53 /* clOsalCondCreate */
54 /* clOsalCondDelete */
55 /* clOsalCondWait */
56 /* clOsalCondBroadcast */
57 /* clOsalCondSignal */
58 /* clOsalTaskKeyCreate */
59 /* clOsalTaskKeyDelete */
60 /* clOsalTaskDataSet */
61 /* clOsalTaskDataGet */
62 /* clOsalPrintf */
63 /* clOsalPrintf */
64 /* clOsalSemCreate */
65 /* clOsalSemIdGet */
66 /* clOsalSemLock */
67 /* clOsalSemTryLock */
68 /* clOsalSemUnlock */
69 /* clOsalSemValueGet */
70 /* clOsalSemDelete */
71 /* clOsalProcessCreate */
72 /* cosProcessResume */
73 /* cosProcessSuspend */
74 /* clOsalProcessDelete */
75 /* clOsalProcessWait */
76 /* clOsalProcessSelfIdGet */
77 /* clOsalShmCreate */
78 /* clOsalShmIdGet */
79 /* clOsalShmDelete */
80 /* clOsalShmAttach */
81 /* clOsalShmDetach */
82 /* clOsalShmSecurityModeSet */
83 /* clOsalShmSecurityModeGet */
84 /* clOsalShmSizeGet */
85 /* clOsalSigHandlerInitialize */
86 /* clOsalErrorReportHandler */
87 /* */
88 /*********************************************************************************/
89 
90 #ifndef _CL_OSAL_API_H_
91 #define _CL_OSAL_API_H_
92 
93 #ifdef __cplusplus
94 extern "C" {
95 #endif
96 
97 #ifndef __KERNEL__
98 #include <stdlib.h>
99 #include <pthread.h>
100 #endif
101 
102 
103 #include <clCommon.h>
104 #include <clTimerApi.h>
105 #include <clHeapApi.h>
106 #ifdef DMALLOC
107 #include <dmalloc.h>
108 #endif /* DMALLOC */
109 
110 #ifdef CL_OSAL_DEBUG
111 #include <clList.h>
112 #endif
113 
114 /******************************************************************************
115  * Constant and Macro Definitions
116  *****************************************************************************/
117 
118 
119 
123 #define CL_OSAL_MIN_STACK_SIZE 196608
124 
128 #define CL_OSAL_NAME_MAX 32
129 /* Uncomment following line to enable signal handler feature */
130 /*#define CL_OSAL_SIGNAL_HANDLER 1 */
131 
132 #ifdef __KERNEL__
133 #define clOsalPrintf printk
134 #endif /* __KERNEL__ */
135 /* FIXME: This doesn't look clean */
136 /* Remove the #if 0 below to enable memleak detection tool in kernel space */
137 #if 0
138 #define MEM_LEAK_DETECT
139 #endif
140 #ifdef MEM_LEAK_DETECT
141 # define kmalloc(x,y) clHeapAllocate(x)
142 # define kfree clHeapFree
143 #endif /* MEM_LEAK_DETECT */
144 
145 /******************************************************************************
146  * Data Types
147  *****************************************************************************/
148 
149 #ifndef __KERNEL__
150 
151 #include <clArchHeaders.h>
152 #include <semaphore.h>
153 
158 {
159  CL_OSAL_SHARED_INVALID = 0x0,
160  CL_OSAL_SHARED_NORMAL = 0x1,
161  CL_OSAL_SHARED_SYSV_SEM = 0x2,
162  CL_OSAL_SHARED_POSIX_SEM = 0x4,
163  CL_OSAL_SHARED_RECURSIVE = 0x8,
164  CL_OSAL_SHARED_PROCESS = 0x10,
165  CL_OSAL_SHARED_ERROR_CHECK = 0x20,
167 
168 typedef struct ClOsalMutex
169 {
170 #ifdef CL_OSAL_DEBUG
171 #define CL_OSAL_DEBUG_MAGIC 0xDEADBEEF
172  ClUint32T magic;
173  pthread_t tid;
174  const ClCharT *creatorFile;
175  ClInt32T creatorLine;
176  const ClCharT *ownerFile;
177  ClInt32T ownerLine;
178  ClListHeadT list; /*entry into the mutex pool*/
179 #endif
181  union shared_lock
182  {
183  pthread_mutex_t mutex;
184  struct ClSem
185  {
186  sem_t posSem;
187  int semId;
188  ClInt32T numSems;
189  }sem;
190  }shared_lock;
191 }ClOsalMutexT;
192 
193 typedef pthread_mutexattr_t ClOsalMutexAttrT;
194 typedef pthread_condattr_t ClOsalCondAttrT;
195 typedef enum ClOsalSharedType
196 {
197  CL_OSAL_PROCESS_PRIVATE = 0, /*default*/
198  CL_OSAL_PROCESS_SHARED = 1
199 }ClOsalSharedTypeT;
200 
204 typedef pthread_cond_t ClOsalCondT;
205 #endif
206 
210 typedef ClUint64T ClOsalTaskIdT;
211 
215 #ifndef __KERNEL__
216 typedef ClOsalMutexT* ClOsalMutexIdT;
217 #else
218 typedef ClPtrT ClOsalMutexIdT;
219 #endif
220 
221 
222 
226 #ifndef __KERNEL__
228 #else
229 typedef ClPtrT ClOsalCondIdT; // Mynk NTC
230 #endif
234 #ifndef POSIX_BUILD
235 typedef ClHandleT ClOsalSemIdT;
236 #else
237 typedef sem_t* ClOsalSemIdT;
238 #endif
239 
243 typedef ClUint32T ClOsalShmIdT;
244 
248 typedef ClUint32T ClOsalPidT;
249 
253 typedef ClPtrT ClOsalTaskDataT;
254 
255 typedef struct timespec ClNanoTimeT;
256 
261 typedef void (*ClOsalProcessFuncT)(void*);
262 
268 typedef void (*ClOsalTaskKeyDeleteCallBackT)(void*);
269 
270 /* ENUM */
271 
278 typedef enum { /* DO NOT CHANGE the order of this enum, since it must be aligned with the Posix ordering */
279 
281  CL_OSAL_SCHED_OTHER = SCHED_OTHER,
282 
284  CL_OSAL_SCHED_FIFO = SCHED_FIFO,
285 
287  CL_OSAL_SCHED_RR = SCHED_RR
289 
294 typedef enum
295 {
300 
304  CL_OSAL_THREAD_PRI_HIGH = 160, /* COS_MAX_PRIORITY, */
305 
309  CL_OSAL_THREAD_PRI_MEDIUM = 80, /* (COS_MAX_PRIORITY - COS_MIN_PRIORITY)/2, */
310 
314  CL_OSAL_THREAD_PRI_LOW = 1, /* COS_MIN_PRIORITY */
316 
322 typedef enum {
328 
329 #if 0
337 typedef enum{
338 
342  CL_OSAL_SHM_PRIVATE = BIT0,
343 
347  CL_OSAL_SHM_PUBLIC = BIT1
348  } CosShmFlag_e;
349 #endif
350 
352 typedef enum {
366 
370 #define CL_OSAL_SHM_EXCEPTION_LENGTH 2048
371 typedef struct {
375  ClCharT exceptionInfo[CL_OSAL_SHM_EXCEPTION_LENGTH];
376 }ClOsalShmAreaDefT;
377 
381 extern ClOsalShmAreaDefT *gpClShmArea;
386 
387 /*****************************************************************************
388  * OSAL APIs
389  *****************************************************************************/
390 
412 ClRcT clOsalInitialize(const ClPtrT pConfig);
413 
428 
429 /* Tasking API's */
430 
431 
479 ClRcT clOsalTaskCreateDetached (const ClCharT *taskName,
480  ClOsalSchedulePolicyT schedulePolicy,
481  ClUint32T priority,
482  ClUint32T stackSize,
483  void* (*fpTaskFunction)(void*),
484  void* pTaskFuncArgument);
485 
537 ClRcT clOsalTaskCreateAttached(const ClCharT *taskName,
538  ClOsalSchedulePolicyT schedulePolicy,
539  ClUint32T priority,
540  ClUint32T stackSize,
541  void* (*fpTaskFunction)(void*),
542  void* pTaskFuncArgument,
543  ClOsalTaskIdT* pTaskId);
544 
566 
588 
589 
611 ClRcT clOsalTaskKill (ClOsalTaskIdT taskId, ClInt32T sig);
612 
613 
637 
638 
639 
657 
658 
659 
660 
680 ClRcT clOsalTaskNameGet (ClOsalTaskIdT taskId, ClCharT** ppTaskName);
681 
682 
683 
684 
706  ClUint32T* pTaskPriority);
707 
708 
709 
710 
733  ClUint32T taskPriority);
734 
735 
736 
737 
761 
762 
779 
797 ClRcT clOsalNanoTimeGet (ClNanoTimeT* pTime);
798 
813 
814 
815 /* Mutex */
816 
817 
838 #ifndef __KERNEL__
839 
840 #ifndef CL_OSAL_DEBUG
841 
842 ClRcT clOsalMutexInit (ClOsalMutexT* pMutex);
843 
844 #else
845 
846 extern ClRcT clOsalMutexInitDebug(ClOsalMutexT *pMutex, const ClCharT *file, ClInt32T line);
847 #define clOsalMutexInit(mutex) clOsalMutexInitDebug(mutex, __FILE__, __LINE__)
848 
849 #endif
850 
851 ClRcT clOsalMutexErrorCheckInit (ClOsalMutexT* pMutex);
852 
853 ClRcT clOsalMutexValueSet(ClOsalMutexIdT mutexId, ClInt32T value);
854 
855 ClRcT clOsalMutexValueGet(ClOsalMutexIdT mutexId, ClInt32T *pValue);
856 
857 #endif
858 
859 
877 #ifndef __KERNEL__
878 ClRcT clOsalProcessSharedMutexInit (ClOsalMutexT* pMutex, ClOsalSharedMutexFlagsT flags, ClUint8T *pKey, ClUint32T keyLen, ClInt32T value);
879 
880 ClRcT clOsalSharedMutexCreate (ClOsalMutexIdT* pMutex, ClOsalSharedMutexFlagsT flags, ClUint8T *pKey, ClUint32T keyLen, ClInt32T value);
881 #endif
882 
883 #define clOsalMutexIdGet(pClOsalMutexT) ((ClOsalMutexIdT)(pClOsalMutexT))
884 
904 #ifndef __KERNEL__
905 
906 #ifndef CL_OSAL_DEBUG
907 
908 ClRcT clOsalRecursiveMutexInit (ClOsalMutexT* pMutex);
909 
910 #else
911 
912 extern ClRcT clOsalRecursiveMutexInitDebug(ClOsalMutexT *pMutex, const ClCharT *file, ClInt32T line);
913 #define clOsalRecursiveMutexInit(mutex) clOsalRecursiveMutexInitDebug(mutex, __FILE__, __LINE__)
914 
915 #endif
916 
917 #endif
918 
937 #ifndef CL_OSAL_DEBUG
938 
940 
941 #else
942 
943 extern ClRcT clOsalMutexCreateDebug(ClOsalMutexIdT *pMutexId, const ClCharT *file, ClInt32T line);
944 #define clOsalMutexCreate(mutexId) clOsalMutexCreateDebug(mutexId, __FILE__, __LINE__)
945 
946 #endif
947 
948 ClRcT clOsalMutexErrorCheckCreate (ClOsalMutexIdT* pMutexId);
949 
950 
970 #ifndef CL_OSAL_DEBUG
971 
973 
974 #else
975 
976 extern ClRcT clOsalMutexCreateAndLockDebug(ClOsalMutexIdT *pMutexId, const ClCharT *file, ClInt32T line);
977 #define clOsalMutexCreateAndLock(mutexId) clOsalMutexCreateAndLockDebug(mutexId, __FILE__, __LINE__)
978 
979 #endif
980 
998 #ifndef CL_OSAL_DEBUG
999 
1001 
1002 #else
1003 
1004 extern ClRcT clOsalMutexLockDebug(ClOsalMutexIdT mutexId, const ClCharT *file, ClInt32T line);
1005 #define clOsalMutexLock(mutexId) clOsalMutexLockDebug(mutexId, __FILE__, __LINE__)
1006 
1007 #endif
1008 
1009 ClRcT clOsalMutexLockSilent (ClOsalMutexIdT mutexId);
1010 
1011 ClRcT
1012 clOsalMutexUnlockNonDebug(ClOsalMutexIdT mutexId);
1013 
1014 ClRcT
1015 clOsalMutexTryLock(ClOsalMutexIdT mutexId);
1016 
1034 #ifndef CL_OSAL_DEBUG
1035 
1037 
1038 #else
1039 
1040 extern ClRcT clOsalMutexUnlockDebug(ClOsalMutexIdT mutexId, const ClCharT *file, ClInt32T line);
1041 #define clOsalMutexUnlock(mutexId) clOsalMutexUnlockDebug(mutexId, __FILE__, __LINE__)
1042 
1043 #endif
1044 
1045 ClRcT clOsalMutexUnlockSilent (ClOsalMutexIdT mutexId);
1046 
1064 #ifndef CL_OSAL_DEBUG
1065 
1067 
1068 #else
1069 
1070 extern ClRcT clOsalMutexDeleteDebug(ClOsalMutexIdT mutexId, const ClCharT *file, ClInt32T line);
1071 #define clOsalMutexDelete(mutexId) clOsalMutexDeleteDebug(mutexId, __FILE__, __LINE__)
1072 
1073 #endif
1074 
1092 #ifndef __KERNEL__
1093 
1094 #ifndef CL_OSAL_DEBUG
1095 
1096 ClRcT clOsalMutexDestroy (ClOsalMutexT *pMutex);
1097 
1098 #else
1099 
1100 extern ClRcT clOsalMutexDestroyDebug(ClOsalMutexT *pMutex, const ClCharT *file, ClInt32T line);
1101 #define clOsalMutexDestroy(mutex) clOsalMutexDestroyDebug(mutex, __FILE__, __LINE__)
1102 
1103 extern ClRcT clOsalBustLocks(void);
1104 
1105 #endif
1106 #endif
1107 
1108 #ifndef __KERNEL__
1127 #endif
1128 
1129 #ifndef __KERNEL__
1148 
1149 #endif
1150 
1171 
1172 
1173 
1195 
1196 
1218 #ifndef __KERNEL__
1220 #endif
1221 
1222 
1252 #ifndef CL_OSAL_DEBUG
1254  ClOsalMutexIdT mutexId,
1255  ClTimerTimeOutT time);
1256 #else
1257 extern ClRcT clOsalCondWaitDebug (ClOsalCondIdT conditionId,
1258  ClOsalMutexIdT mutexId,
1259  ClTimerTimeOutT time,
1260  const ClCharT *file, ClInt32T line);
1261 #define clOsalCondWait(cond, mutex, time) clOsalCondWaitDebug(cond, mutex, time, __FILE__, __LINE__)
1262 #endif
1263 
1285 
1308 
1309 
1327 ClRcT clOsalTaskKeyCreate(ClUint32T* pKey,
1328  ClOsalTaskKeyDeleteCallBackT pCallbackFunc);
1329 
1330 
1331 
1332 
1349 
1350 
1367 ClRcT clOsalTaskDataSet(ClUint32T key,
1368  ClOsalTaskDataT threadData);
1369 
1370 
1371 
1390 ClRcT clOsalTaskDataGet(ClUint32T key,
1391  ClOsalTaskDataT* pThreadData);
1392 
1393 
1394 
1407 #ifndef __KERNEL__
1408 ClRcT clOsalPrintf(const ClCharT* fmt, ...);
1409 #endif /* __KERNEL__ */
1410 
1411 /* Semaphores */
1439 ClRcT clOsalSemCreate(ClUint8T* pName,
1440  ClUint32T value,
1441  ClOsalSemIdT* pSemId);
1442 
1443 
1464 ClRcT clOsalSemIdGet(ClUint8T* pName, ClOsalSemIdT* pSemId);
1465 
1466 
1489 
1490 
1515 
1516 
1517 
1540 
1541 
1542 
1565  ClUint32T* pSemValue);
1566 
1567 
1568 
1591 
1592 
1593 /* Process */
1594 
1595 
1620  void* functionArg,
1621  ClOsalProcessFlagT creationFlags,
1622  ClOsalPidT* pProcessId);
1623 
1640 
1641 
1662 
1663 
1664 
1680 
1681 
1682 /* Shared Memory */
1683 
1684 
1714 ClRcT clOsalShmCreate(ClUint8T* pName,
1715  ClUint32T size,
1716  ClOsalShmIdT *pShmId);
1717 
1718 
1719 
1741 ClRcT clOsalShmIdGet(ClUint8T *pName,
1742  ClOsalShmIdT *pShmId);
1743 
1744 
1745 
1746 
1770 
1771 
1772 
1801  void* pInMem,
1802  void** ppOutMem);
1803 
1804 
1805 
1806 
1828 
1829 
1830 
1831 
1855  ClUint32T mode);
1856 
1857 
1878  ClUint32T* pMode);
1879 
1880 
1881 
1905  ClUint32T* pSize);
1906 
1907 #if 0 /* Deprecated R4.0. Use the standard C library routines */
1922 ClRcT clOsalFileClose (ClFdT *fd);
1923 #endif
1924 
1925 
1926 ClRcT clOsalMmap(ClPtrT start, ClUint32T length, ClInt32T prot, ClInt32T flags,
1927  ClHandleT fd, ClHandleT offset, ClPtrT *mmapped);
1928 
1929 
1930 ClRcT clOsalMunmap(ClPtrT start, ClUint32T length);
1931 
1932 
1933 ClRcT clOsalMsync (ClPtrT start, ClUint32T length, ClInt32T flags);
1934 
1935 
1936 ClRcT clOsalFtruncate (ClFdT fd, off_t length);
1937 
1938 ClRcT clOsalShmOpen (const ClCharT *name, ClInt32T oflag, ClUint32T mode, ClFdT *fd);
1939 ClRcT clOsalShmClose (ClFdT *fd);
1940 
1941 ClRcT clOsalShmUnlink (const ClCharT *name);
1942 
1956 
1957 
1958 /*
1959  * \brief Returns the maximum allowed length of a relative pathname when 'path' is the working directory.
1960  *
1961  * \param path: Relative or absolute path of a directory
1962  *
1963  * \param pLength: The returned length
1964  *
1965  * \retval CL_OK: This API executed successfully.
1966  * \retval CL_OSAL_ERR_OS_ERROR: The OS abstraction layer has not been
1967  * initialized. In other words, clOsalInitialize() has not been called.
1968  * \retval CL_ERR_NULL_PTR: Either 'path' or 'pLength' is NULL
1969  * \retval CL_ERR_NOT_SUPPORTED: This limit cannot be queried at run-time.
1970  * \retval CL_ERR_DOESNT_EXIST: There is no definite limit.
1971  * \retval CL_ERR_UNSPECIFIED: An unknown error was returned by pathconf()
1972  *
1973  * \par Description:
1974  * This function is a wrapper for pathconf().
1975  *
1976  */
1977 ClRcT clOsalMaxPathGet(const ClCharT* path, ClInt32T* pLength);
1978 
2009 ClRcT clOsalPageSizeGet(ClInt32T* pSize);
2010 
2011 
2012 /* Deprecated functions */
2013 
2014 void clOsalErrorReportHandler(void *info) CL_DEPRECATED;
2015 
2016 ClPtrT clOsalMalloc(ClUint32T size) CL_DEPRECATED;
2017 
2018 ClPtrT clOsalCalloc(ClUint32T size) CL_DEPRECATED;
2019 
2020 void clOsalFree(ClPtrT pAddress) CL_DEPRECATED;
2021 
2022 #ifndef __KERNEL__
2023 
2024 ClRcT clOsalMutexAttrInit(ClOsalMutexAttrT *pAttr) CL_DEPRECATED;
2025 
2026 ClRcT clOsalMutexAttrDestroy(ClOsalMutexAttrT *pAttr) CL_DEPRECATED;
2027 
2028 ClRcT clOsalMutexAttrPSharedSet(ClOsalMutexAttrT *pAttr, ClOsalSharedTypeT type) CL_DEPRECATED;
2029 
2030 ClRcT clOsalMutexInitEx(ClOsalMutexT *pMutex, ClOsalMutexAttrT *pAttr) CL_DEPRECATED;
2031 
2032 
2033 ClRcT clOsalCondInitEx(ClOsalCondT *pCond, ClOsalCondAttrT *pAttr) CL_DEPRECATED;
2034 
2035 ClRcT clOsalCondAttrInit(ClOsalCondAttrT *pAttr) CL_DEPRECATED;
2036 
2037 ClRcT clOsalCondAttrDestroy(ClOsalCondAttrT *pAttr) CL_DEPRECATED;
2038 
2039 ClRcT clOsalCondAttrPSharedSet(ClOsalCondAttrT *pAttr, ClOsalSharedTypeT type) CL_DEPRECATED;
2040 #endif
2041 
2042 
2043 
2044 #ifdef __cplusplus
2045 }
2046 #endif
2047 
2048 
2054 #endif /* _CL_OSAL_API_H_ */
2055 
2056 
Typical defines found in any software project.
Timer APIs.
Header file of Heap Management related APIs.
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
ClInt64T ClTimeT
Time duration specified in nanoseconds.
Definition: clCommon.h:154
ClRcT clOsalProcessSelfIdGet(ClOsalPidT *pProcessId)
Retrieves the processId.
ClRcT clOsalCondCreate(ClOsalCondIdT *pConditionId)
Creates a condition variable.
ClRcT clOsalTaskJoin(ClOsalTaskIdT taskId)
Joins a task.
pthread_cond_t ClOsalCondT
The thread condition type wrapped.
Definition: clOsalApi.h:204
ClRcT clOsalShmIdGet(ClUint8T *pName, ClOsalShmIdT *pShmId)
Retrieves a shared memory Id.
ClRcT clOsalShmSizeGet(ClOsalShmIdT shmId, ClUint32T *pSize)
Retrieves the size of shared memory.
ClRcT clOsalSemUnlock(ClOsalSemIdT semId)
Unlocks a semaphore.
ClOsalShmAreaDefT * gpClShmArea
Shared memory associated with the component.
ClRcT clOsalShmAttach(ClOsalShmIdT shmId, void *pInMem, void **ppOutMem)
Attaches a shared memory.
ClRcT clOsalCondWait(ClOsalCondIdT conditionId, ClOsalMutexIdT mutexId, ClTimerTimeOutT time)
Waits for a condition.
ClRcT clOsalCondInit(ClOsalCondT *pCond)
Initializes a condition variable.
ClRcT clOsalTaskKeyDelete(ClUint32T key)
Deletes the key for thread-specific data.
ClRcT clOsalShmSecurityModeSet(ClOsalShmIdT shmId, ClUint32T mode)
Sets permissions to shared memory.
ClTimeT clOsalStopWatchTimeGet(void)
Retrieves the time since the machine is up.
ClRcT clOsalMutexLock(ClOsalMutexIdT mutexId)
Locks a mutex.
ClRcT clOsalTaskDelete(ClOsalTaskIdT taskId)
Deletes a task.
ClRcT clOsalProcessCreate(ClOsalProcessFuncT fpFunction, void *functionArg, ClOsalProcessFlagT creationFlags, ClOsalPidT *pProcessId)
Creates a process.
ClOsalThreadPriorityT
The following enumeration type contains the various thread priorities.
Definition: clOsalApi.h:295
ClRcT clOsalProcessSharedMutexInit(ClOsalMutexT *pMutex, ClOsalSharedMutexFlagsT flags, ClUint8T *pKey, ClUint32T keyLen, ClInt32T value)
Initializes a process-shared mutex.
ClRcT clOsalTaskCreateAttached(const ClCharT *taskName, ClOsalSchedulePolicyT schedulePolicy, ClUint32T priority, ClUint32T stackSize, void *(*fpTaskFunction)(void *), void *pTaskFuncArgument, ClOsalTaskIdT *pTaskId)
Creates a task.
ClRcT clOsalSemCreate(ClUint8T *pName, ClUint32T value, ClOsalSemIdT *pSemId)
Creates a semaphore.
ClRcT clOsalShmDetach(void *pMem)
Detaches a shared memory.
ClRcT clOsalSemLock(ClOsalSemIdT semId)
Locks a semaphore.
ClRcT clOsalTaskDetach(ClOsalTaskIdT taskId)
No longer interested in the task's alive/dead state.
void(* ClOsalTaskKeyDeleteCallBackT)(void *)
CAllback type of callback function invoked when the task specific private key is destruyed.
Definition: clOsalApi.h:268
ClRcT clOsalTaskDelay(ClTimerTimeOutT timeOut)
Delays a task.
ClUint32T ClOsalShmIdT
The type of an identifier to the OSAL Shared Memory ID.
Definition: clOsalApi.h:243
ClRcT clOsalRecursiveMutexInit(ClOsalMutexT *pMutex)
Initializes a mutex.
ClRcT clOsalSelfTaskIdGet(ClOsalTaskIdT *pTaskId)
Retrieves task id.
ClRcT clOsalSemTryLock(ClOsalSemIdT semId)
Locks a semaphore if it is available.
ClRcT clOsalShmDelete(ClOsalShmIdT shmId)
Deletes a shared memory.
ClRcT clOsalMutexCreate(ClOsalMutexIdT *pMutexId)
Creates a mutex.
ClRcT clOsalSemValueGet(ClOsalSemIdT semId, ClUint32T *pSemValue)
Retrieves the value of a semaphore.
ClRcT clOsalPageSizeGet(ClInt32T *pSize)
ClRcT clOsalSemIdGet(ClUint8T *pName, ClOsalSemIdT *pSemId)
Retrieves the semaphore id.
ClOsalSchedulePolicyT
The following enumeration type contains schedule policy of the tasks that will be created.
Definition: clOsalApi.h:278
ClRcT clOsalTaskKeyCreate(ClUint32T *pKey, ClOsalTaskKeyDeleteCallBackT pCallbackFunc)
Creates a key for thread-specific data.
ClRcT clOsalProcessDelete(ClOsalPidT processId)
Deletes a process.
ClRcT clOsalMutexCreateAndLock(ClOsalMutexIdT *pMutexId)
Creates a mutex in locked state.
ClOsalProcessFlagT
Process creation flags.
Definition: clOsalApi.h:322
ClRcT clOsalMutexDelete(ClOsalMutexIdT mutexId)
Deletes a mutex.
ClRcT clOsalCondBroadcast(ClOsalCondIdT conditionId)
Broadcasts a condition.
ClRcT clOsalFinalize(void)
ClRcT clOsalCondDelete(ClOsalCondIdT conditionId)
Deletes a condition variable.
ClRcT clOsalTaskDataSet(ClUint32T key, ClOsalTaskDataT threadData)
Sets the thread-specific data.
ClOsalCondT * ClOsalCondIdT
The type of an identifier to the OSAL condition ID.
Definition: clOsalApi.h:227
ClUint32T ClOsalPidT
The type of an identifier to the OSAL Process ID.
Definition: clOsalApi.h:248
ClRcT clOsalTaskPriorityGet(ClOsalTaskIdT taskId, ClUint32T *pTaskPriority)
Retrieves the priority of the task.
ClRcT clOsalMutexUnlock(ClOsalMutexIdT mutexId)
Unlocks a mutex.
ClRcT clOsalProcessWait(ClOsalPidT processId)
Waits for a process to exit.
ClRcT clOsalTimeOfDayGet(ClTimerTimeOutT *pTime)
Retrieves the current time.
ClHandleT ClOsalSemIdT
The type of an identifier to the OSAL Semaphore ID.
Definition: clOsalApi.h:235
ClRcT clOsalMutexInit(ClOsalMutexT *pMutex)
Initializes a mutex.
ClRcT clOsalTaskCreateDetached(const ClCharT *taskName, ClOsalSchedulePolicyT schedulePolicy, ClUint32T priority, ClUint32T stackSize, void *(*fpTaskFunction)(void *), void *pTaskFuncArgument)
Creates a task.
ClRcT clOsalInitialize(const ClPtrT pConfig)
Initializes the Operating System Abstraction Layer (OSAL).
ClOsalSharedMutexFlags
The mutex type to be initialized.
Definition: clOsalApi.h:158
ClRcT clOsalPrintf(const ClCharT *fmt,...)
Prints to the standard output.
ClRcT clOsalShmSecurityModeGet(ClOsalShmIdT shmId, ClUint32T *pMode)
Retrieves permissions of shared memory.
ClRcT clOsalMutexDestroy(ClOsalMutexT *pMutex)
Destroys a mutex.
ClPtrT ClOsalTaskDataT
The type of an identifier to the OSAL Task Data type.
Definition: clOsalApi.h:253
ClOsalMutexT * ClOsalMutexIdT
The type of an identifier to the OSAL Mutex ID.
Definition: clOsalApi.h:216
ClOsalShmSecurityModeFlagT
Shared memory security options.
Definition: clOsalApi.h:352
ClRcT clOsalProcessSharedCondInit(ClOsalCondT *pCond)
Initializes a condition variable that can be used in multiple processes.
ClRcT clOsalCondSignal(ClOsalCondIdT conditionId)
Signals a condition.
ClRcT clOsalSemDelete(ClOsalSemIdT semId)
Deletes a semaphore.
ClRcT clOsalTaskNameGet(ClOsalTaskIdT taskId, ClCharT **ppTaskName)
Retrieves task name.
ClRcT clOsalTaskKill(ClOsalTaskIdT taskId, ClInt32T sig)
Kills a task by sending a signal.
enum ClOsalSharedMutexFlags ClOsalSharedMutexFlagsT
The mutex type to be initialized.
ClRcT clOsalTaskPrioritySet(ClOsalTaskIdT taskId, ClUint32T taskPriority)
Sets the priority of the task.
#define CL_OSAL_SHM_EXCEPTION_LENGTH
Shared memory area definition.
Definition: clOsalApi.h:370
void clOsalSigHandlerInitialize(void)
Installs and initializes the signal handler.
ClRcT clOsalNanoTimeGet(ClNanoTimeT *pTime)
Returns the time since Epoch, with a best resolution of 1 nanosecond.
void(* ClOsalProcessFuncT)(void *)
CAllback type of callback function invoked when a process is created.
Definition: clOsalApi.h:261
ClRcT clOsalTaskDataGet(ClUint32T key, ClOsalTaskDataT *pThreadData)
Retrieves the thread-specific data.
ClUint64T ClOsalTaskIdT
The type of an identifier to the OSAL Task ID.
Definition: clOsalApi.h:210
ClRcT clOsalCondDestroy(ClOsalCondT *pCond)
Destroys a condition variable.
ClOsalShmIdT gClCompUniqueShmId
Shared memory ID associated with the component.
ClRcT clOsalShmCreate(ClUint8T *pName, ClUint32T size, ClOsalShmIdT *pShmId)
Creates a shared memory.
@ CL_OSAL_THREAD_PRI_MEDIUM
Medium thread priority.
Definition: clOsalApi.h:309
@ CL_OSAL_THREAD_PRI_NOT_APPLICABLE
When the scheduling is CL_OSAL_SCHED_OTHER, priority is not used.
Definition: clOsalApi.h:299
@ CL_OSAL_THREAD_PRI_LOW
Lowest thread priority.
Definition: clOsalApi.h:314
@ CL_OSAL_THREAD_PRI_HIGH
Highest thread priority.
Definition: clOsalApi.h:304
@ CL_OSAL_SCHED_FIFO
First-in-first-out.
Definition: clOsalApi.h:284
@ CL_OSAL_SCHED_OTHER
Default scheduling mechanism.
Definition: clOsalApi.h:281
@ CL_OSAL_SCHED_RR
Roundrobin.
Definition: clOsalApi.h:287
@ CL_OSAL_PROCESS_WITH_NEW_GROUP
This would create a new process group.
Definition: clOsalApi.h:326
@ CL_OSAL_PROCESS_WITH_NEW_SESSION
This will create a process with new session.
Definition: clOsalApi.h:324
@ CL_OSAL_SHM_MODE_READ_OTHERS
read-only by everyone
Definition: clOsalApi.h:358
@ CL_OSAL_SHM_MODE_READ_USER
read-only by this user
Definition: clOsalApi.h:354
@ CL_OSAL_SHM_MODE_WRITE_OTHERS
read/write by everyone
Definition: clOsalApi.h:364
@ CL_OSAL_SHM_MODE_WRITE_GROUP
read/write by the group
Definition: clOsalApi.h:362
@ CL_OSAL_SHM_MODE_WRITE_USER
read/write by this user
Definition: clOsalApi.h:360
@ CL_OSAL_SHM_MODE_READ_GROUP
read-only by the group
Definition: clOsalApi.h:356
The timeout value in seconds and milliseconds.
Definition: clTimerApi.h:87

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen