|
RTOS Wrapper
API reference
|
#include <cmath>#include <type_traits>#include "OsAbstraction.h"#include "OsUtility.h"#include "FreeRTOSUtils.h"Namespaces | |
| namespace | anonymous_namespace{OsUtility.cpp} |
Functions | |
| void | os_delay_msec (uint16_t msec) |
| Delays execution for the specified number of milliseconds. | |
| void | os_delay_time (uint32_t timeBetweenSamples, time_unit_t timeUnit) |
| Delays execution for the specified number of time. | |
| uint32_t | os_get_elapsed_time_msec () |
| Retrieves the elapsed time in milliseconds. | |
| uint32_t | os_get_elapsed_processor_cycle_count (uint32_t startCycleCount, time_unit_t unit) |
| Function to get the elapsed time from a specified processor cycle count. The cycle count can be acquired through os_get_processor_cycle_count() function. | |
| uint32_t | os_get_processor_cycle_count () |
| Gets the processor's current cycle count. | |
| bool | os_mutex_create_ex (OS_Mutex &mutex, const char *mutexName, OS_Uint inherit, bool suppressVerbose) noexcept |
| Creates a mutex with the specified parameters. | |
| bool | os_mutex_create_p (OS_Mutex *mutex, const char *mutexName, OS_Uint inherit, bool suppressVerbose) noexcept |
| Creates a mutex with the specified parameters. | |
| bool | os_mutex_get_ex (OS_Mutex &mutex, OS_Ulong wait_option, bool suppressVerbose) noexcept |
| Acquire (wait for) a TX mutex. | |
| bool | os_mutex_get_p (OS_Mutex *mutex, OS_Ulong wait_option, bool suppressVerbose) noexcept |
| Acquire (wait for) a TX mutex. | |
| bool | os_mutex_put_ex (OS_Mutex &mutex, bool suppressVerbose) noexcept |
| Release a TX mutex. | |
| bool | os_mutex_put_p (OS_Mutex *mutex, bool suppressVerbose) noexcept |
| Release a TX mutex. | |
| bool | os_mutex_delete_ex (OS_Mutex &mutex, bool suppressVerbose) noexcept |
| Deletes the specified mutex and logs any error. | |
| bool | os_mutex_delete_p (OS_Mutex *mutex, bool suppressVerbose) noexcept |
| Deletes the specified mutex and logs any error. | |
| __attribute__ ((weak)) uint32_t g_ssp_common_thread_count=0 | |
| Provide a default definition if not supplied by higher-level code (weak symbol). | |
| bool | os_thread_create_ex (OS_Thread *txThread, const char *name, void(*entry_function)(OS_Ulong id), OS_Ulong entry_input, uint8_t *stack, OS_Ulong stackSizeBytes, OS_Uint priority, OS_Uint preempt_threshold, OS_Ulong timeSliceAllowed, OS_Uint auto_start, bool suppressVerbose) noexcept |
| Function to Create TX thread. | |
| bool | os_thread_create_ex_pinned (OS_Thread *txThread, const char *name, void(*entry_function)(OS_Ulong id), OS_Ulong entry_input, uint8_t *stack, OS_Ulong stackSizeBytes, OS_Uint priority, OS_Uint preempt_threshold, OS_Ulong timeSliceAllowed, OS_Uint auto_start, int core_id, bool suppressVerbose) noexcept |
| Pinned-to-core variant of os_thread_create_ex (FreeRTOS / SMP). | |
| bool | os_thread_delete_ex (OS_Thread *txThread, bool suppressVerbose) noexcept |
| Function to Delete TX thread. | |
| bool | os_thread_resume_ex (OS_Thread *thread, bool suppressVerbose) |
| Resumes the specified OS thread. | |
| bool | os_thread_resume_if_suspended (OS_Thread *thread, bool suppressVerbose) noexcept |
| Function to Resume TX thread only if it is suspended. | |
| bool | os_thread_suspend_ex (OS_Thread *thread, bool suppressVerbose) |
| Suspends the specified OS thread. | |
| bool | os_queue_create_ex (OS_Queue &queue, const char *queueName, OS_Uint messageSizeInWords, void *queueStorage, OS_Ulong queueSize, bool suppressVerbose) noexcept |
| Creates a queue with the specified parameters. | |
| bool | os_queue_delete_ex (OS_Queue &queue, bool suppressVerbose) noexcept |
| Deletes the specified queue and logs any error. | |
| bool | os_queue_send_ex (OS_Queue &queue, void *message, OS_Ulong wait_option, bool suppressVerbose) noexcept |
| Send a message to the queue. | |
| bool | os_queue_receive_ex (OS_Queue &queue, void *message, OS_Ulong wait_option, bool suppressVerbose) noexcept |
| Receive a message from the queue. | |
| template<typename Callback > | |
| OS_Uint | anonymous_namespace{OsUtility.cpp}::CreateTimer (OS_Timer &timer, char *name, Callback callback, uint32_t id, uint32_t initialTicks, uint32_t rescheduleTicks, OS_Uint autoActivate) noexcept |
| bool | os_timer_create_ex (OS_Timer &timer, const char *name, void(*callback)(uint32_t), uint32_t callbackExpirationInput, uint32_t initialTimeoutTicks, uint32_t rescheduleTimeoutTicks, OS_Uint autoActivate, bool suppressVerbose) noexcept |
| Function to create a OS timer and report errors associated with the creation. | |
| bool | os_timer_deactivate_and_delete_ex (OS_Timer &timer, bool suppressVerbose) noexcept |
| Function to delete a OS timer and report errors associated with the deletion. | |
| bool | os_timer_activate_ex (OS_Timer &timer, bool suppressVerbose) noexcept |
| Activates a OS timer. | |
| bool | os_timer_deactivate_ex (OS_Timer &timer, bool suppressVerbose) noexcept |
| Deactivates a OS timer. | |
| bool | os_semaphore_create_ex (OS_Semaphore *txSemaphore, const char *name, OS_Uint initial_count, bool suppressVerbose) noexcept |
| Function to Create TX semaphore. | |
| bool | os_semaphore_delete_ex (OS_Semaphore *txSemaphore, bool suppressVerbose) noexcept |
| Function to Delete TX semaphore. | |
| bool | os_semaphore_put_ex (OS_Semaphore *txSemaphore, bool suppressVerbose) noexcept |
| Function to put (release) a TX semaphore. | |
| bool | os_semaphore_get_ex (OS_Semaphore *txSemaphore, OS_Ulong wait_option, bool suppressVerbose) noexcept |
| Function to get (wait for) a TX semaphore. | |
| OS_Ulong | os_semaphore_get_count_ex (OS_Semaphore *txSemaphore, bool suppressVerbose) noexcept |
| Function to get TX semaphore count. | |
| bool | os_event_flags_create_ex (OS_EventGroup &eventFlags, const char *name, bool suppressVerbose) noexcept |
| Creates an event flag group with the specified parameters. | |
| bool | os_event_flags_delete_ex (OS_EventGroup &eventFlags, bool suppressVerbose) noexcept |
| Deletes the specified event flag group and logs any error. | |
| bool | os_event_flags_set_ex (OS_EventGroup &eventFlags, OS_Ulong flagsToSet, bool suppressVerbose) noexcept |
| Set event flags in the event flag group. | |
| bool | os_event_flags_clear_ex (OS_EventGroup &eventFlags, OS_Ulong flagsToClear, bool suppressVerbose) noexcept |
| Clears event flags in the event flag group. | |
| bool | os_event_flags_get_ex (OS_EventGroup &eventFlags, OS_Ulong flagsToGet, OS_Uint getOption, OS_Ulong &actualFlags, OS_Ulong wait_option, bool suppressVerbose) noexcept |
| Get event flags from the event flag group. | |
| void | os_stack_fault_handler (OS_Thread *thread) |
| Handler for stack faults in threads. | |
|
pure virtual |
Provide a default definition if not supplied by higher-level code (weak symbol).
| void os_delay_msec | ( | uint16_t | msec | ) |
Delays execution for the specified number of milliseconds.
Contains the declaration and definition of the utility functions related to the FreeRTOS RTOS.
Note: These functions are not thread or interrupt-safe and should be called called with appropriate guards if used within an ISR or shared between tasks.
| void os_delay_time | ( | uint32_t | timeBetweenSamples, |
| time_unit_t | timeUnit | ||
| ) |
Delays execution for the specified number of time.
Currently only supports MSEC AND S, everything else just returns
| msec | The delay duration in milliseconds. |
|
noexcept |
Clears event flags in the event flag group.
| eventFlags | - The OS event flags to set |
| flagsToClear | - The flags to clear |
|
noexcept |
Creates an event flag group with the specified parameters.
| eventFlags | - The OS event flags to create |
| name | - The name for the event flag group |
|
noexcept |
Deletes the specified event flag group and logs any error.
| eventFlags | - The OS event flags to delete |
|
noexcept |
Get event flags from the event flag group.
| eventFlags | - The OS event flags to get |
| flagsToGet | - The flags to get |
| getOption | - The option on how to get the flags |
| actualFlags | - The actual flags gotten |
| wait_option | - The option on how to wait if the flags are not available |
|
noexcept |
Set event flags in the event flag group.
| eventFlags | - The OS event flags to set |
| flagsToSet | - The flags to set |
| uint32_t os_get_elapsed_processor_cycle_count | ( | uint32_t | startCycleCount, |
| time_unit_t | unit | ||
| ) |
Function to get the elapsed time from a specified processor cycle count. The cycle count can be acquired through os_get_processor_cycle_count() function.
| startCycleCount | : value of the cycle count DWT->CYCCNT at first position of the program. |
| unit | : UNIT_MS, if the result is requested in milliseconds. UNIT_US, if the result is requested in microseconds. UNIT_SEC, if the result is requested in seconds. |
| uint32_t os_get_elapsed_time_msec | ( | ) |
Retrieves the elapsed time in milliseconds.
| uint32_t os_get_processor_cycle_count | ( | ) |
Gets the processor's current cycle count.
|
noexcept |
Creates a mutex with the specified parameters.
| mutex | - The OS mutex to create |
| name | - The name fo rthe mutex |
| inherit | - The inherit property for the mutex |
|
noexcept |
Creates a mutex with the specified parameters.
| mutex | - The OS mutex to create |
| name | - The name fo rthe mutex |
| name | - The priority for the mutex |
|
noexcept |
Deletes the specified mutex and logs any error.
| mutex | - The OS mutex to delete |
|
noexcept |
Deletes the specified mutex and logs any error.
| mutex | - The OS mutex to delete |
Acquire (wait for) a TX mutex.
| mutex_ptr | Pointer to the mutex control block. |
| wait_option | Specifies the maximum time to wait for the mutex. |
| suppressVerbose | Flag to suppress verbose output. |
Acquire (wait for) a TX mutex.
| mutex_ptr | Pointer to the mutex control block. |
| wait_option | Specifies the maximum time to wait for the mutex. |
| suppressVerbose | Flag to suppress verbose output. |
|
noexcept |
Release a TX mutex.
| mutex_ptr | Pointer to the mutex control block. |
| suppressVerbose | Flag to suppress verbose output. |
|
noexcept |
Release a TX mutex.
| mutex_ptr | Pointer to the mutex control block. |
| suppressVerbose | Flag to suppress verbose output. |
|
noexcept |
Creates a queue with the specified parameters.
| queue | - The OS queue to create |
| queueName | - The name for the queue |
| messageSizeInWords | - The size of the messages that will be stored in the queue |
|
noexcept |
Deletes the specified queue and logs any error.
| queue | - The OS queue to delete |
|
noexcept |
Receive a message from the queue.
| queue | - The OS queue to receive the message from |
| message | - The received message |
| wait_option | - The option on how to wait if the queue is empty |
|
noexcept |
Send a message to the queue.
| queue | - The OS queue to send the message to |
| message | - The message to send |
| wait_option | - The option on how to wait if the queue is full |
|
noexcept |
Function to Create TX semaphore.
| txSemaphore | Pointer to the OS semaphore control block. |
| name | Name of the semaphore. |
| initial_count | Initial count of the semaphore. |
|
noexcept |
Function to Delete TX semaphore.
| txSemaphore | Pointer to the OS semaphore control block to be deleted. |
|
noexcept |
Function to get TX semaphore count.
| txSemaphore | Pointer to the OS semaphore control block. |
|
noexcept |
Function to get (wait for) a TX semaphore.
| txSemaphore | Pointer to the OS semaphore control block. |
| wait_option | Specifies the maximum time to wait for the semaphore. |
|
noexcept |
Function to put (release) a TX semaphore.
| txSemaphore | Pointer to the OS semaphore control block. |
| void os_stack_fault_handler | ( | OS_Thread * | thread | ) |
Handler for stack faults in threads.
| thread | The thread where the stack fault occurred. |
|
noexcept |
Function to Create TX thread.
| txThread | Pointer to the OS thread control block. |
| name | Name of the thread. |
| entry_function | Pointer to the thread's entry function. |
| entry_input | Input value for the thread's entry function. |
| stack | Pointer to the thread's stack. |
| stackSizeBytes | Size of the thread's stack in bytes. |
| priority | Priority of the thread. |
| preempt_threshold | Preemption threshold of the thread. |
| timeSliceAllowed | Maximum length of time (in ticks) that the thread can execute before OS will reschedule. |
| auto_start | OS_AUTO_START if the thread should start immediately, or OS_DONT_START if it should not start until explicitly resumed. |
Create the OS Thread
Add to the overall system thread count
TODO: log appropriate error here
|
noexcept |
Pinned-to-core variant of os_thread_create_ex (FreeRTOS / SMP).
Mirrors os_thread_create_ex but takes an additional core_id that is forwarded to os_thread_create_pinned. Pass core_id < 0 (e.g. -1) for "no affinity" — equivalent to the non-pinned variant.
| core_id | CPU core to pin the new task to (0 or 1 on ESP32-S3), or any value < 0 for no affinity. |
|
noexcept |
Function to Delete TX thread.
| txThread | Pointer to the OS thread control block to be deleted. |
| bool os_thread_resume_ex | ( | OS_Thread * | thread, |
| bool | suppressVerbose = true |
||
| ) |
Resumes the specified OS thread.
| thread | The OS thread to resume. |
|
noexcept |
Function to Resume TX thread only if it is suspended.
| txThread | Pointer to the OS thread control block to be resumed. |
| bool os_thread_suspend_ex | ( | OS_Thread * | thread, |
| bool | suppressVerbose = true |
||
| ) |
Suspends the specified OS thread.
| thread | The OS thread to resume. |
|
noexcept |
Activates a OS timer.
| timer | Reference to the timer to be activated. |
|
noexcept |
Function to create a OS timer and report errors associated with the creation.
Creates a OS timer and reports any errors associated with the creation.
| timer | Reference to timer control block. |
| name | Pointer to timer name. |
| callback | timer expiration callback function. |
| callbackExpirationInput | A uint32_t data point that can be passed to expiration callback function. |
| initialTimeoutTicks | Initial Expiration ticks. |
| rescheduleTimeoutTicks | Reschedule ticks. |
| autoActivate | The data value to set. |
|
noexcept |
Function to delete a OS timer and report errors associated with the deletion.
Stops and deletes a OS timer, reporting any errors associated with the operation.
| timer | The timer to delete. |
|
noexcept |
Deactivates a OS timer.
| timer | Reference to the timer to be deactivated. |