Prusa MINI Firmware overview
cmsis_os.h File Reference

Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specific to FreeRTOS. More...

#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "queue.h"
#include "semphr.h"
#include "event_groups.h"

Go to the source code of this file.

Classes

struct  os_thread_def
 
struct  os_timer_def
 
struct  os_mutex_def
 
struct  os_semaphore_def
 
struct  os_pool_def
 
struct  os_messageQ_def
 
struct  os_mailQ_def
 
struct  osEvent
 

Macros

#define osCMSIS   0x10002
 API version (main [31:16] .sub [15:0]) More...
 
#define osCMSIS_KERNEL   0x10000
 RTOS identification and version (main [31:16] .sub [15:0]) More...
 
#define osKernelSystemId   "KERNEL V1.00"
 RTOS identification string. More...
 
#define osFeature_MainThread   1
 main thread 1=main can be thread, 0=not available More...
 
#define osFeature_Pool   1
 Memory Pools: 1=available, 0=not available. More...
 
#define osFeature_MailQ   1
 Mail Queues: 1=available, 0=not available. More...
 
#define osFeature_MessageQ   1
 Message Queues: 1=available, 0=not available. More...
 
#define osFeature_Signals   8
 maximum number of Signal Flags available per thread More...
 
#define osFeature_Semaphore   1
 osFeature_Semaphore function: 1=available, 0=not available More...
 
#define osFeature_Wait   0
 osWait function: 1=available, 0=not available More...
 
#define osFeature_SysTick   1
 osKernelSysTick functions: 1=available, 0=not available More...
 
#define osWaitForever   0xFFFFFFFF
 wait forever timeout value More...
 
#define osKernelSysTickFrequency   (configTICK_RATE_HZ)
 
#define osKernelSysTickMicroSec(microsec)   (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)
 
#define osThreadDef(name, thread, priority, instances, stacksz)
 
#define osThread(name)   &os_thread_def_##name
 
#define osTimerDef(name, function)
 
#define osTimer(name)   &os_timer_def_##name
 
#define osMutexDef(name)   const osMutexDef_t os_mutex_def_##name = { 0 }
 
#define osMutex(name)   &os_mutex_def_##name
 
#define osSemaphoreDef(name)   const osSemaphoreDef_t os_semaphore_def_##name = { 0 }
 
#define osSemaphore(name)   &os_semaphore_def_##name
 
#define osPoolDef(name, no, type)
 Define a Memory Pool. More...
 
#define osPool(name)   &os_pool_def_##name
 Access a Memory Pool definition. More...
 
#define osMessageQDef(name, queue_sz, type)
 Create a Message Queue Definition. More...
 
#define osMessageQ(name)   &os_messageQ_def_##name
 Access a Message Queue Definition. More...
 
#define osMailQDef(name, queue_sz, type)
 Create a Mail Queue Definition. More...
 
#define osMailQ(name)   &os_mailQ_def_##name
 Access a Mail Queue Definition. More...
 

Typedefs

typedef void(* os_pthread) (void const *argument)
 
typedef void(* os_ptimer) (void const *argument)
 
typedef TaskHandle_t osThreadId
 
typedef TimerHandle_t osTimerId
 
typedef SemaphoreHandle_t osMutexId
 
typedef SemaphoreHandle_t osSemaphoreId
 
typedef struct os_pool_cbosPoolId
 
typedef QueueHandle_t osMessageQId
 
typedef struct os_mailQ_cbosMailQId
 
typedef struct os_thread_def osThreadDef_t
 
typedef struct os_timer_def osTimerDef_t
 
typedef struct os_mutex_def osMutexDef_t
 
typedef struct os_semaphore_def osSemaphoreDef_t
 
typedef struct os_pool_def osPoolDef_t
 
typedef struct os_messageQ_def osMessageQDef_t
 
typedef struct os_mailQ_def osMailQDef_t
 

Enumerations

enum  osPriority {
  osPriorityIdle = -3, osPriorityLow = -2, osPriorityBelowNormal = -1, osPriorityNormal = 0,
  osPriorityAboveNormal = +1, osPriorityHigh = +2, osPriorityRealtime = +3, osPriorityError = 0x84
}
 
enum  osStatus {
  osOK = 0, osEventSignal = 0x08, osEventMessage = 0x10, osEventMail = 0x20,
  osEventTimeout = 0x40, osErrorParameter = 0x80, osErrorResource = 0x81, osErrorTimeoutResource = 0xC1,
  osErrorISR = 0x82, osErrorISRRecursive = 0x83, osErrorPriority = 0x84, osErrorNoMemory = 0x85,
  osErrorValue = 0x86, osErrorOS = 0xFF, os_status_reserved = 0x7FFFFFFF
}
 
enum  os_timer_type { osTimerOnce = 0, osTimerPeriodic = 1 }
 

Functions

osStatus osKernelInitialize (void)
 
osStatus osKernelStart (void)
 Start the RTOS Kernel with executing the specified thread. More...
 
int32_t osKernelRunning (void)
 Check if the RTOS kernel is already started. More...
 
uint32_t osKernelSysTick (void)
 Get the value of the Kernel SysTick timer. More...
 
osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)
 Create a thread and add it to Active Threads and set it to state READY. More...
 
osThreadId osThreadGetId (void)
 Return the thread ID of the current running thread. More...
 
osStatus osThreadTerminate (osThreadId thread_id)
 Terminate execution of a thread and remove it from Active Threads. More...
 
osStatus osThreadYield (void)
 Pass control to next thread that is in state READY. More...
 
osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)
 Change priority of an active thread. More...
 
osPriority osThreadGetPriority (osThreadId thread_id)
 Get current priority of an active thread. More...
 
osStatus osDelay (uint32_t millisec)
 Wait for Timeout (Time Delay) More...
 
osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument)
 Create a timer. More...
 
osStatus osTimerStart (osTimerId timer_id, uint32_t millisec)
 Start or restart a timer. More...
 
osStatus osTimerStop (osTimerId timer_id)
 Stop a timer. More...
 
osStatus osTimerDelete (osTimerId timer_id)
 Delete a timer. More...
 
int32_t osSignalSet (osThreadId thread_id, int32_t signals)
 Set the specified Signal Flags of an active thread. More...
 
int32_t osSignalClear (osThreadId thread_id, int32_t signals)
 
osEvent osSignalWait (int32_t signals, uint32_t millisec)
 Wait for one or more Signal Flags to become signaled for the current RUNNING thread. More...
 
osMutexId osMutexCreate (const osMutexDef_t *mutex_def)
 Create and Initialize a Mutex object. More...
 
osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec)
 Wait until a Mutex becomes available. More...
 
osStatus osMutexRelease (osMutexId mutex_id)
 Release a Mutex that was obtained by osMutexWait. More...
 
osStatus osMutexDelete (osMutexId mutex_id)
 Delete a Mutex. More...
 
osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count)
 Create and Initialize a Semaphore object used for managing resources. More...
 
int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec)
 Wait until a Semaphore token becomes available. More...
 
osStatus osSemaphoreRelease (osSemaphoreId semaphore_id)
 Release a Semaphore token. More...
 
osStatus osSemaphoreDelete (osSemaphoreId semaphore_id)
 Delete a Semaphore. More...
 
osPoolId osPoolCreate (const osPoolDef_t *pool_def)
 Create and Initialize a memory pool. More...
 
voidosPoolAlloc (osPoolId pool_id)
 Allocate a memory block from a memory pool. More...
 
voidosPoolCAlloc (osPoolId pool_id)
 Allocate a memory block from a memory pool and set memory block to zero. More...
 
osStatus osPoolFree (osPoolId pool_id, void *block)
 Return an allocated memory block back to a specific memory pool. More...
 
osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id)
 Create and Initialize a Message Queue. More...
 
osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec)
 Put a Message to a Queue. More...
 
osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec)
 Get a Message or Wait for a Message from a Queue. More...
 
osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id)
 Create and Initialize mail queue. More...
 
voidosMailAlloc (osMailQId queue_id, uint32_t millisec)
 Allocate a memory block from a mail. More...
 
voidosMailCAlloc (osMailQId queue_id, uint32_t millisec)
 Allocate a memory block from a mail and set memory block to zero. More...
 
osStatus osMailPut (osMailQId queue_id, void *mail)
 Put a mail to a queue. More...
 
osEvent osMailGet (osMailQId queue_id, uint32_t millisec)
 Get a mail from a queue. More...
 
osStatus osMailFree (osMailQId queue_id, void *mail)
 Free a memory block from a mail. More...
 
void osSystickHandler (void)
 Handles the tick increment. More...
 
osStatus osThreadSuspend (osThreadId thread_id)
 Suspend execution of a thread. More...
 
osStatus osThreadResume (osThreadId thread_id)
 Resume execution of a suspended thread. More...
 
osStatus osThreadSuspendAll (void)
 Suspend execution of a all active threads. More...
 
osStatus osThreadResumeAll (void)
 Resume execution of a all suspended threads. More...
 
osStatus osDelayUntil (uint32_t *PreviousWakeTime, uint32_t millisec)
 Delay a task until a specified time. More...
 
osStatus osAbortDelay (osThreadId thread_id)
 Abort the delay for a specific thread. More...
 
osStatus osThreadList (uint8_t *buffer)
 Lists all the current threads, along with their current state and stack usage high water mark. More...
 
osEvent osMessagePeek (osMessageQId queue_id, uint32_t millisec)
 Receive an item from a queue without removing the item from the queue. More...
 
uint32_t osMessageWaiting (osMessageQId queue_id)
 Get the number of messaged stored in a queue. More...
 
uint32_t osMessageAvailableSpace (osMessageQId queue_id)
 Get the available space in a message queue. More...
 
osStatus osMessageDelete (osMessageQId queue_id)
 Delete a Message Queue. More...
 
osMutexId osRecursiveMutexCreate (const osMutexDef_t *mutex_def)
 Create and Initialize a Recursive Mutex. More...
 
osStatus osRecursiveMutexRelease (osMutexId mutex_id)
 Release a Recursive Mutex. More...
 
osStatus osRecursiveMutexWait (osMutexId mutex_id, uint32_t millisec)
 Release a Recursive Mutex. More...
 
uint32_t osSemaphoreGetCount (osSemaphoreId semaphore_id)
 Returns the current count value of a counting semaphore. More...
 

Detailed Description

Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specific to FreeRTOS.

Author
MCD Application Team
Date
13-July-2017
Attention

Redistribution and use in source and binary forms, with or without modification, are permitted, provided that the following conditions are met:

  1. Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of other contributors to this software may be used to endorse or promote products derived from this software without specific written permission.
  4. This software, including modifications and/or derivative works of this software, must execute solely and exclusively on microcontroller or microprocessor devices manufactured by or for STMicroelectronics.
  5. Redistribution and use of this software other than as permitted under this license is void and will automatically terminate your rights under this license.

THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ osCMSIS

#define osCMSIS   0x10002

API version (main [31:16] .sub [15:0])

cmsis_os_h Header File Template: cmsis_os.h

The file cmsis_os.h is a template header file for a CMSIS-RTOS compliant Real-Time Operating System (RTOS). Each RTOS that is compliant with CMSIS-RTOS shall provide a specific cmsis_os.h header file that represents its implementation.

The file cmsis_os.h contains:

  • CMSIS-RTOS API function definitions
  • struct definitions for parameters and return types
  • status and priority values used by CMSIS-RTOS API functions
  • macros for defining threads and other kernel objects

Name conventions and header file modifications

All definitions are prefixed with os to give an unique name space for CMSIS-RTOS functions. Definitions that are prefixed os_ are not used in the application code but local to this header file. All definitions and functions that belong to a module are grouped and have a common prefix, i.e. osThread.

Definitions that are marked with CAN BE CHANGED can be adapted towards the needs of the actual CMSIS-RTOS implementation. These definitions can be specific to the underlying RTOS kernel.

Definitions that are marked with MUST REMAIN UNCHANGED cannot be altered. Otherwise the CMSIS-RTOS implementation is no longer compliant to the standard. Note that some functions are optional and need not to be provided by every CMSIS-RTOS implementation.

Function calls from interrupt service routines

The following CMSIS-RTOS functions can be called from threads and interrupt service routines (ISR):

Functions that cannot be called from an ISR are verifying the interrupt status and return in case that they are called from an ISR context the status code osErrorISR. In some implementations this condition might be caught using the HARD FAULT vector.

Some CMSIS-RTOS implementations support CMSIS-RTOS function calls from multiple ISR at the same time. If this is impossible, the CMSIS-RTOS rejects calls by nested ISR functions with the status code osErrorISRRecursive.

Define and reference object definitions

With #define osObjectsExternal objects are defined as external symbols. This allows to create a consistent header file that is used throughout a project as shown below:

Header File

#include <cmsis_os.h> // CMSIS RTOS header file
// Thread definition
extern void thread_sample (void const *argument); // function prototype
osThreadDef (thread_sample, osPriorityBelowNormal, 1, 100);
// Pool definition
osPoolDef(MyPool, 10, long);

This header file defines all objects when included in a C/C++ source file. When #define osObjectsExternal is present before the header file, the objects are defined as external symbols. A single consistent header file can therefore be used throughout the whole project.

Example

#include "osObjects.h" // Definition of the CMSIS-RTOS objects
#define osObjectExternal // Objects will be defined as external symbols
#include "osObjects.h" // Reference to the CMSIS-RTOS objects
Note
MUST REMAIN UNCHANGED: osCMSIS identifies the CMSIS-RTOS API version.

◆ osCMSIS_KERNEL

#define osCMSIS_KERNEL   0x10000

RTOS identification and version (main [31:16] .sub [15:0])

Note
CAN BE CHANGED: osCMSIS_KERNEL identifies the underlying RTOS kernel and version number.

◆ osKernelSystemId

#define osKernelSystemId   "KERNEL V1.00"

RTOS identification string.

Note
MUST REMAIN UNCHANGED: osKernelSystemId shall be consistent in every CMSIS-RTOS.

◆ osFeature_MainThread

#define osFeature_MainThread   1

main thread 1=main can be thread, 0=not available

Note
MUST REMAIN UNCHANGED: osFeature_xxx shall be consistent in every CMSIS-RTOS.

◆ osFeature_Pool

#define osFeature_Pool   1

Memory Pools: 1=available, 0=not available.

◆ osFeature_MailQ

#define osFeature_MailQ   1

Mail Queues: 1=available, 0=not available.

◆ osFeature_MessageQ

#define osFeature_MessageQ   1

Message Queues: 1=available, 0=not available.

◆ osFeature_Signals

#define osFeature_Signals   8

maximum number of Signal Flags available per thread

◆ osFeature_Semaphore

#define osFeature_Semaphore   1

osFeature_Semaphore function: 1=available, 0=not available

◆ osFeature_Wait

#define osFeature_Wait   0

osWait function: 1=available, 0=not available

◆ osFeature_SysTick

#define osFeature_SysTick   1

osKernelSysTick functions: 1=available, 0=not available

◆ osWaitForever

#define osWaitForever   0xFFFFFFFF

wait forever timeout value

Timeout value.

Note
MUST REMAIN UNCHANGED: osWaitForever shall be consistent in every CMSIS-RTOS.

◆ osKernelSysTickFrequency

#define osKernelSysTickFrequency   (configTICK_RATE_HZ)

The RTOS kernel system timer frequency in Hz

Note
Reflects the system timer setting and is typically defined in a configuration file.

◆ osKernelSysTickMicroSec

#define osKernelSysTickMicroSec (   microsec)    (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)

Convert a microseconds value to a RTOS kernel system timer value.

Parameters
microsectime value in microseconds.
Returns
time value normalized to the osKernelSysTickFrequency

◆ osThreadDef

#define osThreadDef (   name,
  thread,
  priority,
  instances,
  stacksz 
)
Value:
const osThreadDef_t os_thread_def_##name = \
{ #name, (thread), (priority), (instances), (stacksz)}

Create a Thread Definition with function, priority, and stack requirements.

Parameters
namename of the thread function.
priorityinitial priority of the thread function.
instancesnumber of possible thread instances.
stackszstack size (in bytes) requirements for the thread function.
Note
CAN BE CHANGED: The parameters to osThreadDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osThread

#define osThread (   name)    &os_thread_def_##name

Access a Thread definition.

Parameters
namename of the thread definition object.
Note
CAN BE CHANGED: The parameter to osThread shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osTimerDef

#define osTimerDef (   name,
  function 
)
Value:
const osTimerDef_t os_timer_def_##name = \
{ (function) }

Define a Timer object.

Parameters
namename of the timer object.
functionname of the timer call back function.
Note
CAN BE CHANGED: The parameter to osTimerDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osTimer

#define osTimer (   name)    &os_timer_def_##name

Access a Timer definition.

Parameters
namename of the timer object.
Note
CAN BE CHANGED: The parameter to osTimer shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osMutexDef

#define osMutexDef (   name)    const osMutexDef_t os_mutex_def_##name = { 0 }

Define a Mutex.

Parameters
namename of the mutex object.
Note
CAN BE CHANGED: The parameter to osMutexDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osMutex

#define osMutex (   name)    &os_mutex_def_##name

Access a Mutex definition.

Parameters
namename of the mutex object.
Note
CAN BE CHANGED: The parameter to osMutex shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osSemaphoreDef

#define osSemaphoreDef (   name)    const osSemaphoreDef_t os_semaphore_def_##name = { 0 }

Define a Semaphore object.

Parameters
namename of the semaphore object.
Note
CAN BE CHANGED: The parameter to osSemaphoreDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osSemaphore

#define osSemaphore (   name)    &os_semaphore_def_##name

Access a Semaphore definition.

Parameters
namename of the semaphore object.
Note
CAN BE CHANGED: The parameter to osSemaphore shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osPoolDef

#define osPoolDef (   name,
  no,
  type 
)
Value:
const osPoolDef_t os_pool_def_##name = \
{ (no), sizeof(type), NULL }

Define a Memory Pool.

Parameters
namename of the memory pool.
nomaximum number of blocks (objects) in the memory pool.
typedata type of a single block (object).
Note
CAN BE CHANGED: The parameter to osPoolDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osPool

#define osPool (   name)    &os_pool_def_##name

Access a Memory Pool definition.

Parameters
namename of the memory pool
Note
CAN BE CHANGED: The parameter to osPool shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osMessageQDef

#define osMessageQDef (   name,
  queue_sz,
  type 
)
Value:
const osMessageQDef_t os_messageQ_def_##name = \
{ (queue_sz), sizeof (type) }

Create a Message Queue Definition.

Parameters
namename of the queue.
queue_szmaximum number of messages in the queue.
typedata type of a single message element (for debugger).
Note
CAN BE CHANGED: The parameter to osMessageQDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osMessageQ

#define osMessageQ (   name)    &os_messageQ_def_##name

Access a Message Queue Definition.

Parameters
namename of the queue
Note
CAN BE CHANGED: The parameter to osMessageQ shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osMailQDef

#define osMailQDef (   name,
  queue_sz,
  type 
)
Value:
struct os_mailQ_cb *os_mailQ_cb_##name; \
const osMailQDef_t os_mailQ_def_##name = \
{ (queue_sz), sizeof (type), (&os_mailQ_cb_##name) }

Create a Mail Queue Definition.

Parameters
namename of the queue
queue_szmaximum number of messages in queue
typedata type of a single message element
Note
CAN BE CHANGED: The parameter to osMailQDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

◆ osMailQ

#define osMailQ (   name)    &os_mailQ_def_##name

Access a Mail Queue Definition.

Parameters
namename of the queue
Note
CAN BE CHANGED: The parameter to osMailQ shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Typedef Documentation

◆ os_pthread

typedef void(* os_pthread) (void const *argument)

Entry point of a thread.

Note
MUST REMAIN UNCHANGED: os_pthread shall be consistent in every CMSIS-RTOS.

◆ os_ptimer

typedef void(* os_ptimer) (void const *argument)

Entry point of a timer call back function.

Note
MUST REMAIN UNCHANGED: os_ptimer shall be consistent in every CMSIS-RTOS.

◆ osThreadId

Thread ID identifies the thread (pointer to a thread control block).

Note
CAN BE CHANGED: os_thread_cb is implementation specific in every CMSIS-RTOS.

◆ osTimerId

Timer ID identifies the timer (pointer to a timer control block).

Note
CAN BE CHANGED: os_timer_cb is implementation specific in every CMSIS-RTOS.

◆ osMutexId

Mutex ID identifies the mutex (pointer to a mutex control block).

Note
CAN BE CHANGED: os_mutex_cb is implementation specific in every CMSIS-RTOS.

◆ osSemaphoreId

Semaphore ID identifies the semaphore (pointer to a semaphore control block).

Note
CAN BE CHANGED: os_semaphore_cb is implementation specific in every CMSIS-RTOS.

◆ osPoolId

typedef struct os_pool_cb* osPoolId

Pool ID identifies the memory pool (pointer to a memory pool control block).

Note
CAN BE CHANGED: os_pool_cb is implementation specific in every CMSIS-RTOS.

◆ osMessageQId

Message ID identifies the message queue (pointer to a message queue control block).

Note
CAN BE CHANGED: os_messageQ_cb is implementation specific in every CMSIS-RTOS.

◆ osMailQId

typedef struct os_mailQ_cb* osMailQId

Mail ID identifies the mail queue (pointer to a mail queue control block).

Note
CAN BE CHANGED: os_mailQ_cb is implementation specific in every CMSIS-RTOS.

◆ osThreadDef_t

typedef struct os_thread_def osThreadDef_t

Thread Definition structure contains startup information of a thread.

Note
CAN BE CHANGED: os_thread_def is implementation specific in every CMSIS-RTOS.

◆ osTimerDef_t

typedef struct os_timer_def osTimerDef_t

Timer Definition structure contains timer parameters.

Note
CAN BE CHANGED: os_timer_def is implementation specific in every CMSIS-RTOS.

◆ osMutexDef_t

typedef struct os_mutex_def osMutexDef_t

Mutex Definition structure contains setup information for a mutex.

Note
CAN BE CHANGED: os_mutex_def is implementation specific in every CMSIS-RTOS.

◆ osSemaphoreDef_t

Semaphore Definition structure contains setup information for a semaphore.

Note
CAN BE CHANGED: os_semaphore_def is implementation specific in every CMSIS-RTOS.

◆ osPoolDef_t

typedef struct os_pool_def osPoolDef_t

Definition structure for memory block allocation.

Note
CAN BE CHANGED: os_pool_def is implementation specific in every CMSIS-RTOS.

◆ osMessageQDef_t

Definition structure for message queue.

Note
CAN BE CHANGED: os_messageQ_def is implementation specific in every CMSIS-RTOS.

◆ osMailQDef_t

typedef struct os_mailQ_def osMailQDef_t

Definition structure for mail queue.

Note
CAN BE CHANGED: os_mailQ_def is implementation specific in every CMSIS-RTOS.

Enumeration Type Documentation

◆ osPriority

enum osPriority

Priority used for thread control.

Note
MUST REMAIN UNCHANGED: osPriority shall be consistent in every CMSIS-RTOS.
Enumerator
osPriorityIdle 

priority: idle (lowest)

osPriorityLow 

priority: low

osPriorityBelowNormal 

priority: below normal

osPriorityNormal 

priority: normal (default)

osPriorityAboveNormal 

priority: above normal

osPriorityHigh 

priority: high

osPriorityRealtime 

priority: realtime (highest)

osPriorityError 

system cannot determine priority or thread has illegal priority

217  {
218  osPriorityIdle = -3, ///< priority: idle (lowest)
219  osPriorityLow = -2, ///< priority: low
220  osPriorityBelowNormal = -1, ///< priority: below normal
221  osPriorityNormal = 0, ///< priority: normal (default)
222  osPriorityAboveNormal = +1, ///< priority: above normal
223  osPriorityHigh = +2, ///< priority: high
224  osPriorityRealtime = +3, ///< priority: realtime (highest)
225  osPriorityError = 0x84 ///< system cannot determine priority or thread has illegal priority
226 } osPriority;

◆ osStatus

enum osStatus

Status code values returned by CMSIS-RTOS functions.

Note
MUST REMAIN UNCHANGED: osStatus shall be consistent in every CMSIS-RTOS.
Enumerator
osOK 

function completed; no error or event occurred.

osEventSignal 

function completed; signal event occurred.

osEventMessage 

function completed; message event occurred.

osEventMail 

function completed; mail event occurred.

osEventTimeout 

function completed; timeout occurred.

osErrorParameter 

parameter error: a mandatory parameter was missing or specified an incorrect object.

osErrorResource 

resource not available: a specified resource was not available.

osErrorTimeoutResource 

resource not available within given time: a specified resource was not available within the timeout period.

osErrorISR 

not allowed in ISR context: the function cannot be called from interrupt service routines.

osErrorISRRecursive 

function called multiple times from ISR with same object.

osErrorPriority 

system cannot determine priority or thread has illegal priority.

osErrorNoMemory 

system is out of memory: it was impossible to allocate or reserve memory for the operation.

osErrorValue 

value of a parameter is out of range.

osErrorOS 

unspecified RTOS error: run-time error but no other error message fits.

os_status_reserved 

prevent from enum down-size compiler optimization.

234  {
235  osOK = 0, ///< function completed; no error or event occurred.
236  osEventSignal = 0x08, ///< function completed; signal event occurred.
237  osEventMessage = 0x10, ///< function completed; message event occurred.
238  osEventMail = 0x20, ///< function completed; mail event occurred.
239  osEventTimeout = 0x40, ///< function completed; timeout occurred.
240  osErrorParameter = 0x80, ///< parameter error: a mandatory parameter was missing or specified an incorrect object.
241  osErrorResource = 0x81, ///< resource not available: a specified resource was not available.
242  osErrorTimeoutResource = 0xC1, ///< resource not available within given time: a specified resource was not available within the timeout period.
243  osErrorISR = 0x82, ///< not allowed in ISR context: the function cannot be called from interrupt service routines.
244  osErrorISRRecursive = 0x83, ///< function called multiple times from ISR with same object.
245  osErrorPriority = 0x84, ///< system cannot determine priority or thread has illegal priority.
246  osErrorNoMemory = 0x85, ///< system is out of memory: it was impossible to allocate or reserve memory for the operation.
247  osErrorValue = 0x86, ///< value of a parameter is out of range.
248  osErrorOS = 0xFF, ///< unspecified RTOS error: run-time error but no other error message fits.
249  os_status_reserved = 0x7FFFFFFF ///< prevent from enum down-size compiler optimization.
250 } osStatus;

◆ os_timer_type

Timer type value for the timer definition.

Note
MUST REMAIN UNCHANGED: os_timer_type shall be consistent in every CMSIS-RTOS.
Enumerator
osTimerOnce 

one-shot timer

osTimerPeriodic 

repeating timer

266  {
267  osTimerOnce = 0, ///< one-shot timer
268  osTimerPeriodic = 1 ///< repeating timer
269 } os_timer_type;

Function Documentation

◆ osKernelInitialize()

osStatus osKernelInitialize ( void  )

Initialize the RTOS Kernel for creating objects.

Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osKernelInitialize shall be consistent in every CMSIS-RTOS.

◆ osKernelStart()

osStatus osKernelStart ( void  )

Start the RTOS Kernel with executing the specified thread.

Start the RTOS Kernel.

Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osKernelStart shall be consistent in every CMSIS-RTOS.
Parameters
thread_defthread definition referenced with osThread.
argumentpointer that is passed to the thread function as start argument.
Return values
statuscode that indicates the execution status of the function
Note
MUST REMAIN UNCHANGED: osKernelStart shall be consistent in every CMSIS-RTOS.
194 {
196 
197  return osOK;
198 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osKernelRunning()

int32_t osKernelRunning ( void  )

Check if the RTOS kernel is already started.

Check if the RTOS kernel is already started.

Note
MUST REMAIN UNCHANGED: osKernelRunning shall be consistent in every CMSIS-RTOS.
Returns
0 RTOS is not started, 1 RTOS is started.
Parameters
None
Return values
(0)RTOS is not started (1) RTOS is started (-1) if this feature is disabled in FreeRTOSConfig.h
Note
MUST REMAIN UNCHANGED: osKernelRunning shall be consistent in every CMSIS-RTOS.
209 {
210 #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
212  return 0;
213  else
214  return 1;
215 #else
216  return (-1);
217 #endif
218 }
Here is the call graph for this function:

◆ osKernelSysTick()

uint32_t osKernelSysTick ( void  )

Get the value of the Kernel SysTick timer.

Get the RTOS kernel system timer counter

Note
MUST REMAIN UNCHANGED: osKernelSysTick shall be consistent in every CMSIS-RTOS.
Returns
RTOS kernel system timer as 32-bit value
Parameters
None
Return values
None
Note
MUST REMAIN UNCHANGED: osKernelSysTick shall be consistent in every CMSIS-RTOS.
228 {
229  if (inHandlerMode()) {
230  return xTaskGetTickCountFromISR();
231  }
232  else {
233  return xTaskGetTickCount();
234  }
235 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osThreadCreate()

osThreadId osThreadCreate ( const osThreadDef_t thread_def,
void argument 
)

Create a thread and add it to Active Threads and set it to state READY.

Create a thread and add it to Active Threads and set it to state READY.

Parameters
[in]thread_defthread definition referenced with osThread.
[in]argumentpointer that is passed to the thread function as start argument.
Returns
thread ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osThreadCreate shall be consistent in every CMSIS-RTOS.
Parameters
thread_defthread definition referenced with osThread.
argumentpointer that is passed to the thread function as start argument.
Return values
threadID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osThreadCreate shall be consistent in every CMSIS-RTOS.
246 {
248 
249 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
250  if((thread_def->buffer != NULL) && (thread_def->controlblock != NULL)) {
251  handle = xTaskCreateStatic((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
252  thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
253  thread_def->buffer, thread_def->controlblock);
254  }
255  else {
256  if (xTaskCreate((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
257  thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
258  &handle) != pdPASS) {
259  return NULL;
260  }
261  }
262 #elif( configSUPPORT_STATIC_ALLOCATION == 1 )
263 
264  handle = xTaskCreateStatic((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
265  thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
266  thread_def->buffer, thread_def->controlblock);
267 #else
268  if (xTaskCreate((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
269  thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
270  &handle) != pdPASS) {
271  return NULL;
272  }
273 #endif
274 
275  return handle;
276 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osThreadGetId()

osThreadId osThreadGetId ( void  )

Return the thread ID of the current running thread.

Return the thread ID of the current running thread.

Returns
thread ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osThreadGetId shall be consistent in every CMSIS-RTOS.
Return values
threadID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osThreadGetId shall be consistent in every CMSIS-RTOS.
284 {
285 #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) )
286  return xTaskGetCurrentTaskHandle();
287 #else
288  return NULL;
289 #endif
290 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osThreadTerminate()

osStatus osThreadTerminate ( osThreadId  thread_id)

Terminate execution of a thread and remove it from Active Threads.

Terminate execution of a thread and remove it from Active Threads.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osThreadTerminate shall be consistent in every CMSIS-RTOS.
Parameters
thread_idthread ID obtained by osThreadCreate or osThreadGetId.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osThreadTerminate shall be consistent in every CMSIS-RTOS.
299 {
300 #if (INCLUDE_vTaskDelete == 1)
301  vTaskDelete(thread_id);
302  return osOK;
303 #else
304  return osErrorOS;
305 #endif
306 }
Here is the call graph for this function:

◆ osThreadYield()

osStatus osThreadYield ( void  )

Pass control to next thread that is in state READY.

Pass control to next thread that is in state READY.

Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osThreadYield shall be consistent in every CMSIS-RTOS.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osThreadYield shall be consistent in every CMSIS-RTOS.
314 {
315  taskYIELD();
316 
317  return osOK;
318 }

◆ osThreadSetPriority()

osStatus osThreadSetPriority ( osThreadId  thread_id,
osPriority  priority 
)

Change priority of an active thread.

Change priority of an active thread.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
[in]prioritynew priority value for the thread function.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osThreadSetPriority shall be consistent in every CMSIS-RTOS.
Parameters
thread_idthread ID obtained by osThreadCreate or osThreadGetId.
prioritynew priority value for the thread function.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osThreadSetPriority shall be consistent in every CMSIS-RTOS.
328 {
329 #if (INCLUDE_vTaskPrioritySet == 1)
330  vTaskPrioritySet(thread_id, makeFreeRtosPriority(priority));
331  return osOK;
332 #else
333  return osErrorOS;
334 #endif
335 }
Here is the call graph for this function:

◆ osThreadGetPriority()

osPriority osThreadGetPriority ( osThreadId  thread_id)

Get current priority of an active thread.

Get current priority of an active thread.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
Returns
current priority value of the thread function.
Note
MUST REMAIN UNCHANGED: osThreadGetPriority shall be consistent in every CMSIS-RTOS.
Parameters
thread_idthread ID obtained by osThreadCreate or osThreadGetId.
Return values
currentpriority value of the thread function.
Note
MUST REMAIN UNCHANGED: osThreadGetPriority shall be consistent in every CMSIS-RTOS.
344 {
345 #if (INCLUDE_uxTaskPriorityGet == 1)
346  if (inHandlerMode())
347  {
348  return makeCmsisPriority(uxTaskPriorityGetFromISR(thread_id));
349  }
350  else
351  {
352  return makeCmsisPriority(uxTaskPriorityGet(thread_id));
353  }
354 #else
355  return osPriorityError;
356 #endif
357 }
Here is the call graph for this function:

◆ osDelay()

osStatus osDelay ( uint32_t  millisec)

Wait for Timeout (Time Delay)

Wait for Timeout (Time Delay).

Parameters
[in]millisectime delay value
Returns
status code that indicates the execution status of the function.
Parameters
millisectime delay value
Return values
statuscode that indicates the execution status of the function.
366 {
367 #if INCLUDE_vTaskDelay
368  TickType_t ticks = millisec / portTICK_PERIOD_MS;
369 
370  vTaskDelay(ticks ? ticks : 1); /* Minimum delay = 1 tick */
371 
372  return osOK;
373 #else
374  (void) millisec;
375 
376  return osErrorResource;
377 #endif
378 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osTimerCreate()

osTimerId osTimerCreate ( const osTimerDef_t timer_def,
os_timer_type  type,
void argument 
)

Create a timer.

Create a timer.

Parameters
[in]timer_deftimer object referenced with osTimer.
[in]typeosTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
[in]argumentargument to the timer call back function.
Returns
timer ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osTimerCreate shall be consistent in every CMSIS-RTOS.
Parameters
timer_deftimer object referenced with osTimer.
typeosTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
argumentargument to the timer call back function.
Return values
timerID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osTimerCreate shall be consistent in every CMSIS-RTOS.
401 {
402 #if (configUSE_TIMERS == 1)
403 
404 #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
405  if(timer_def->controlblock != NULL) {
406  return xTimerCreateStatic((const char *)"",
407  1, // period should be filled when starting the Timer using osTimerStart
409  (void *) argument,
410  (TaskFunction_t)timer_def->ptimer,
411  (StaticTimer_t *)timer_def->controlblock);
412  }
413  else {
414  return xTimerCreate((const char *)"",
415  1, // period should be filled when starting the Timer using osTimerStart
417  (void *) argument,
418  (TaskFunction_t)timer_def->ptimer);
419  }
420 #elif( configSUPPORT_STATIC_ALLOCATION == 1 )
421  return xTimerCreateStatic((const char *)"",
422  1, // period should be filled when starting the Timer using osTimerStart
424  (void *) argument,
425  (TaskFunction_t)timer_def->ptimer,
426  (StaticTimer_t *)timer_def->controlblock);
427 #else
428  return xTimerCreate((const char *)"",
429  1, // period should be filled when starting the Timer using osTimerStart
431  (void *) argument,
432  (TaskFunction_t)timer_def->ptimer);
433 #endif
434 
435 #else
436  return NULL;
437 #endif
438 }

◆ osTimerStart()

osStatus osTimerStart ( osTimerId  timer_id,
uint32_t  millisec 
)

Start or restart a timer.

Start or restart a timer.

Parameters
[in]timer_idtimer ID obtained by osTimerCreate.
[in]millisectime delay value of the timer.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osTimerStart shall be consistent in every CMSIS-RTOS.
Parameters
timer_idtimer ID obtained by osTimerCreate.
millisectime delay value of the timer.
Return values
statuscode that indicates the execution status of the function
Note
MUST REMAIN UNCHANGED: osTimerStart shall be consistent in every CMSIS-RTOS.
448 {
449  osStatus result = osOK;
450 #if (configUSE_TIMERS == 1)
451  portBASE_TYPE taskWoken = pdFALSE;
452  TickType_t ticks = millisec / portTICK_PERIOD_MS;
453 
454  if (ticks == 0)
455  ticks = 1;
456 
457  if (inHandlerMode())
458  {
459  if (xTimerChangePeriodFromISR(timer_id, ticks, &taskWoken) != pdPASS)
460  {
461  result = osErrorOS;
462  }
463  else
464  {
465  portEND_SWITCHING_ISR(taskWoken);
466  }
467  }
468  else
469  {
470  if (xTimerChangePeriod(timer_id, ticks, 0) != pdPASS)
471  result = osErrorOS;
472  }
473 
474 #else
475  result = osErrorOS;
476 #endif
477  return result;
478 }
Here is the call graph for this function:

◆ osTimerStop()

osStatus osTimerStop ( osTimerId  timer_id)

Stop a timer.

Stop the timer.

Parameters
[in]timer_idtimer ID obtained by osTimerCreate.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osTimerStop shall be consistent in every CMSIS-RTOS.
Parameters
timer_idtimer ID obtained by osTimerCreate
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osTimerStop shall be consistent in every CMSIS-RTOS.
487 {
488  osStatus result = osOK;
489 #if (configUSE_TIMERS == 1)
490  portBASE_TYPE taskWoken = pdFALSE;
491 
492  if (inHandlerMode()) {
493  if (xTimerStopFromISR(timer_id, &taskWoken) != pdPASS) {
494  return osErrorOS;
495  }
496  portEND_SWITCHING_ISR(taskWoken);
497  }
498  else {
499  if (xTimerStop(timer_id, 0) != pdPASS) {
500  result = osErrorOS;
501  }
502  }
503 #else
504  result = osErrorOS;
505 #endif
506  return result;
507 }
Here is the call graph for this function:

◆ osTimerDelete()

osStatus osTimerDelete ( osTimerId  timer_id)

Delete a timer.

Delete a timer that was created by osTimerCreate.

Parameters
[in]timer_idtimer ID obtained by osTimerCreate.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osTimerDelete shall be consistent in every CMSIS-RTOS.
Parameters
timer_idtimer ID obtained by osTimerCreate
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osTimerDelete shall be consistent in every CMSIS-RTOS.
516 {
517 osStatus result = osOK;
518 
519 #if (configUSE_TIMERS == 1)
520 
521  if (inHandlerMode()) {
522  return osErrorISR;
523  }
524  else {
525  if ((xTimerDelete(timer_id, osWaitForever )) != pdPASS) {
526  result = osErrorOS;
527  }
528  }
529 
530 #else
531  result = osErrorOS;
532 #endif
533 
534  return result;
535 }
Here is the call graph for this function:

◆ osSignalSet()

int32_t osSignalSet ( osThreadId  thread_id,
int32_t  signal 
)

Set the specified Signal Flags of an active thread.

Set the specified Signal Flags of an active thread.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
[in]signalsspecifies the signal flags of the thread that should be set.
Returns
osOK if successful, osErrorOS if failed.
Note
MUST REMAIN UNCHANGED: osSignalSet shall be consistent in every CMSIS-RTOS.
Parameters
thread_idthread ID obtained by osThreadCreate or osThreadGetId.
signalsspecifies the signal flags of the thread that should be set.
Return values
previoussignal flags of the specified thread or 0x80000000 in case of incorrect parameters.
Note
MUST REMAIN UNCHANGED: osSignalSet shall be consistent in every CMSIS-RTOS.
546 {
547 #if( configUSE_TASK_NOTIFICATIONS == 1 )
548  BaseType_t xHigherPriorityTaskWoken = pdFALSE;
549  uint32_t ulPreviousNotificationValue = 0;
550 
551  if (inHandlerMode())
552  {
553  if(xTaskGenericNotifyFromISR( thread_id , (uint32_t)signal, eSetBits, &ulPreviousNotificationValue, &xHigherPriorityTaskWoken ) != pdPASS )
554  return 0x80000000;
555 
556  portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
557  }
558  else if(xTaskGenericNotify( thread_id , (uint32_t)signal, eSetBits, &ulPreviousNotificationValue) != pdPASS )
559  return 0x80000000;
560 
561  return ulPreviousNotificationValue;
562 #else
563  (void) thread_id;
564  (void) signal;
565 
566  return 0x80000000; /* Task Notification not supported */
567 #endif
568 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osSignalClear()

int32_t osSignalClear ( osThreadId  thread_id,
int32_t  signals 
)

Clear the specified Signal Flags of an active thread.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
[in]signalsspecifies the signal flags of the thread that shall be cleared.
Returns
previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
Note
MUST REMAIN UNCHANGED: osSignalClear shall be consistent in every CMSIS-RTOS.

◆ osSignalWait()

osEvent osSignalWait ( int32_t  signals,
uint32_t  millisec 
)

Wait for one or more Signal Flags to become signaled for the current RUNNING thread.

Wait for one or more Signal Flags to become signaled for the current RUNNING thread.

Parameters
[in]signalswait until all specified signal flags set or 0 for any single signal flag.
[in]millisectimeout value or 0 in case of no time-out.
Returns
event flag information or error code.
Note
MUST REMAIN UNCHANGED: osSignalWait shall be consistent in every CMSIS-RTOS.
Parameters
signalswait until all specified signal flags set or 0 for any single signal flag.
millisectimeout value or 0 in case of no time-out.
Return values
eventflag information or error code.
Note
MUST REMAIN UNCHANGED: osSignalWait shall be consistent in every CMSIS-RTOS.
587 {
588  osEvent ret;
589 
590 #if( configUSE_TASK_NOTIFICATIONS == 1 )
591 
592  TickType_t ticks;
593 
594  ret.value.signals = 0;
595  ticks = 0;
596  if (millisec == osWaitForever) {
597  ticks = portMAX_DELAY;
598  }
599  else if (millisec != 0) {
600  ticks = millisec / portTICK_PERIOD_MS;
601  if (ticks == 0) {
602  ticks = 1;
603  }
604  }
605 
606  if (inHandlerMode())
607  {
608  ret.status = osErrorISR; /*Not allowed in ISR*/
609  }
610  else
611  {
612  if(xTaskNotifyWait( 0,(uint32_t) signals, (uint32_t *)&ret.value.signals, ticks) != pdTRUE)
613  {
614  if(ticks == 0) ret.status = osOK;
615  else ret.status = osEventTimeout;
616  }
617  else if(ret.value.signals < 0)
618  {
619  ret.status = osErrorValue;
620  }
621  else ret.status = osEventSignal;
622  }
623 #else
624  (void) signals;
625  (void) millisec;
626 
627  ret.status = osErrorOS; /* Task Notification not supported */
628 #endif
629 
630  return ret;
631 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osMutexCreate()

osMutexId osMutexCreate ( const osMutexDef_t mutex_def)

Create and Initialize a Mutex object.

Create and Initialize a Mutex object.

Parameters
[in]mutex_defmutex definition referenced with osMutex.
Returns
mutex ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMutexCreate shall be consistent in every CMSIS-RTOS.
Parameters
mutex_defmutex definition referenced with osMutex.
Return values
mutexID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMutexCreate shall be consistent in every CMSIS-RTOS.
641 {
642 #if ( configUSE_MUTEXES == 1)
643 
644 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
645 
646  if (mutex_def->controlblock != NULL) {
647  return xSemaphoreCreateMutexStatic( mutex_def->controlblock );
648  }
649  else {
650  return xSemaphoreCreateMutex();
651  }
652 #elif ( configSUPPORT_STATIC_ALLOCATION == 1 )
653  return xSemaphoreCreateMutexStatic( mutex_def->controlblock );
654 #else
655  return xSemaphoreCreateMutex();
656 #endif
657 #else
658  return NULL;
659 #endif
660 }
Here is the caller graph for this function:

◆ osMutexWait()

osStatus osMutexWait ( osMutexId  mutex_id,
uint32_t  millisec 
)

Wait until a Mutex becomes available.

Wait until a Mutex becomes available.

Parameters
[in]mutex_idmutex ID obtained by osMutexCreate.
[in]millisectimeout value or 0 in case of no time-out.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMutexWait shall be consistent in every CMSIS-RTOS.
Parameters
mutex_idmutex ID obtained by osMutexCreate.
millisectimeout value or 0 in case of no time-out.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMutexWait shall be consistent in every CMSIS-RTOS.
670 {
671  TickType_t ticks;
672  portBASE_TYPE taskWoken = pdFALSE;
673 
674 
675  if (mutex_id == NULL) {
676  return osErrorParameter;
677  }
678 
679  ticks = 0;
680  if (millisec == osWaitForever) {
681  ticks = portMAX_DELAY;
682  }
683  else if (millisec != 0) {
684  ticks = millisec / portTICK_PERIOD_MS;
685  if (ticks == 0) {
686  ticks = 1;
687  }
688  }
689 
690  if (inHandlerMode()) {
691  if (xSemaphoreTakeFromISR(mutex_id, &taskWoken) != pdTRUE) {
692  return osErrorOS;
693  }
694  portEND_SWITCHING_ISR(taskWoken);
695  }
696  else if (xSemaphoreTake(mutex_id, ticks) != pdTRUE) {
697  return osErrorOS;
698  }
699 
700  return osOK;
701 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osMutexRelease()

osStatus osMutexRelease ( osMutexId  mutex_id)

Release a Mutex that was obtained by osMutexWait.

Release a Mutex that was obtained by osMutexWait.

Parameters
[in]mutex_idmutex ID obtained by osMutexCreate.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMutexRelease shall be consistent in every CMSIS-RTOS.
Parameters
mutex_idmutex ID obtained by osMutexCreate.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMutexRelease shall be consistent in every CMSIS-RTOS.
710 {
711  osStatus result = osOK;
712  portBASE_TYPE taskWoken = pdFALSE;
713 
714  if (inHandlerMode()) {
715  if (xSemaphoreGiveFromISR(mutex_id, &taskWoken) != pdTRUE) {
716  return osErrorOS;
717  }
718  portEND_SWITCHING_ISR(taskWoken);
719  }
720  else if (xSemaphoreGive(mutex_id) != pdTRUE)
721  {
722  result = osErrorOS;
723  }
724  return result;
725 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osMutexDelete()

osStatus osMutexDelete ( osMutexId  mutex_id)

Delete a Mutex.

Delete a Mutex that was created by osMutexCreate.

Parameters
[in]mutex_idmutex ID obtained by osMutexCreate.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMutexDelete shall be consistent in every CMSIS-RTOS.
Parameters
mutex_idmutex ID obtained by osMutexCreate.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMutexDelete shall be consistent in every CMSIS-RTOS.
734 {
735  if (inHandlerMode()) {
736  return osErrorISR;
737  }
738 
739  vQueueDelete(mutex_id);
740 
741  return osOK;
742 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osSemaphoreCreate()

osSemaphoreId osSemaphoreCreate ( const osSemaphoreDef_t semaphore_def,
int32_t  count 
)

Create and Initialize a Semaphore object used for managing resources.

Create and Initialize a Semaphore object used for managing resources.

Parameters
[in]semaphore_defsemaphore definition referenced with osSemaphore.
[in]countnumber of available resources.
Returns
semaphore ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osSemaphoreCreate shall be consistent in every CMSIS-RTOS.
Parameters
semaphore_defsemaphore definition referenced with osSemaphore.
countnumber of available resources.
Return values
semaphoreID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osSemaphoreCreate shall be consistent in every CMSIS-RTOS.
756 {
757 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
758 
759  osSemaphoreId sema;
760 
761  if (semaphore_def->controlblock != NULL){
762  if (count == 1) {
763  return xSemaphoreCreateBinaryStatic( semaphore_def->controlblock );
764  }
765  else {
766 #if (configUSE_COUNTING_SEMAPHORES == 1 )
767  return xSemaphoreCreateCountingStatic( count, count, semaphore_def->controlblock );
768 #else
769  return NULL;
770 #endif
771  }
772  }
773  else {
774  if (count == 1) {
775  vSemaphoreCreateBinary(sema);
776  return sema;
777  }
778  else {
779 #if (configUSE_COUNTING_SEMAPHORES == 1 )
780  return xSemaphoreCreateCounting(count, count);
781 #else
782  return NULL;
783 #endif
784  }
785  }
786 #elif ( configSUPPORT_STATIC_ALLOCATION == 1 ) // configSUPPORT_DYNAMIC_ALLOCATION == 0
787  if(count == 1) {
788  return xSemaphoreCreateBinaryStatic( semaphore_def->controlblock );
789  }
790  else
791  {
792 #if (configUSE_COUNTING_SEMAPHORES == 1 )
793  return xSemaphoreCreateCountingStatic( count, count, semaphore_def->controlblock );
794 #else
795  return NULL;
796 #endif
797  }
798 #else // configSUPPORT_STATIC_ALLOCATION == 0 && configSUPPORT_DYNAMIC_ALLOCATION == 1
799  osSemaphoreId sema;
800 
801  if (count == 1) {
802  vSemaphoreCreateBinary(sema);
803  return sema;
804  }
805  else {
806 #if (configUSE_COUNTING_SEMAPHORES == 1 )
807  return xSemaphoreCreateCounting(count, count);
808 #else
809  return NULL;
810 #endif
811  }
812 #endif
813 }
Here is the caller graph for this function:

◆ osSemaphoreWait()

int32_t osSemaphoreWait ( osSemaphoreId  semaphore_id,
uint32_t  millisec 
)

Wait until a Semaphore token becomes available.

Wait until a Semaphore token becomes available.

Parameters
[in]semaphore_idsemaphore object referenced with osSemaphoreCreate.
[in]millisectimeout value or 0 in case of no time-out.
Returns
number of available tokens, or -1 in case of incorrect parameters.
Note
MUST REMAIN UNCHANGED: osSemaphoreWait shall be consistent in every CMSIS-RTOS.
Parameters
semaphore_idsemaphore object referenced with osSemaphore.
millisectimeout value or 0 in case of no time-out.
Return values
numberof available tokens, or -1 in case of incorrect parameters.
Note
MUST REMAIN UNCHANGED: osSemaphoreWait shall be consistent in every CMSIS-RTOS.
823 {
824  TickType_t ticks;
825  portBASE_TYPE taskWoken = pdFALSE;
826 
827 
828  if (semaphore_id == NULL) {
829  return osErrorParameter;
830  }
831 
832  ticks = 0;
833  if (millisec == osWaitForever) {
834  ticks = portMAX_DELAY;
835  }
836  else if (millisec != 0) {
837  ticks = millisec / portTICK_PERIOD_MS;
838  if (ticks == 0) {
839  ticks = 1;
840  }
841  }
842 
843  if (inHandlerMode()) {
844  if (xSemaphoreTakeFromISR(semaphore_id, &taskWoken) != pdTRUE) {
845  return osErrorOS;
846  }
847  portEND_SWITCHING_ISR(taskWoken);
848  }
849  else if (xSemaphoreTake(semaphore_id, ticks) != pdTRUE) {
850  return osErrorOS;
851  }
852 
853  return osOK;
854 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osSemaphoreRelease()

osStatus osSemaphoreRelease ( osSemaphoreId  semaphore_id)

Release a Semaphore token.

Release a Semaphore token.

Parameters
[in]semaphore_idsemaphore object referenced with osSemaphoreCreate.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osSemaphoreRelease shall be consistent in every CMSIS-RTOS.
Parameters
semaphore_idsemaphore object referenced with osSemaphore.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osSemaphoreRelease shall be consistent in every CMSIS-RTOS.
863 {
864  osStatus result = osOK;
865  portBASE_TYPE taskWoken = pdFALSE;
866 
867 
868  if (inHandlerMode()) {
869  if (xSemaphoreGiveFromISR(semaphore_id, &taskWoken) != pdTRUE) {
870  return osErrorOS;
871  }
872  portEND_SWITCHING_ISR(taskWoken);
873  }
874  else {
875  if (xSemaphoreGive(semaphore_id) != pdTRUE) {
876  result = osErrorOS;
877  }
878  }
879 
880  return result;
881 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osSemaphoreDelete()

osStatus osSemaphoreDelete ( osSemaphoreId  semaphore_id)

Delete a Semaphore.

Delete a Semaphore that was created by osSemaphoreCreate.

Parameters
[in]semaphore_idsemaphore object referenced with osSemaphoreCreate.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osSemaphoreDelete shall be consistent in every CMSIS-RTOS.
Parameters
semaphore_idsemaphore object referenced with osSemaphore.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osSemaphoreDelete shall be consistent in every CMSIS-RTOS.
890 {
891  if (inHandlerMode()) {
892  return osErrorISR;
893  }
894 
895  vSemaphoreDelete(semaphore_id);
896 
897  return osOK;
898 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osPoolCreate()

osPoolId osPoolCreate ( const osPoolDef_t pool_def)

Create and Initialize a memory pool.

Create and Initialize a memory pool.

Parameters
[in]pool_defmemory pool definition referenced with osPool.
Returns
memory pool ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osPoolCreate shall be consistent in every CMSIS-RTOS.
Parameters
pool_defmemory pool definition referenced with osPool.
Return values
memorypool ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osPoolCreate shall be consistent in every CMSIS-RTOS.
927 {
928 #if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
929  osPoolId thePool;
930  int itemSize = 4 * ((pool_def->item_sz + 3) / 4);
931  uint32_t i;
932 
933  /* First have to allocate memory for the pool control block. */
934  thePool = pvPortMalloc(sizeof(os_pool_cb_t));
935 
936 
937  if (thePool) {
938  thePool->pool_sz = pool_def->pool_sz;
939  thePool->item_sz = itemSize;
940  thePool->currentIndex = 0;
941 
942  /* Memory for markers */
943  thePool->markers = pvPortMalloc(pool_def->pool_sz);
944 
945  if (thePool->markers) {
946  /* Now allocate the pool itself. */
947  thePool->pool = pvPortMalloc(pool_def->pool_sz * itemSize);
948 
949  if (thePool->pool) {
950  for (i = 0; i < pool_def->pool_sz; i++) {
951  thePool->markers[i] = 0;
952  }
953  }
954  else {
955  vPortFree(thePool->markers);
956  vPortFree(thePool);
957  thePool = NULL;
958  }
959  }
960  else {
961  vPortFree(thePool);
962  thePool = NULL;
963  }
964  }
965 
966  return thePool;
967 
968 #else
969  return NULL;
970 #endif
971 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osPoolAlloc()

void* osPoolAlloc ( osPoolId  pool_id)

Allocate a memory block from a memory pool.

Allocate a memory block from a memory pool.

Parameters
[in]pool_idmemory pool ID obtain referenced with osPoolCreate.
Returns
address of the allocated memory block or NULL in case of no memory available.
Note
MUST REMAIN UNCHANGED: osPoolAlloc shall be consistent in every CMSIS-RTOS.
Parameters
pool_idmemory pool ID obtain referenced with osPoolCreate.
Return values
addressof the allocated memory block or NULL in case of no memory available.
Note
MUST REMAIN UNCHANGED: osPoolAlloc shall be consistent in every CMSIS-RTOS.
980 {
981  int dummy = 0;
982  void *p = NULL;
983  uint32_t i;
984  uint32_t index;
985 
986  if (inHandlerMode()) {
988  }
989  else {
991  }
992 
993  for (i = 0; i < pool_id->pool_sz; i++) {
994  index = pool_id->currentIndex + i;
995  if (index >= pool_id->pool_sz) {
996  index = 0;
997  }
998 
999  if (pool_id->markers[index] == 0) {
1000  pool_id->markers[index] = 1;
1001  p = (void *)((uint32_t)(pool_id->pool) + (index * pool_id->item_sz));
1002  pool_id->currentIndex = index;
1003  break;
1004  }
1005  }
1006 
1007  if (inHandlerMode()) {
1009  }
1010  else {
1012  }
1013 
1014  return p;
1015 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osPoolCAlloc()

void* osPoolCAlloc ( osPoolId  pool_id)

Allocate a memory block from a memory pool and set memory block to zero.

Allocate a memory block from a memory pool and set memory block to zero.

Parameters
[in]pool_idmemory pool ID obtain referenced with osPoolCreate.
Returns
address of the allocated memory block or NULL in case of no memory available.
Note
MUST REMAIN UNCHANGED: osPoolCAlloc shall be consistent in every CMSIS-RTOS.
Parameters
pool_idmemory pool ID obtain referenced with osPoolCreate.
Return values
addressof the allocated memory block or NULL in case of no memory available.
Note
MUST REMAIN UNCHANGED: osPoolCAlloc shall be consistent in every CMSIS-RTOS.
1024 {
1025  void *p = osPoolAlloc(pool_id);
1026 
1027  if (p != NULL)
1028  {
1029  memset(p, 0, sizeof(pool_id->pool_sz));
1030  }
1031 
1032  return p;
1033 }
Here is the call graph for this function:

◆ osPoolFree()

osStatus osPoolFree ( osPoolId  pool_id,
void block 
)

Return an allocated memory block back to a specific memory pool.

Return an allocated memory block back to a specific memory pool.

Parameters
[in]pool_idmemory pool ID obtain referenced with osPoolCreate.
[in]blockaddress of the allocated memory block that is returned to the memory pool.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osPoolFree shall be consistent in every CMSIS-RTOS.
Parameters
pool_idmemory pool ID obtain referenced with osPoolCreate.
blockaddress of the allocated memory block that is returned to the memory pool.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osPoolFree shall be consistent in every CMSIS-RTOS.
1043 {
1044  uint32_t index;
1045 
1046  if (pool_id == NULL) {
1047  return osErrorParameter;
1048  }
1049 
1050  if (block == NULL) {
1051  return osErrorParameter;
1052  }
1053 
1054  if (block < pool_id->pool) {
1055  return osErrorParameter;
1056  }
1057 
1058  index = (uint32_t)block - (uint32_t)(pool_id->pool);
1059  if (index % pool_id->item_sz) {
1060  return osErrorParameter;
1061  }
1062  index = index / pool_id->item_sz;
1063  if (index >= pool_id->pool_sz) {
1064  return osErrorParameter;
1065  }
1066 
1067  pool_id->markers[index] = 0;
1068 
1069  return osOK;
1070 }
Here is the caller graph for this function:

◆ osMessageCreate()

osMessageQId osMessageCreate ( const osMessageQDef_t queue_def,
osThreadId  thread_id 
)

Create and Initialize a Message Queue.

Create and Initialize a Message Queue.

Parameters
[in]queue_defqueue definition referenced with osMessageQ.
[in]thread_idthread ID (obtained by osThreadCreate or osThreadGetId) or NULL.
Returns
message queue ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMessageCreate shall be consistent in every CMSIS-RTOS.
Parameters
queue_defqueue definition referenced with osMessageQ.
thread_idthread ID (obtained by osThreadCreate or osThreadGetId) or NULL.
Return values
messagequeue ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMessageCreate shall be consistent in every CMSIS-RTOS.
1087 {
1088  (void) thread_id;
1089 
1090 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
1091 
1092  if ((queue_def->buffer != NULL) && (queue_def->controlblock != NULL)) {
1093  return xQueueCreateStatic(queue_def->queue_sz, queue_def->item_sz, queue_def->buffer, queue_def->controlblock);
1094  }
1095  else {
1096  return xQueueCreate(queue_def->queue_sz, queue_def->item_sz);
1097  }
1098 #elif ( configSUPPORT_STATIC_ALLOCATION == 1 )
1099  return xQueueCreateStatic(queue_def->queue_sz, queue_def->item_sz, queue_def->buffer, queue_def->controlblock);
1100 #else
1101  return xQueueCreate(queue_def->queue_sz, queue_def->item_sz);
1102 #endif
1103 }
Here is the caller graph for this function:

◆ osMessagePut()

osStatus osMessagePut ( osMessageQId  queue_id,
uint32_t  info,
uint32_t  millisec 
)

Put a Message to a Queue.

Put a Message to a Queue.

Parameters
[in]queue_idmessage queue ID obtained with osMessageCreate.
[in]infomessage information.
[in]millisectimeout value or 0 in case of no time-out.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMessagePut shall be consistent in every CMSIS-RTOS.
Parameters
queue_idmessage queue ID obtained with osMessageCreate.
infomessage information.
millisectimeout value or 0 in case of no time-out.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMessagePut shall be consistent in every CMSIS-RTOS.
1114 {
1115  portBASE_TYPE taskWoken = pdFALSE;
1116  TickType_t ticks;
1117 
1118  ticks = millisec / portTICK_PERIOD_MS;
1119  if (ticks == 0) {
1120  ticks = 1;
1121  }
1122 
1123  if (inHandlerMode()) {
1124  if (xQueueSendFromISR(queue_id, &info, &taskWoken) != pdTRUE) {
1125  return osErrorOS;
1126  }
1127  portEND_SWITCHING_ISR(taskWoken);
1128  }
1129  else {
1130  if (xQueueSend(queue_id, &info, ticks) != pdTRUE) {
1131  return osErrorOS;
1132  }
1133  }
1134 
1135  return osOK;
1136 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osMessageGet()

osEvent osMessageGet ( osMessageQId  queue_id,
uint32_t  millisec 
)

Get a Message or Wait for a Message from a Queue.

Get a Message or Wait for a Message from a Queue.

Parameters
[in]queue_idmessage queue ID obtained with osMessageCreate.
[in]millisectimeout value or 0 in case of no time-out.
Returns
event information that includes status code.
Note
MUST REMAIN UNCHANGED: osMessageGet shall be consistent in every CMSIS-RTOS.
Parameters
queue_idmessage queue ID obtained with osMessageCreate.
millisectimeout value or 0 in case of no time-out.
Return values
eventinformation that includes status code.
Note
MUST REMAIN UNCHANGED: osMessageGet shall be consistent in every CMSIS-RTOS.
1146 {
1147  portBASE_TYPE taskWoken;
1148  TickType_t ticks;
1149  osEvent event;
1150 
1151  event.def.message_id = queue_id;
1152  event.value.v = 0;
1153 
1154  if (queue_id == NULL) {
1155  event.status = osErrorParameter;
1156  return event;
1157  }
1158 
1159  taskWoken = pdFALSE;
1160 
1161  ticks = 0;
1162  if (millisec == osWaitForever) {
1163  ticks = portMAX_DELAY;
1164  }
1165  else if (millisec != 0) {
1166  ticks = millisec / portTICK_PERIOD_MS;
1167  if (ticks == 0) {
1168  ticks = 1;
1169  }
1170  }
1171 
1172  if (inHandlerMode()) {
1173  if (xQueueReceiveFromISR(queue_id, &event.value.v, &taskWoken) == pdTRUE) {
1174  /* We have mail */
1175  event.status = osEventMessage;
1176  }
1177  else {
1178  event.status = osOK;
1179  }
1180  portEND_SWITCHING_ISR(taskWoken);
1181  }
1182  else {
1183  if (xQueueReceive(queue_id, &event.value.v, ticks) == pdTRUE) {
1184  /* We have mail */
1185  event.status = osEventMessage;
1186  }
1187  else {
1188  event.status = (ticks == 0) ? osOK : osEventTimeout;
1189  }
1190  }
1191 
1192  return event;
1193 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osMailCreate()

osMailQId osMailCreate ( const osMailQDef_t queue_def,
osThreadId  thread_id 
)

Create and Initialize mail queue.

Create and Initialize mail queue.

Parameters
[in]queue_defreference to the mail queue definition obtain with osMailQ
[in]thread_idthread ID (obtained by osThreadCreate or osThreadGetId) or NULL.
Returns
mail queue ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMailCreate shall be consistent in every CMSIS-RTOS.
Parameters
queue_defreference to the mail queue definition obtain with osMailQ
thread_idthread ID (obtained by osThreadCreate or osThreadGetId) or NULL.
Return values
mailqueue ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMailCreate shall be consistent in every CMSIS-RTOS.
1215 {
1216 #if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
1217  (void) thread_id;
1218 
1220 
1221  /* Create a mail queue control block */
1222 
1223  *(queue_def->cb) = pvPortMalloc(sizeof(struct os_mailQ_cb));
1224 
1225  if (*(queue_def->cb) == NULL) {
1226  return NULL;
1227  }
1228  (*(queue_def->cb))->queue_def = queue_def;
1229 
1230  /* Create a queue in FreeRTOS */
1231  (*(queue_def->cb))->handle = xQueueCreate(queue_def->queue_sz, sizeof(void *));
1232 
1233 
1234  if ((*(queue_def->cb))->handle == NULL) {
1235  vPortFree(*(queue_def->cb));
1236  return NULL;
1237  }
1238 
1239  /* Create a mail pool */
1240  (*(queue_def->cb))->pool = osPoolCreate(&pool_def);
1241  if ((*(queue_def->cb))->pool == NULL) {
1242  //TODO: Delete queue. How to do it in FreeRTOS?
1243  vPortFree(*(queue_def->cb));
1244  return NULL;
1245  }
1246 
1247  return *(queue_def->cb);
1248 #else
1249  return NULL;
1250 #endif
1251 }
Here is the call graph for this function:

◆ osMailAlloc()

void* osMailAlloc ( osMailQId  queue_id,
uint32_t  millisec 
)

Allocate a memory block from a mail.

Allocate a memory block from a mail.

Parameters
[in]queue_idmail queue ID obtained with osMailCreate.
[in]millisectimeout value or 0 in case of no time-out
Returns
pointer to memory block that can be filled with mail or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMailAlloc shall be consistent in every CMSIS-RTOS.
Parameters
queue_idmail queue ID obtained with osMailCreate.
millisectimeout value or 0 in case of no time-out.
Return values
pointerto memory block that can be filled with mail or NULL in case error.
Note
MUST REMAIN UNCHANGED: osMailAlloc shall be consistent in every CMSIS-RTOS.
1261 {
1262  (void) millisec;
1263  void *p;
1264 
1265 
1266  if (queue_id == NULL) {
1267  return NULL;
1268  }
1269 
1270  p = osPoolAlloc(queue_id->pool);
1271 
1272  return p;
1273 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osMailCAlloc()

void* osMailCAlloc ( osMailQId  queue_id,
uint32_t  millisec 
)

Allocate a memory block from a mail and set memory block to zero.

Allocate a memory block from a mail and set memory block to zero.

Parameters
[in]queue_idmail queue ID obtained with osMailCreate.
[in]millisectimeout value or 0 in case of no time-out
Returns
pointer to memory block that can be filled with mail or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMailCAlloc shall be consistent in every CMSIS-RTOS.
Parameters
queue_idmail queue ID obtained with osMailCreate.
millisectimeout value or 0 in case of no time-out.
Return values
pointerto memory block that can be filled with mail or NULL in case error.
Note
MUST REMAIN UNCHANGED: osMailCAlloc shall be consistent in every CMSIS-RTOS.
1283 {
1284  uint32_t i;
1285  void *p = osMailAlloc(queue_id, millisec);
1286 
1287  if (p) {
1288  for (i = 0; i < queue_id->queue_def->item_sz; i++) {
1289  ((uint8_t *)p)[i] = 0;
1290  }
1291  }
1292 
1293  return p;
1294 }
Here is the call graph for this function:

◆ osMailPut()

osStatus osMailPut ( osMailQId  queue_id,
void mail 
)

Put a mail to a queue.

Put a mail to a queue.

Parameters
[in]queue_idmail queue ID obtained with osMailCreate.
[in]mailmemory block previously allocated with osMailAlloc or osMailCAlloc.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMailPut shall be consistent in every CMSIS-RTOS.
Parameters
queue_idmail queue ID obtained with osMailCreate.
mailmemory block previously allocated with osMailAlloc or osMailCAlloc.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMailPut shall be consistent in every CMSIS-RTOS.
1304 {
1305  portBASE_TYPE taskWoken;
1306 
1307 
1308  if (queue_id == NULL) {
1309  return osErrorParameter;
1310  }
1311 
1312  taskWoken = pdFALSE;
1313 
1314  if (inHandlerMode()) {
1315  if (xQueueSendFromISR(queue_id->handle, &mail, &taskWoken) != pdTRUE) {
1316  return osErrorOS;
1317  }
1318  portEND_SWITCHING_ISR(taskWoken);
1319  }
1320  else {
1321  if (xQueueSend(queue_id->handle, &mail, 0) != pdTRUE) {
1322  return osErrorOS;
1323  }
1324  }
1325 
1326  return osOK;
1327 }
Here is the call graph for this function:

◆ osMailGet()

osEvent osMailGet ( osMailQId  queue_id,
uint32_t  millisec 
)

Get a mail from a queue.

Get a mail from a queue.

Parameters
[in]queue_idmail queue ID obtained with osMailCreate.
[in]millisectimeout value or 0 in case of no time-out
Returns
event that contains mail information or error code.
Note
MUST REMAIN UNCHANGED: osMailGet shall be consistent in every CMSIS-RTOS.
Parameters
queue_idmail queue ID obtained with osMailCreate.
millisectimeout value or 0 in case of no time-out
Return values
eventthat contains mail information or error code.
Note
MUST REMAIN UNCHANGED: osMailGet shall be consistent in every CMSIS-RTOS.
1337 {
1338  portBASE_TYPE taskWoken;
1339  TickType_t ticks;
1340  osEvent event;
1341 
1342  event.def.mail_id = queue_id;
1343 
1344  if (queue_id == NULL) {
1345  event.status = osErrorParameter;
1346  return event;
1347  }
1348 
1349  taskWoken = pdFALSE;
1350 
1351  ticks = 0;
1352  if (millisec == osWaitForever) {
1353  ticks = portMAX_DELAY;
1354  }
1355  else if (millisec != 0) {
1356  ticks = millisec / portTICK_PERIOD_MS;
1357  if (ticks == 0) {
1358  ticks = 1;
1359  }
1360  }
1361 
1362  if (inHandlerMode()) {
1363  if (xQueueReceiveFromISR(queue_id->handle, &event.value.p, &taskWoken) == pdTRUE) {
1364  /* We have mail */
1365  event.status = osEventMail;
1366  }
1367  else {
1368  event.status = osOK;
1369  }
1370  portEND_SWITCHING_ISR(taskWoken);
1371  }
1372  else {
1373  if (xQueueReceive(queue_id->handle, &event.value.p, ticks) == pdTRUE) {
1374  /* We have mail */
1375  event.status = osEventMail;
1376  }
1377  else {
1378  event.status = (ticks == 0) ? osOK : osEventTimeout;
1379  }
1380  }
1381 
1382  return event;
1383 }
Here is the call graph for this function:

◆ osMailFree()

osStatus osMailFree ( osMailQId  queue_id,
void mail 
)

Free a memory block from a mail.

Free a memory block from a mail.

Parameters
[in]queue_idmail queue ID obtained with osMailCreate.
[in]mailpointer to the memory block that was obtained with osMailGet.
Returns
status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMailFree shall be consistent in every CMSIS-RTOS.
Parameters
queue_idmail queue ID obtained with osMailCreate.
mailpointer to the memory block that was obtained with osMailGet.
Return values
statuscode that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMailFree shall be consistent in every CMSIS-RTOS.
1393 {
1394  if (queue_id == NULL) {
1395  return osErrorParameter;
1396  }
1397 
1398  return osPoolFree(queue_id->pool, mail);
1399 }
Here is the call graph for this function:

◆ osSystickHandler()

void osSystickHandler ( void  )

Handles the tick increment.

Parameters
none.
Return values
none.
1409 {
1410 
1411 #if (INCLUDE_xTaskGetSchedulerState == 1 )
1413  {
1414 #endif /* INCLUDE_xTaskGetSchedulerState */
1416 #if (INCLUDE_xTaskGetSchedulerState == 1 )
1417  }
1418 #endif /* INCLUDE_xTaskGetSchedulerState */
1419 }
Here is the call graph for this function:

◆ osThreadSuspend()

osStatus osThreadSuspend ( osThreadId  thread_id)

Suspend execution of a thread.

Parameters
thread_idthread ID obtained by osThreadCreate or osThreadGetId.
Return values
statuscode that indicates the execution status of the function.
1479 {
1480 #if (INCLUDE_vTaskSuspend == 1)
1481  vTaskSuspend(thread_id);
1482 
1483  return osOK;
1484 #else
1485  return osErrorResource;
1486 #endif
1487 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osThreadResume()

osStatus osThreadResume ( osThreadId  thread_id)

Resume execution of a suspended thread.

Parameters
thread_idthread ID obtained by osThreadCreate or osThreadGetId.
Return values
statuscode that indicates the execution status of the function.
1495 {
1496 #if (INCLUDE_vTaskSuspend == 1)
1497  if(inHandlerMode())
1498  {
1499  if (xTaskResumeFromISR(thread_id) == pdTRUE)
1500  {
1502  }
1503  }
1504  else
1505  {
1506  vTaskResume(thread_id);
1507  }
1508  return osOK;
1509 #else
1510  return osErrorResource;
1511 #endif
1512 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osThreadSuspendAll()

osStatus osThreadSuspendAll ( void  )

Suspend execution of a all active threads.

Return values
statuscode that indicates the execution status of the function.
1519 {
1520  vTaskSuspendAll();
1521 
1522  return osOK;
1523 }
Here is the call graph for this function:

◆ osThreadResumeAll()

osStatus osThreadResumeAll ( void  )

Resume execution of a all suspended threads.

Return values
statuscode that indicates the execution status of the function.
1530 {
1531  if (xTaskResumeAll() == pdTRUE)
1532  return osOK;
1533  else
1534  return osErrorOS;
1535 
1536 }
Here is the call graph for this function:

◆ osDelayUntil()

osStatus osDelayUntil ( uint32_t *  PreviousWakeTime,
uint32_t  millisec 
)

Delay a task until a specified time.

Parameters
PreviousWakeTimePointer to a variable that holds the time at which the task was last unblocked. PreviousWakeTime must be initialised with the current time prior to its first use (PreviousWakeTime = osKernelSysTick() )
millisectime delay value
Return values
statuscode that indicates the execution status of the function.
1547 {
1548 #if INCLUDE_vTaskDelayUntil
1549  TickType_t ticks = (millisec / portTICK_PERIOD_MS);
1550  vTaskDelayUntil((TickType_t *) PreviousWakeTime, ticks ? ticks : 1);
1551 
1552  return osOK;
1553 #else
1554  (void) millisec;
1555  (void) PreviousWakeTime;
1556 
1557  return osErrorResource;
1558 #endif
1559 }
Here is the call graph for this function:

◆ osAbortDelay()

osStatus osAbortDelay ( osThreadId  thread_id)

Abort the delay for a specific thread.

Parameters
thread_idthread ID obtained by osThreadCreate or osThreadGetId
Return values
statuscode that indicates the execution status of the function.
1567 {
1568 #if INCLUDE_xTaskAbortDelay
1569 
1570  xTaskAbortDelay(thread_id);
1571 
1572  return osOK;
1573 #else
1574  (void) thread_id;
1575 
1576  return osErrorResource;
1577 #endif
1578 }
Here is the call graph for this function:

◆ osThreadList()

osStatus osThreadList ( uint8_t buffer)

Lists all the current threads, along with their current state and stack usage high water mark.

Parameters
bufferA buffer into which the above mentioned details will be written
Return values
statuscode that indicates the execution status of the function.
1588 {
1589 #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )
1590  vTaskList((char *)buffer);
1591 #endif
1592  return osOK;
1593 }
Here is the call graph for this function:

◆ osMessagePeek()

osEvent osMessagePeek ( osMessageQId  queue_id,
uint32_t  millisec 
)

Receive an item from a queue without removing the item from the queue.

Parameters
queue_idmessage queue ID obtained with osMessageCreate.
millisectimeout value or 0 in case of no time-out.
Return values
eventinformation that includes status code.
1602 {
1603  TickType_t ticks;
1604  osEvent event;
1605 
1606  event.def.message_id = queue_id;
1607 
1608  if (queue_id == NULL) {
1609  event.status = osErrorParameter;
1610  return event;
1611  }
1612 
1613  ticks = 0;
1614  if (millisec == osWaitForever) {
1615  ticks = portMAX_DELAY;
1616  }
1617  else if (millisec != 0) {
1618  ticks = millisec / portTICK_PERIOD_MS;
1619  if (ticks == 0) {
1620  ticks = 1;
1621  }
1622  }
1623 
1624  if (xQueuePeek(queue_id, &event.value.v, ticks) == pdTRUE)
1625  {
1626  /* We have mail */
1627  event.status = osEventMessage;
1628  }
1629  else
1630  {
1631  event.status = (ticks == 0) ? osOK : osEventTimeout;
1632  }
1633 
1634  return event;
1635 }

◆ osMessageWaiting()

uint32_t osMessageWaiting ( osMessageQId  queue_id)

Get the number of messaged stored in a queue.

Parameters
queue_idmessage queue ID obtained with osMessageCreate.
Return values
numberof messages stored in a queue.
1643 {
1644  if (inHandlerMode()) {
1645  return uxQueueMessagesWaitingFromISR(queue_id);
1646  }
1647  else
1648  {
1649  return uxQueueMessagesWaiting(queue_id);
1650  }
1651 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osMessageAvailableSpace()

uint32_t osMessageAvailableSpace ( osMessageQId  queue_id)

Get the available space in a message queue.

Parameters
queue_idmessage queue ID obtained with osMessageCreate.
Return values
availablespace in a message queue.
1659 {
1660  return uxQueueSpacesAvailable(queue_id);
1661 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osMessageDelete()

osStatus osMessageDelete ( osMessageQId  queue_id)

Delete a Message Queue.

Parameters
queue_idmessage queue ID obtained with osMessageCreate.
Return values
statuscode that indicates the execution status of the function.
1669 {
1670  if (inHandlerMode()) {
1671  return osErrorISR;
1672  }
1673 
1674  vQueueDelete(queue_id);
1675 
1676  return osOK;
1677 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ osRecursiveMutexCreate()

osMutexId osRecursiveMutexCreate ( const osMutexDef_t mutex_def)

Create and Initialize a Recursive Mutex.

Parameters
mutex_defmutex definition referenced with osMutex.
Return values
mutexID for reference by other functions or NULL in case of error..
1685 {
1686 #if (configUSE_RECURSIVE_MUTEXES == 1)
1687 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
1688 
1689  if (mutex_def->controlblock != NULL){
1690  return xSemaphoreCreateRecursiveMutexStatic( mutex_def->controlblock );
1691  }
1692  else {
1693  return xSemaphoreCreateRecursiveMutex();
1694  }
1695 #elif ( configSUPPORT_STATIC_ALLOCATION == 1 )
1696  return xSemaphoreCreateRecursiveMutexStatic( mutex_def->controlblock );
1697 #else
1698  return xSemaphoreCreateRecursiveMutex();
1699 #endif
1700 #else
1701  return NULL;
1702 #endif
1703 }

◆ osRecursiveMutexRelease()

osStatus osRecursiveMutexRelease ( osMutexId  mutex_id)

Release a Recursive Mutex.

Parameters
mutex_idmutex ID obtained by osRecursiveMutexCreate.
Return values
statuscode that indicates the execution status of the function.
1711 {
1712 #if (configUSE_RECURSIVE_MUTEXES == 1)
1713  osStatus result = osOK;
1714 
1715  if (xSemaphoreGiveRecursive(mutex_id) != pdTRUE)
1716  {
1717  result = osErrorOS;
1718  }
1719  return result;
1720 #else
1721  return osErrorResource;
1722 #endif
1723 }

◆ osRecursiveMutexWait()

osStatus osRecursiveMutexWait ( osMutexId  mutex_id,
uint32_t  millisec 
)

Release a Recursive Mutex.

Parameters
mutex_idmutex ID obtained by osRecursiveMutexCreate.
millisectimeout value or 0 in case of no time-out.
Return values
statuscode that indicates the execution status of the function.
1732 {
1733 #if (configUSE_RECURSIVE_MUTEXES == 1)
1734  TickType_t ticks;
1735 
1736  if (mutex_id == NULL)
1737  {
1738  return osErrorParameter;
1739  }
1740 
1741  ticks = 0;
1742  if (millisec == osWaitForever)
1743  {
1744  ticks = portMAX_DELAY;
1745  }
1746  else if (millisec != 0)
1747  {
1748  ticks = millisec / portTICK_PERIOD_MS;
1749  if (ticks == 0)
1750  {
1751  ticks = 1;
1752  }
1753  }
1754 
1755  if (xSemaphoreTakeRecursive(mutex_id, ticks) != pdTRUE)
1756  {
1757  return osErrorOS;
1758  }
1759  return osOK;
1760 #else
1761  return osErrorResource;
1762 #endif
1763 }

◆ osSemaphoreGetCount()

uint32_t osSemaphoreGetCount ( osSemaphoreId  semaphore_id)

Returns the current count value of a counting semaphore.

Parameters
semaphore_idsemaphore_id ID obtained by osSemaphoreCreate.
Return values
countvalue
1771 {
1772  return uxSemaphoreGetCount(semaphore_id);
1773 }
os_pool_cb::pool
void * pool
Definition: cmsis_os.c:912
os_mailQ_cb::handle
QueueHandle_t handle
Definition: cmsis_os.c:1203
os_thread_def::tpriority
osPriority tpriority
initial thread priority
Definition: cmsis_os.h:328
os_mailQ_cb::pool
osPoolId pool
Definition: cmsis_os.c:1204
os_mailQ_cb::queue_def
const osMailQDef_t * queue_def
Definition: cmsis_os.c:1202
os_mailQ_def
Definition: cmsis_os.h:386
os_mailQ_cb
Definition: cmsis_os.c:1201
portMAX_DELAY
#define portMAX_DELAY
Definition: portmacro.h:106
portSET_INTERRUPT_MASK_FROM_ISR
#define portSET_INTERRUPT_MASK_FROM_ISR()
Definition: FreeRTOS.h:300
xTaskGenericNotifyFromISR
PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotifyFromISR(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken)
osThreadDef
#define osThreadDef(name, thread, priority, instances, stacksz)
Definition: cmsis_os.h:468
xTaskGetSchedulerState
PRIVILEGED_FUNCTION BaseType_t xTaskGetSchedulerState(void)
xTaskNotifyWait
PRIVILEGED_FUNCTION BaseType_t xTaskNotifyWait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait)
osPriorityAboveNormal
priority: above normal
Definition: cmsis_os.h:222
xTaskGenericNotify
PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotify(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue)
uxQueueSpacesAvailable
PRIVILEGED_FUNCTION UBaseType_t uxQueueSpacesAvailable(const QueueHandle_t xQueue)
Definition: queue.c:1595
vTaskStartScheduler
PRIVILEGED_FUNCTION void vTaskStartScheduler(void)
Definition: tasks.c:1826
pvPortMalloc
PRIVILEGED_FUNCTION void * pvPortMalloc(size_t xSize)
Definition: heap_4.c:155
os_mailQ_def::item_sz
uint32_t item_sz
size of an item
Definition: cmsis_os.h:388
osPoolAlloc
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool.
Definition: cmsis_os.c:979
type
uint8_t type
Definition: UsbCore.h:184
xSemaphoreTake
#define xSemaphoreTake(xSemaphore, xBlockTime)
Definition: semphr.h:331
osStatus
osStatus
Definition: cmsis_os.h:234
os_thread_def::stacksize
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
Definition: cmsis_os.h:330
os_pool_cb::item_sz
uint32_t item_sz
Definition: cmsis_os.c:915
osEventTimeout
function completed; timeout occurred.
Definition: cmsis_os.h:239
xTaskGetTickCountFromISR
PRIVILEGED_FUNCTION TickType_t xTaskGetTickCountFromISR(void)
Definition: tasks.c:2142
xSemaphoreTakeFromISR
#define xSemaphoreTakeFromISR(xSemaphore, pxHigherPriorityTaskWoken)
Definition: semphr.h:700
i
uint8_t i
Definition: screen_test_graph.c:72
xTimerStopFromISR
#define xTimerStopFromISR(xTimer, pxHigherPriorityTaskWoken)
Definition: timers.h:978
osErrorISR
not allowed in ISR context: the function cannot be called from interrupt service routines.
Definition: cmsis_os.h:243
xTaskGetTickCount
PRIVILEGED_FUNCTION TickType_t xTaskGetTickCount(void)
Definition: tasks.c:2127
osPriorityIdle
priority: idle (lowest)
Definition: cmsis_os.h:218
osErrorTimeoutResource
resource not available within given time: a specified resource was not available within the timeout p...
Definition: cmsis_os.h:242
xSemaphoreGiveFromISR
#define xSemaphoreGiveFromISR(xSemaphore, pxHigherPriorityTaskWoken)
Definition: semphr.h:666
eSetBits
Definition: task.h:126
xTimerStop
#define xTimerStop(xTimer, xTicksToWait)
Definition: timers.h:587
NULL
#define NULL
Definition: usbd_def.h:53
osEvent::status
osStatus status
status code: event or error information
Definition: cmsis_os.h:396
vPortEnterCritical
void vPortEnterCritical(void)
Definition: port.c:407
vTaskSuspend
PRIVILEGED_FUNCTION void vTaskSuspend(TaskHandle_t xTaskToSuspend)
pdPASS
#define pdPASS
Definition: projdefs.h:89
os_status_reserved
prevent from enum down-size compiler optimization.
Definition: cmsis_os.h:249
xTaskAbortDelay
PRIVILEGED_FUNCTION BaseType_t xTaskAbortDelay(TaskHandle_t xTask)
os_pool_cb::currentIndex
uint32_t currentIndex
Definition: cmsis_os.c:916
TickType_t
uint32_t TickType_t
Definition: portmacro.h:105
osErrorResource
resource not available: a specified resource was not available.
Definition: cmsis_os.h:241
osErrorISRRecursive
function called multiple times from ISR with same object.
Definition: cmsis_os.h:244
osSemaphoreId
SemaphoreHandle_t osSemaphoreId
Definition: cmsis_os.h:295
osEventMail
function completed; mail event occurred.
Definition: cmsis_os.h:238
xTaskResumeFromISR
PRIVILEGED_FUNCTION BaseType_t xTaskResumeFromISR(TaskHandle_t xTaskToResume)
osPoolDef
#define osPoolDef(name, no, type)
Define a Memory Pool.
Definition: cmsis_os.h:755
osEvent
Definition: cmsis_os.h:395
TaskHandle_t
void * TaskHandle_t
Definition: task.h:103
osPoolFree
osStatus osPoolFree(osPoolId pool_id, void *block)
Return an allocated memory block back to a specific memory pool.
Definition: cmsis_os.c:1042
osPriorityError
system cannot determine priority or thread has illegal priority
Definition: cmsis_os.h:225
pdFALSE
#define pdFALSE
Definition: projdefs.h:86
vTaskDelete
PRIVILEGED_FUNCTION void vTaskDelete(TaskHandle_t xTaskToDelete)
os_pool_def::pool_sz
uint32_t pool_sz
number of items (elements) in the pool
Definition: cmsis_os.h:367
xTimerChangePeriod
#define xTimerChangePeriod(xTimer, xNewPeriod, xTicksToWait)
Definition: timers.h:667
uxQueueMessagesWaitingFromISR
PRIVILEGED_FUNCTION UBaseType_t uxQueueMessagesWaitingFromISR(const QueueHandle_t xQueue)
Definition: queue.c:1613
osEvent::def
union osEvent::@55 def
event definition
xSTATIC_TIMER
Definition: FreeRTOS.h:1041
uxSemaphoreGetCount
#define uxSemaphoreGetCount(xSemaphore)
Definition: semphr.h:1167
xTimerDelete
#define xTimerDelete(xTimer, xTicksToWait)
Definition: timers.h:705
os_pool_def
Definition: cmsis_os.h:366
xTaskGetCurrentTaskHandle
PRIVILEGED_FUNCTION TaskHandle_t xTaskGetCurrentTaskHandle(void)
osPoolCreate
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create and Initialize a memory pool.
Definition: cmsis_os.c:926
osOK
function completed; no error or event occurred.
Definition: cmsis_os.h:235
portYIELD_FROM_ISR
#define portYIELD_FROM_ISR(x)
Definition: portmacro.h:135
uxTaskPriorityGet
PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGet(TaskHandle_t xTask)
void
void
Definition: png.h:1083
osEventMessage
function completed; message event occurred.
Definition: cmsis_os.h:237
vQueueDelete
PRIVILEGED_FUNCTION void vQueueDelete(QueueHandle_t xQueue)
Definition: queue.c:1625
vTaskResume
PRIVILEGED_FUNCTION void vTaskResume(TaskHandle_t xTaskToResume)
xQueueReceiveFromISR
PRIVILEGED_FUNCTION BaseType_t xQueueReceiveFromISR(QueueHandle_t xQueue, void *const pvBuffer, BaseType_t *const pxHigherPriorityTaskWoken)
Definition: queue.c:1434
portBASE_TYPE
#define portBASE_TYPE
Definition: portmacro.h:95
vSemaphoreDelete
#define vSemaphoreDelete(xSemaphore)
Definition: semphr.h:1140
taskSCHEDULER_NOT_STARTED
#define taskSCHEDULER_NOT_STARTED
Definition: task.h:258
os_thread_def
Definition: cmsis_os.h:325
osWaitForever
#define osWaitForever
wait forever timeout value
Definition: cmsis_os.h:230
taskYIELD
#define taskYIELD()
Definition: task.h:203
os_thread_def::name
char * name
Thread name.
Definition: cmsis_os.h:326
xQueueSendFromISR
#define xQueueSendFromISR(xQueue, pvItemToQueue, pxHigherPriorityTaskWoken)
Definition: queue.h:1361
os_thread_def::pthread
os_pthread pthread
start address of thread function
Definition: cmsis_os.h:327
makeFreeRtosPriority
static unsigned portBASE_TYPE makeFreeRtosPriority(osPriority priority)
Definition: cmsis_os.c:146
TaskFunction_t
void(* TaskFunction_t)(void *)
Definition: projdefs.h:77
portTICK_PERIOD_MS
#define portTICK_PERIOD_MS
Definition: portmacro.h:116
uint8_t
const uint8_t[]
Definition: 404_html.c:3
osPriorityRealtime
priority: realtime (highest)
Definition: cmsis_os.h:224
vTaskPrioritySet
PRIVILEGED_FUNCTION void vTaskPrioritySet(TaskHandle_t xTask, UBaseType_t uxNewPriority)
os_pool_cb::markers
uint8_t * markers
Definition: cmsis_os.c:913
osPriorityBelowNormal
priority: below normal
Definition: cmsis_os.h:220
osErrorPriority
system cannot determine priority or thread has illegal priority.
Definition: cmsis_os.h:245
osMailAlloc
void * osMailAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail.
Definition: cmsis_os.c:1260
osEventSignal
function completed; signal event occurred.
Definition: cmsis_os.h:236
osPriorityHigh
priority: high
Definition: cmsis_os.h:223
osPriorityLow
priority: low
Definition: cmsis_os.h:219
osEvent::mail_id
osMailQId mail_id
mail id obtained by osMailCreate
Definition: cmsis_os.h:403
uxQueueMessagesWaiting
PRIVILEGED_FUNCTION UBaseType_t uxQueueMessagesWaiting(const QueueHandle_t xQueue)
Definition: queue.c:1579
portEND_SWITCHING_ISR
#define portEND_SWITCHING_ISR(xSwitchRequired)
Definition: portmacro.h:134
osErrorOS
unspecified RTOS error: run-time error but no other error message fits.
Definition: cmsis_os.h:248
os_mailQ_def::cb
struct os_mailQ_cb ** cb
Definition: cmsis_os.h:389
BaseType_t
long BaseType_t
Definition: portmacro.h:98
pdTRUE
#define pdTRUE
Definition: projdefs.h:87
osErrorParameter
parameter error: a mandatory parameter was missing or specified an incorrect object.
Definition: cmsis_os.h:240
osErrorValue
value of a parameter is out of range.
Definition: cmsis_os.h:247
vTaskDelay
PRIVILEGED_FUNCTION void vTaskDelay(const TickType_t xTicksToDelay)
osErrorNoMemory
system is out of memory: it was impossible to allocate or reserve memory for the operation.
Definition: cmsis_os.h:246
os_pool_def::item_sz
uint32_t item_sz
size of an item
Definition: cmsis_os.h:368
xTaskResumeAll
PRIVILEGED_FUNCTION BaseType_t xTaskResumeAll(void)
Definition: tasks.c:2017
xTimerChangePeriodFromISR
#define xTimerChangePeriodFromISR(xTimer, xNewPeriod, pxHigherPriorityTaskWoken)
Definition: timers.h:1051
xPortSysTickHandler
void xPortSysTickHandler(void)
Definition: port.c:493
vPortFree
PRIVILEGED_FUNCTION void vPortFree(void *pv)
Definition: heap_4.c:305
osEvent::value
union osEvent::@54 value
event value
portCLEAR_INTERRUPT_MASK_FROM_ISR
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedStatusValue)
Definition: FreeRTOS.h:304
osTimerPeriodic
repeating timer
Definition: cmsis_os.h:268
os_timer_type
os_timer_type
Definition: cmsis_os.h:266
os_pool_cb
Definition: cmsis_os.c:911
os_timer_def
Definition: cmsis_os.h:339
inHandlerMode
static int inHandlerMode(void)
Definition: cmsis_os.c:173
vPortExitCritical
void vPortExitCritical(void)
Definition: port.c:424
os_mailQ_def::queue_sz
uint32_t queue_sz
number of elements in the queue
Definition: cmsis_os.h:387
portCHAR
#define portCHAR
Definition: portmacro.h:89
os_timer_def::ptimer
os_ptimer ptimer
start address of a timer function
Definition: cmsis_os.h:340
osEvent::v
uint32_t v
message as 32-bit value
Definition: cmsis_os.h:398
osPriorityNormal
priority: normal (default)
Definition: cmsis_os.h:221
os_messageQ_def
Definition: cmsis_os.h:374
xQueueSend
#define xQueueSend(xQueue, pvItemToQueue, xTicksToWait)
Definition: queue.h:521
vTaskSuspendAll
PRIVILEGED_FUNCTION void vTaskSuspendAll(void)
Definition: tasks.c:1944
os_pool_cb::pool_sz
uint32_t pool_sz
Definition: cmsis_os.c:914
osPriority
osPriority
Definition: cmsis_os.h:217
cmsis_os.h
Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specifi...
osEvent::message_id
osMessageQId message_id
message id obtained by osMessageCreate
Definition: cmsis_os.h:404
xSemaphoreGive
#define xSemaphoreGive(xSemaphore)
Definition: semphr.h:489
osTimerOnce
one-shot timer
Definition: cmsis_os.h:267
xQueueReceive
#define xQueueReceive(xQueue, pvBuffer, xTicksToWait)
Definition: queue.h:914
osEvent::p
void * p
message or mail as void pointer
Definition: cmsis_os.h:399
vTaskList
PRIVILEGED_FUNCTION void vTaskList(char *pcWriteBuffer)
vTaskDelayUntil
PRIVILEGED_FUNCTION void vTaskDelayUntil(TickType_t *const pxPreviousWakeTime, const TickType_t xTimeIncrement)
xQueuePeek
#define xQueuePeek(xQueue, pvBuffer, xTicksToWait)
Definition: queue.h:788
osEvent::signals
int32_t signals
signal flags
Definition: cmsis_os.h:400
uxTaskPriorityGetFromISR
PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGetFromISR(TaskHandle_t xTask)
info
uint8_t info[12]
Definition: masstorage.h:54