90 #ifndef _CL_OSAL_API_H_
91 #define _CL_OSAL_API_H_
123 #define CL_OSAL_MIN_STACK_SIZE 196608
128 #define CL_OSAL_NAME_MAX 32
132 #define clOsalPrintf printk
137 #define MEM_LEAK_DETECT
139 #ifdef MEM_LEAK_DETECT
140 # define kmalloc(x,y) clHeapAllocate(x)
141 # define kfree clHeapFree
150 #include <clArchHeaders.h>
151 #include <semaphore.h>
158 CL_OSAL_SHARED_INVALID = 0x0,
159 CL_OSAL_SHARED_NORMAL = 0x1,
160 CL_OSAL_SHARED_SYSV_SEM = 0x2,
161 CL_OSAL_SHARED_POSIX_SEM = 0x4,
162 CL_OSAL_SHARED_RECURSIVE = 0x8,
163 CL_OSAL_SHARED_PROCESS = 0x10,
164 CL_OSAL_SHARED_ERROR_CHECK = 0x20,
167 typedef struct ClOsalMutex
170 #define CL_OSAL_DEBUG_MAGIC 0xDEADBEEF
173 const ClCharT *creatorFile;
174 ClInt32T creatorLine;
175 const ClCharT *ownerFile;
182 pthread_mutex_t mutex;
192 typedef pthread_mutexattr_t ClOsalMutexAttrT;
193 typedef pthread_condattr_t ClOsalCondAttrT;
194 typedef enum ClOsalSharedType
196 CL_OSAL_PROCESS_PRIVATE = 0,
197 CL_OSAL_PROCESS_SHARED = 1
254 typedef struct timespec ClNanoTimeT;
341 CL_OSAL_SHM_PRIVATE = BIT0,
346 CL_OSAL_SHM_PUBLIC = BIT1
369 #define CL_OSAL_SHM_EXCEPTION_LENGTH 2048
482 void* (*fpTaskFunction)(
void*),
483 void* pTaskFuncArgument);
540 void* (*fpTaskFunction)(
void*),
541 void* pTaskFuncArgument,
542 ClOsalTaskIdT* pTaskId);
705 ClUint32T* pTaskPriority);
732 ClUint32T taskPriority);
839 #ifndef CL_OSAL_DEBUG
845 extern ClRcT clOsalMutexInitDebug(ClOsalMutexT *pMutex,
const ClCharT *file, ClInt32T line);
846 #define clOsalMutexInit(mutex) clOsalMutexInitDebug(mutex, __FILE__, __LINE__)
850 ClRcT clOsalMutexErrorCheckInit (ClOsalMutexT* pMutex);
852 ClRcT clOsalMutexValueSet(ClOsalMutexIdT mutexId, ClInt32T value);
854 ClRcT clOsalMutexValueGet(ClOsalMutexIdT mutexId, ClInt32T *pValue);
879 ClRcT clOsalSharedMutexCreate (ClOsalMutexIdT* pMutex,
ClOsalSharedMutexFlagsT flags, ClUint8T *pKey, ClUint32T keyLen, ClInt32T value);
882 #define clOsalMutexIdGet(pClOsalMutexT) ((ClOsalMutexIdT)(pClOsalMutexT))
905 #ifndef CL_OSAL_DEBUG
911 extern ClRcT clOsalRecursiveMutexInitDebug(ClOsalMutexT *pMutex,
const ClCharT *file, ClInt32T line);
912 #define clOsalRecursiveMutexInit(mutex) clOsalRecursiveMutexInitDebug(mutex, __FILE__, __LINE__)
936 #ifndef CL_OSAL_DEBUG
942 extern ClRcT clOsalMutexCreateDebug(ClOsalMutexIdT *pMutexId,
const ClCharT *file, ClInt32T line);
943 #define clOsalMutexCreate(mutexId) clOsalMutexCreateDebug(mutexId, __FILE__, __LINE__)
947 ClRcT clOsalMutexErrorCheckCreate (ClOsalMutexIdT* pMutexId);
969 #ifndef CL_OSAL_DEBUG
975 extern ClRcT clOsalMutexCreateAndLockDebug(ClOsalMutexIdT *pMutexId,
const ClCharT *file, ClInt32T line);
976 #define clOsalMutexCreateAndLock(mutexId) clOsalMutexCreateAndLockDebug(mutexId, __FILE__, __LINE__)
997 #ifndef CL_OSAL_DEBUG
1003 extern ClRcT clOsalMutexLockDebug(ClOsalMutexIdT mutexId,
const ClCharT *file, ClInt32T line);
1004 #define clOsalMutexLock(mutexId) clOsalMutexLockDebug(mutexId, __FILE__, __LINE__)
1008 ClRcT clOsalMutexLockSilent (ClOsalMutexIdT mutexId);
1011 clOsalMutexUnlockNonDebug(ClOsalMutexIdT mutexId);
1014 clOsalMutexTryLock(ClOsalMutexIdT mutexId);
1033 #ifndef CL_OSAL_DEBUG
1039 extern ClRcT clOsalMutexUnlockDebug(ClOsalMutexIdT mutexId,
const ClCharT *file, ClInt32T line);
1040 #define clOsalMutexUnlock(mutexId) clOsalMutexUnlockDebug(mutexId, __FILE__, __LINE__)
1044 ClRcT clOsalMutexUnlockSilent (ClOsalMutexIdT mutexId);
1063 #ifndef CL_OSAL_DEBUG
1069 extern ClRcT clOsalMutexDeleteDebug(ClOsalMutexIdT mutexId,
const ClCharT *file, ClInt32T line);
1070 #define clOsalMutexDelete(mutexId) clOsalMutexDeleteDebug(mutexId, __FILE__, __LINE__)
1093 #ifndef CL_OSAL_DEBUG
1099 extern ClRcT clOsalMutexDestroyDebug(ClOsalMutexT *pMutex,
const ClCharT *file, ClInt32T line);
1100 #define clOsalMutexDestroy(mutex) clOsalMutexDestroyDebug(mutex, __FILE__, __LINE__)
1102 extern ClRcT clOsalBustLocks(
void);
1251 #ifndef CL_OSAL_DEBUG
1253 ClOsalMutexIdT mutexId,
1256 extern ClRcT clOsalCondWaitDebug (ClOsalCondIdT conditionId,
1257 ClOsalMutexIdT mutexId,
1259 const ClCharT *file, ClInt32T line);
1260 #define clOsalCondWait(cond, mutex, time) clOsalCondWaitDebug(cond, mutex, time, __FILE__, __LINE__)
1367 ClOsalTaskDataT threadData);
1390 ClOsalTaskDataT* pThreadData);
1440 ClOsalSemIdT* pSemId);
1564 ClUint32T* pSemValue);
1621 ClOsalPidT* pProcessId);
1715 ClOsalShmIdT *pShmId);
1741 ClOsalShmIdT *pShmId);
1921 ClRcT clOsalFileClose (ClFdT *fd);
1925 ClRcT clOsalMmap(ClPtrT start, ClUint32T length, ClInt32T prot, ClInt32T flags,
1926 ClHandleT fd, ClHandleT offset, ClPtrT *mmapped);
1929 ClRcT clOsalMunmap(ClPtrT start, ClUint32T length);
1932 ClRcT clOsalMsync (ClPtrT start, ClUint32T length, ClInt32T flags);
1935 ClRcT clOsalFtruncate (ClFdT fd, off_t length);
1937 ClRcT clOsalShmOpen (
const ClCharT *name, ClInt32T oflag, ClUint32T mode, ClFdT *fd);
1938 ClRcT clOsalShmClose (ClFdT *fd);
1940 ClRcT clOsalShmUnlink (
const ClCharT *name);
1976 ClRcT clOsalMaxPathGet(
const ClCharT* path, ClInt32T* pLength);
2013 void clOsalErrorReportHandler(
void *info) CL_DEPRECATED;
2015 ClPtrT clOsalMalloc(ClUint32T size) CL_DEPRECATED;
2017 ClPtrT clOsalCalloc(ClUint32T size) CL_DEPRECATED;
2019 void clOsalFree(ClPtrT pAddress) CL_DEPRECATED;
2023 ClRcT clOsalMutexAttrInit(ClOsalMutexAttrT *pAttr) CL_DEPRECATED;
2025 ClRcT clOsalMutexAttrDestroy(ClOsalMutexAttrT *pAttr) CL_DEPRECATED;
2027 ClRcT clOsalMutexAttrPSharedSet(ClOsalMutexAttrT *pAttr, ClOsalSharedTypeT type) CL_DEPRECATED;
2029 ClRcT clOsalMutexInitEx(ClOsalMutexT *pMutex, ClOsalMutexAttrT *pAttr) CL_DEPRECATED;
2032 ClRcT clOsalCondInitEx(ClOsalCondT *pCond, ClOsalCondAttrT *pAttr) CL_DEPRECATED;
2034 ClRcT clOsalCondAttrInit(ClOsalCondAttrT *pAttr) CL_DEPRECATED;
2036 ClRcT clOsalCondAttrDestroy(ClOsalCondAttrT *pAttr) CL_DEPRECATED;
2038 ClRcT clOsalCondAttrPSharedSet(ClOsalCondAttrT *pAttr, ClOsalSharedTypeT type) CL_DEPRECATED;