Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PAL RTOS - platform. This file contains the real-time OS APIs that need to be implemented in the platform layer. More...
Go to the source code of this file.
Functions | |
| void | pal_plat_osReboot (void) |
| palStatus_t | pal_plat_RTOSInitialize (void *opaqueContext) |
| palStatus_t | pal_plat_RTOSDestroy (void) |
| uint64_t | pal_plat_osKernelSysTick (void) |
| uint64_t | pal_plat_osKernelSysTickMicroSec (uint64_t microseconds) |
| uint64_t | pal_plat_osKernelSysTickFrequency (void) |
| palStatus_t | pal_plat_osThreadCreate (palThreadFuncPtr function, void *funcArgument, palThreadPriority_t priority, uint32_t stackSize, uint32_t *stackPtr, palThreadLocalStore_t *store, palThreadID_t *threadID) |
| palStatus_t | pal_plat_osThreadTerminate (palThreadID_t *threadID) |
| palThreadID_t | pal_plat_osThreadGetId (void) |
| palThreadLocalStore_t * | pal_plat_osThreadGetLocalStore (void) |
| palStatus_t | pal_plat_osDelay (uint32_t milliseconds) |
| palStatus_t | pal_plat_osTimerCreate (palTimerFuncPtr function, void *funcArgument, palTimerType_t timerType, palTimerID_t *timerID) |
| palStatus_t | pal_plat_osTimerStart (palTimerID_t timerID, uint32_t millisec) |
| palStatus_t | pal_plat_osTimerStop (palTimerID_t timerID) |
| palStatus_t | pal_plat_osTimerDelete (palTimerID_t *timerID) |
| palStatus_t | pal_plat_osMutexCreate (palMutexID_t *mutexID) |
| palStatus_t | pal_plat_osMutexWait (palMutexID_t mutexID, uint32_t millisec) |
| palStatus_t | pal_plat_osMutexRelease (palMutexID_t mutexID) |
| palStatus_t | pal_plat_osMutexDelete (palMutexID_t *mutexID) |
| palStatus_t | pal_plat_osSemaphoreCreate (uint32_t count, palSemaphoreID_t *semaphoreID) |
| palStatus_t | pal_plat_osSemaphoreWait (palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t *countersAvailable) |
| palStatus_t | pal_plat_osSemaphoreRelease (palSemaphoreID_t semaphoreID) |
| palStatus_t | pal_plat_osSemaphoreDelete (palSemaphoreID_t *semaphoreID) |
| palStatus_t | pal_plat_osPoolCreate (uint32_t blockSize, uint32_t blockCount, palMemoryPoolID_t *memoryPoolID) |
| void * | pal_plat_osPoolAlloc (palMemoryPoolID_t memoryPoolID) |
| void * | pal_plat_osPoolCAlloc (palMemoryPoolID_t memoryPoolID) |
| palStatus_t | pal_plat_osPoolFree (palMemoryPoolID_t memoryPoolID, void *block) |
| palStatus_t | pal_plat_osPoolDestroy (palMemoryPoolID_t *memoryPoolID) |
| palStatus_t | pal_plat_osMessageQueueCreate (uint32_t messageQCount, palMessageQID_t *messageQID) |
| palStatus_t | pal_plat_osMessagePut (palMessageQID_t messageQID, uint32_t info, uint32_t timeout) |
| palStatus_t | pal_plat_osMessageGet (palMessageQID_t messageQID, uint32_t timeout, uint32_t *messageValue) |
| palStatus_t | pal_plat_osMessageQueueDestroy (palMessageQID_t *messageQID) |
| int32_t | pal_plat_osAtomicIncrement (int32_t *valuePtr, int32_t increment) |
| void * | pal_plat_malloc (size_t len) |
| void | pal_plat_free (void *buffer) |
| palStatus_t | pal_plat_osRandomBuffer (uint8_t *randomBuf, size_t bufSizeBytes) |
| palStatus_t | pal_plat_osGetRoT128Bit (uint8_t *keyBuf, size_t keyLenBytes) |
Variables | |
| uint32_t | g_palThreadPriorities [PAL_NUMBER_OF_THREADS_PRIORITIES] |
| This array holds a counter for each thread priority. | |
Detailed Description
PAL RTOS - platform. This file contains the real-time OS APIs that need to be implemented in the platform layer.
Definition in file pal_plat_rtos.h.
Function Documentation
| void pal_plat_free | ( | void * | buffer ) |
Free memory back to the OS heap.
- Parameters:
-
[in] *buffer A pointer to the buffer that should be free.
- Returns:
- `void`
Definition at line 1135 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| void* pal_plat_malloc | ( | size_t | len ) |
Perform allocation from the heap according to the OS specification.
- Parameters:
-
[in] len The length of the buffer to be allocated.
- Returns:
- `void *`. The pointer of the malloc received from the OS if NULL error occurred
Definition at line 1129 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| int32_t pal_plat_osAtomicIncrement | ( | int32_t * | valuePtr, |
| int32_t | increment | ||
| ) |
Perform an atomic increment for a signed32 bit value.
- Parameters:
-
[in,out] valuePtr The address of the value to increment. [in] increment The number by which to increment.
- Returns:
- The value of the `valuePtr` after the increment operation.
Perform an atomic increment for a signed32 bit value.
- Parameters:
-
[in,out] valuePtr The address of the value to increment. [in] increment The number by which to increment.
- Returns:
- The value of the valuePtr after the increment operation.
Definition at line 1714 of file Linux/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osDelay | ( | uint32_t | milliseconds ) |
Wait for a specified period of time in milliseconds.
- Parameters:
-
[in] milliseconds The number of milliseconds to wait before proceeding.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Wait for a specified period of time in milliseconds.
- Parameters:
-
[in] milliseconds The number of milliseconds to wait before proceeding.
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 231 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osGetRoT128Bit | ( | uint8_t * | keyBuf, |
| size_t | keyLenBytes | ||
| ) |
Retrieve platform Root of Trust certificate
- Parameters:
-
[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. The buffer needs to be able to hold 16 bytes of data.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
| uint64_t pal_plat_osKernelSysTick | ( | void | ) |
Get the RTOS kernel system timer counter.
- Returns:
- The RTOS kernel system timer counter.
- Note:
- The required tick counter is the OS (platform) kernel system tick counter.
- If the platform supports 64-bit tick counter, please implement it. If the platform supports only 32 bit, note that this counter wraps around very often (for example, once every 42 sec for 100Mhz).
Definition at line 238 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| uint64_t pal_plat_osKernelSysTickFrequency | ( | void | ) |
Get the system tick frequency.
- Returns:
- The system tick frequency.
- Note:
- The system tick frequency MUST be more than 1KHz (at least one tick per millisecond).
Get the system tick frequency.
- Returns:
- The system tick frequency.
Definition at line 259 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| uint64_t pal_plat_osKernelSysTickMicroSec | ( | uint64_t | microseconds ) |
Convert the value from microseconds to kernel sys ticks. This is the same as CMSIS macro `osKernelSysTickMicroSec`.
Definition at line 253 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osMessageGet | ( | palMessageQID_t | messageQID, |
| uint32_t | timeout, | ||
| uint32_t * | messageValue | ||
| ) |
Get a message or wait for a message from a queue.
- Parameters:
-
[in] messageQID The handle for the message queue. [in] timeout The timeout in milliseconds. [out] messageValue The data to send.
- Returns:
- PAL_SUCCESS(0) in case of success. One of the following error codes in case of failure:
- PAL_ERR_RTOS_RESOURCE - Semaphore was not available but not due to timeout.
- PAL_ERR_RTOS_TIMEOUT - No message arrived during the timeout period.
- PAL_ERR_RTOS_RESOURCE - No message received and there was no timeout.
- PAL_ERR_RTOS_RESOURCE - Semaphore was not available but not due to timeout.
Get a message or wait for a message from a queue.
- Parameters:
-
[in] messageQID The handle for the message queue. [in] timeout The timeout in milliseconds. [out] messageValue The data to send.
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, one of the following error codes in case of failure: PAL_ERR_RTOS_TIMEOUT - No message arrived during the timeout period. PAL_ERR_RTOS_RESOURCE - No message received and there was no timeout.
Definition at line 1085 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osMessagePut | ( | palMessageQID_t | messageQID, |
| uint32_t | info, | ||
| uint32_t | timeout | ||
| ) |
Put a message to a queue.
- Parameters:
-
[in] messageQID The handle for the message queue. [in] info The data to send. [in] timeout The timeout in milliseconds.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Put a message to a queue.
- Parameters:
-
[in] messageQID The handle for the message queue. [in] info The data to send. [in] timeout The timeout in milliseconds.
All messages has the same priority (set as 0).
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 1065 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osMessageQueueCreate | ( | uint32_t | messageQSize, |
| palMessageQID_t * | messageQID | ||
| ) |
Create and initialize a message queue.
- Parameters:
-
[in] messageQCount The size of the message queue. [out] messageQID The ID of the created message queue, zero value indicates an error.
- Returns:
- PAL_SUCCESS when the message queue was created successfully. A specific error in case of failure.
PAL_ERR_NO_MEMORY when there is no memory resource available to create a message queue object.
- Note:
- The create function MUST NOT wait for the platform resources and it should return PAL_ERR_RTOS_RESOURCE, unless the platform API is blocking.
Create and initialize a message queue.
- Parameters:
-
[in] messageQSize The size of the message queue. [out] messageQID The ID of the created message queue, zero value indicates an error.
- Returns:
- PAL_SUCCESS when the message queue was created successfully, a specific error in case of failure.
allocate the message queue structure
allocate the message queue structure
allocate the actual memory allocation for the message queue blocks, the size of the memory to allocate was taken from CMSIS header (cmsis_os.h)
< number of items (elements) in the queue
Definition at line 1031 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osMessageQueueDestroy | ( | palMessageQID_t * | messageQID ) |
Delete a message queue object.
- Parameters:
-
inout] messageQID The handle for the message queue. In success, `*messageQID` = NULL.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Delete a message queue object.
- Parameters:
-
inout] messageQID The handle for the message queue. In success, *messageQID = NULL.
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 1111 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osMutexCreate | ( | palMutexID_t * | mutexID ) |
Create and initialize a mutex object.
- Parameters:
-
[out] mutexID The created mutex ID handle, zero value indicates an error.
- Returns:
- PAL_SUCCESS when the mutex was created successfully, a specific error in case of failure.
PAL_ERR_NO_MEMORY when there is no memory resource available to create a mutex object.
- Note:
- The create function MUST NOT wait for the platform resources and it should return PAL_ERR_RTOS_RESOURCE, unless the platform API is blocking. By default, the mutex is created with a recursive flag set.
Create and initialize a mutex object.
- Parameters:
-
[out] mutexID The created mutex ID handle, zero value indicates an error.
- Returns:
- PAL_SUCCESS when the mutex was created successfully, a specific error in case of failure.
Definition at line 633 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osMutexDelete | ( | palMutexID_t * | mutexID ) |
Delete a mutex object.
- Parameters:
-
inout] mutexID The ID of the mutex to delete. In success, `*mutexID` = NULL.
- Returns:
- PAL_SUCCESS when the mutex was deleted successfully, one of the following error codes in case of failure:
- PAL_ERR_RTOS_RESOURCE - Mutex already released.
- PAL_ERR_RTOS_PARAMETER - Mutex ID is invalid.
- PAL_ERR_RTOS_ISR - Cannot be called from interrupt service routines.
- PAL_ERR_RTOS_RESOURCE - Mutex already released.
- Note:
- After this call, `mutex_id` is no longer valid and cannot be used.
Definition at line 736 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osMutexRelease | ( | palMutexID_t | mutexID ) |
Release a mutex that was obtained by `osMutexWait`.
- Parameters:
-
[in] mutexID The handle for the mutex.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Definition at line 702 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osMutexWait | ( | palMutexID_t | mutexID, |
| uint32_t | millisec | ||
| ) |
Wait until a mutex becomes available.
- Parameters:
-
[in] mutexID The handle for the mutex. [in] millisec The timeout for the waiting operation if the timeout expires before the semaphore is released and an error is returned from the function.
- Returns:
- PAL_SUCCESS(0) in case of success. One of the following error codes in case of failure:
- PAL_ERR_RTOS_RESOURCE - Mutex not available but no timeout set.
- PAL_ERR_RTOS_TIMEOUT - Mutex was not available until timeout expired.
- PAL_ERR_RTOS_PARAMETER - The mutex ID is invalid.
- PAL_ERR_RTOS_ISR - Cannot be called from interrupt service routines.
- PAL_ERR_RTOS_RESOURCE - Mutex not available but no timeout set.
Definition at line 666 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| void* pal_plat_osPoolAlloc | ( | palMemoryPoolID_t | memoryPoolID ) |
Allocate a single memory block from a memory pool.
- Parameters:
-
[in] memoryPoolID The handle for the memory pool.
- Returns:
- A pointer to a single allocated memory from the pool, NULL in case of failure.
Definition at line 989 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| void* pal_plat_osPoolCAlloc | ( | palMemoryPoolID_t | memoryPoolID ) |
Allocate a single memory block from a memory pool and set the memory block to zero.
- Parameters:
-
[in] memoryPoolID The handle for the memory pool.
- Returns:
- A pointer to a single allocated memory from the pool, NULL in case of failure.
Allocate a single memory block from a memory pool and set memory block to zero.
- Parameters:
-
[in] memoryPoolID The handle for the memory pool.
- Returns:
- A pointer to a single allocated memory from the pool, NULL in case of failure.
Definition at line 994 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osPoolCreate | ( | uint32_t | blockSize, |
| uint32_t | blockCount, | ||
| palMemoryPoolID_t * | memoryPoolID | ||
| ) |
Create and initialize a memory pool.
- Parameters:
-
[in] blockSize The size of a single block in bytes. [in] blockCount The maximum number of blocks in the memory pool. [out] memoryPoolID The ID of the created memory pool. Zero value indicates an error.
- Returns:
- PAL_SUCCESS when the memory pool was created successfully. A specific error in case of failure.
PAL_ERR_NO_MEMORY when no memory resource is available to create a memory pool object.
- Note:
- The create function MUST NOT wait for the platform resources and it should return PAL_ERR_RTOS_RESOURCE, unless the platform API is blocking.
Create and initialize a memory pool.
- Parameters:
-
[in] blockSize The size of a single block in bytes. [in] blockCount The maximum number of blocks in the memory pool. [out] memoryPoolID The ID of the created memory pool, zero value indicates an error.
- Returns:
- PAL_SUCCESS when the memory pool was created successfully, a specific error in case of failure.
allocate the memory pool structure
allocate the memory pool structure
allocate the actual memory allocation for the memory pool blocks, the size of the memory to allocate was taken from CMSIS header (cmsis_os.h)
< number of items (elements) in the pool
< size of an item
Definition at line 913 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osPoolDestroy | ( | palMemoryPoolID_t * | memoryPoolID ) |
Delete a memory pool object.
- Parameters:
-
inout] memoryPoolID The handle for the memory pool. In success, `*memoryPoolID` = NULL.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Delete a memory pool object.
- Parameters:
-
inout] memoryPoolID The handle for the memory pool. In success, *memoryPoolID = NULL.
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 1017 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osPoolFree | ( | palMemoryPoolID_t | memoryPoolID, |
| void * | block | ||
| ) |
Return the memoryPoolID of the memory block back to a specific memory pool.
- Parameters:
-
[in] memoryPoolID The handle for the memory pool. [in] block The block to be freed.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Return the memoryPoolID of the memory block back to a specific memory pool.
- Parameters:
-
[in] memoryPoolID The handle for the memory pool. [in] block The block to be freed.
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 999 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osRandomBuffer | ( | uint8_t * | randomBuf, |
| size_t | bufSizeBytes | ||
| ) |
Generate a random number into the given buffer with the given size in bytes.
- Parameters:
-
[out] randomBuf A buffer to hold the generated number. [in] bufSizeBytes The size of the buffer and the size of the required random number to generate.
- Returns:
- PAL_SUCCESS on success. A negative value indicating a specific error code in case of failure.
Definition at line 1141 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| void pal_plat_osReboot | ( | void | ) |
Initiate a system reboot.
Definition at line 102 of file Linux/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osSemaphoreCreate | ( | uint32_t | count, |
| palSemaphoreID_t * | semaphoreID | ||
| ) |
Create and initialize a semaphore object.
- Parameters:
-
[in] count The number of available resources. [out] semaphoreID The ID of the created semaphore, zero value indicates an error.
- Returns:
- PAL_SUCCESS when the semaphore was created successfully, a specific error in case of failure.
PAL_ERR_NO_MEMORY: No memory resource available to create a semaphore object.
- Note:
- The create function MUST not wait for the platform resources and it should return PAL_ERR_RTOS_RESOURCE, unless the platform API is blocking.
Definition at line 762 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osSemaphoreDelete | ( | palSemaphoreID_t * | semaphoreID ) |
Delete a semaphore object.
- Parameters:
-
inout] semaphoreID: The ID of the semaphore to delete. In success, `*semaphoreID` = NULL.
- Returns:
- PAL_SUCCESS when the semaphore was deleted successfully. One of the following error codes in case of failure:
PAL_ERR_RTOS_RESOURCE - Semaphore already released.
PAL_ERR_RTOS_PARAMETER - Semaphore ID is invalid.
- Note:
- After this call, the `semaphore_id` is no longer valid and cannot be used.
Delete a semaphore object.
- Parameters:
-
inout] semaphoreID: The ID of the semaphore to delete. In success, *semaphoreID = NULL.
- Returns:
- PAL_SUCCESS when the semaphore was deleted successfully, one of the following error codes in case of failure: PAL_ERR_RTOS_RESOURCE - Semaphore already released. PAL_ERR_RTOS_PARAMETER - Semaphore ID is invalid.
- Note:
- After this call, the semaphore_id is no longer valid and cannot be used.
Definition at line 887 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osSemaphoreRelease | ( | palSemaphoreID_t | semaphoreID ) |
Release a semaphore token.
- Parameters:
-
[in] semaphoreID The handle for the semaphore.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Release a semaphore token.
- Parameters:
-
[in] semaphoreID The handle for the semaphore.
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 846 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osSemaphoreWait | ( | palSemaphoreID_t | semaphoreID, |
| uint32_t | millisec, | ||
| int32_t * | countersAvailable | ||
| ) |
Wait until a semaphore token becomes available.
- Parameters:
-
[in] semaphoreID The handle for the semaphore. [in] millisec The timeout for the waiting operation if the timeout expires before the semaphore is released and an error is returned from the function. [out] countersAvailable The number of semaphores available. If semaphores are not available (timeout/error) zero is returned.
- Returns:
- PAL_SUCCESS(0) in case of success. One of the following error codes in case of failure:
- PAL_ERR_RTOS_TIMEOUT - Semaphore was not available until timeout expired.
- PAL_ERR_RTOS_PARAMETER - Semaphore ID is invalid.
- PAL_ERR_RTOS_TIMEOUT - Semaphore was not available until timeout expired.
Definition at line 797 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osThreadCreate | ( | palThreadFuncPtr | function, |
| void * | funcArgument, | ||
| palThreadPriority_t | priority, | ||
| uint32_t | stackSize, | ||
| uint32_t * | stackPtr, | ||
| palThreadLocalStore_t * | store, | ||
| palThreadID_t * | threadID | ||
| ) |
Create and start a thread function.
- Parameters:
-
[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] stackPtr A pointer to the thread's stack. [in] store A pointer to thread's local store, can be NULL. [out] threadID The created thread ID handle, zero indicates an error.
- Returns:
- The ID of the created thread. In case of error, returns zero.
- Note:
- Each thread MUST have a unique priority.
- When the priority of the created thread function is higher than the current running thread, the created thread function starts instantly and becomes the new running thread.
- The create function MUST not wait for platform resources and it should return PAL_ERR_RTOS_RESOURCE, unless the platform API is blocking.
Create and start a thread function.
- Parameters:
-
[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] stackPtr A pointer to the thread's stack. [in] store A pointer to thread's local store, can be NULL. [out] threadID The created thread ID handle, zero indicates an error.
- Returns:
- The ID of the created thread, in case of error return zero.
- Note:
- Each thread MUST have a unique priority.
- When the priority of the created thread function is higher than the current running thread, the created thread function starts instantly and becomes the new running thread.
in case of error in the thread creation, reset the data of the given index in the threads array.
in case of error in the thread creation, reset the data of the given index in the threads array.
in case of error in the thread creation, reset the data of the given index in the threads array.
Definition at line 264 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palThreadID_t pal_plat_osThreadGetId | ( | void | ) |
Get the ID of the current thread.
- Returns:
- The ID of the current thread. In case of error, returns PAL_MAX_UINT32.
- Note:
- For a thread with real time priority, the function always returns PAL_MAX_UINT32.
Get the ID of the current thread.
- Returns:
- The ID of the current thread, in case of error return PAL_maX_UINT32.
- Note:
- For a thread with real time priority, the function always returns PAL_maX_UINT32.
Definition at line 351 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palThreadLocalStore_t* pal_plat_osThreadGetLocalStore | ( | void | ) |
Get the storage of the current thread.
- Returns:
- The storage of the current thread.
Definition at line 406 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osThreadTerminate | ( | palThreadID_t * | threadID ) |
Terminate and free allocated data for the thread.
- Parameters:
-
[in] threadID The ID of the thread to stop and terminate.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Terminate and free allocated data for the thread.
- Parameters:
-
[in] threadID The ID of the thread to stop and terminate.
- Returns:
- palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 368 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osTimerCreate | ( | palTimerFuncPtr | function, |
| void * | funcArgument, | ||
| palTimerType_t | timerType, | ||
| palTimerID_t * | timerID | ||
| ) |
Create a timer.
- Parameters:
-
[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.
- Returns:
- PAL_SUCCESS when the timer was created successfully. A specific error in case of failure.
PAL_ERR_NO_MEMORY: No memory resource available to create a timer object.
- Note:
- The timer callback function runs according to the platform resources of stack size and priority.
- The create function MUST not wait for platform resources and it should return PAL_ERR_RTOS_RESOURCE, unless the platform API is blocking.
Create a timer.
- Parameters:
-
[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.
- Returns:
- PAL_SUCCESS when the timer was created successfully. A specific error in case of failure.
Definition at line 436 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osTimerDelete | ( | palTimerID_t * | timerID ) |
Delete the timer object.
- Parameters:
-
inout] timerID The handle for the timer to delete. In success, `*timerID` = NULL.
- Returns:
- PAL_SUCCESS when the timer was deleted successfully. PAL_ERR_RTOS_PARAMETER when the `timerID` is incorrect.
- Note:
- In case of a running timer, `pal_platosTimerDelete()` MUST stop the timer before deletion.
Delete the timer object
- Parameters:
-
inout] timerID The handle for the timer to delete. In success, *timerID = NULL.
- Returns:
- PAL_SUCCESS when the timer was deleted successfully, PAL_ERR_RTOS_PARAMETER when the timerID is incorrect.
Definition at line 588 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osTimerStart | ( | palTimerID_t | timerID, |
| uint32_t | millisec | ||
| ) |
Start or restart a timer.
- Parameters:
-
[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.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Start or restart a timer.
- Parameters:
-
[in] timerID The handle for the timer to start. [in] millisec The time in milliseconds to set the timer to.
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 500 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_osTimerStop | ( | palTimerID_t | timerID ) |
Stop a timer.
- Parameters:
-
[in] timerID The handle for the timer to stop.
- Returns:
- PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.
Stop a timer.
- Parameters:
-
[in] timerID The handle for the timer to stop.
- Returns:
- The status in the form of palStatus_t; PAL_SUCCESS(0) in case of success, a negative value indicating a specific error code in case of failure.
Definition at line 554 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| palStatus_t pal_plat_RTOSDestroy | ( | void | ) |
De-initialize thread objects.
De-Initialize thread objects.
Definition at line 226 of file FreeRTOS/RTOS/pal_plat_rtos.c.
| 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.
- Parameters:
-
[in] opaqueContext The context passed to the initialization (not required for generic CMSIS, pass NULL in this case).
- Returns:
- PAL_SUCCESS(0) in case of success, PAL_ERR_CREATION_FAILED in case of failure.
Initialize all data structures (semaphores, mutexs, memory pools, message queues) at system initialization. In case of a failure in any of the initializations, the function returns with an error and stops the rest of the initializations.
- Parameters:
-
[in] opaqueContext The context passed to the initialization (not required for generic CMSIS, pass NULL in this case).
- Returns:
- PAL_SUCCESS(0) in case of success, PAL_ERR_CREATION_FAILED in case of failure.
Definition at line 208 of file FreeRTOS/RTOS/pal_plat_rtos.c.
Variable Documentation
| uint32_t g_palThreadPriorities[PAL_NUMBER_OF_THREADS_PRIORITIES] |
This array holds a counter for each thread priority.
If the counter is more than 1, it means that more than one thread has the same priority and this is a forbidden situation. The mapping between the priorities and the index in the array is as follow:
PAL_osPriorityIdle --> g_palThreadPriorities[0] PAL_osPriorityLow --> g_palThreadPriorities[1] PAL_osPriorityBelowNormal --> g_palThreadPriorities[2] PAL_osPriorityNormal --> g_palThreadPriorities[3] PAL_osPriorityAboveNormal --> g_palThreadPriorities[4] PAL_osPriorityHigh --> g_palThreadPriorities[5] PAL_osPriorityRealtime --> g_palThreadPriorities[6] An array of PAL thread priorities. The size of the array is defined in the Service API (`pal_configuration.h`) by PAL_MAX_NUMBER_OF_THREADS.
Definition at line 25 of file pal_rtos.c.
Generated on Tue Jul 12 2022 16:22:14 by
1.7.2