Prusa MINI Firmware overview
|
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.
|
#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...
|
|
|
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
} |
|
|
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...
|
|
void * | osPoolAlloc (osPoolId pool_id) |
| Allocate a memory block from a memory pool. More...
|
|
void * | osPoolCAlloc (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...
|
|
void * | osMailAlloc (osMailQId queue_id, uint32_t millisec) |
| Allocate a memory block from a mail. More...
|
|
void * | osMailCAlloc (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...
|
|
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:
- Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- 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.
- 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.
- 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.
- 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.
◆ osCMSIS
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
extern void thread_sample (void const *argument);
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
#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
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
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
The RTOS kernel system timer frequency in Hz
- Note
- Reflects the system timer setting and is typically defined in a configuration file.
◆ osKernelSysTickMicroSec
Convert a microseconds value to a RTOS kernel system timer value.
- Parameters
-
microsec | time value in microseconds. |
- Returns
- time value normalized to the osKernelSysTickFrequency
◆ osThreadDef
#define osThreadDef |
( |
|
name, |
|
|
|
thread, |
|
|
|
priority, |
|
|
|
instances, |
|
|
|
stacksz |
|
) |
| |
Value:
{ #name, (thread), (priority), (instances), (stacksz)}
Create a Thread Definition with function, priority, and stack requirements.
- Parameters
-
name | name of the thread function. |
priority | initial priority of the thread function. |
instances | number of possible thread instances. |
stacksz | stack 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
-
name | name 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:Define a Timer object.
- Parameters
-
name | name of the timer object. |
function | name 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
-
name | name 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 a Mutex.
- Parameters
-
name | name 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
-
name | name 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 a Semaphore object.
- Parameters
-
name | name 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
-
name | name 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:
Define a Memory Pool.
- Parameters
-
name | name of the memory pool. |
no | maximum number of blocks (objects) in the memory pool. |
type | data 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
-
name | name 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:
{ (queue_sz),
sizeof (
type) }
Create a Message Queue Definition.
- Parameters
-
name | name of the queue. |
queue_sz | maximum number of messages in the queue. |
type | data 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
-
- 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:
{ (queue_sz),
sizeof (
type), (&os_mailQ_cb_##name) }
Create a Mail Queue Definition.
- Parameters
-
name | name of the queue |
queue_sz | maximum number of messages in queue |
type | data 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
-
- Note
- CAN BE CHANGED: The parameter to osMailQ shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.
◆ os_pthread
Entry point of a thread.
- Note
- MUST REMAIN UNCHANGED: os_pthread shall be consistent in every CMSIS-RTOS.
◆ os_ptimer
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
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
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
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
Timer Definition structure contains timer parameters.
- Note
- CAN BE CHANGED: os_timer_def is implementation specific in every CMSIS-RTOS.
◆ 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
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
Definition structure for mail queue.
- Note
- CAN BE CHANGED: os_mailQ_def is implementation specific in every CMSIS-RTOS.
◆ 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
|
◆ 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.
|
◆ 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
|
◆ osKernelInitialize()
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()
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_def | thread definition referenced with osThread. |
argument | pointer that is passed to the thread function as start argument. |
- Return values
-
status | code that indicates the execution status of the function |
- Note
- MUST REMAIN UNCHANGED: osKernelStart shall be consistent in every CMSIS-RTOS.
◆ 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
-
- 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.
210 #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
◆ 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
-
- Return values
-
- Note
- MUST REMAIN UNCHANGED: osKernelSysTick shall be consistent in every CMSIS-RTOS.
◆ osThreadCreate()
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_def | thread definition referenced with osThread. |
[in] | argument | pointer 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_def | thread definition referenced with osThread. |
argument | pointer that is passed to the thread function as start argument. |
- Return values
-
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.
249 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
250 if((thread_def->buffer !=
NULL) && (thread_def->controlblock !=
NULL)) {
253 thread_def->buffer, thread_def->controlblock);
262 #elif( configSUPPORT_STATIC_ALLOCATION == 1 )
266 thread_def->buffer, thread_def->controlblock);
◆ osThreadGetId()
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
-
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.
285 #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) )
◆ osThreadTerminate()
Terminate execution of a thread and remove it from Active Threads.
Terminate execution of a thread and remove it from Active Threads.
- Parameters
-
- Returns
- status code that indicates the execution status of the function.
- Note
- MUST REMAIN UNCHANGED: osThreadTerminate shall be consistent in every CMSIS-RTOS.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osThreadTerminate shall be consistent in every CMSIS-RTOS.
300 #if (INCLUDE_vTaskDelete == 1)
◆ osThreadYield()
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
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osThreadYield shall be consistent in every CMSIS-RTOS.
◆ osThreadSetPriority()
Change priority of an active thread.
Change priority of an active thread.
- Parameters
-
- Returns
- status code that indicates the execution status of the function.
- Note
- MUST REMAIN UNCHANGED: osThreadSetPriority shall be consistent in every CMSIS-RTOS.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osThreadSetPriority shall be consistent in every CMSIS-RTOS.
329 #if (INCLUDE_vTaskPrioritySet == 1)
◆ osThreadGetPriority()
Get current priority of an active thread.
Get current priority of an active thread.
- Parameters
-
- Returns
- current priority value of the thread function.
- Note
- MUST REMAIN UNCHANGED: osThreadGetPriority shall be consistent in every CMSIS-RTOS.
- Parameters
-
- Return values
-
current | priority value of the thread function. |
- Note
- MUST REMAIN UNCHANGED: osThreadGetPriority shall be consistent in every CMSIS-RTOS.
345 #if (INCLUDE_uxTaskPriorityGet == 1)
◆ osDelay()
Wait for Timeout (Time Delay)
Wait for Timeout (Time Delay).
- Parameters
-
[in] | millisec | time delay value |
- Returns
- status code that indicates the execution status of the function.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
367 #if INCLUDE_vTaskDelay
◆ osTimerCreate()
Create a timer.
Create a timer.
- Parameters
-
[in] | timer_def | timer object referenced with osTimer. |
[in] | type | osTimerOnce for one-shot or osTimerPeriodic for periodic behavior. |
[in] | argument | argument 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_def | timer object referenced with osTimer. |
type | osTimerOnce for one-shot or osTimerPeriodic for periodic behavior. |
argument | argument to the timer call back function. |
- Return values
-
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.
402 #if (configUSE_TIMERS == 1)
404 #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
405 if(timer_def->controlblock !=
NULL) {
406 return xTimerCreateStatic((
const char *)
"",
414 return xTimerCreate((
const char *)
"",
420 #elif( configSUPPORT_STATIC_ALLOCATION == 1 )
421 return xTimerCreateStatic((
const char *)
"",
428 return xTimerCreate((
const char *)
"",
◆ osTimerStart()
Start or restart a timer.
Start or restart a timer.
- Parameters
-
[in] | timer_id | timer ID obtained by osTimerCreate. |
[in] | millisec | time 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_id | timer ID obtained by osTimerCreate. |
millisec | time delay value of the timer. |
- Return values
-
status | code that indicates the execution status of the function |
- Note
- MUST REMAIN UNCHANGED: osTimerStart shall be consistent in every CMSIS-RTOS.
450 #if (configUSE_TIMERS == 1)
◆ osTimerStop()
Stop a timer.
Stop the timer.
- Parameters
-
- Returns
- status code that indicates the execution status of the function.
- Note
- MUST REMAIN UNCHANGED: osTimerStop shall be consistent in every CMSIS-RTOS.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osTimerStop shall be consistent in every CMSIS-RTOS.
489 #if (configUSE_TIMERS == 1)
◆ osTimerDelete()
Delete a timer.
Delete a timer that was created by osTimerCreate.
- Parameters
-
- Returns
- status code that indicates the execution status of the function.
- Note
- MUST REMAIN UNCHANGED: osTimerDelete shall be consistent in every CMSIS-RTOS.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osTimerDelete shall be consistent in every CMSIS-RTOS.
519 #if (configUSE_TIMERS == 1)
◆ 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_id | thread ID obtained by osThreadCreate or osThreadGetId. |
[in] | signals | specifies 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
-
- Return values
-
previous | signal flags of the specified thread or 0x80000000 in case of incorrect parameters. |
- Note
- MUST REMAIN UNCHANGED: osSignalSet shall be consistent in every CMSIS-RTOS.
547 #if( configUSE_TASK_NOTIFICATIONS == 1 )
549 uint32_t ulPreviousNotificationValue = 0;
561 return ulPreviousNotificationValue;
◆ osSignalClear()
int32_t osSignalClear |
( |
osThreadId |
thread_id, |
|
|
int32_t |
signals |
|
) |
| |
Clear the specified Signal Flags of an active thread.
- Parameters
-
[in] | thread_id | thread ID obtained by osThreadCreate or osThreadGetId. |
[in] | signals | specifies 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] | signals | wait until all specified signal flags set or 0 for any single signal flag. |
[in] | millisec | timeout 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
-
signals | wait until all specified signal flags set or 0 for any single signal flag. |
millisec | timeout value or 0 in case of no time-out. |
- Return values
-
event | flag information or error code. |
- Note
- MUST REMAIN UNCHANGED: osSignalWait shall be consistent in every CMSIS-RTOS.
590 #if( configUSE_TASK_NOTIFICATIONS == 1 )
599 else if (millisec != 0) {
◆ osMutexCreate()
Create and Initialize a Mutex object.
Create and Initialize a Mutex object.
- Parameters
-
[in] | mutex_def | mutex 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_def | mutex definition referenced with osMutex. |
- Return values
-
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.
642 #if ( configUSE_MUTEXES == 1)
644 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
646 if (mutex_def->controlblock !=
NULL) {
647 return xSemaphoreCreateMutexStatic( mutex_def->controlblock );
650 return xSemaphoreCreateMutex();
652 #elif ( configSUPPORT_STATIC_ALLOCATION == 1 )
653 return xSemaphoreCreateMutexStatic( mutex_def->controlblock );
655 return xSemaphoreCreateMutex();
◆ osMutexWait()
Wait until a Mutex becomes available.
Wait until a Mutex becomes available.
- Parameters
-
[in] | mutex_id | mutex ID obtained by osMutexCreate. |
[in] | millisec | timeout 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_id | mutex ID obtained by osMutexCreate. |
millisec | timeout value or 0 in case of no time-out. |
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osMutexWait shall be consistent in every CMSIS-RTOS.
675 if (mutex_id ==
NULL) {
683 else if (millisec != 0) {
◆ osMutexRelease()
Release a Mutex that was obtained by osMutexWait.
Release a Mutex that was obtained by osMutexWait.
- Parameters
-
- Returns
- status code that indicates the execution status of the function.
- Note
- MUST REMAIN UNCHANGED: osMutexRelease shall be consistent in every CMSIS-RTOS.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osMutexRelease shall be consistent in every CMSIS-RTOS.
◆ osMutexDelete()
Delete a Mutex.
Delete a Mutex that was created by osMutexCreate.
- Parameters
-
- Returns
- status code that indicates the execution status of the function.
- Note
- MUST REMAIN UNCHANGED: osMutexDelete shall be consistent in every CMSIS-RTOS.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osMutexDelete shall be consistent in every CMSIS-RTOS.
◆ osSemaphoreCreate()
Create and Initialize a Semaphore object used for managing resources.
Create and Initialize a Semaphore object used for managing resources.
- Parameters
-
[in] | semaphore_def | semaphore definition referenced with osSemaphore. |
[in] | count | number 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_def | semaphore definition referenced with osSemaphore. |
count | number of available resources. |
- Return values
-
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.
757 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
761 if (semaphore_def->controlblock !=
NULL){
763 return xSemaphoreCreateBinaryStatic( semaphore_def->controlblock );
766 #if (configUSE_COUNTING_SEMAPHORES == 1 )
767 return xSemaphoreCreateCountingStatic( count, count, semaphore_def->controlblock );
775 vSemaphoreCreateBinary(sema);
779 #if (configUSE_COUNTING_SEMAPHORES == 1 )
780 return xSemaphoreCreateCounting(count, count);
786 #elif ( configSUPPORT_STATIC_ALLOCATION == 1 ) // configSUPPORT_DYNAMIC_ALLOCATION == 0
788 return xSemaphoreCreateBinaryStatic( semaphore_def->controlblock );
792 #if (configUSE_COUNTING_SEMAPHORES == 1 )
793 return xSemaphoreCreateCountingStatic( count, count, semaphore_def->controlblock );
798 #else // configSUPPORT_STATIC_ALLOCATION == 0 && configSUPPORT_DYNAMIC_ALLOCATION == 1
802 vSemaphoreCreateBinary(sema);
806 #if (configUSE_COUNTING_SEMAPHORES == 1 )
807 return xSemaphoreCreateCounting(count, count);
◆ 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_id | semaphore object referenced with osSemaphoreCreate. |
[in] | millisec | timeout 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_id | semaphore object referenced with osSemaphore. |
millisec | timeout value or 0 in case of no time-out. |
- Return values
-
number | of available tokens, or -1 in case of incorrect parameters. |
- Note
- MUST REMAIN UNCHANGED: osSemaphoreWait shall be consistent in every CMSIS-RTOS.
828 if (semaphore_id ==
NULL) {
836 else if (millisec != 0) {
◆ osSemaphoreRelease()
Release a Semaphore token.
Release a Semaphore token.
- Parameters
-
- 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_id | semaphore object referenced with osSemaphore. |
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osSemaphoreRelease shall be consistent in every CMSIS-RTOS.
◆ osSemaphoreDelete()
Delete a Semaphore.
Delete a Semaphore that was created by osSemaphoreCreate.
- Parameters
-
- 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_id | semaphore object referenced with osSemaphore. |
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osSemaphoreDelete shall be consistent in every CMSIS-RTOS.
◆ osPoolCreate()
Create and Initialize a memory pool.
Create and Initialize a memory pool.
- Parameters
-
[in] | pool_def | memory 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_def | memory pool definition referenced with osPool. |
- Return values
-
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.
928 #if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
930 int itemSize = 4 * ((pool_def->
item_sz + 3) / 4);
◆ osPoolAlloc()
Allocate a memory block from a memory pool.
Allocate a memory block from a memory pool.
- Parameters
-
[in] | pool_id | memory 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
-
- Return values
-
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.
995 if (index >= pool_id->
pool_sz) {
999 if (pool_id->
markers[index] == 0) {
1001 p = (
void *)((uint32_t)(pool_id->
pool) + (index * pool_id->
item_sz));
◆ osPoolCAlloc()
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_id | memory 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
-
- Return values
-
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.
1029 memset(p, 0,
sizeof(pool_id->
pool_sz));
◆ osPoolFree()
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_id | memory pool ID obtain referenced with osPoolCreate. |
[in] | block | address 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_id | memory pool ID obtain referenced with osPoolCreate. |
block | address of the allocated memory block that is returned to the memory pool. |
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osPoolFree shall be consistent in every CMSIS-RTOS.
1046 if (pool_id ==
NULL) {
1050 if (block ==
NULL) {
1054 if (block < pool_id->
pool) {
1058 index = (uint32_t)block - (uint32_t)(pool_id->
pool);
1059 if (index % pool_id->
item_sz) {
1062 index = index / pool_id->
item_sz;
1063 if (index >= pool_id->
pool_sz) {
◆ osMessageCreate()
Create and Initialize a Message Queue.
Create and Initialize a Message Queue.
- Parameters
-
- 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
-
- Return values
-
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.
1090 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
1098 #elif ( configSUPPORT_STATIC_ALLOCATION == 1 )
◆ osMessagePut()
Put a Message to a Queue.
Put a Message to a Queue.
- Parameters
-
[in] | queue_id | message queue ID obtained with osMessageCreate. |
[in] | info | message information. |
[in] | millisec | timeout 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_id | message queue ID obtained with osMessageCreate. |
info | message information. |
millisec | timeout value or 0 in case of no time-out. |
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osMessagePut shall be consistent in every CMSIS-RTOS.
◆ osMessageGet()
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_id | message queue ID obtained with osMessageCreate. |
[in] | millisec | timeout 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_id | message queue ID obtained with osMessageCreate. |
millisec | timeout value or 0 in case of no time-out. |
- Return values
-
event | information that includes status code. |
- Note
- MUST REMAIN UNCHANGED: osMessageGet shall be consistent in every CMSIS-RTOS.
1154 if (queue_id ==
NULL) {
1165 else if (millisec != 0) {
1178 event.status =
osOK;
◆ osMailCreate()
Create and Initialize mail queue.
Create and Initialize mail queue.
- Parameters
-
- 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
-
- Return values
-
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.
1216 #if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
◆ osMailAlloc()
Allocate a memory block from a mail.
Allocate a memory block from a mail.
- Parameters
-
[in] | queue_id | mail queue ID obtained with osMailCreate. |
[in] | millisec | timeout 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_id | mail queue ID obtained with osMailCreate. |
millisec | timeout value or 0 in case of no time-out. |
- Return values
-
pointer | to 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.
1266 if (queue_id ==
NULL) {
◆ osMailCAlloc()
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_id | mail queue ID obtained with osMailCreate. |
[in] | millisec | timeout 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_id | mail queue ID obtained with osMailCreate. |
millisec | timeout value or 0 in case of no time-out. |
- Return values
-
pointer | to 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.
◆ osMailPut()
Put a mail to a queue.
Put a mail to a queue.
- Parameters
-
- Returns
- status code that indicates the execution status of the function.
- Note
- MUST REMAIN UNCHANGED: osMailPut shall be consistent in every CMSIS-RTOS.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osMailPut shall be consistent in every CMSIS-RTOS.
1308 if (queue_id ==
NULL) {
◆ osMailGet()
Get a mail from a queue.
Get a mail from a queue.
- Parameters
-
[in] | queue_id | mail queue ID obtained with osMailCreate. |
[in] | millisec | timeout 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_id | mail queue ID obtained with osMailCreate. |
millisec | timeout value or 0 in case of no time-out |
- Return values
-
event | that contains mail information or error code. |
- Note
- MUST REMAIN UNCHANGED: osMailGet shall be consistent in every CMSIS-RTOS.
1344 if (queue_id ==
NULL) {
1355 else if (millisec != 0) {
1368 event.status =
osOK;
◆ osMailFree()
Free a memory block from a mail.
Free a memory block from a mail.
- Parameters
-
[in] | queue_id | mail queue ID obtained with osMailCreate. |
[in] | mail | pointer 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_id | mail queue ID obtained with osMailCreate. |
mail | pointer to the memory block that was obtained with osMailGet. |
- Return values
-
status | code that indicates the execution status of the function. |
- Note
- MUST REMAIN UNCHANGED: osMailFree shall be consistent in every CMSIS-RTOS.
1394 if (queue_id ==
NULL) {
◆ osSystickHandler()
Handles the tick increment.
- Parameters
-
- Return values
-
1411 #if (INCLUDE_xTaskGetSchedulerState == 1 )
1416 #if (INCLUDE_xTaskGetSchedulerState == 1 )
◆ osThreadSuspend()
Suspend execution of a thread.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
1480 #if (INCLUDE_vTaskSuspend == 1)
◆ osThreadResume()
Resume execution of a suspended thread.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
1496 #if (INCLUDE_vTaskSuspend == 1)
◆ osThreadSuspendAll()
Suspend execution of a all active threads.
- Return values
-
status | code that indicates the execution status of the function. |
◆ osThreadResumeAll()
Resume execution of a all suspended threads.
- Return values
-
status | code that indicates the execution status of the function. |
◆ osDelayUntil()
osStatus osDelayUntil |
( |
uint32_t * |
PreviousWakeTime, |
|
|
uint32_t |
millisec |
|
) |
| |
Delay a task until a specified time.
- Parameters
-
PreviousWakeTime | Pointer 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() ) |
millisec | time delay value |
- Return values
-
status | code that indicates the execution status of the function. |
1548 #if INCLUDE_vTaskDelayUntil
1555 (
void) PreviousWakeTime;
◆ osAbortDelay()
Abort the delay for a specific thread.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
1568 #if INCLUDE_xTaskAbortDelay
◆ osThreadList()
Lists all the current threads, along with their current state and stack usage high water mark.
- Parameters
-
buffer | A buffer into which the above mentioned details will be written |
- Return values
-
status | code that indicates the execution status of the function. |
1589 #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )
◆ osMessagePeek()
Receive an item from a queue without removing the item from the queue.
- Parameters
-
queue_id | message queue ID obtained with osMessageCreate. |
millisec | timeout value or 0 in case of no time-out. |
- Return values
-
event | information that includes status code. |
1608 if (queue_id ==
NULL) {
1617 else if (millisec != 0) {
◆ osMessageWaiting()
Get the number of messaged stored in a queue.
- Parameters
-
- Return values
-
number | of messages stored in a queue. |
◆ osMessageAvailableSpace()
Get the available space in a message queue.
- Parameters
-
- Return values
-
available | space in a message queue. |
◆ osMessageDelete()
Delete a Message Queue.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
◆ osRecursiveMutexCreate()
Create and Initialize a Recursive Mutex.
- Parameters
-
mutex_def | mutex definition referenced with osMutex. |
- Return values
-
mutex | ID for reference by other functions or NULL in case of error.. |
1686 #if (configUSE_RECURSIVE_MUTEXES == 1)
1687 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
1689 if (mutex_def->controlblock !=
NULL){
1690 return xSemaphoreCreateRecursiveMutexStatic( mutex_def->controlblock );
1693 return xSemaphoreCreateRecursiveMutex();
1695 #elif ( configSUPPORT_STATIC_ALLOCATION == 1 )
1696 return xSemaphoreCreateRecursiveMutexStatic( mutex_def->controlblock );
1698 return xSemaphoreCreateRecursiveMutex();
◆ osRecursiveMutexRelease()
Release a Recursive Mutex.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
1712 #if (configUSE_RECURSIVE_MUTEXES == 1)
1715 if (xSemaphoreGiveRecursive(mutex_id) !=
pdTRUE)
◆ osRecursiveMutexWait()
Release a Recursive Mutex.
- Parameters
-
- Return values
-
status | code that indicates the execution status of the function. |
1733 #if (configUSE_RECURSIVE_MUTEXES == 1)
1736 if (mutex_id ==
NULL)
1746 else if (millisec != 0)
1755 if (xSemaphoreTakeRecursive(mutex_id, ticks) !=
pdTRUE)
◆ osSemaphoreGetCount()
Returns the current count value of a counting semaphore.
- Parameters
-
- Return values
-
void * pool
Definition: cmsis_os.c:912
QueueHandle_t handle
Definition: cmsis_os.c:1203
osPriority tpriority
initial thread priority
Definition: cmsis_os.h:328
osPoolId pool
Definition: cmsis_os.c:1204
const osMailQDef_t * queue_def
Definition: cmsis_os.c:1202
Definition: cmsis_os.h:386
Definition: cmsis_os.c:1201
#define portMAX_DELAY
Definition: portmacro.h:106
#define portSET_INTERRUPT_MASK_FROM_ISR()
Definition: FreeRTOS.h:300
PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotifyFromISR(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken)
#define osThreadDef(name, thread, priority, instances, stacksz)
Definition: cmsis_os.h:468
PRIVILEGED_FUNCTION BaseType_t xTaskGetSchedulerState(void)
PRIVILEGED_FUNCTION BaseType_t xTaskNotifyWait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait)
priority: above normal
Definition: cmsis_os.h:222
PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotify(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue)
PRIVILEGED_FUNCTION UBaseType_t uxQueueSpacesAvailable(const QueueHandle_t xQueue)
Definition: queue.c:1595
PRIVILEGED_FUNCTION void vTaskStartScheduler(void)
Definition: tasks.c:1826
PRIVILEGED_FUNCTION void * pvPortMalloc(size_t xSize)
Definition: heap_4.c:155
uint32_t item_sz
size of an item
Definition: cmsis_os.h:388
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool.
Definition: cmsis_os.c:979
uint8_t type
Definition: UsbCore.h:184
#define xSemaphoreTake(xSemaphore, xBlockTime)
Definition: semphr.h:331
osStatus
Definition: cmsis_os.h:234
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
Definition: cmsis_os.h:330
uint32_t item_sz
Definition: cmsis_os.c:915
function completed; timeout occurred.
Definition: cmsis_os.h:239
PRIVILEGED_FUNCTION TickType_t xTaskGetTickCountFromISR(void)
Definition: tasks.c:2142
#define xSemaphoreTakeFromISR(xSemaphore, pxHigherPriorityTaskWoken)
Definition: semphr.h:700
uint8_t i
Definition: screen_test_graph.c:72
#define xTimerStopFromISR(xTimer, pxHigherPriorityTaskWoken)
Definition: timers.h:978
not allowed in ISR context: the function cannot be called from interrupt service routines.
Definition: cmsis_os.h:243
PRIVILEGED_FUNCTION TickType_t xTaskGetTickCount(void)
Definition: tasks.c:2127
priority: idle (lowest)
Definition: cmsis_os.h:218
resource not available within given time: a specified resource was not available within the timeout p...
Definition: cmsis_os.h:242
#define xSemaphoreGiveFromISR(xSemaphore, pxHigherPriorityTaskWoken)
Definition: semphr.h:666
#define xTimerStop(xTimer, xTicksToWait)
Definition: timers.h:587
#define NULL
Definition: usbd_def.h:53
osStatus status
status code: event or error information
Definition: cmsis_os.h:396
void vPortEnterCritical(void)
Definition: port.c:407
PRIVILEGED_FUNCTION void vTaskSuspend(TaskHandle_t xTaskToSuspend)
#define pdPASS
Definition: projdefs.h:89
prevent from enum down-size compiler optimization.
Definition: cmsis_os.h:249
PRIVILEGED_FUNCTION BaseType_t xTaskAbortDelay(TaskHandle_t xTask)
uint32_t currentIndex
Definition: cmsis_os.c:916
uint32_t TickType_t
Definition: portmacro.h:105
resource not available: a specified resource was not available.
Definition: cmsis_os.h:241
function called multiple times from ISR with same object.
Definition: cmsis_os.h:244
SemaphoreHandle_t osSemaphoreId
Definition: cmsis_os.h:295
function completed; mail event occurred.
Definition: cmsis_os.h:238
PRIVILEGED_FUNCTION BaseType_t xTaskResumeFromISR(TaskHandle_t xTaskToResume)
#define osPoolDef(name, no, type)
Define a Memory Pool.
Definition: cmsis_os.h:755
Definition: cmsis_os.h:395
void * TaskHandle_t
Definition: task.h:103
osStatus osPoolFree(osPoolId pool_id, void *block)
Return an allocated memory block back to a specific memory pool.
Definition: cmsis_os.c:1042
system cannot determine priority or thread has illegal priority
Definition: cmsis_os.h:225
#define pdFALSE
Definition: projdefs.h:86
PRIVILEGED_FUNCTION void vTaskDelete(TaskHandle_t xTaskToDelete)
uint32_t pool_sz
number of items (elements) in the pool
Definition: cmsis_os.h:367
#define xTimerChangePeriod(xTimer, xNewPeriod, xTicksToWait)
Definition: timers.h:667
PRIVILEGED_FUNCTION UBaseType_t uxQueueMessagesWaitingFromISR(const QueueHandle_t xQueue)
Definition: queue.c:1613
union osEvent::@55 def
event definition
Definition: FreeRTOS.h:1041
#define uxSemaphoreGetCount(xSemaphore)
Definition: semphr.h:1167
#define xTimerDelete(xTimer, xTicksToWait)
Definition: timers.h:705
Definition: cmsis_os.h:366
PRIVILEGED_FUNCTION TaskHandle_t xTaskGetCurrentTaskHandle(void)
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create and Initialize a memory pool.
Definition: cmsis_os.c:926
function completed; no error or event occurred.
Definition: cmsis_os.h:235
#define portYIELD_FROM_ISR(x)
Definition: portmacro.h:135
PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGet(TaskHandle_t xTask)
void
Definition: png.h:1083
function completed; message event occurred.
Definition: cmsis_os.h:237
PRIVILEGED_FUNCTION void vQueueDelete(QueueHandle_t xQueue)
Definition: queue.c:1625
PRIVILEGED_FUNCTION void vTaskResume(TaskHandle_t xTaskToResume)
PRIVILEGED_FUNCTION BaseType_t xQueueReceiveFromISR(QueueHandle_t xQueue, void *const pvBuffer, BaseType_t *const pxHigherPriorityTaskWoken)
Definition: queue.c:1434
#define portBASE_TYPE
Definition: portmacro.h:95
#define vSemaphoreDelete(xSemaphore)
Definition: semphr.h:1140
#define taskSCHEDULER_NOT_STARTED
Definition: task.h:258
Definition: cmsis_os.h:325
#define osWaitForever
wait forever timeout value
Definition: cmsis_os.h:230
#define taskYIELD()
Definition: task.h:203
char * name
Thread name.
Definition: cmsis_os.h:326
#define xQueueSendFromISR(xQueue, pvItemToQueue, pxHigherPriorityTaskWoken)
Definition: queue.h:1361
os_pthread pthread
start address of thread function
Definition: cmsis_os.h:327
static unsigned portBASE_TYPE makeFreeRtosPriority(osPriority priority)
Definition: cmsis_os.c:146
void(* TaskFunction_t)(void *)
Definition: projdefs.h:77
#define portTICK_PERIOD_MS
Definition: portmacro.h:116
const uint8_t[]
Definition: 404_html.c:3
priority: realtime (highest)
Definition: cmsis_os.h:224
PRIVILEGED_FUNCTION void vTaskPrioritySet(TaskHandle_t xTask, UBaseType_t uxNewPriority)
uint8_t * markers
Definition: cmsis_os.c:913
priority: below normal
Definition: cmsis_os.h:220
system cannot determine priority or thread has illegal priority.
Definition: cmsis_os.h:245
void * osMailAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail.
Definition: cmsis_os.c:1260
function completed; signal event occurred.
Definition: cmsis_os.h:236
priority: high
Definition: cmsis_os.h:223
priority: low
Definition: cmsis_os.h:219
osMailQId mail_id
mail id obtained by osMailCreate
Definition: cmsis_os.h:403
PRIVILEGED_FUNCTION UBaseType_t uxQueueMessagesWaiting(const QueueHandle_t xQueue)
Definition: queue.c:1579
#define portEND_SWITCHING_ISR(xSwitchRequired)
Definition: portmacro.h:134
unspecified RTOS error: run-time error but no other error message fits.
Definition: cmsis_os.h:248
struct os_mailQ_cb ** cb
Definition: cmsis_os.h:389
long BaseType_t
Definition: portmacro.h:98
#define pdTRUE
Definition: projdefs.h:87
parameter error: a mandatory parameter was missing or specified an incorrect object.
Definition: cmsis_os.h:240
value of a parameter is out of range.
Definition: cmsis_os.h:247
PRIVILEGED_FUNCTION void vTaskDelay(const TickType_t xTicksToDelay)
system is out of memory: it was impossible to allocate or reserve memory for the operation.
Definition: cmsis_os.h:246
uint32_t item_sz
size of an item
Definition: cmsis_os.h:368
PRIVILEGED_FUNCTION BaseType_t xTaskResumeAll(void)
Definition: tasks.c:2017
#define xTimerChangePeriodFromISR(xTimer, xNewPeriod, pxHigherPriorityTaskWoken)
Definition: timers.h:1051
void xPortSysTickHandler(void)
Definition: port.c:493
PRIVILEGED_FUNCTION void vPortFree(void *pv)
Definition: heap_4.c:305
union osEvent::@54 value
event value
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedStatusValue)
Definition: FreeRTOS.h:304
repeating timer
Definition: cmsis_os.h:268
os_timer_type
Definition: cmsis_os.h:266
Definition: cmsis_os.c:911
Definition: cmsis_os.h:339
static int inHandlerMode(void)
Definition: cmsis_os.c:173
void vPortExitCritical(void)
Definition: port.c:424
uint32_t queue_sz
number of elements in the queue
Definition: cmsis_os.h:387
#define portCHAR
Definition: portmacro.h:89
os_ptimer ptimer
start address of a timer function
Definition: cmsis_os.h:340
uint32_t v
message as 32-bit value
Definition: cmsis_os.h:398
priority: normal (default)
Definition: cmsis_os.h:221
Definition: cmsis_os.h:374
#define xQueueSend(xQueue, pvItemToQueue, xTicksToWait)
Definition: queue.h:521
PRIVILEGED_FUNCTION void vTaskSuspendAll(void)
Definition: tasks.c:1944
uint32_t pool_sz
Definition: cmsis_os.c:914
osPriority
Definition: cmsis_os.h:217
Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specifi...
osMessageQId message_id
message id obtained by osMessageCreate
Definition: cmsis_os.h:404
#define xSemaphoreGive(xSemaphore)
Definition: semphr.h:489
one-shot timer
Definition: cmsis_os.h:267
#define xQueueReceive(xQueue, pvBuffer, xTicksToWait)
Definition: queue.h:914
void * p
message or mail as void pointer
Definition: cmsis_os.h:399
PRIVILEGED_FUNCTION void vTaskList(char *pcWriteBuffer)
PRIVILEGED_FUNCTION void vTaskDelayUntil(TickType_t *const pxPreviousWakeTime, const TickType_t xTimeIncrement)
#define xQueuePeek(xQueue, pvBuffer, xTicksToWait)
Definition: queue.h:788
int32_t signals
signal flags
Definition: cmsis_os.h:400
PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGetFromISR(TaskHandle_t xTask)
uint8_t info[12]
Definition: masstorage.h:54