Neonode zForce(TM) SDK

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

OsAbstractionLayer.h
Go to the documentation of this file.
1
12 #ifndef ZFORCE_OSABSTRACTIONLAYER_H
13 #define ZFORCE_OSABSTRACTIONLAYER_H
14
15 #ifndef ZFORCECOMMON_H
16 #error Please include "zForceCommon.h" before this file.
17 #endif // ZFORCECOMMON_H
18
19 typedef void zForceMutex;
20 typedef void zForceSemaphore;
21 typedef void zForceThread;
22
26 typedef struct zForceThreadWrapper zForceThreadWrapper;
30 struct zForceThreadWrapper
31 {
32 zForceThread * zForceThread;
33 void ( * EntryPoint)(void *);
34 void * Arguments;
35 };
36
40 typedef struct OsAbstractionLayer OsAbstractionLayer;
44 struct OsAbstractionLayer
45 {
59 void * ( * Malloc)(size_t size);
60
70 void ( * Free)(void * memoryPointer);
71
86 void * ( * Realloc)(void * memoryPointer, size_t size);
87
102 void * ( * MallocWithPattern)(size_t size, uint8_t pattern);
103
117 bool ( * InitializeMutex)(zForceMutex ** zForceMutex);
118
132 bool ( * LockMutex)(zForceMutex * zForceMutex);
133
147 bool ( * UnlockMutex)(zForceMutex * zForceMutex);
148
162 bool ( * DestroyMutex)(zForceMutex * zForceMutex);
163
183 bool ( * InitializeSemaphore)
184 (zForceSemaphore ** zForceSemaphore, uint32_t initialValue);
185
203 bool ( * WaitForSemaphore)(zForceSemaphore * zForceSemaphore,
204 uint32_t timeoutMs);
205
220 bool ( * IncrementSemaphore)(zForceSemaphore * zForceSemaphore);
221
236 bool ( * DestroySemaphore)(zForceSemaphore * zForceSemaphore);
237
248 uint64_t ( * GetTimeMilliSeconds)(void);
249
266 bool ( * CreateThread)(zForceThread ** zForceThread,
267 void ( * entryPoint)(void *),
268 void * arguments);
269
284 bool ( * WaitForThreadExit)(zForceThread * zForceThread);
285
296 void ( * Sleep)(uint32_t milliSeconds);
297 };
298
299 DLLINTERNAL bool OsAbstractionLayer_Initialize (
300 OsAbstractionLayer * osAbstractionLayer,
301 OsAbstractionLayer * userSuppliedOsAbstractionLayer);
302
303 DLLINTERNAL void OsAbstractionLayer_ThreadWrapper (
304 zForceThreadWrapper * wrapper);
305
306 #endif // ZFORCE_OSABSTRACTIONLAYER_H
307
zForceMutex
void zForceMutex
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:19
zForceThreadWrapper::Arguments
void * Arguments
Arguments for the entry function.
Definition: OsAbstractionLayer.h:34
zForceThreadWrapper::EntryPoint
void(* EntryPoint)(void *)
Entry function for the thread.
Definition: OsAbstractionLayer.h:33
OsAbstractionLayer
Overrides for OS Functions.
Definition: OsAbstractionLayer.h:44
zForceSemaphore
void zForceSemaphore
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:20
zForceThreadWrapper
Wrapper for threads.
Definition: OsAbstractionLayer.h:30
zForceThread
void zForceThread
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:21
zForceThreadWrapper::zForceThread
zForceThread * zForceThread
Thread pointer.
Definition: OsAbstractionLayer.h:32