Mbed Cloud example program for workshop in W27 2018.
pal_rtos.h File Reference
PAL RTOS. This file contains the real-time OS APIs and is a part of the PAL service API. It provides thread, timers, semaphores, mutexes and memory pool management APIs. Random API and ROT (root of trust) are also provided. More...
Go to the source code of this file.
Data Structures | |
struct | pal_threadLocalStore |
Thread local store struct. More... | |
Typedefs | |
typedef uintptr_t | palThreadID_t |
Primitive ID type declarations. | |
typedef enum palTimerType | palTimerType_t |
Timer types supported in PAL. | |
typedef void(* | palTimerFuncPtr )(void const *funcArgument) |
PAL timer function prototype. | |
typedef void(* | palThreadFuncPtr )(void const *funcArgument) |
PAL thread function prototype. | |
typedef enum pal_osPriority | palThreadPriority_t |
Available priorities in PAL implementation, each priority can appear only once. | |
typedef struct pal_threadLocalStore | palThreadLocalStore_t |
Thread local store struct. | |
Enumerations | |
enum | palTimerType { , palOsTimerPeriodic = 1 } |
Timer types supported in PAL. More... | |
enum | pal_osPriority |
Available priorities in PAL implementation, each priority can appear only once. More... | |
Functions | |
PAL_DEPRECATED (palOsStorageEncryptionKey and palOsStorageSignatureKey are deprecated please use palOsStorageEncryptionKey128Bit palOsStorageSignatureKey128Bit) typedef enum palDeviceKeyType | |
Device key types supported in PAL. | |
void | pal_osReboot (void) |
uint64_t | pal_osKernelSysTick (void) |
uint64_t | pal_osKernelSysTickMicroSec (uint64_t microseconds) |
uint64_t | pal_osKernelSysMilliSecTick (uint64_t sysTicks) |
uint64_t | pal_osKernelSysTickFrequency (void) |
uint64_t | pal_osGetTime (void) |
palStatus_t | pal_osSetTime (uint64_t seconds) |
Set the current system time by accepting seconds since January 1st 1970 UTC+0. | |
palStatus_t | pal_osThreadCreate (palThreadFuncPtr function, void *funcArgument, palThreadPriority_t priority, uint32_t stackSize, uint32_t *stackPtr, palThreadLocalStore_t *store, palThreadID_t *threadID) |
-----This function shall be deprecated in the next PAL release!!------ This function creates and starts the thread function (inside the PAL platform wrapper function). | |
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). | |
palStatus_t | pal_osThreadTerminate (palThreadID_t *threadID) |
palThreadID_t | pal_osThreadGetId (void) |
palThreadLocalStore_t * | pal_osThreadGetLocalStore (void) |
palStatus_t | pal_osDelay (uint32_t milliseconds) |
palStatus_t | pal_osTimerCreate (palTimerFuncPtr function, void *funcArgument, palTimerType_t timerType, palTimerID_t *timerID) |
palStatus_t | pal_osTimerStart (palTimerID_t timerID, uint32_t millisec) |
palStatus_t | pal_osTimerStop (palTimerID_t timerID) |
palStatus_t | pal_osTimerDelete (palTimerID_t *timerID) |
palStatus_t | pal_osMutexCreate (palMutexID_t *mutexID) |
palStatus_t | pal_osMutexWait (palMutexID_t mutexID, uint32_t millisec) |
palStatus_t | pal_osMutexRelease (palMutexID_t mutexID) |
palStatus_t | pal_osMutexDelete (palMutexID_t *mutexID) |
palStatus_t | pal_osSemaphoreCreate (uint32_t count, palSemaphoreID_t *semaphoreID) |
palStatus_t | pal_osSemaphoreWait (palSemaphoreID_t semaphoreID, uint32_t millisec, int32_t *countersAvailable) |
palStatus_t | pal_osSemaphoreRelease (palSemaphoreID_t semaphoreID) |
palStatus_t | pal_osSemaphoreDelete (palSemaphoreID_t *semaphoreID) |
palStatus_t | pal_osPoolCreate (uint32_t blockSize, uint32_t blockCount, palMemoryPoolID_t *memoryPoolID) |
void * | pal_osPoolAlloc (palMemoryPoolID_t memoryPoolID) |
void * | pal_osPoolCAlloc (palMemoryPoolID_t memoryPoolID) |
palStatus_t | pal_osPoolFree (palMemoryPoolID_t memoryPoolID, void *block) |
palStatus_t | pal_osPoolDestroy (palMemoryPoolID_t *memoryPoolID) |
palStatus_t | pal_osMessageQueueCreate (uint32_t messageQCount, palMessageQID_t *messageQID) |
palStatus_t | pal_osMessagePut (palMessageQID_t messageQID, uint32_t info, uint32_t timeout) |
palStatus_t | pal_osMessageGet (palMessageQID_t messageQID, uint32_t timeout, uint32_t *messageValue) |
palStatus_t | pal_osMessageQueueDestroy (palMessageQID_t *messageQID) |
int32_t | pal_osAtomicIncrement (int32_t *valuePtr, int32_t increment) |
palStatus_t | pal_osRandom32bit (uint32_t *random) |
palStatus_t | pal_osRandomBuffer (uint8_t *randomBuf, size_t bufSizeBytes) |
palStatus_t | pal_osRandomUniform (uint32_t upperBound, uint32_t *random) |
PAL_DEPRECATED (pal_osGetDeviceKey128Bit is deprecated please use pal_osGetDeviceKey) palStatus_t pal_osGetDeviceKey(palDevKeyType_t keyType | |
palStatus_t | pal_RTOSInitialize (void *opaqueContext) |
palStatus_t | pal_RTOSDestroy (void) |
Detailed Description
PAL RTOS. This file contains the real-time OS APIs and is a part of the PAL service API. It provides thread, timers, semaphores, mutexes and memory pool management APIs. Random API and ROT (root of trust) are also provided.
Definition in file pal_rtos.h.
Typedef Documentation
typedef void(* palThreadFuncPtr)(void const *funcArgument) |
PAL thread function prototype.
Definition at line 74 of file pal_rtos.h.
typedef uintptr_t palThreadID_t |
Primitive ID type declarations.
Definition at line 44 of file pal_rtos.h.
typedef struct pal_threadLocalStore palThreadLocalStore_t |
Thread local store struct.
Thread priority levels for PAL threads - each thread must have a different priority. Can be used to hold for example state and configurations inside the thread.
typedef enum pal_osPriority palThreadPriority_t |
Available priorities in PAL implementation, each priority can appear only once.
typedef void(* palTimerFuncPtr)(void const *funcArgument) |
PAL timer function prototype.
Definition at line 71 of file pal_rtos.h.
typedef enum palTimerType palTimerType_t |
Timer types supported in PAL.
Enumeration Type Documentation
enum pal_osPriority |
Available priorities in PAL implementation, each priority can appear only once.
Definition at line 78 of file pal_rtos.h.
enum palTimerType |
Timer types supported in PAL.
Definition at line 52 of file pal_rtos.h.
Function Documentation
PAL_DEPRECATED | ( | palOsStorageEncryptionKey and palOsStorageSignatureKey are deprecated please use palOsStorageEncryptionKey128Bit | palOsStorageSignatureKey128Bit ) |
Device key types supported in PAL.
128bit storage encryption key derived from RoT.
128bit storage signature key derived from RoT.
Definition at line 58 of file pal_rtos.h.
PAL_DEPRECATED | ( | pal_osGetDeviceKey128Bit is deprecated please use | pal_osGetDeviceKey ) |
Return a device unique key derived from the root of trust.
- Parameters:
-
[in] keyType The type of key to derive. [in,out] key A 128-bit OR 256-bit buffer to hold the derived key, size is defined according to the `keyType`. [in] keyLenBytes The size of buffer to hold the 128-bit OR 256-bit key.
- Returns:
- PAL_SUCCESS in case of success and one of the following error codes in case of failure:
PAL_ERR_GET_DEV_KEY - an error in key derivation.
int32_t pal_osAtomicIncrement | ( | int32_t * | valuePtr, |
int32_t | increment | ||
) |
Perform an atomic increment for a signed 32-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 `valuePtr` after the increment operation.
Definition at line 404 of file pal_rtos.c.
palStatus_t pal_osDelay | ( | uint32_t | milliseconds ) |
Wait for a specified time period in milliseconds.
- Parameters:
-
[in] milliseconds The number of milliseconds to wait before proceeding.
- Returns:
- PAL_SUCCESS(0) in case of success and a negative value indicating a specific error code in case of failure.
Definition at line 244 of file pal_rtos.c.
uint64_t pal_osGetTime | ( | void | ) |
Get the system time.
- Returns:
- The system 64-bit counter indicating the current system time in seconds on success. Zero value when the time is not set in the system.
Definition at line 419 of file pal_rtos.c.
uint64_t pal_osKernelSysMilliSecTick | ( | uint64_t | sysTicks ) |
Converts value from kernel system ticks to milliseconds.
- Parameters:
-
[in] sysTicks The number of kernel system ticks to convert into milliseconds.
- Returns:
- Converted value in system milliseconds.
Definition at line 131 of file pal_rtos.c.
uint64_t pal_osKernelSysTick | ( | void | ) |
Get the RTOS kernel system timer counter.
- Note:
- The system needs to supply a 64-bit tick counter. If only a 32-bit counter is supported,
- the counter wraps around very often (for example, once every 42 sec for 100Mhz).
- Returns:
- The RTOS kernel system timer counter.
Definition at line 106 of file pal_rtos.c.
uint64_t pal_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).
Definition at line 143 of file pal_rtos.c.
uint64_t pal_osKernelSysTickMicroSec | ( | uint64_t | microseconds ) |
Converts a value from microseconds to kernel system ticks.
- Parameters:
-
[in] microseconds The number of microseconds to convert into system ticks.
- Returns:
- Converted value in system ticks.
Definition at line 124 of file pal_rtos.c.
palStatus_t pal_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 memory pool. [in] timeout The timeout in milliseconds. Value zero means that the function returns instantly
The value PAL_RTOS_WAIT_FOREVER means that the funtion waits for an infinite time until message can be put to the queue.[out] messageValue The message value from the message queue.
- Returns:
- PAL_SUCCESS(0) in case of success and one of the following error codes in case of failure:
PAL_ERR_RTOS_TIMEOUT - no message arrived during the given timeout period. Can also be returned in case of timeout zero value, which means that there are no messages in the queue.
Definition at line 390 of file pal_rtos.c.
palStatus_t pal_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. Value zero means that the function returns instantly.
The value PAL_RTOS_WAIT_FOREVER means that the function waits for an infinite time until the message can be put to the queue.
- Returns:
- PAL_SUCCESS(0) in case of success and a negative value indicating a specific error code in case of failure.
Definition at line 383 of file pal_rtos.c.
palStatus_t pal_osMessageQueueCreate | ( | uint32_t | messageQCount, |
palMessageQID_t * | messageQID | ||
) |
Create and initialize a message queue of `uint32_t` messages.
- Parameters:
-
[in] messageQCount The maximum number of messages in the queue. [out] messageQID,: The created message queue ID handle. In case of error, this value is NULL.
- Returns:
- PAL_SUCCESS when the message queue was created successfully.
PAL_ERR_NO_MEMORY when there is no memory resource available to create a message queue object.
Definition at line 376 of file pal_rtos.c.
palStatus_t pal_osMessageQueueDestroy | ( | palMessageQID_t * | messageQID ) |
Delete a message queue object.
- Parameters:
-
[in,out] messageQID The handle for the message queue. In success, `*messageQID` = NULL.
- Returns:
- PAL_SUCCESS(0) in case of success and a negative value indicating a specific error code in case of failure.
Definition at line 397 of file pal_rtos.c.
palStatus_t pal_osMutexCreate | ( | palMutexID_t * | mutexID ) |
Create and initialize a mutex object.
- Parameters:
-
[out] mutexID The created mutex ID handle. In case of error, this value is NULL.
- Returns:
- PAL_SUCCESS when the mutex was created successfully.
PAL_ERR_NO_MEMORY when there is no memory resource available to create a mutex object.
Definition at line 284 of file pal_rtos.c.
palStatus_t pal_osMutexDelete | ( | palMutexID_t * | mutexID ) |
Delete a mutex object.
- Parameters:
-
inout] mutexID The mutex handle to delete. In success, `*mutexID` = NULL.
- Returns:
- PAL_SUCCESS when the mutex was deleted successfully.
PAL_ERR_RTOS_RESOURCE - mutex is already released.
PAL_ERR_RTOS_PARAMETER - mutex ID is invalid.
PAL_ERR_RTOS_ISR - cannot be called from the interrupt service routines.
- Note:
- After this call, the `mutex_id` is no longer valid and cannot be used.
Definition at line 305 of file pal_rtos.c.
palStatus_t pal_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 and another negative value indicating a specific error code in case of failure.
Definition at line 298 of file pal_rtos.c.
palStatus_t pal_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 waiting to the mutex to be available. PAL_RTOS_WAIT_FOREVER can be used as a parameter.
- Returns:
- PAL_SUCCESS(0) in case of success or one of the following error codes in case of failure:
PAL_ERR_RTOS_RESOURCE - mutex was not availabe but no timeout was set.
PAL_ERR_RTOS_TIMEOUT - mutex was not available until the timeout.
PAL_ERR_RTOS_PARAMETER - mutex ID is invalid.
PAL_ERR_RTOS_ISR - cannot be called from the interrupt service routines.
Definition at line 291 of file pal_rtos.c.
void* pal_osPoolAlloc | ( | palMemoryPoolID_t | memoryPoolID ) |
Allocate a single memory block from the memory pool.
- Parameters:
-
[in] memoryPoolID The handle for the memory pool.
- Returns:
- A pointer to a single allocated memory from the pool or NULL in case of failure.
Definition at line 346 of file pal_rtos.c.
void* pal_osPoolCAlloc | ( | palMemoryPoolID_t | memoryPoolID ) |
Allocate a single memory block from the memory pool and set it to zero.
- Parameters:
-
[in] memoryPoolID The handle for the memory pool.
- Returns:
- A pointer to a single allocated memory from the pool or NULL in case of failure.
Definition at line 353 of file pal_rtos.c.
palStatus_t pal_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 created memory pool ID handle. In case of error, this value is NULL.
- Returns:
- PAL_SUCCESS when the memory pool was created successfully.
PAL_ERR_NO_MEMORY when there is no memory resource available to create a memory pool object.
Definition at line 339 of file pal_rtos.c.
palStatus_t pal_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 and a negative value indicating a specific error code in case of failure.
Definition at line 369 of file pal_rtos.c.
palStatus_t pal_osPoolFree | ( | palMemoryPoolID_t | memoryPoolID, |
void * | block | ||
) |
Return a memory block back to a specific memory pool.
- Parameters:
-
[in] memoryPoolHandle The handle for the memory pool. [in] block The block to free.
- Returns:
- PAL_SUCCESS(0) in case of success and a negative value indicating a specific error code in case of failure.
Definition at line 361 of file pal_rtos.c.
palStatus_t pal_osRandom32bit | ( | uint32_t * | random ) |
Generate a 32-bit random number.
- Parameters:
-
[out] random A 32-bit buffer to hold the generated number.
- Note:
- `pal_init()` MUST be called before this function.
- Returns:
- PAL_SUCCESS on success, a negative value indicating a specific error code in case of failure.
Definition at line 447 of file pal_rtos.c.
palStatus_t pal_osRandomBuffer | ( | uint8_t * | randomBuf, |
size_t | bufSizeBytes | ||
) |
Generate random number into given buffer with 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.
- Note:
- `pal_init()` MUST be called before this function
- Returns:
- PAL_SUCCESS on success, a negative value indicating a specific error code in case of failure.
Definition at line 460 of file pal_rtos.c.
palStatus_t pal_osRandomUniform | ( | uint32_t | upperBound, |
uint32_t * | random | ||
) |
Generate a 32-bit random number uniformly distributed less than `upperBound`.
- Parameters:
-
[out] random A pointer to a 32-bit buffer to hold the generated number.
- Note:
- `pal_init()` MUST be called before this function
- For the first phase, the `upperBound` parameter is ignored.
- Returns:
- PAL_SUCCESS on success, a negative value indicating a specific error code in case of failure.
Definition at line 492 of file pal_rtos.c.
void pal_osReboot | ( | void | ) |
Initiates a system reboot.
Definition at line 101 of file pal_rtos.c.
palStatus_t pal_osSemaphoreCreate | ( | uint32_t | count, |
palSemaphoreID_t * | semaphoreID | ||
) |
Create and initialize a semaphore object.
- Parameters:
-
[in] count The number of available resources. [out] semaphoreID The created semaphore ID handle. In case of error, this value is NULL.
- Returns:
- PAL_SUCCESS when the semaphore was created successfully.
PAL_ERR_NO_MEMORY when there is no memory resource available to create a semaphore object.
Definition at line 311 of file pal_rtos.c.
palStatus_t pal_osSemaphoreDelete | ( | palSemaphoreID_t * | semaphoreID ) |
Delete a semaphore object.
- Parameters:
-
inout] semaphoreID The semaphore handle to delete. In success, `*semaphoreID` = NULL.
- Returns:
- PAL_SUCCESS when the semaphore was deleted successfully.
PAL_ERR_RTOS_RESOURCE - the semaphore was already released.
PAL_ERR_RTOS_PARAMETER - the semaphore ID is invalid.
- Note:
- After this call, the `semaphore_id` is no longer valid and cannot be used.
Definition at line 332 of file pal_rtos.c.
palStatus_t pal_osSemaphoreRelease | ( | palSemaphoreID_t | semaphoreID ) |
Release a semaphore token.
- Parameters:
-
[in] semaphoreID The handle for the semaphore
- Returns:
- PAL_SUCCESS(0) in case of success and a negative value indicating a specific error code in case of failure.
Definition at line 325 of file pal_rtos.c.
palStatus_t pal_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 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 (timeout/error) zero is returned. This parameter can be NULL
- Returns:
- PAL_SUCCESS(0) in case of success and one of the following error codes in case of failure:
PAL_ERR_RTOS_TIMEOUT - the semaphore was not available until timeout.
PAL_ERR_RTOS_PARAMETER - the semaphore ID is invalid.
Definition at line 318 of file pal_rtos.c.
palStatus_t pal_osSetTime | ( | uint64_t | seconds ) |
Set the current system time by accepting seconds since January 1st 1970 UTC+0.
- Parameters:
-
[in] seconds Seconds from January 1st 1970 UTC+0.
- Returns:
- PAL_SUCCESS when the time was set successfully.
PAL_ERR_INVALID_TIME when there is a failure setting the system time.
Definition at line 431 of file pal_rtos.c.
palStatus_t pal_osThreadCreate | ( | palThreadFuncPtr | function, |
void * | funcArgument, | ||
palThreadPriority_t | priority, | ||
uint32_t | stackSize, | ||
uint32_t * | stackPtr, | ||
palThreadLocalStore_t * | store, | ||
palThreadID_t * | threadID | ||
) |
-----This function shall be deprecated in the next PAL release!!------ This function creates and starts the thread function (inside the PAL platform wrapper 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, can NOT be 0. [in] stackPtr A pointer to the thread's stack. ----Shall not be used, The user need to free this resource------ [in] store A pointer to thread's local store, can be NULL. [out] threadID The created thread ID handle. In case of error, this value is NULL.
- Returns:
- PAL_SUCCESS when the thread was created successfully.
PAL_ERR_RTOS_PRIORITY when the given priority is already used in the system.
- 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.
check if the priority have been used by other thread before
Definition at line 150 of file pal_rtos.c.
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).
- 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, can NOT be 0. [in] store A pointer to thread's local store, can be NULL. [out] threadID,: The created thread ID handle. In case of error, this value is NULL.
- Returns:
- PAL_SUCCESS when the thread was created successfully.
PAL_ERR_RTOS_PRIORITY when the given priority is already used in the system.
- 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.
-
Calling
pal_osThreadTerminate()
releases the thread stack.
check if the priority have been used by other thread before
Definition at line 184 of file pal_rtos.c.
palThreadID_t pal_osThreadGetId | ( | void | ) |
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 230 of file pal_rtos.c.
palThreadLocalStore_t* pal_osThreadGetLocalStore | ( | void | ) |
Get the storage of the current thread.
- Returns:
- The storage of the current thread.
Definition at line 237 of file pal_rtos.c.
palStatus_t pal_osThreadTerminate | ( | palThreadID_t * | threadID ) |
Terminate and free allocated data for the thread.
- Parameters:
-
[in] threadID The thread ID to stop and terminate.
- Returns:
- PAL_SUCCESS(0) in case of success and a negative value indicating a specific error code in case of failure.
PAL_ERR_RTOS_RESOURCE if the thread ID is not correct.
- Note:
- pal_osThreadTerminate is a non blocking operation, pal_osThreadTerminate sends cancellation request to the thread, usually the thread exits immediately, but the system does not always guarantee this
Definition at line 219 of file pal_rtos.c.
palStatus_t pal_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 created timer ID handle. In case of error, this value is NULL.
- Returns:
- PAL_SUCCESS when the timer was created successfully.
PAL_ERR_NO_MEMORY when there is no memory resource available to create a timer object.
- Note:
- The timer function runs according to the platform resources of stack-size and priority.
Definition at line 252 of file pal_rtos.c.
palStatus_t pal_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 timer was deleted successfully.
PAL_ERR_RTOS_PARAMETER when the `timerID` is incorrect.
Definition at line 277 of file pal_rtos.c.
palStatus_t pal_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 amount of time in milliseconds to set the timer to. MUST be larger than 0. In case of 0 value, the error PAL_ERR_RTOS_VALUE is returned.
- Returns:
- PAL_SUCCESS(0) in case of success and a negative value indicating a specific error code in case of failure.
Definition at line 259 of file pal_rtos.c.
palStatus_t pal_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 and a negative value indicating a specific error code in case of failure.
Definition at line 270 of file pal_rtos.c.
palStatus_t pal_RTOSDestroy | ( | void | ) |
This function removes PAL from the system and can be called after `pal_RTOSInitialize`.
- Returns:
- PAL_SUCCESS upon success.
PAL_ERR_NOT_INITIALIZED - if the user did not call `pal_RTOSInitialize()` first.
Definition at line 69 of file pal_rtos.c.
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.
- Parameters:
-
[in] opaqueContext,: context to be passed to the platform if needed.
- Returns:
- PAL_SUCCESS upon success.
Definition at line 47 of file pal_rtos.c.
Generated on Tue Jul 12 2022 16:22:14 by 1.7.2