#include <stdint.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
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 30 |
maximum count for osSemaphoreCreate function More... | |
#define | osFeature_Wait 1 |
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 100000000 |
#define | osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000) |
#define | osThreadDef(name, 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 struct os_thread_cb * | osThreadId |
typedef struct os_timer_cb * | osTimerId |
typedef struct os_mutex_cb * | osMutexId |
typedef struct os_semaphore_cb * | osSemaphoreId |
typedef struct os_pool_cb * | osPoolId |
typedef struct os_messageQ_cb * | osMessageQId |
typedef struct os_mailQ_cb * | osMailQId |
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 } |
#define osCMSIS 0x10002 |
API version (main [31:16] .sub [15:0])
#define osCMSIS_KERNEL 0x10000 |
RTOS identification and version (main [31:16] .sub [15:0])
#define osFeature_MailQ 1 |
Mail Queues: 1=available, 0=not available.
#define osFeature_MainThread 1 |
main thread 1=main can be thread, 0=not available
#define osFeature_MessageQ 1 |
Message Queues: 1=available, 0=not available.
#define osFeature_Pool 1 |
Memory Pools: 1=available, 0=not available.
#define osFeature_Semaphore 30 |
maximum count for osSemaphoreCreate function
#define osFeature_Signals 8 |
maximum number of Signal Flags available per thread
#define osFeature_SysTick 1 |
osKernelSysTick functions: 1=available, 0=not available
#define osFeature_Wait 1 |
osWait function: 1=available, 0=not available
#define osKernelSystemId "KERNEL V1.00" |
RTOS identification string.
#define osKernelSysTickFrequency 100000000 |
The RTOS kernel system timer frequency in Hz
#define osKernelSysTickMicroSec | ( | microsec | ) | (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000) |
Convert a microseconds value to a RTOS kernel system timer value.
microsec | time value in microseconds. |
#define osMailQ | ( | name | ) | &os_mailQ_def_##name |
Access a Mail Queue Definition.
name | name of the queue |
#define osMailQDef | ( | name, | |
queue_sz, | |||
type | |||
) |
Create a Mail Queue Definition.
name | name of the queue |
queue_sz | maximum number of messages in queue |
type | data type of a single message element |
#define osMessageQ | ( | name | ) | &os_messageQ_def_##name |
Access a Message Queue Definition.
name | name of the queue |
#define osMessageQDef | ( | name, | |
queue_sz, | |||
type | |||
) |
Create a Message Queue Definition.
name | name of the queue. |
queue_sz | maximum number of messages in the queue. |
type | data type of a single message element (for debugger). |
#define osMutex | ( | name | ) | &os_mutex_def_##name |
Access a Mutex definition.
name | name of the mutex object. |
#define osMutexDef | ( | name | ) | const osMutexDef_t os_mutex_def_##name = { 0 } |
Define a Mutex.
name | name of the mutex object. |
#define osPool | ( | name | ) | &os_pool_def_##name |
Access a Memory Pool definition.
name | name of the memory pool |
#define osPoolDef | ( | name, | |
no, | |||
type | |||
) |
Define a Memory Pool.
name | name of the memory pool. |
no | maximum number of blocks (objects) in the memory pool. |
type | data type of a single block (object). |
#define osSemaphore | ( | name | ) | &os_semaphore_def_##name |
Access a Semaphore definition.
name | name of the semaphore object. |
#define osSemaphoreDef | ( | name | ) | const osSemaphoreDef_t os_semaphore_def_##name = { 0 } |
Define a Semaphore object.
name | name of the semaphore object. |
#define osThread | ( | name | ) | &os_thread_def_##name |
Access a Thread definition.
name | name of the thread definition object. |
#define osThreadDef | ( | name, | |
priority, | |||
instances, | |||
stacksz | |||
) |
Create a Thread Definition with function, priority, and stack requirements.
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. |
#define osTimer | ( | name | ) | &os_timer_def_##name |
Access a Timer definition.
name | name of the timer object. |
#define osTimerDef | ( | name, | |
function | |||
) |
Define a Timer object.
name | name of the timer object. |
function | name of the timer call back function. |
#define osWaitForever 0xFFFFFFFF |
wait forever timeout value
Timeout value.
Entry point of a thread.
Entry point of a timer call back function.
typedef struct os_mailQ_def osMailQDef_t |
Definition structure for mail queue.
typedef struct os_mailQ_cb* osMailQId |
Mail ID identifies the mail queue (pointer to a mail queue control block).
typedef struct os_messageQ_def osMessageQDef_t |
Definition structure for message queue.
typedef struct os_messageQ_cb* osMessageQId |
Message ID identifies the message queue (pointer to a message queue control block).
typedef struct os_mutex_def osMutexDef_t |
Mutex Definition structure contains setup information for a mutex.
typedef struct os_mutex_cb* osMutexId |
Mutex ID identifies the mutex (pointer to a mutex control block).
typedef struct os_pool_def osPoolDef_t |
Definition structure for memory block allocation.
typedef struct os_pool_cb* osPoolId |
Pool ID identifies the memory pool (pointer to a memory pool control block).
typedef struct os_semaphore_def osSemaphoreDef_t |
Semaphore Definition structure contains setup information for a semaphore.
typedef struct os_semaphore_cb* osSemaphoreId |
Semaphore ID identifies the semaphore (pointer to a semaphore control block).
typedef struct os_thread_def osThreadDef_t |
Thread Definition structure contains startup information of a thread.
typedef struct os_thread_cb* osThreadId |
Thread ID identifies the thread (pointer to a thread control block).
typedef struct os_timer_def osTimerDef_t |
Timer Definition structure contains timer parameters.
typedef struct os_timer_cb* osTimerId |
Timer ID identifies the timer (pointer to a timer control block).
enum os_timer_type |
enum osPriority |
Priority used for thread control.
enum osStatus |
Status code values returned by CMSIS-RTOS functions.
osStatus osDelay | ( | uint32_t | millisec | ) |
Wait for Timeout (Time Delay).
[in] | millisec | time delay value |
Initialize the RTOS Kernel for creating objects.
int32_t osKernelRunning | ( | void | ) |
Check if the RTOS kernel is already started.
Start the RTOS Kernel.
uint32_t osKernelSysTick | ( | void | ) |
Get the RTOS kernel system timer counter
Allocate a memory block from a mail.
[in] | queue_id | mail queue ID obtained with osMailCreate. |
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out |
Allocate a memory block from a mail and set memory block to zero.
[in] | queue_id | mail queue ID obtained with osMailCreate. |
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out |
osMailQId osMailCreate | ( | const osMailQDef_t * | queue_def, |
osThreadId | thread_id | ||
) |
Create and Initialize mail queue.
[in] | queue_def | reference to the mail queue definition obtain with osMailQ |
[in] | thread_id | thread ID (obtained by osThreadCreate or osThreadGetId) or NULL. |
Free a memory block from a mail.
[in] | queue_id | mail queue ID obtained with osMailCreate. |
[in] | pointer to the memory block that was obtained with osMailGet. |
Get a mail from a queue.
[in] | queue_id | mail queue ID obtained with osMailCreate. |
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out |
Put a mail to a queue.
[in] | queue_id | mail queue ID obtained with osMailCreate. |
[in] | memory block previously allocated with osMailAlloc or osMailCAlloc. |
osMessageQId osMessageCreate | ( | const osMessageQDef_t * | queue_def, |
osThreadId | thread_id | ||
) |
Create and Initialize a Message Queue.
[in] | queue_def | queue definition referenced with osMessageQ. |
[in] | thread_id | thread ID (obtained by osThreadCreate or osThreadGetId) or NULL. |
osEvent osMessageGet | ( | osMessageQId | queue_id, |
uint32_t | millisec | ||
) |
Get a Message or Wait for a Message from a Queue.
[in] | queue_id | message queue ID obtained with osMessageCreate. |
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out. |
osStatus osMessagePut | ( | osMessageQId | queue_id, |
uint32_t | info, | ||
uint32_t | millisec | ||
) |
Put a Message to a Queue.
[in] | queue_id | message queue ID obtained with osMessageCreate. |
[in] | info | message information. |
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out. |
osMutexId osMutexCreate | ( | const osMutexDef_t * | mutex_def | ) |
Create and Initialize a Mutex object.
[in] | mutex_def | mutex definition referenced with osMutex. |
Delete a Mutex that was created by osMutexCreate.
[in] | mutex_id | mutex ID obtained by osMutexCreate. |
Release a Mutex that was obtained by osMutexWait.
[in] | mutex_id | mutex ID obtained by osMutexCreate. |
Wait until a Mutex becomes available.
[in] | mutex_id | mutex ID obtained by osMutexCreate. |
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out. |
Allocate a memory block from a memory pool.
[in] | pool_id | memory pool ID obtain referenced with osPoolCreate. |
Allocate a memory block from a memory pool and set memory block to zero.
[in] | pool_id | memory pool ID obtain referenced with osPoolCreate. |
osPoolId osPoolCreate | ( | const osPoolDef_t * | pool_def | ) |
Create and Initialize a memory pool.
[in] | pool_def | memory pool definition referenced with osPool. |
Return an allocated memory block back to a specific memory pool.
[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. |
osSemaphoreId osSemaphoreCreate | ( | const osSemaphoreDef_t * | semaphore_def, |
int32_t | count | ||
) |
Create and Initialize a Semaphore object used for managing resources.
[in] | semaphore_def | semaphore definition referenced with osSemaphore. |
[in] | count | number of available resources. |
osStatus osSemaphoreDelete | ( | osSemaphoreId | semaphore_id | ) |
Delete a Semaphore that was created by osSemaphoreCreate.
[in] | semaphore_id | semaphore object referenced with osSemaphoreCreate. |
osStatus osSemaphoreRelease | ( | osSemaphoreId | semaphore_id | ) |
Release a Semaphore token.
[in] | semaphore_id | semaphore object referenced with osSemaphoreCreate. |
int32_t osSemaphoreWait | ( | osSemaphoreId | semaphore_id, |
uint32_t | millisec | ||
) |
Wait until a Semaphore token becomes available.
[in] | semaphore_id | semaphore object referenced with osSemaphoreCreate. |
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out. |
int32_t osSignalClear | ( | osThreadId | thread_id, |
int32_t | signals | ||
) |
Clear the specified Signal Flags of an active thread.
[in] | thread_id | thread ID obtained by osThreadCreate or osThreadGetId. |
[in] | signals | specifies the signal flags of the thread that shall be cleared. |
int32_t osSignalSet | ( | osThreadId | thread_id, |
int32_t | signals | ||
) |
Set the specified Signal Flags of an active thread.
[in] | thread_id | thread ID obtained by osThreadCreate or osThreadGetId. |
[in] | signals | specifies the signal flags of the thread that should be set. |
osEvent osSignalWait | ( | int32_t | signals, |
uint32_t | millisec | ||
) |
Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
[in] | signals | wait until all specified signal flags set or 0 for any single signal flag. |
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out. |
osThreadId osThreadCreate | ( | const osThreadDef_t * | thread_def, |
void * | argument | ||
) |
Create a thread and add it to Active Threads and set it to state READY.
[in] | thread_def | thread definition referenced with osThread. |
[in] | argument | pointer that is passed to the thread function as start argument. |
osThreadId osThreadGetId | ( | void | ) |
Return the thread ID of the current running thread.
osPriority osThreadGetPriority | ( | osThreadId | thread_id | ) |
Get current priority of an active thread.
[in] | thread_id | thread ID obtained by osThreadCreate or osThreadGetId. |
osStatus osThreadSetPriority | ( | osThreadId | thread_id, |
osPriority | priority | ||
) |
Change priority of an active thread.
[in] | thread_id | thread ID obtained by osThreadCreate or osThreadGetId. |
[in] | priority | new priority value for the thread function. |
osStatus osThreadTerminate | ( | osThreadId | thread_id | ) |
Terminate execution of a thread and remove it from Active Threads.
[in] | thread_id | thread ID obtained by osThreadCreate or osThreadGetId. |
Pass control to next thread that is in state READY.
osTimerId osTimerCreate | ( | const osTimerDef_t * | timer_def, |
os_timer_type | type, | ||
void * | argument | ||
) |
Create a timer.
[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. |
Delete a timer that was created by osTimerCreate.
[in] | timer_id | timer ID obtained by osTimerCreate. |
Start or restart a timer.
[in] | timer_id | timer ID obtained by osTimerCreate. |
[in] | millisec | time delay value of the timer. |
Stop the timer.
[in] | timer_id | timer ID obtained by osTimerCreate. |
osEvent osWait | ( | uint32_t | millisec | ) |
Wait for Signal, Message, Mail, or Timeout.
[in] | millisec | CMSIS_RTOS_TimeOutValue or 0 in case of no time-out |