PAL RTOS - platform. This file contains the real-time OS APIs that need to be implemented in the platform layer. More...
#include "pal.h"
Go to the source code of this file.
Functions | |
void | pal_plat_osReboot (void) |
Initiate a system reboot. More... | |
void | pal_plat_osApplicationReboot (void) |
Application provided implementation to replace default pal_osReboot() functionality. More... | |
palStatus_t | pal_plat_RTOSInitialize (void *opaqueContext) |
Initialize all data structures (semaphores, mutexes, memory pools, message queues) at system initialization. More... | |
palStatus_t | pal_plat_RTOSDestroy (void) |
De-initialize thread objects. More... | |
uint64_t | pal_plat_osKernelSysTick (void) |
Get the RTOS kernel system timer counter. More... | |
uint64_t | pal_plat_osKernelSysTickMicroSec (uint64_t microseconds) |
Convert the value from microseconds to kernel system ticks. More... | |
uint64_t | pal_plat_osKernelSysTickFrequency (void) |
Get the system tick frequency. More... | |
palStatus_t | pal_plat_osThreadCreate (palThreadFuncPtr function, void *funcArgument, palThreadPriority_t priority, uint32_t stackSize, palThreadID_t *threadID) |
Create and run the thread. More... | |
palStatus_t | pal_plat_osThreadTerminate (palThreadID_t *threadID) |
Terminate and free allocated data for the thread. More... | |
palThreadID_t | pal_plat_osThreadGetId (void) |
Get the ID of the current thread. More... | |
palStatus_t | pal_plat_osDelay (uint32_t milliseconds) |
Wait for a specified period of time in milliseconds. More... | |
palStatus_t | pal_plat_osTimerCreate (palTimerFuncPtr function, void *funcArgument, palTimerType_t timerType, palTimerID_t *timerID) |
Create a timer. More... | |
palStatus_t | pal_plat_osTimerStart (palTimerID_t timerID, uint32_t millisec) |
Start or restart a timer. More... | |
palStatus_t | pal_plat_osTimerStop (palTimerID_t timerID) |
Stop a timer. More... | |
palStatus_t | pal_plat_osTimerDelete (palTimerID_t *timerID) |
Delete the timer object. More... | |
palStatus_t | pal_plat_osMutexCreate (palMutexID_t *mutexID) |
Create and initialize a mutex object. More... | |
palStatus_t | pal_plat_osMutexWait (palMutexID_t mutexID, uint32_t millisec) |
Wait until a mutex becomes available. More... | |
palStatus_t | pal_plat_osMutexRelease (palMutexID_t mutexID) |
Release a mutex that was obtained by osMutexWait . More... | |
palStatus_t | pal_plat_osMutexDelete (palMutexID_t *mutexID) |
Delete a mutex object. More... | |
palStatus_t | pal_plat_osSemaphoreCreate (uint32_t count, palSemaphoreID_t *semaphoreID) |
Create and initialize a semaphore object. More... | |
palStatus_t | pal_plat_osSemaphoreWait (palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t *countersAvailable) |
Wait until a semaphore token becomes available. More... | |
palStatus_t | pal_plat_osSemaphoreRelease (palSemaphoreID_t semaphoreID) |
Release a semaphore token. More... | |
palStatus_t | pal_plat_osSemaphoreDelete (palSemaphoreID_t *semaphoreID) |
Delete a semaphore object. More... | |
int32_t | pal_plat_osAtomicIncrement (int32_t *valuePtr, int32_t increment) |
Perform an atomic increment for a signed 32-bit value. More... | |
void * | pal_plat_malloc (size_t len) |
Perform allocation from the heap according to the OS specification. More... | |
void | pal_plat_free (void *buffer) |
Free memory back to the OS heap. More... | |
palStatus_t | pal_plat_osGetRoTFromHW (uint8_t *keyBuf, size_t keyLenBytes) |
Retrieve platform Root of Trust (RoT) certificate. More... | |
palStatus_t | pal_plat_osSetRtcTime (uint64_t rtcSetTime) |
This function calls the platform layer and sets the new real-time clock (RTC) to the hardware. More... | |
palStatus_t | pal_plat_osGetRtcTime (uint64_t *rtcGetTime) |
This function gets the real-time clock (RTC) from the platform. More... | |
palStatus_t | pal_plat_rtcDeInit (void) |
This function deinitializes the realt-time clock (RTC) module. More... | |
palStatus_t | pal_plat_rtcInit (void) |
This function initializes the real-time clock (RTC) module. More... | |
PAL RTOS - platform. This file contains the real-time OS APIs that need to be implemented in the platform layer.
void pal_plat_free | ( | void * | buffer | ) |
Free memory back to the OS heap.
[in] | buffer | A pointer to the buffer that should be freed. |
void
void* pal_plat_malloc | ( | size_t | len | ) |
Perform allocation from the heap according to the OS specification.
[in] | len | The length of the buffer to be allocated in bytes. |
void *
, or the pointer of the malloc received from the OS if NULL error occurred void pal_plat_osApplicationReboot | ( | void | ) |
Application provided implementation to replace default pal_osReboot()
functionality.
int32_t pal_plat_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_plat_osDelay | ( | uint32_t | milliseconds | ) |
Wait for a specified period of time in milliseconds.
[in] | milliseconds | The number of milliseconds to wait before proceeding. |
palStatus_t pal_plat_osGetRoTFromHW | ( | uint8_t * | keyBuf, |
size_t | keyLenBytes | ||
) |
Retrieve platform Root of Trust (RoT) certificate.
[in,out] | keyBuf | A pointer to the buffer that holds the RoT. |
[in] | keyLenBytes | The size of the buffer to hold the 128 bit key, must be at least 16 bytes. |
palStatus_t pal_plat_osGetRtcTime | ( | uint64_t * | rtcGetTime | ) |
This function gets the real-time clock (RTC) from the platform.
[out] | rtcGetTime | - Holds the RTC value |
uint64_t pal_plat_osKernelSysTick | ( | void | ) |
Get the RTOS kernel system timer counter.
uint64_t pal_plat_osKernelSysTickFrequency | ( | void | ) |
Get the system tick frequency.
uint64_t pal_plat_osKernelSysTickMicroSec | ( | uint64_t | microseconds | ) |
Convert the value from microseconds to kernel system ticks.
This is the same as CMSIS macro osKernelSysTickMicroSec
.
microseconds | The value in microseconds to be converted to kernel system ticks. |
palStatus_t pal_plat_osMutexCreate | ( | palMutexID_t * | mutexID | ) |
Create and initialize a mutex object.
[out] | mutexID | The created mutex ID handle, zero value indicates an error. |
palStatus_t pal_plat_osMutexDelete | ( | palMutexID_t * | mutexID | ) |
Delete a mutex object.
[in,out] | mutexID | The ID of the mutex to delete. In success, mutexID = NULL. |
mutexID
is no longer valid and cannot be used. palStatus_t pal_plat_osMutexRelease | ( | palMutexID_t | mutexID | ) |
Release a mutex that was obtained by osMutexWait
.
[in] | mutexID | The handle for the mutex. |
palStatus_t pal_plat_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 the waiting operation. If the timeout expires before the mutex is released, an error is returned from the function. |
void pal_plat_osReboot | ( | void | ) |
Initiate a system reboot.
palStatus_t pal_plat_osSemaphoreCreate | ( | uint32_t | count, |
palSemaphoreID_t * | semaphoreID | ||
) |
Create and initialize a semaphore object.
[in] | count | The number of available resources. |
[out] | semaphoreID | The ID of the created semaphore, zero value indicates an error. |
palStatus_t pal_plat_osSemaphoreDelete | ( | palSemaphoreID_t * | semaphoreID | ) |
Delete a semaphore object.
[in,out] | semaphoreID | The ID of the semaphore to delete. On success, semaphoreID = NULL. |
semaphoreID
is no longer valid and cannot be used. palStatus_t pal_plat_osSemaphoreRelease | ( | palSemaphoreID_t | semaphoreID | ) |
Release a semaphore token.
[in] | semaphoreID | The handle for the semaphore. |
palStatus_t pal_plat_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. |
[out] | countersAvailable | The number of semaphores available. If semaphores are not available due to timeout or error, zero is returned. |
palStatus_t pal_plat_osSetRtcTime | ( | uint64_t | rtcSetTime | ) |
This function calls the platform layer and sets the new real-time clock (RTC) to the hardware.
[in] | rtcSetTime | the new RTC time |
palStatus_t pal_plat_osThreadCreate | ( | palThreadFuncPtr | function, |
void * | funcArgument, | ||
palThreadPriority_t | priority, | ||
uint32_t | stackSize, | ||
palThreadID_t * | threadID | ||
) |
Create and run the thread.
[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 in bytes, can NOT be 0. |
[out] | threadID | The created thread ID handle. In case of error, this value is NULL. |
palThreadID_t pal_plat_osThreadGetId | ( | void | ) |
Get the ID of the current thread.
palStatus_t pal_plat_osThreadTerminate | ( | palThreadID_t * | threadID | ) |
Terminate and free allocated data for the thread.
[in] | threadID | A pointer to a palThreadData_t structure containing information about the thread. |
palStatus_t pal_plat_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, periodic or oneShot . |
[out] | timerID | The ID of the created timer. Zero value indicates an error. |
palStatus_t pal_plat_osTimerDelete | ( | palTimerID_t * | timerID | ) |
Delete the timer object.
[in,out] | timerID | The handle for the timer to delete. on success, timerID = NULL. |
timerID
is incorrect. pal_plat_osTimerDelete()
MUST stop the timer before deletion. palStatus_t pal_plat_osTimerStart | ( | palTimerID_t | timerID, |
uint32_t | millisec | ||
) |
Start or restart a timer.
[in] | timerID | The handle for the timer to start. |
[in] | millisec | The time in milliseconds to set the timer to, MUST be larger than 0. In case the value is 0, the error PAL_ERR_RTOS_VALUE will be returned. |
palStatus_t pal_plat_osTimerStop | ( | palTimerID_t | timerID | ) |
Stop a timer.
[in] | timerID | The handle for the timer to stop. |
palStatus_t pal_plat_rtcDeInit | ( | void | ) |
This function deinitializes the realt-time clock (RTC) module.
palStatus_t pal_plat_rtcInit | ( | void | ) |
This function initializes the real-time clock (RTC) module.
palStatus_t pal_plat_RTOSDestroy | ( | void | ) |
De-initialize thread objects.
palStatus_t pal_plat_RTOSInitialize | ( | void * | opaqueContext | ) |
Initialize all data structures (semaphores, mutexes, memory pools, message queues) at system initialization.
In case of a failure in any of the initializations, the function returns an error and stops the rest of the initializations.
[in] | opaqueContext | The context passed to the initialization (not required for generic CMSIS, pass NULL in this case). |