Neonode zForce(TM) SDK
OsAbstractionLayer.h
Go to the documentation of this file.
1 
11 #ifndef ZFORCE_OSABSTRACTIONLAYER_H
12 #define ZFORCE_OSABSTRACTIONLAYER_H 1
13 
14 #ifndef ZFORCECOMMON_H
15  #error Please include "zForceCommon.h" before this file.
16 #endif // ZFORCECOMMON_H
17 
18 typedef void zForceMutex;
19 typedef void zForceSemaphore;
20 typedef void zForceThread;
21 
30 {
32  void ( * EntryPoint) (void *);
33  void * Arguments;
34 };
35 
44 {
58  void * ( * Malloc) (size_t size);
59 
69  void ( * Free) (void * memoryPointer);
70 
85  void * ( * Realloc) (void * memoryPointer, size_t size);
86 
101  void * ( * MallocWithPattern) (size_t size, uint8_t pattern);
102 
117 
132 
147 
162 
182  bool ( * InitializeSemaphore) (zForceSemaphore ** zForceSemaphore, uint32_t initialValue);
183 
201  bool ( * WaitForSemaphore) (zForceSemaphore * zForceSemaphore, uint32_t timeoutMs);
202 
218 
234 
245  uint64_t ( * GetTimeMilliSeconds) (void);
246 
263  bool ( * CreateThread) (zForceThread ** zForceThread, void ( * entryPoint)(void *), void * arguments);
264 
280 
291  void ( * Sleep) (uint32_t milliSeconds);
292 };
293 
294 #ifdef __cplusplus
295 extern "C"
296 {
297 #endif // __cplusplus
298 
299 DLLINTERNAL bool OsAbstractionLayer_Initialize (OsAbstractionLayer * osAbstractionLayer,
300  OsAbstractionLayer * userSuppliedOsAbstractionLayer);
301 
302 DLLINTERNAL void OsAbstractionLayer_ThreadWrapper (zForceThreadWrapper * wrapper);
303 
304 #ifdef __cplusplus
305 }
306 #endif // __cplusplus
307 
308 #endif // ZFORCE_OSABSTRACTIONLAYER_H
void zForceThread
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:20
void zForceSemaphore
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:19
void zForceMutex
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:18
Overrides for OS Functions.
Definition: OsAbstractionLayer.h:44
void(* Sleep)(uint32_t milliSeconds)
Sleep for a specified amount of MilliSeconds.
Definition: OsAbstractionLayer.h:291
void(* Free)(void *memoryPointer)
Free previously allocated memory area.
Definition: OsAbstractionLayer.h:69
bool(* InitializeMutex)(zForceMutex **zForceMutex)
Initialize Mutex.
Definition: OsAbstractionLayer.h:116
uint64_t(* GetTimeMilliSeconds)(void)
Get time in MilliSeconds.
Definition: OsAbstractionLayer.h:245
bool(* IncrementSemaphore)(zForceSemaphore *zForceSemaphore)
Increment Semaphore.
Definition: OsAbstractionLayer.h:217
bool(* DestroyMutex)(zForceMutex *zForceMutex)
Destroy Mutex.
Definition: OsAbstractionLayer.h:161
bool(* InitializeSemaphore)(zForceSemaphore **zForceSemaphore, uint32_t initialValue)
Initialize Semaphore.
Definition: OsAbstractionLayer.h:182
bool(* DestroySemaphore)(zForceSemaphore *zForceSemaphore)
Destroy Semaphore.
Definition: OsAbstractionLayer.h:233
bool(* LockMutex)(zForceMutex *zForceMutex)
Lock Mutex.
Definition: OsAbstractionLayer.h:131
bool(* CreateThread)(zForceThread **zForceThread, void(*entryPoint)(void *), void *arguments)
Create Thread and run it.
Definition: OsAbstractionLayer.h:263
bool(* UnlockMutex)(zForceMutex *zForceMutex)
Unlock Mutex.
Definition: OsAbstractionLayer.h:146
bool(* WaitForThreadExit)(zForceThread *zForceThread)
Wait for Thread to exit.
Definition: OsAbstractionLayer.h:279
bool(* WaitForSemaphore)(zForceSemaphore *zForceSemaphore, uint32_t timeoutMs)
Wait for Semaphore.
Definition: OsAbstractionLayer.h:201
Wrapper for threads.
Definition: OsAbstractionLayer.h:30
void(* EntryPoint)(void *)
Entry function for the thread.
Definition: OsAbstractionLayer.h:32
zForceThread * zForceThread
Thread pointer.
Definition: OsAbstractionLayer.h:31
void * Arguments
Arguments for the entry function.
Definition: OsAbstractionLayer.h:33