STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
cmsis_os2.c File Reference
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "event_groups.h"
#include "semphr.h"
#include "timers.h"
#include "freertos_mpool.h"
#include "freertos_os2.h"
#include "cmsis_os2.h"
#include "cmsis_compiler.h"
Include dependency graph for cmsis_os2.c:

Go to the source code of this file.

Classes

struct  TimerCallback_t

Macros

#define __ARM_ARCH_6M__   0
#define __ARM_ARCH_7M__   0
#define __ARM_ARCH_7EM__   0
#define __ARM_ARCH_8M_MAIN__   0
#define __ARM_ARCH_7A__   0
#define IS_IRQ_MASKED()
#define IS_IRQ_MODE()
#define MAX_BITS_TASK_NOTIFY   31U
#define MAX_BITS_EVENT_GROUPS   24U
#define THREAD_FLAGS_INVALID_BITS   (~((1UL << MAX_BITS_TASK_NOTIFY) - 1U))
#define EVENT_FLAGS_INVALID_BITS   (~((1UL << MAX_BITS_EVENT_GROUPS) - 1U))
#define KERNEL_VERSION
#define KERNEL_ID   ("FreeRTOS " tskKERNEL_VERSION_NUMBER)

Functions

static uint32_t OS_Tick_GetCount (void)
static uint32_t OS_Tick_GetOverflow (void)
static uint32_t OS_Tick_GetInterval (void)
__STATIC_INLINE void SVC_Setup (void)
__STATIC_INLINE uint32_t IRQ_Context (void)
osStatus_t osKernelInitialize (void)
 Initialize the RTOS Kernel.
osStatus_t osKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size)
 Get RTOS Kernel Information.
osKernelState_t osKernelGetState (void)
 Get the current RTOS Kernel state.
osStatus_t osKernelStart (void)
 Start the RTOS Kernel scheduler.
int32_t osKernelLock (void)
 Lock the RTOS Kernel scheduler.
int32_t osKernelUnlock (void)
 Unlock the RTOS Kernel scheduler.
int32_t osKernelRestoreLock (int32_t lock)
 Restore the RTOS Kernel scheduler lock state.
uint32_t osKernelGetTickCount (void)
 Get the RTOS kernel tick count.
uint32_t osKernelGetTickFreq (void)
 Get the RTOS kernel tick frequency.
uint32_t osKernelGetSysTimerCount (void)
 Get the RTOS kernel system timer count.
uint32_t osKernelGetSysTimerFreq (void)
 Get the RTOS kernel system timer frequency.
osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr)
 Create a thread and add it to Active Threads.
const char * osThreadGetName (osThreadId_t thread_id)
 Get name of a thread.
osThreadId_t osThreadGetId (void)
 Return the thread ID of the current running thread.
osThreadState_t osThreadGetState (osThreadId_t thread_id)
 Get current thread state of a thread.
uint32_t osThreadGetStackSpace (osThreadId_t thread_id)
 Get available stack space of a thread based on stack watermark recording during execution.
osStatus_t osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority)
 Change priority of a thread.
osPriority_t osThreadGetPriority (osThreadId_t thread_id)
 Get current priority of a thread.
osStatus_t osThreadYield (void)
 Pass control to next thread that is in state READY.
osStatus_t osThreadSuspend (osThreadId_t thread_id)
 Suspend execution of a thread.
osStatus_t osThreadResume (osThreadId_t thread_id)
 Resume execution of a thread.
__NO_RETURN void osThreadExit (void)
 Terminate execution of current running thread.
osStatus_t osThreadTerminate (osThreadId_t thread_id)
 Terminate execution of a thread.
uint32_t osThreadGetCount (void)
 Get number of active threads.
uint32_t osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items)
 Enumerate active threads.
osStatus_t osDelay (uint32_t ticks)
 Wait for Timeout (Time Delay).
osStatus_t osDelayUntil (uint32_t ticks)
 Wait until specified time.
osEventFlagsId_t osEventFlagsNew (const osEventFlagsAttr_t *attr)
 Create and Initialize an Event Flags object.
uint32_t osEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags)
 Set the specified Event Flags.
uint32_t osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags)
 Clear the specified Event Flags.
uint32_t osEventFlagsGet (osEventFlagsId_t ef_id)
 Get the current Event Flags.
uint32_t osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout)
 Wait for one or more Event Flags to become signaled.
osStatus_t osEventFlagsDelete (osEventFlagsId_t ef_id)
 Delete an Event Flags object.
osSemaphoreId_t osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr)
 Create and Initialize a Semaphore object.
osStatus_t osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout)
 Acquire a Semaphore token or timeout if no tokens are available.
osStatus_t osSemaphoreRelease (osSemaphoreId_t semaphore_id)
 Release a Semaphore token up to the initial maximum count.
uint32_t osSemaphoreGetCount (osSemaphoreId_t semaphore_id)
 Get current Semaphore token count.
osStatus_t osSemaphoreDelete (osSemaphoreId_t semaphore_id)
 Delete a Semaphore object.
osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr)
 Create and Initialize a Message Queue object.
osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)
 Put a Message into a Queue or timeout if Queue is full.
osStatus_t osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)
 Get a Message from a Queue or timeout if Queue is empty.
uint32_t osMessageQueueGetCapacity (osMessageQueueId_t mq_id)
 Get maximum number of messages in a Message Queue.
uint32_t osMessageQueueGetMsgSize (osMessageQueueId_t mq_id)
 Get maximum message size in a Message Queue.
uint32_t osMessageQueueGetCount (osMessageQueueId_t mq_id)
 Get number of queued messages in a Message Queue.
uint32_t osMessageQueueGetSpace (osMessageQueueId_t mq_id)
 Get number of available slots for messages in a Message Queue.
osStatus_t osMessageQueueReset (osMessageQueueId_t mq_id)
 Reset a Message Queue to initial empty state.
osStatus_t osMessageQueueDelete (osMessageQueueId_t mq_id)
 Delete a Message Queue object.
void vApplicationIdleHook (void)
void vApplicationMallocFailedHook (void)
void vApplicationDaemonTaskStartupHook (void)

Variables

static osKernelState_t KernelState = osKernelInactive

Macro Definition Documentation

◆ __ARM_ARCH_6M__

#define __ARM_ARCH_6M__   0

Definition at line 38 of file cmsis_os2.c.

◆ __ARM_ARCH_7A__

#define __ARM_ARCH_7A__   0

Definition at line 50 of file cmsis_os2.c.

◆ __ARM_ARCH_7EM__

#define __ARM_ARCH_7EM__   0

Definition at line 44 of file cmsis_os2.c.

◆ __ARM_ARCH_7M__

#define __ARM_ARCH_7M__   0

Definition at line 41 of file cmsis_os2.c.

◆ __ARM_ARCH_8M_MAIN__

#define __ARM_ARCH_8M_MAIN__   0

Definition at line 47 of file cmsis_os2.c.

◆ EVENT_FLAGS_INVALID_BITS

#define EVENT_FLAGS_INVALID_BITS   (~((1UL << MAX_BITS_EVENT_GROUPS) - 1U))

Definition at line 83 of file cmsis_os2.c.

Referenced by osEventFlagsClear(), osEventFlagsSet(), and osEventFlagsWait().

◆ IS_IRQ_MASKED

#define IS_IRQ_MASKED ( )
Value:
(__get_PRIMASK() != 0U)
__STATIC_INLINE uint32_t __get_PRIMASK(void)
Get Priority Mask.

Definition at line 65 of file cmsis_os2.c.

Referenced by IRQ_Context(), and osKernelGetSysTimerCount().

◆ IS_IRQ_MODE

#define IS_IRQ_MODE ( )
Value:
(__get_IPSR() != 0U)
__STATIC_INLINE uint32_t __get_IPSR(void)
Get IPSR Register.

Definition at line 75 of file cmsis_os2.c.

Referenced by IRQ_Context().

◆ KERNEL_ID

#define KERNEL_ID   ("FreeRTOS " tskKERNEL_VERSION_NUMBER)

Definition at line 90 of file cmsis_os2.c.

Referenced by osKernelGetInfo().

◆ KERNEL_VERSION

#define KERNEL_VERSION
Value:
(((uint32_t)tskKERNEL_VERSION_MAJOR * 10000000UL) | \
((uint32_t)tskKERNEL_VERSION_MINOR * 10000UL) | \
((uint32_t)tskKERNEL_VERSION_BUILD * 1UL))
#define tskKERNEL_VERSION_BUILD
Definition task.h:59
#define tskKERNEL_VERSION_MAJOR
Definition task.h:57
#define tskKERNEL_VERSION_MINOR
Definition task.h:58

Definition at line 86 of file cmsis_os2.c.

Referenced by osKernelGetInfo().

◆ MAX_BITS_EVENT_GROUPS

#define MAX_BITS_EVENT_GROUPS   24U

Definition at line 80 of file cmsis_os2.c.

◆ MAX_BITS_TASK_NOTIFY

#define MAX_BITS_TASK_NOTIFY   31U

Definition at line 79 of file cmsis_os2.c.

◆ THREAD_FLAGS_INVALID_BITS

#define THREAD_FLAGS_INVALID_BITS   (~((1UL << MAX_BITS_TASK_NOTIFY) - 1U))

Definition at line 82 of file cmsis_os2.c.

Function Documentation

◆ IRQ_Context()

◆ OS_Tick_GetCount()

uint32_t OS_Tick_GetCount ( void )
static

Definition at line 228 of file cmsis_os2.c.

Referenced by osKernelGetSysTimerCount().

◆ OS_Tick_GetInterval()

uint32_t OS_Tick_GetInterval ( void )
static

Definition at line 251 of file cmsis_os2.c.

Referenced by osKernelGetSysTimerCount().

◆ OS_Tick_GetOverflow()

uint32_t OS_Tick_GetOverflow ( void )
static

Definition at line 239 of file cmsis_os2.c.

Referenced by osKernelGetSysTimerCount().

◆ osDelay()

osStatus_t osDelay ( uint32_t ticks)

Wait for Timeout (Time Delay).

Parameters
[in]tickstime ticks value
Returns
status code that indicates the execution status of the function.

Definition at line 1094 of file cmsis_os2.c.

References IRQ_Context(), osErrorISR, osOK, and vTaskDelay().

Referenced by board_bringup_power_up(), bringup_task(), anonymous_namespace{radio_task.cpp}::BoardControl::delay_ms(), delay_ms(), emmc_stm32_writer_task(), gps_power(), ms5611_reset(), port_start(), sd_nand_probe(), StartDefaultTask(), wait_since_boot(), and wait_transfer_state().

◆ osDelayUntil()

osStatus_t osDelayUntil ( uint32_t ticks)

Wait until specified time.

Parameters
[in]ticksabsolute time in ticks
Returns
status code that indicates the execution status of the function.

Definition at line 1115 of file cmsis_os2.c.

References delay(), IRQ_Context(), osError, osErrorISR, osErrorParameter, osOK, pdFALSE, xTaskDelayUntil(), and xTaskGetTickCount().

◆ osEventFlagsClear()

uint32_t osEventFlagsClear ( osEventFlagsId_t ef_id,
uint32_t flags )

Clear the specified Event Flags.

Parameters
[in]ef_idevent flags ID obtained by osEventFlagsNew.
[in]flagsspecifies the flags that shall be cleared.
Returns
event flags before clearing or error code if highest bit set.

Definition at line 1505 of file cmsis_os2.c.

References EVENT_FLAGS_INVALID_BITS, IRQ_Context(), NULL, osErrorParameter, osErrorResource, pdFAIL, pdTRUE, portYIELD_FROM_ISR, xEventGroupClearBits(), xEventGroupClearBitsFromISR, and xEventGroupGetBitsFromISR().

◆ osEventFlagsDelete()

osStatus_t osEventFlagsDelete ( osEventFlagsId_t ef_id)

Delete an Event Flags object.

Parameters
[in]ef_idevent flags ID obtained by osEventFlagsNew.
Returns
status code that indicates the execution status of the function.

Definition at line 1629 of file cmsis_os2.c.

References IRQ_Context(), NULL, osError, osErrorISR, osErrorParameter, osOK, and vEventGroupDelete().

◆ osEventFlagsGet()

uint32_t osEventFlagsGet ( osEventFlagsId_t ef_id)

Get the current Event Flags.

Parameters
[in]ef_idevent flags ID obtained by osEventFlagsNew.
Returns
current event flags.

Definition at line 1544 of file cmsis_os2.c.

References IRQ_Context(), NULL, xEventGroupGetBits, and xEventGroupGetBitsFromISR().

◆ osEventFlagsNew()

osEventFlagsId_t osEventFlagsNew ( const osEventFlagsAttr_t * attr)

Create and Initialize an Event Flags object.

Parameters
[in]attrevent flags attributes; NULL: default values.
Returns
event flags ID for reference by other functions or NULL in case of error.

Definition at line 1416 of file cmsis_os2.c.

References osEventFlagsAttr_t::cb_mem, osEventFlagsAttr_t::cb_size, IRQ_Context(), and NULL.

◆ osEventFlagsSet()

uint32_t osEventFlagsSet ( osEventFlagsId_t ef_id,
uint32_t flags )

Set the specified Event Flags.

Parameters
[in]ef_idevent flags ID obtained by osEventFlagsNew.
[in]flagsspecifies the flags that shall be set.
Returns
event flags after setting or error code if highest bit set.

Definition at line 1465 of file cmsis_os2.c.

References EVENT_FLAGS_INVALID_BITS, IRQ_Context(), NULL, osErrorParameter, osErrorResource, pdFAIL, pdFALSE, portYIELD_FROM_ISR, xEventGroupGetBitsFromISR(), xEventGroupSetBits(), and xEventGroupSetBitsFromISR.

◆ osEventFlagsWait()

uint32_t osEventFlagsWait ( osEventFlagsId_t ef_id,
uint32_t flags,
uint32_t options,
uint32_t timeout )

Wait for one or more Event Flags to become signaled.

Parameters
[in]ef_idevent flags ID obtained by osEventFlagsNew.
[in]flagsspecifies the flags to wait for.
[in]optionsspecifies flags options (osFlagsXxxx).
[in]timeoutCMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
Returns
event flags before clearing or error code if highest bit set.

Definition at line 1569 of file cmsis_os2.c.

References EVENT_FLAGS_INVALID_BITS, IRQ_Context(), NULL, osErrorISR, osErrorParameter, osErrorResource, osErrorTimeout, osFlagsErrorParameter, osFlagsNoClear, osFlagsWaitAll, pdFAIL, pdTRUE, and xEventGroupWaitBits().

◆ osKernelGetInfo()

osStatus_t osKernelGetInfo ( osVersion_t * version,
char * id_buf,
uint32_t id_size )

Get RTOS Kernel Information.

Parameters
[out]versionpointer to buffer for retrieving version information.
[out]id_bufpointer to buffer for retrieving kernel identification string.
[in]id_sizesize of buffer for kernel identification string.
Returns
status code that indicates the execution status of the function.

Definition at line 298 of file cmsis_os2.c.

References osVersion_t::api, osVersion_t::kernel, KERNEL_ID, KERNEL_VERSION, NULL, and osOK.

◆ osKernelGetState()

osKernelState_t osKernelGetState ( void )

Get the current RTOS Kernel state.

Returns
current RTOS Kernel state.

Definition at line 322 of file cmsis_os2.c.

References KernelState, osKernelInactive, osKernelLocked, osKernelReady, osKernelRunning, state, taskSCHEDULER_NOT_STARTED, taskSCHEDULER_RUNNING, taskSCHEDULER_SUSPENDED, and xTaskGetSchedulerState().

◆ osKernelGetSysTimerCount()

uint32_t osKernelGetSysTimerCount ( void )

Get the RTOS kernel system timer count.

Returns
RTOS kernel current system timer count as 32-bit value.

Definition at line 515 of file cmsis_os2.c.

References __disable_irq, __enable_irq, IS_IRQ_MASKED, OS_Tick_GetCount(), OS_Tick_GetInterval(), OS_Tick_GetOverflow(), and xTaskGetTickCount().

◆ osKernelGetSysTimerFreq()

uint32_t osKernelGetSysTimerFreq ( void )

Get the RTOS kernel system timer frequency.

Returns
frequency of the system timer in hertz, i.e. timer ticks per second.

Definition at line 561 of file cmsis_os2.c.

References configCPU_CLOCK_HZ.

◆ osKernelGetTickCount()

uint32_t osKernelGetTickCount ( void )

Get the RTOS kernel tick count.

Returns
RTOS kernel current tick count.

Definition at line 491 of file cmsis_os2.c.

References IRQ_Context(), xTaskGetTickCount(), and xTaskGetTickCountFromISR().

Referenced by app_set_state(), emmc_stm32_writer_task(), finish(), idle_task(), to_emmc(), to_emmc(), and wait_transfer_state().

◆ osKernelGetTickFreq()

uint32_t osKernelGetTickFreq ( void )

Get the RTOS kernel tick frequency.

Returns
frequency of the kernel tick in hertz, i.e. kernel ticks per second.

Definition at line 507 of file cmsis_os2.c.

References configTICK_RATE_HZ.

◆ osKernelInitialize()

osStatus_t osKernelInitialize ( void )

Initialize the RTOS Kernel.

Returns
status code that indicates the execution status of the function.

Definition at line 264 of file cmsis_os2.c.

References IRQ_Context(), KernelState, osError, osErrorISR, osKernelInactive, osKernelReady, osOK, state, taskSCHEDULER_NOT_STARTED, vPortDefineHeapRegions(), and xTaskGetSchedulerState().

Referenced by main().

◆ osKernelLock()

int32_t osKernelLock ( void )

Lock the RTOS Kernel scheduler.

Returns
previous lock state (1 - locked, 0 - not locked, error code if negative).

Definition at line 384 of file cmsis_os2.c.

References IRQ_Context(), lock, osError, osErrorISR, taskSCHEDULER_NOT_STARTED, taskSCHEDULER_RUNNING, taskSCHEDULER_SUSPENDED, vTaskSuspendAll(), and xTaskGetSchedulerState().

◆ osKernelRestoreLock()

int32_t osKernelRestoreLock ( int32_t lock)

Restore the RTOS Kernel scheduler lock state.

Parameters
[in]locklock state obtained by osKernelLock or osKernelUnlock.
Returns
new lock state (1 - locked, 0 - not locked, error code if negative).

Definition at line 451 of file cmsis_os2.c.

References IRQ_Context(), lock, osError, osErrorISR, pdTRUE, taskSCHEDULER_NOT_STARTED, taskSCHEDULER_RUNNING, taskSCHEDULER_SUSPENDED, vTaskSuspendAll(), xTaskGetSchedulerState(), and xTaskResumeAll().

◆ osKernelStart()

osStatus_t osKernelStart ( void )

Start the RTOS Kernel scheduler.

Returns
status code that indicates the execution status of the function.

Definition at line 353 of file cmsis_os2.c.

References IRQ_Context(), KernelState, osError, osErrorISR, osKernelReady, osKernelRunning, osOK, state, SVC_Setup(), taskSCHEDULER_NOT_STARTED, vTaskStartScheduler(), and xTaskGetSchedulerState().

Referenced by main().

◆ osKernelUnlock()

int32_t osKernelUnlock ( void )

Unlock the RTOS Kernel scheduler.

Returns
previous lock state (1 - locked, 0 - not locked, error code if negative).

Definition at line 415 of file cmsis_os2.c.

References IRQ_Context(), lock, osError, osErrorISR, pdTRUE, taskSCHEDULER_NOT_STARTED, taskSCHEDULER_RUNNING, taskSCHEDULER_SUSPENDED, xTaskGetSchedulerState(), and xTaskResumeAll().

◆ osMessageQueueDelete()

osStatus_t osMessageQueueDelete ( osMessageQueueId_t mq_id)

Delete a Message Queue object.

Parameters
[in]mq_idmessage queue ID obtained by osMessageQueueNew.
Returns
status code that indicates the execution status of the function.

Definition at line 2360 of file cmsis_os2.c.

References IRQ_Context(), NULL, osError, osErrorISR, osErrorParameter, osOK, vQueueDelete(), and vQueueUnregisterQueue.

◆ osMessageQueueGet()

osStatus_t osMessageQueueGet ( osMessageQueueId_t mq_id,
void * msg_ptr,
uint8_t * msg_prio,
uint32_t timeout )

Get a Message from a Queue or timeout if Queue is empty.

Parameters
[in]mq_idmessage queue ID obtained by osMessageQueueNew.
[out]msg_ptrpointer to buffer for message to get from a queue.
[out]msg_priopointer to buffer for message priority or NULL.
[in]timeoutCMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
Returns
status code that indicates the execution status of the function.

Definition at line 2209 of file cmsis_os2.c.

References IRQ_Context(), NULL, osErrorParameter, osErrorResource, osErrorTimeout, osOK, pdFALSE, pdPASS, portYIELD_FROM_ISR, xQueueReceive(), and xQueueReceiveFromISR().

Referenced by poll_command().

◆ osMessageQueueGetCapacity()

uint32_t osMessageQueueGetCapacity ( osMessageQueueId_t mq_id)

Get maximum number of messages in a Message Queue.

Parameters
[in]mq_idmessage queue ID obtained by osMessageQueueNew.
Returns
maximum number of messages.

Definition at line 2254 of file cmsis_os2.c.

References NULL, and xSTATIC_QUEUE::uxDummy4.

◆ osMessageQueueGetCount()

uint32_t osMessageQueueGetCount ( osMessageQueueId_t mq_id)

Get number of queued messages in a Message Queue.

Parameters
[in]mq_idmessage queue ID obtained by osMessageQueueNew.
Returns
number of queued messages.

Definition at line 2290 of file cmsis_os2.c.

References count(), IRQ_Context(), NULL, uxQueueMessagesWaiting(), and uxQueueMessagesWaitingFromISR().

Referenced by work_waiting().

◆ osMessageQueueGetMsgSize()

uint32_t osMessageQueueGetMsgSize ( osMessageQueueId_t mq_id)

Get maximum message size in a Message Queue.

Parameters
[in]mq_idmessage queue ID obtained by osMessageQueueNew.
Returns
maximum message size in bytes.

Definition at line 2272 of file cmsis_os2.c.

References NULL, and xSTATIC_QUEUE::uxDummy4.

◆ osMessageQueueGetSpace()

uint32_t osMessageQueueGetSpace ( osMessageQueueId_t mq_id)

Get number of available slots for messages in a Message Queue.

Parameters
[in]mq_idmessage queue ID obtained by osMessageQueueNew.
Returns
number of available slots for messages.

Definition at line 2311 of file cmsis_os2.c.

References IRQ_Context(), NULL, taskENTER_CRITICAL_FROM_ISR, taskEXIT_CRITICAL_FROM_ISR, xSTATIC_QUEUE::uxDummy4, and uxQueueSpacesAvailable().

◆ osMessageQueueNew()

osMessageQueueId_t osMessageQueueNew ( uint32_t msg_count,
uint32_t msg_size,
const osMessageQueueAttr_t * attr )

Create and Initialize a Message Queue object.

Parameters
[in]msg_countmaximum number of messages in queue.
[in]msg_sizemaximum message size in bytes.
[in]attrmessage queue attributes; NULL: default values.
Returns
message queue ID for reference by other functions or NULL in case of error.

Definition at line 2100 of file cmsis_os2.c.

References osMessageQueueAttr_t::cb_mem, osMessageQueueAttr_t::cb_size, IRQ_Context(), osMessageQueueAttr_t::mq_mem, osMessageQueueAttr_t::mq_size, osMessageQueueAttr_t::name, NULL, and vQueueAddToRegistry.

Referenced by idle_task_start().

◆ osMessageQueuePut()

osStatus_t osMessageQueuePut ( osMessageQueueId_t mq_id,
const void * msg_ptr,
uint8_t msg_prio,
uint32_t timeout )

Put a Message into a Queue or timeout if Queue is full.

Parameters
[in]mq_idmessage queue ID obtained by osMessageQueueNew.
[in]msg_ptrpointer to buffer with message to put into a queue.
[in]msg_priomessage priority.
[in]timeoutCMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
Returns
status code that indicates the execution status of the function.

Definition at line 2161 of file cmsis_os2.c.

References IRQ_Context(), NULL, osErrorParameter, osErrorResource, osErrorTimeout, osOK, pdFALSE, pdPASS, pdTRUE, portYIELD_FROM_ISR, xQueueSendToBack, and xQueueSendToBackFromISR.

Referenced by idle_task_command().

◆ osMessageQueueReset()

osStatus_t osMessageQueueReset ( osMessageQueueId_t mq_id)

Reset a Message Queue to initial empty state.

Parameters
[in]mq_idmessage queue ID obtained by osMessageQueueNew.
Returns
status code that indicates the execution status of the function.

Definition at line 2338 of file cmsis_os2.c.

References IRQ_Context(), NULL, osErrorISR, osErrorParameter, osOK, and xQueueReset.

◆ osSemaphoreAcquire()

osStatus_t osSemaphoreAcquire ( osSemaphoreId_t semaphore_id,
uint32_t timeout )

Acquire a Semaphore token or timeout if no tokens are available.

Parameters
[in]semaphore_idsemaphore ID obtained by osSemaphoreNew.
[in]timeoutCMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
Returns
status code that indicates the execution status of the function.

Definition at line 1970 of file cmsis_os2.c.

References IRQ_Context(), NULL, osErrorParameter, osErrorResource, osErrorTimeout, osOK, pdFALSE, pdPASS, portYIELD_FROM_ISR, xSemaphoreTake, and xSemaphoreTakeFromISR.

Referenced by finish(), port_read(), and port_write().

◆ osSemaphoreDelete()

osStatus_t osSemaphoreDelete ( osSemaphoreId_t semaphore_id)

Delete a Semaphore object.

Parameters
[in]semaphore_idsemaphore ID obtained by osSemaphoreNew.
Returns
status code that indicates the execution status of the function.

Definition at line 2063 of file cmsis_os2.c.

References IRQ_Context(), NULL, osError, osErrorISR, osErrorParameter, osOK, vQueueUnregisterQueue, and vSemaphoreDelete.

◆ osSemaphoreGetCount()

uint32_t osSemaphoreGetCount ( osSemaphoreId_t semaphore_id)

Get current Semaphore token count.

Parameters
[in]semaphore_idsemaphore ID obtained by osSemaphoreNew.
Returns
number of tokens available.

Definition at line 2043 of file cmsis_os2.c.

References count(), IRQ_Context(), NULL, uxSemaphoreGetCount, and uxSemaphoreGetCountFromISR.

◆ osSemaphoreNew()

osSemaphoreId_t osSemaphoreNew ( uint32_t max_count,
uint32_t initial_count,
const osSemaphoreAttr_t * attr )

Create and Initialize a Semaphore object.

Parameters
[in]max_countmaximum number of available tokens.
[in]initial_countinitial number of available tokens.
[in]attrsemaphore attributes; NULL: default values.
Returns
semaphore ID for reference by other functions or NULL in case of error.

Definition at line 1894 of file cmsis_os2.c.

References osSemaphoreAttr_t::cb_mem, osSemaphoreAttr_t::cb_size, IRQ_Context(), osSemaphoreAttr_t::name, NULL, pdPASS, vQueueAddToRegistry, vSemaphoreDelete, and xSemaphoreGive.

Referenced by emmc_stm32_init().

◆ osSemaphoreRelease()

osStatus_t osSemaphoreRelease ( osSemaphoreId_t semaphore_id)

Release a Semaphore token up to the initial maximum count.

Parameters
[in]semaphore_idsemaphore ID obtained by osSemaphoreNew.
Returns
status code that indicates the execution status of the function.

Definition at line 2011 of file cmsis_os2.c.

References IRQ_Context(), NULL, osErrorParameter, osErrorResource, osOK, pdFALSE, pdPASS, pdTRUE, portYIELD_FROM_ISR, xSemaphoreGive, and xSemaphoreGiveFromISR.

Referenced by HAL_MMC_ErrorCallback(), and HAL_MMC_TxCpltCallback().

◆ osThreadEnumerate()

uint32_t osThreadEnumerate ( osThreadId_t * thread_array,
uint32_t array_items )

Enumerate active threads.

Parameters
[out]thread_arraypointer to array for retrieving thread IDs.
[in]array_itemsmaximum number of items in array for retrieving thread IDs.
Returns
number of enumerated threads.

Definition at line 886 of file cmsis_os2.c.

References count(), IRQ_Context(), NULL, pvPortMalloc(), uxTaskGetNumberOfTasks(), uxTaskGetSystemState(), vPortFree(), vTaskSuspendAll(), and xTaskResumeAll().

◆ osThreadExit()

__NO_RETURN void osThreadExit ( void )

Terminate execution of current running thread.

Definition at line 826 of file cmsis_os2.c.

References __NO_RETURN, NULL, and vTaskDelete().

◆ osThreadGetCount()

uint32_t osThreadGetCount ( void )

Get number of active threads.

Returns
number of active threads.

Definition at line 869 of file cmsis_os2.c.

References count(), IRQ_Context(), and uxTaskGetNumberOfTasks().

◆ osThreadGetId()

osThreadId_t osThreadGetId ( void )

Return the thread ID of the current running thread.

Returns
thread ID for reference by other functions or NULL in case of error.

Definition at line 669 of file cmsis_os2.c.

References xTaskGetCurrentTaskHandle().

Referenced by gnss_task(), anonymous_namespace{radio_task.cpp}::radio_task(), and sensors_task().

◆ osThreadGetName()

const char * osThreadGetName ( osThreadId_t thread_id)

Get name of a thread.

Parameters
[in]thread_idthread ID obtained by osThreadNew or osThreadGetId.
Returns
name as null-terminated string.

Definition at line 652 of file cmsis_os2.c.

References IRQ_Context(), NULL, and pcTaskGetName().

◆ osThreadGetPriority()

osPriority_t osThreadGetPriority ( osThreadId_t thread_id)

Get current priority of a thread.

Parameters
[in]thread_idthread ID obtained by osThreadNew or osThreadGetId.
Returns
current priority value of the specified thread.

Definition at line 746 of file cmsis_os2.c.

References IRQ_Context(), NULL, osPriorityError, and uxTaskPriorityGet().

◆ osThreadGetStackSpace()

uint32_t osThreadGetStackSpace ( osThreadId_t thread_id)

Get available stack space of a thread based on stack watermark recording during execution.

Parameters
[in]thread_idthread ID obtained by osThreadNew or osThreadGetId.
Returns
remaining stack space in bytes.

Definition at line 707 of file cmsis_os2.c.

References IRQ_Context(), NULL, and uxTaskGetStackHighWaterMark().

◆ osThreadGetState()

osThreadState_t osThreadGetState ( osThreadId_t thread_id)

Get current thread state of a thread.

Parameters
[in]thread_idthread ID obtained by osThreadNew or osThreadGetId.
Returns
current thread state of the specified thread.

Definition at line 681 of file cmsis_os2.c.

References eBlocked, eDeleted, eInvalid, eReady, eRunning, eSuspended, eTaskGetState(), IRQ_Context(), NULL, osThreadBlocked, osThreadError, osThreadReady, osThreadRunning, and state.

◆ osThreadNew()

osThreadId_t osThreadNew ( osThreadFunc_t func,
void * argument,
const osThreadAttr_t * attr )

Create a thread and add it to Active Threads.

Parameters
[in]functhread function.
[in]argumentpointer that is passed to the thread function as start argument.
[in]attrthread attributes; NULL: default values.
Returns
thread ID for reference by other functions or NULL in case of error.

Definition at line 577 of file cmsis_os2.c.

References osThreadAttr_t::attr_bits, osThreadAttr_t::cb_mem, osThreadAttr_t::cb_size, configMINIMAL_STACK_SIZE, configSTACK_DEPTH_TYPE, IRQ_Context(), osThreadAttr_t::name, NULL, osPriorityIdle, osPriorityISR, osPriorityNone, osPriorityNormal, osThreadJoinable, pdPASS, osThreadAttr_t::priority, osThreadAttr_t::stack_mem, and osThreadAttr_t::stack_size.

Referenced by bringup_task_start(), gnss_task_start(), idle_task_start(), main(), radio_task_start(), sensors_task_start(), and start_emmc().

◆ osThreadResume()

osStatus_t osThreadResume ( osThreadId_t thread_id)

Resume execution of a thread.

Parameters
[in]thread_idthread ID obtained by osThreadNew or osThreadGetId.
Returns
status code that indicates the execution status of the function.

Definition at line 803 of file cmsis_os2.c.

References IRQ_Context(), NULL, osErrorISR, osErrorParameter, osOK, and vTaskResume().

◆ osThreadSetPriority()

osStatus_t osThreadSetPriority ( osThreadId_t thread_id,
osPriority_t priority )

Change priority of a thread.

Parameters
[in]thread_idthread ID obtained by osThreadNew or osThreadGetId.
[in]prioritynew priority value for the thread function.
Returns
status code that indicates the execution status of the function.

Definition at line 724 of file cmsis_os2.c.

References IRQ_Context(), NULL, osErrorISR, osErrorParameter, osOK, osPriorityIdle, osPriorityISR, and vTaskPrioritySet().

◆ osThreadSuspend()

osStatus_t osThreadSuspend ( osThreadId_t thread_id)

Suspend execution of a thread.

Parameters
[in]thread_idthread ID obtained by osThreadNew or osThreadGetId.
Returns
status code that indicates the execution status of the function.

Definition at line 781 of file cmsis_os2.c.

References IRQ_Context(), NULL, osErrorISR, osErrorParameter, osOK, and vTaskSuspend().

◆ osThreadTerminate()

osStatus_t osThreadTerminate ( osThreadId_t thread_id)

Terminate execution of a thread.

Parameters
[in]thread_idthread ID obtained by osThreadNew or osThreadGetId.
Returns
status code that indicates the execution status of the function.

Definition at line 836 of file cmsis_os2.c.

References eDeleted, eTaskGetState(), IRQ_Context(), NULL, osError, osErrorISR, osErrorParameter, osErrorResource, osOK, and vTaskDelete().

◆ osThreadYield()

osStatus_t osThreadYield ( void )

Pass control to next thread that is in state READY.

Returns
status code that indicates the execution status of the function.

Definition at line 763 of file cmsis_os2.c.

References IRQ_Context(), osErrorISR, osOK, and taskYIELD.

◆ SVC_Setup()

__STATIC_INLINE void SVC_Setup ( void )

Definition at line 181 of file cmsis_os2.c.

References __STATIC_INLINE, NVIC_SetPriority, and SVCall_IRQn.

Referenced by osKernelStart().

◆ vApplicationDaemonTaskStartupHook()

void vApplicationDaemonTaskStartupHook ( void )
extern

References __WEAK.

◆ vApplicationIdleHook()

void vApplicationIdleHook ( void )
extern

Referenced by portTASK_FUNCTION().

◆ vApplicationMallocFailedHook()

void vApplicationMallocFailedHook ( void )
extern

Definition at line 69 of file freertos.c.

Referenced by prvHeapInit().

Variable Documentation

◆ KernelState

osKernelState_t KernelState = osKernelInactive
static

Definition at line 99 of file cmsis_os2.c.

Referenced by osKernelGetState(), osKernelInitialize(), and osKernelStart().