PAL RTOS. This file contains the real-time OS APIs and is a part of the PAL service API. More...
Go to the source code of this file.
Data Structures | |
| struct | pal_threadLocalStore | 
| Thread local store struct.  More... | |
| struct | pal_timeVal | 
Macros | |
| #define | PAL_TICK_TO_MILLI_FACTOR 1000 | 
| Wait forever define. Used for semaphores and mutexes.  More... | |
Typedefs | |
| typedef uintptr_t | palThreadID_t | 
| Primitive ID type declarations.  More... | |
| typedef uintptr_t | palTimerID_t | 
| typedef uintptr_t | palMutexID_t | 
| typedef uintptr_t | palSemaphoreID_t | 
| typedef uintptr_t | palMemoryPoolID_t | 
| typedef uintptr_t | palMessageQID_t | 
| typedef enum palTimerType | palTimerType_t | 
| Timer types supported in PAL.  More... | |
| typedef void(* | palTimerFuncPtr) (void const *funcArgument) | 
| PAL timer function prototype.  More... | |
| typedef void(* | palThreadFuncPtr) (void const *funcArgument) | 
| PAL thread function prototype.  More... | |
| typedef enum pal_osPriority | palThreadPriority_t | 
| Thread priority levels for PAL threads - each thread must have a different priority.  More... | |
| typedef struct pal_threadLocalStore | palThreadLocalStore_t | 
| Thread local store struct.  More... | |
| typedef struct pal_timeVal | pal_timeVal_t | 
Enumerations | |
| enum | palTimerType { palOsTimerOnce = 0, palOsTimerPeriodic = 1 } | 
| Timer types supported in PAL.  More... | |
| enum | pal_osPriority {  PAL_osPriorityFirst = 0, PAL_osPriorityIdle = PAL_osPriorityFirst, PAL_osPriorityLow = 1, PAL_osPriorityReservedTRNG = 2, PAL_osPriorityBelowNormal = 3, PAL_osPriorityNormal = 4, PAL_osPriorityAboveNormal = 5, PAL_osPriorityReservedDNS = 6, PAL_osPriorityReservedSockets = 7, PAL_osPriorityHigh = 8, PAL_osPriorityReservedHighResTimer = 9, PAL_osPriorityRealtime = 10, PAL_osPrioritylast = PAL_osPriorityRealtime, PAL_osPriorityError = 0x84 }  | 
| Available priorities in PAL implementation, each priority can appear only once.  More... | |
Functions | |
| void | pal_osReboot (void) | 
| Initiates a system reboot.  More... | |
| uint64_t | pal_osKernelSysTick (void) | 
| Get the RTOS kernel system timer counter.  More... | |
| uint64_t | pal_osKernelSysTickMicroSec (uint64_t microseconds) | 
| Converts a value from microseconds to kernel system ticks.  More... | |
| uint64_t | pal_osKernelSysMilliSecTick (uint64_t sysTicks) | 
| Converts kernel system ticks to milliseconds.  More... | |
| uint64_t | pal_osKernelSysTickFrequency (void) | 
| Get the system tick frequency.  More... | |
| palStatus_t | pal_osThreadCreateWithAlloc (palThreadFuncPtr function, void *funcArgument, palThreadPriority_t priority, uint32_t stackSize, palThreadLocalStore_t *store, palThreadID_t *threadID) | 
| Allocates memory for the thread stack, creates and starts the thread function inside the PAL platform wrapper function.  More... | |
| palStatus_t | pal_osThreadTerminate (palThreadID_t *threadID) | 
| Terminate the thread and free the data allocated for it.  More... | |
| palThreadID_t | pal_osThreadGetId (void) | 
| Get the ID of the current thread.  More... | |
| palStatus_t | pal_osDelay (uint32_t milliseconds) | 
| Wait for a specified time period in milliseconds.  More... | |
| palStatus_t | pal_osTimerCreate (palTimerFuncPtr function, void *funcArgument, palTimerType_t timerType, palTimerID_t *timerID) | 
| Create a timer.  More... | |
| palStatus_t | pal_osTimerStart (palTimerID_t timerID, uint32_t millisec) | 
| Start or restart a timer.  More... | |
| palStatus_t | pal_osTimerStop (palTimerID_t timerID) | 
| Stop a timer.  More... | |
| palStatus_t | pal_osTimerDelete (palTimerID_t *timerID) | 
| Delete a timer object.  More... | |
| palStatus_t | pal_osMutexCreate (palMutexID_t *mutexID) | 
| Create and initialize a mutex object.  More... | |
| palStatus_t | pal_osMutexWait (palMutexID_t mutexID, uint32_t millisec) | 
| Wait until a mutex becomes available.  More... | |
| palStatus_t | pal_osMutexRelease (palMutexID_t mutexID) | 
Release a mutex that was obtained by osMutexWait.  More... | |
| palStatus_t | pal_osMutexDelete (palMutexID_t *mutexID) | 
| Delete a mutex object.  More... | |
| palStatus_t | pal_osSemaphoreCreate (uint32_t count, palSemaphoreID_t *semaphoreID) | 
| Create and initialize a semaphore object.  More... | |
| palStatus_t | pal_osSemaphoreWait (palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t *countersAvailable) | 
| Wait until a semaphore token becomes available.  More... | |
| palStatus_t | pal_osSemaphoreRelease (palSemaphoreID_t semaphoreID) | 
| Release a semaphore token.  More... | |
| palStatus_t | pal_osSemaphoreDelete (palSemaphoreID_t *semaphoreID) | 
| Delete a semaphore object.  More... | |
| int32_t | pal_osAtomicIncrement (int32_t *valuePtr, int32_t increment) | 
| Perform an atomic increment for a signed 32-bit value.  More... | |
| palStatus_t | pal_RTOSInitialize (void *opaqueContext) | 
| palStatus_t | pal_RTOSDestroy (void) | 
PAL RTOS. This file contains the real-time OS APIs and is a part of the PAL service API.
Random API is also provided. as well as random API and ROT (root of trust).
| #define PAL_TICK_TO_MILLI_FACTOR 1000 | 
Wait forever define. Used for semaphores and mutexes.
| typedef struct pal_timeVal pal_timeVal_t | 
| typedef uintptr_t palMemoryPoolID_t | 
| typedef uintptr_t palMessageQID_t | 
| typedef uintptr_t palMutexID_t | 
| typedef uintptr_t palSemaphoreID_t | 
| typedef void(* palThreadFuncPtr) (void const *funcArgument) | 
PAL thread function prototype.
| typedef uintptr_t palThreadID_t | 
Primitive ID type declarations.
| typedef struct pal_threadLocalStore palThreadLocalStore_t | 
Thread local store struct.
Can be used to hold, for example, state and configurations inside the thread.
| typedef enum pal_osPriority palThreadPriority_t | 
Thread priority levels for PAL threads - each thread must have a different priority.
| typedef void(* palTimerFuncPtr) (void const *funcArgument) | 
PAL timer function prototype.
| typedef uintptr_t palTimerID_t | 
| typedef enum palTimerType palTimerType_t | 
Timer types supported in PAL.
| enum pal_osPriority | 
Available priorities in PAL implementation, each priority can appear only once.
| enum palTimerType | 
| int32_t pal_osAtomicIncrement | ( | int32_t * | valuePtr, | 
| int32_t | increment | ||
| ) | 
Perform an atomic increment for a signed 32-bit value.
| [in,out] | valuePtr | The address of the value to increment. | 
| [in] | increment | The number by which to increment. | 
valuePtr after the increment operation. | palStatus_t pal_osDelay | ( | uint32_t | milliseconds | ) | 
Wait for a specified time period in milliseconds.
| [in] | milliseconds | The number of milliseconds to wait before proceeding. | 
| uint64_t pal_osKernelSysMilliSecTick | ( | uint64_t | sysTicks | ) | 
Converts kernel system ticks to milliseconds.
| [in] | sysTicks | The number of kernel system ticks to convert into milliseconds. | 
| uint64_t pal_osKernelSysTick | ( | void | ) | 
Get the RTOS kernel system timer counter.
| uint64_t pal_osKernelSysTickFrequency | ( | void | ) | 
Get the system tick frequency.
| uint64_t pal_osKernelSysTickMicroSec | ( | uint64_t | microseconds | ) | 
Converts a value from microseconds to kernel system ticks.
| [in] | microseconds | The number of microseconds to convert into system ticks. | 
| palStatus_t pal_osMutexCreate | ( | palMutexID_t * | mutexID | ) | 
Create and initialize a mutex object.
| [out] | mutexID | The created mutex ID handle. In case of error, this value is NULL. | 
| palStatus_t pal_osMutexDelete | ( | palMutexID_t * | mutexID | ) | 
Delete a mutex object.
| [in,out] | mutexID | The mutex handle to delete. On success, *mutexID is changed to NULL. | 
mutexID is no longer valid and cannot be used. | palStatus_t pal_osMutexRelease | ( | palMutexID_t | mutexID | ) | 
Release a mutex that was obtained by osMutexWait. 
| [in] | mutexID | The handle for the mutex. | 
| palStatus_t pal_osMutexWait | ( | palMutexID_t | mutexID, | 
| uint32_t | millisec | ||
| ) | 
Wait until a mutex becomes available.
| [in] | mutexID | The handle for the mutex. | 
| [in] | millisec | The timeout for waiting for the mutex to be available. PAL_RTOS_WAIT_FOREVER can be used as a parameter. | 
| void pal_osReboot | ( | void | ) | 
Initiates a system reboot.
Applications can provide their own implementation by defining PAL_USE_APPLICATION_REBOOT and providing the implementation for pal_plat_osApplicationReboot() function. 
| palStatus_t pal_osSemaphoreCreate | ( | uint32_t | count, | 
| palSemaphoreID_t * | semaphoreID | ||
| ) | 
Create and initialize a semaphore object.
| [in] | count | The number of available resources. | 
| [out] | semaphoreID | The created semaphore ID handle. In case of error, this value is NULL. | 
| palStatus_t pal_osSemaphoreDelete | ( | palSemaphoreID_t * | semaphoreID | ) | 
Delete a semaphore object.
| [in,out] | semaphoreID | The semaphore handle to delete. On success, *semaphoreID is changed to NULL. | 
semaphoreID is no longer valid and cannot be used. | palStatus_t pal_osSemaphoreRelease | ( | palSemaphoreID_t | semaphoreID | ) | 
Release a semaphore token.
| [in] | semaphoreID | The handle for the semaphore | 
| palStatus_t pal_osSemaphoreWait | ( | palSemaphoreID_t | semaphoreID, | 
| uint32_t | millisec, | ||
| int32_t * | countersAvailable | ||
| ) | 
Wait until a semaphore token becomes available.
| [in] | semaphoreID | The handle for the semaphore. | 
| [in] | millisec | The timeout for the waiting operation. If the timeout expires before the semaphore is released, an error is returned from the function. PAL_RTOS_WAIT_FOREVER can be used. | 
| [out] | countersAvailable | The number of semaphores available at the call if a semaphore is available. If the semaphore is not available due to timeout or error, 0 is returned. This parameter can be NULL  | 
| palStatus_t pal_osThreadCreateWithAlloc | ( | palThreadFuncPtr | function, | 
| void * | funcArgument, | ||
| palThreadPriority_t | priority, | ||
| uint32_t | stackSize, | ||
| palThreadLocalStore_t * | store, | ||
| palThreadID_t * | threadID | ||
| ) | 
Allocates memory for the thread stack, creates and starts the thread function inside the PAL platform wrapper function.
| [in] | function | A function pointer to the thread callback function. | 
| [in] | funcArgument | An argument for the thread function. | 
| [in] | priority | The priority of the thread. | 
| [in] | stackSize | The stack size of the thread, can NOT be 0. | 
| [in] | store | MUST be NULL - this functionality is not supported.  | 
| [out] | threadID | The created thread ID handle. In case of error, this value is NULL. | 
pal_osThreadTerminate() releases the thread stack. | palThreadID_t pal_osThreadGetId | ( | void | ) | 
Get the ID of the current thread.
| palStatus_t pal_osThreadTerminate | ( | palThreadID_t * | threadID | ) | 
Terminate the thread and free the data allocated for it.
| [in] | threadID | The thread ID to stop and terminate. | 
pal_osThreadTerminate is a non-blocking operation. It sends a cancellation request to the thread, and usually the thread exits immediately, but the system does not always guarantee this. | palStatus_t pal_osTimerCreate | ( | palTimerFuncPtr | function, | 
| void * | funcArgument, | ||
| palTimerType_t | timerType, | ||
| palTimerID_t * | timerID | ||
| ) | 
Create a timer.
| [in] | function | A function pointer to the timer callback function. | 
| [in] | funcArgument | An argument for the timer callback function. | 
| [in] | timerType | The timer type to be created, either periodic or one-shot. | 
| [out] | timerID | The ID handle for the created timer. In case of error, this value is NULL. | 
| palStatus_t pal_osTimerDelete | ( | palTimerID_t * | timerID | ) | 
Delete a timer object.
| [in,out] | timerID | The ID handle for the timer to delete. On success, *timerID is changed to NULL. | 
timerID is incorrect. | palStatus_t pal_osTimerStart | ( | palTimerID_t | timerID, | 
| uint32_t | millisec | ||
| ) | 
Start or restart a timer.
| [in] | timerID | The ID handle for the timer to start or restart. | 
| [in] | millisec | The length of time in milliseconds to set the timer to. MUST be larger than 0. | 
millisec was 0 . | palStatus_t pal_osTimerStop | ( | palTimerID_t | timerID | ) | 
Stop a timer.
| [in] | timerID | The ID handle for the timer to stop. | 
| palStatus_t pal_RTOSDestroy | ( | void | ) | 
This function removes PAL from the system and can be called after pal_RTOSInitialize.
pal_RTOSInitialize() first. | palStatus_t pal_RTOSInitialize | ( | void * | opaqueContext | ) | 
Initialize the RTOS module for PAL. This function can be called only once before running the system. To remove PAL from the system, call pal_RTOSDestroy. After calling pal_RTOSDestroy, you can call pal_RTOSInitialize again.
| [in] | opaqueContext | context to be passed to the platform if needed. |