Renesas PTX1xxR IoT-Reader API Version 7.3.1
Renesas Software Stack for IoT-Reader Applications
Topics | Typedefs | Functions
PTX NSC Operating System Abstraction Layer (OSAL)
Collaboration diagram for PTX NSC Operating System Abstraction Layer (OSAL):

Topics

 OSAL Interface Extensions
 

Typedefs

typedef struct ptxMutex * ptxMutex_t
 Mutex Wrapper Structure - Forward Declaration.
 
typedef struct ptxSemaphore * ptxSemaphore_t
 Semaphore Wrapper Structure - Forward Declaration.
 
typedef uint64_t ptxTimeDiff_t
 Time difference type.
 
typedef void(* pptxOsal_ThreadProc_t) (void *threadParam)
 Thread procedure function pointer declaration.
 
typedef void(* pptxOsal_TimerProc_t) (void *timerParam)
 Timer procedure function pointer declaration.
 

Functions

ptxStatus_t ptxOsal_AllocInit (struct ptxOsal **osalCtx, void *sysCtx)
 Initialize the OSAL.
 
void ptxOsal_DeInit (struct ptxOsal *osalCtx)
 Un-Initialize the OSAL.
 
void ptxOsal_DeAlloc (struct ptxOsal **osalCtx)
 De-Allocate the OSAL.
 
void * ptxOsal_Allocate (struct ptxOsal *osalCtx, size_t allocSize)
 Allocate memory. Track memory usage.
 
void * ptxOsal_JustAllocate (size_t allocSize)
 Allocate memory. Do not track memory usage. Does not need an instance of OSAL.
 
void ptxOsal_Free (struct ptxOsal *osalCtx, void *memToFree)
 Free memory, allocated by ptxOsal_Allocate.
 
void ptxOsal_FreeNull (struct ptxOsal *osalCtx, void **memToFree)
 Free memory, allocated by ptxOsal_Allocate and set the pointer to NULL.
 
void * ptxOsal_Allocate_NoTrack (struct ptxOsal *osalCtx, size_t allocSize)
 Allocate memory. Do not track memory usage.
 
void ptxOsal_Free_NoTrack (struct ptxOsal *osalCtx, void *memToFree)
 Free memory, allocated by ptxOsal_Allocate_NoTrack.
 
void ptxOsal_JustFree (void *memToFree, uint32_t *sentryViolationCount)
 Free memory, allocated by ptxOsal_JustAllocate.
 
ptxStatus_t ptxOsal_SemInit (struct ptxOsal *osalCtx, ptxSemaphore_t *hSem, uint32_t initialCount, uint32_t maxCount)
 Initialize an already allocated but non-initialized object.
 
ptxStatus_t ptxOsal_SemClose (struct ptxOsal *osalCtx, ptxSemaphore_t *hSem)
 Close an initialized semaphore object.
 
ptxStatus_t ptxOsal_SemPost (struct ptxOsal *osalCtx, ptxSemaphore_t *hSem)
 Signal a semaphore, unblock a waiting thread.
 
ptxStatus_t ptxOsal_SemWait (struct ptxOsal *osalCtx, ptxSemaphore_t *hSem)
 Wait on the semaphore.
 
ptxStatus_t ptxOsal_SemTimedWait (struct ptxOsal *osalCtx, ptxSemaphore_t *hSem, uint32_t msTimeout)
 Wait on the semaphore, with timeout.
 
ptxStatus_t ptxOsal_MutexInit (struct ptxOsal *osalCtx, ptxMutex_t *hMutex)
 Initialize a Mutex.
 
ptxStatus_t ptxOsal_MutexDestroy (struct ptxOsal *osalCtx, ptxMutex_t *hMutex)
 Remove a Mutex.
 
ptxStatus_t ptxOsal_MutexLock (struct ptxOsal *osalCtx, ptxMutex_t *hMutex)
 Lock/acquire a Mutex.
 
ptxStatus_t ptxOsal_MutexUnlock (struct ptxOsal *osalCtx, ptxMutex_t *hMutex)
 Unlock/release a Mutex.
 
struct ptxThread * ptxOsal_ThreadAllocate (struct ptxOsal *osalCtx)
 Allocate a thread structure.
 
ptxStatus_t ptxOsal_ThreadCreate (struct ptxOsal *osalCtx, struct ptxThread *hThd, pptxOsal_ThreadProc_t thdFn, void *thdParam)
 Create a thread.
 
ptxStatus_t ptxOsal_ThreadJoin (struct ptxOsal *osalCtx, struct ptxThread *hThd)
 Join on a thread, wait until it has exited.
 
ptxStatus_t ptxOsal_ThreadClose (struct ptxOsal *osalCtx, struct ptxThread *hThd)
 Close a thread, once it has exited.
 
void ptxOsal_ThreadSleep (struct ptxOsal *osalCtx, uint32_t msSleep)
 Sleep for a number of ms.
 
struct ptxTimer * ptxOsal_TimerAllocate (struct ptxOsal *osalCtx)
 Allocate a timer structure.
 
ptxStatus_t ptxOsal_TimerCreate (struct ptxOsal *osalCtx, struct ptxTimer *hTimer, pptxOsal_TimerProc_t timerProc, void *timerParam)
 Create a timer.
 
ptxStatus_t ptxOsal_TimerStart (struct ptxOsal *osalCtx, struct ptxTimer *hTimer, uint32_t msInterval)
 Start or restart the timer.
 
ptxStatus_t ptxOsal_TimerCancel (struct ptxOsal *osalCtx, struct ptxTimer *hTimer)
 Cancel a timer, if active.
 
ptxStatus_t ptxOsal_TimerClose (struct ptxOsal *osalCtx, struct ptxTimer *hTimer)
 Close a timer, once it has expired.
 
ptxStatus_t ptxOsal_StopwatchStart (struct ptxOsal *osalCtx, ptxTimeDiff_t *startVal)
 Start a time measurement or get a time value.
 
ptxStatus_t ptxOsal_StopwatchStop (struct ptxOsal *osalCtx, ptxTimeDiff_t *startStopVal)
 End a time measurement.
 
void * ptxOsal_GetSysCtx (struct ptxOsal *osalCtx)
 Get the System Context.
 

Detailed Description

Typedef Documentation

◆ pptxOsal_ThreadProc_t

typedef void(* pptxOsal_ThreadProc_t) (void *threadParam)

Thread procedure function pointer declaration.

Parameters
threadParamPointer to thread-specific ("context") storage.

◆ pptxOsal_TimerProc_t

typedef void(* pptxOsal_TimerProc_t) (void *timerParam)

Timer procedure function pointer declaration.

Parameters
timerParamPointer to timer-specific ("context") storage.

Function Documentation

◆ ptxOsal_Allocate()

void * ptxOsal_Allocate ( struct ptxOsal * osalCtx,
size_t allocSize )

Allocate memory. Track memory usage.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]allocSizeNumber of bytes to allocate.
Returns
Pointer to the allocated memory or NULL if not successful.

◆ ptxOsal_Allocate_NoTrack()

void * ptxOsal_Allocate_NoTrack ( struct ptxOsal * osalCtx,
size_t allocSize )

Allocate memory. Do not track memory usage.

This function shall be used for optional/supplemental components, not directly belonging to the stack. The memory consumption of is not tracked; Use this allocator variant for components whose memory consumption shall not be counted with the stack memory allocation (e.g. logger). De-allocate only with ptxOsal_Free_NoTrack.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]allocSizeNumber of bytes to allocate.
Returns
Pointer to the allocated memory or NULL if not successful. p

◆ ptxOsal_AllocInit()

ptxStatus_t ptxOsal_AllocInit ( struct ptxOsal ** osalCtx,
void * sysCtx )

Initialize the OSAL.

Function that sets up the Component.

Parameters
[in,out]osalCtxPointer to a non_allocated and non-initialized OSAL component structure.
[in]sysCtxArbitrary platform context, as required. May be NULL on some platforms. It could be NULL.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_DeAlloc()

void ptxOsal_DeAlloc ( struct ptxOsal ** osalCtx)

De-Allocate the OSAL.

Function that frees up the memory and closes the Component and sets pointer to NULL.

Parameters
[in,out]osalCtxPointer to an allocated OSAL component structure pointer.

◆ ptxOsal_DeInit()

void ptxOsal_DeInit ( struct ptxOsal * osalCtx)

Un-Initialize the OSAL.

Function that cleans up the Component: de-inits internal members.

Parameters
[in,out]osalCtxPointer to an initialized OSAL component structure.

◆ ptxOsal_Free()

void ptxOsal_Free ( struct ptxOsal * osalCtx,
void * memToFree )

Free memory, allocated by ptxOsal_Allocate.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]memToFreePointer to the previously allocated (ptxOsal_Allocate) section of memory to be released.

◆ ptxOsal_Free_NoTrack()

void ptxOsal_Free_NoTrack ( struct ptxOsal * osalCtx,
void * memToFree )

Free memory, allocated by ptxOsal_Allocate_NoTrack.

Note
Free memory, provided by non-tracking allocator ptxOsal_Allocate_NoTrack. Do not use on memory allocated by other functions than the dedicated, non-tracking variant.
Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]memToFreePointer to the previously allocated (ptxOsal_Allocate) section of memory to be released.

◆ ptxOsal_FreeNull()

void ptxOsal_FreeNull ( struct ptxOsal * osalCtx,
void ** memToFree )

Free memory, allocated by ptxOsal_Allocate and set the pointer to NULL.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]memToFreePointer to a location that references the the previously allocated (ptxOsal_Allocate) section of memory to be released.
Note
The function takes a pointer-to-pointer argument, in contrast to ptxOsal_Free.

◆ ptxOsal_GetSysCtx()

void * ptxOsal_GetSysCtx ( struct ptxOsal * osalCtx)

Get the System Context.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
Returns
System Context, a pointer to arbitrary context.

◆ ptxOsal_JustAllocate()

void * ptxOsal_JustAllocate ( size_t allocSize)

Allocate memory. Do not track memory usage. Does not need an instance of OSAL.

This function shall be used for optional/supplemental components, not directly belonging to the stack. The memory consumption of the stack itself is tracked; Use this allocator variant for components whose memory consumption shall not be counted with the stack memory allocation (e.g. logger). De-allocate only with ptxOsal_JustFree.

Parameters
[in]allocSizeNumber of bytes to allocate.
Returns
Pointer to the allocated memory or NULL if not successful.

◆ ptxOsal_JustFree()

void ptxOsal_JustFree ( void * memToFree,
uint32_t * sentryViolationCount )

Free memory, allocated by ptxOsal_JustAllocate.

Free memory, provided by non-tracking allocator ptxOsal_JustAllocate. Do not use on memory allocated by other functions than the dedicated variant.

Parameters
[in]memToFreePointer to the previously allocated (ptxOsal_Allocate) section of memory to be released.
[out]sentryViolationCountPointer to a variable that will be incremented each time a memory boundary violation has been found (destroyed sentry pattern). The caller has to set the variable to 0 initially.

◆ ptxOsal_MutexDestroy()

ptxStatus_t ptxOsal_MutexDestroy ( struct ptxOsal * osalCtx,
ptxMutex_t * hMutex )

Remove a Mutex.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hMutexPointer to the Mutex object.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_MutexInit()

ptxStatus_t ptxOsal_MutexInit ( struct ptxOsal * osalCtx,
ptxMutex_t * hMutex )

Initialize a Mutex.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hMutexPointer to a location that will be initialized/receive the Mutex object.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_MutexLock()

ptxStatus_t ptxOsal_MutexLock ( struct ptxOsal * osalCtx,
ptxMutex_t * hMutex )

Lock/acquire a Mutex.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]hMutexPointer to the initialized Mutex object.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_MutexUnlock()

ptxStatus_t ptxOsal_MutexUnlock ( struct ptxOsal * osalCtx,
ptxMutex_t * hMutex )

Unlock/release a Mutex.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]hMutexPointer to the initialized Mutex object.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_SemClose()

ptxStatus_t ptxOsal_SemClose ( struct ptxOsal * osalCtx,
ptxSemaphore_t * hSem )

Close an initialized semaphore object.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]hSemPointer to an initialized semaphore object.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_SemInit()

ptxStatus_t ptxOsal_SemInit ( struct ptxOsal * osalCtx,
ptxSemaphore_t * hSem,
uint32_t initialCount,
uint32_t maxCount )

Initialize an already allocated but non-initialized object.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hSemPointer to an allocated but non-initialized semaphore object.
[in]initialCountInitial value.
[in]maxCountMaximum count.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_SemPost()

ptxStatus_t ptxOsal_SemPost ( struct ptxOsal * osalCtx,
ptxSemaphore_t * hSem )

Signal a semaphore, unblock a waiting thread.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]hSemPointer to an initialized semaphore object.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_SemTimedWait()

ptxStatus_t ptxOsal_SemTimedWait ( struct ptxOsal * osalCtx,
ptxSemaphore_t * hSem,
uint32_t msTimeout )

Wait on the semaphore, with timeout.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]hSemPointer to an initialized semaphore object.
[in]msTimeoutTimeout period, in ms.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_SemWait()

ptxStatus_t ptxOsal_SemWait ( struct ptxOsal * osalCtx,
ptxSemaphore_t * hSem )

Wait on the semaphore.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]hSemPointer to an initialized semaphore object.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_StopwatchStart()

ptxStatus_t ptxOsal_StopwatchStart ( struct ptxOsal * osalCtx,
ptxTimeDiff_t * startVal )

Start a time measurement or get a time value.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in,out]startValPointer to a variable that will receive the start value.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_StopwatchStop()

ptxStatus_t ptxOsal_StopwatchStop ( struct ptxOsal * osalCtx,
ptxTimeDiff_t * startStopVal )

End a time measurement.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in,out]startStopValPointer to a variable that provides the start time and that will receive the time span. The time unit is microseconds.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_ThreadAllocate()

struct ptxThread * ptxOsal_ThreadAllocate ( struct ptxOsal * osalCtx)

Allocate a thread structure.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
Returns
Pointer to an allocated instance of Thread structure(NULL if error).

◆ ptxOsal_ThreadClose()

ptxStatus_t ptxOsal_ThreadClose ( struct ptxOsal * osalCtx,
struct ptxThread * hThd )

Close a thread, once it has exited.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hThdPointer to the thread, created by ptxOsal_ThreadCreate.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_ThreadCreate()

ptxStatus_t ptxOsal_ThreadCreate ( struct ptxOsal * osalCtx,
struct ptxThread * hThd,
pptxOsal_ThreadProc_t thdFn,
void * thdParam )

Create a thread.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hThdPointer to a platform-specific thread descriptor/structure/handle.
[in]thdFnPointer to the thread procedure.
[in]thdParamParameter that the thread function will receive when it is started. May be NULL if there is no data to share with or to hand over to the thread respectively.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_ThreadJoin()

ptxStatus_t ptxOsal_ThreadJoin ( struct ptxOsal * osalCtx,
struct ptxThread * hThd )

Join on a thread, wait until it has exited.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hThdPointer to the thread, created by ptxOsal_ThreadCreate.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_ThreadSleep()

void ptxOsal_ThreadSleep ( struct ptxOsal * osalCtx,
uint32_t msSleep )

Sleep for a number of ms.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]msSleepNumber of ms to suspend the current thread. If 0, a Yield operation is performed.

◆ ptxOsal_TimerAllocate()

struct ptxTimer * ptxOsal_TimerAllocate ( struct ptxOsal * osalCtx)

Allocate a timer structure.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
Returns
Pointer to an allocated instance of Timer structure(NULL if error).

◆ ptxOsal_TimerCancel()

ptxStatus_t ptxOsal_TimerCancel ( struct ptxOsal * osalCtx,
struct ptxTimer * hTimer )

Cancel a timer, if active.

Note
If timer is not running, no operation is performed and status returned is Successful.
Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[in]hTimerPointer to the timer, created by ptxOsal_TimerCreate.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_TimerClose()

ptxStatus_t ptxOsal_TimerClose ( struct ptxOsal * osalCtx,
struct ptxTimer * hTimer )

Close a timer, once it has expired.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hTimerPointer to the timer, created by ptxOsal_TimerCreate.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_TimerCreate()

ptxStatus_t ptxOsal_TimerCreate ( struct ptxOsal * osalCtx,
struct ptxTimer * hTimer,
pptxOsal_TimerProc_t timerProc,
void * timerParam )

Create a timer.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hTimerPointer to a platform-specific variable that will receive the timer descriptor/structure/handle.
[in]timerProcPointer to the timer procedure.
[in]timerParamParameter that the timer procedure will receive when it is started. May be NULL if there is no data to share with or to hand over to the thread respectively.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.

◆ ptxOsal_TimerStart()

ptxStatus_t ptxOsal_TimerStart ( struct ptxOsal * osalCtx,
struct ptxTimer * hTimer,
uint32_t msInterval )

Start or restart the timer.

The timer is started or restarted in one-shot mode.

Parameters
[in]osalCtxPointer to an initialized OSAL component structure.
[out]hTimerPointer to the timer, created by ptxOsal_TimerCreate.
[out]msIntervalInterval, in ms.
Returns
Status, indicating whether the operation was successful. See ptxStatus_t.