Neonode zForce(TM) SDK
Public Attributes | List of all members
OsAbstractionLayer Struct Reference

Overrides for OS Functions. More...

#include <OsAbstractionLayer.h>

Public Attributes

void *(* Malloc )(size_t size)
 Allocate memory area. The memory area is not nulled. More...
 
void(* Free )(void *memoryPointer)
 Free previously allocated memory area. More...
 
void *(* Realloc )(void *memoryPointer, size_t size)
 Reallocate previously allocated memory area with a new size. More...
 
void *(* MallocWithPattern )(size_t size, uint8_t pattern)
 Allocate memory area, setting all memory to the supplied pattern. More...
 
bool(* InitializeMutex )(zForceMutex **zForceMutex)
 Initialize Mutex. More...
 
bool(* LockMutex )(zForceMutex *zForceMutex)
 Lock Mutex. More...
 
bool(* UnlockMutex )(zForceMutex *zForceMutex)
 Unlock Mutex. More...
 
bool(* DestroyMutex )(zForceMutex *zForceMutex)
 Destroy Mutex. More...
 
bool(* InitializeSemaphore )(zForceSemaphore **zForceSemaphore, uint32_t initialValue)
 Initialize Semaphore. More...
 
bool(* WaitForSemaphore )(zForceSemaphore *zForceSemaphore, uint32_t timeoutMs)
 Wait for Semaphore. More...
 
bool(* IncrementSemaphore )(zForceSemaphore *zForceSemaphore)
 Increment Semaphore. More...
 
bool(* DestroySemaphore )(zForceSemaphore *zForceSemaphore)
 Destroy Semaphore. More...
 
uint64_t(* GetTimeMilliSeconds )(void)
 Get time in MilliSeconds. More...
 
bool(* CreateThread )(zForceThread **zForceThread, void(*entryPoint)(void *), void *arguments)
 Create Thread and run it. More...
 
bool(* WaitForThreadExit )(zForceThread *zForceThread)
 Wait for Thread to exit. More...
 
void(* Sleep )(uint32_t milliSeconds)
 Sleep for a specified amount of MilliSeconds. More...
 

Detailed Description

Overrides for OS Functions.

Member Data Documentation

bool( * OsAbstractionLayer::CreateThread) (zForceThread **zForceThread, void(*entryPoint)(void *), void *arguments)

Create Thread and run it.

Create Thread and run it.

On failure, errno is set.

Parameters
[out]zForceThreadPointer to zForceThread pointer.
entryPointThe entrypoint of the code to run.
argumentsPointer to arguments passed to the thread.
Returns
True for success, False for failure. See errno.
bool( * OsAbstractionLayer::DestroyMutex) (zForceMutex *zForceMutex)

Destroy Mutex.

Destroy Mutex.

On failure, errno is set.

Parameters
zForceMutexPointer to zForceMutex instance.
Returns
True for success, False for failure. See errno.
bool( * OsAbstractionLayer::DestroySemaphore) (zForceSemaphore *zForceSemaphore)

Destroy Semaphore.

Destroy Semaphore. Regardless of return code, the Semaphore should no longer be used.

On failure, errno is set.

Parameters
zForceSemaphoreSemaphore to wait for.
Returns
True for success, False for failure. See errno.
void( * OsAbstractionLayer::Free) (void *memoryPointer)

Free previously allocated memory area.

Free previously allocated memory area.

Parameters
memoryPointerPointer to memory area to free.
Returns
No return value.
uint64_t( * OsAbstractionLayer::GetTimeMilliSeconds) (void)

Get time in MilliSeconds.

The only requirement on this time is that it is a time that does not change according to timezone changes or daylight time changes. There is no requirement on this being number of milliseconds since some specified time in history.

Returns
Unsigned 64-bit value representing time in MilliSeconds.
bool( * OsAbstractionLayer::IncrementSemaphore) (zForceSemaphore *zForceSemaphore)

Increment Semaphore.

Increment Semaphore by 1.

On failure, errno is set.

Parameters
zForceSemaphoreSemaphore to increment.
Returns
True for success, False for failure. See errno.
bool( * OsAbstractionLayer::InitializeMutex) (zForceMutex **zForceMutex)

Initialize Mutex.

Initialize Mutex.

On failure, errno is set.

Parameters
[out]zForceMutexPointer to a zForceMutex pointer.
Returns
True for success, False for failure. See errno.
bool( * OsAbstractionLayer::InitializeSemaphore) (zForceSemaphore **zForceSemaphore, uint32_t initialValue)

Initialize Semaphore.

Initialize Semaphore and set it to initialValue. The initial value is 0 for blocking and positive value for not currently blocking regardless of underlying implementation. For example for a queue, an initial value of 0 is desirable as the queue is empty initially.

On failure, errno is set.

Parameters
[out]zForceSemaphorePointer to zForceSemaphore pointer.
initialValueInitial value to set the Semaphore to.
Returns
True for success, False for failure. See errno.
bool( * OsAbstractionLayer::LockMutex) (zForceMutex *zForceMutex)

Lock Mutex.

Lock Mutex.

On failure, errno is set.

Parameters
zForceMutexPointer to zForceMutex instance.
Returns
True for success, False for failure. See errno.
void*( * OsAbstractionLayer::Malloc) (size_t size)

Allocate memory area. The memory area is not nulled.

Allocate memory area. The memory area is not nulled.

On failure, errno is set.

Parameters
sizeSize of the requested memory area in bytes.
Returns
Pointer to allocated memory area or NULL for failure. See errno.
void*( * OsAbstractionLayer::MallocWithPattern) (size_t size, uint8_t pattern)

Allocate memory area, setting all memory to the supplied pattern.

Allocate memory area, setting all memory to the supplied pattern.

On failure, errno is set.

Parameters
sizeSize of the requested memory area in bytes.
pattern1-byte pattern to fill the memory with.
Returns
Pointer to allocated memory area or NULL for failure. See errno.
void*( * OsAbstractionLayer::Realloc) (void *memoryPointer, size_t size)

Reallocate previously allocated memory area with a new size.

Reallocate previously allocated memory area with a new size.

On failure, errno is set.

Parameters
memoryPointerPointer to memory area or NULL to allocate a new one.
sizeSize of the new area.
Returns
Pointer to memory area. Can point to a new location.
void( * OsAbstractionLayer::Sleep) (uint32_t milliSeconds)

Sleep for a specified amount of MilliSeconds.

Suspends the execution of the current thread for the specified amount of MilliSeconds.

Parameters
milliSecondsAmount of MilliSeconds to Sleep.
Returns
No return value.
bool( * OsAbstractionLayer::UnlockMutex) (zForceMutex *zForceMutex)

Unlock Mutex.

Unlock Mutex.

On failure, errno is set.

Parameters
zForceMutexPointer to zForceMutex instance.
Returns
True for success, False for failure. See errno.
bool( * OsAbstractionLayer::WaitForSemaphore) (zForceSemaphore *zForceSemaphore, uint32_t timeoutMs)

Wait for Semaphore.

Wait for Semaphore. Blocks until count is incremented. No guarantee of order if multiple threads are waiting for the same Semaphore.

On failure, errno is set.

Parameters
zForceSemaphoreSemaphore to wait for.
Returns
True for success, False for failure. See errno.
bool( * OsAbstractionLayer::WaitForThreadExit) (zForceThread *zForceThread)

Wait for Thread to exit.

Waits for Thread to exit. This function should normally never be called other than internally in the library. Blocks until Thread has exited, possibly forever.

On failure, errno is set.

Parameters
zForceThreadzForceThread to wait for.
Returns
True for success, False for failure. See errno.

The documentation for this struct was generated from the following file: