101 #if defined ( __CC_ARM ) 103 #define __INLINE __inline 104 #define __STATIC_INLINE static __inline 105 #elif defined ( __ICCARM__ ) 107 #define __INLINE inline 108 #define __STATIC_INLINE static inline 109 #elif defined ( __GNUC__ ) 111 #define __INLINE inline 112 #define __STATIC_INLINE static inline 207 #define osCMSIS 0x10002 209 #define osCMSIS_KERNEL 0x10000 212 #define osKernelSystemId "KERNEL V1.00" 215 #define osFeature_MainThread 1 217 #define osFeature_Pool 1 218 #define osFeature_MailQ 1 219 #define osFeature_MessageQ 1 220 #define osFeature_Signals 8 221 #define osFeature_Semaphore 1 222 #define osFeature_Wait 0 223 #define osFeature_SysTick 1 248 #define osWaitForever 0xFFFFFFFF 270 #if ( INCLUDE_eTaskGetState == 1 ) 273 osThreadRunning = 0x0,
274 osThreadReady = 0x1 ,
275 osThreadBlocked = 0x2,
276 osThreadSuspended = 0x3,
277 osThreadDeleted = 0x4,
278 osThreadError = 0x7FFFFFFF
414 #if (defined (osFeature_SysTick) && (osFeature_SysTick != 0)) // System Timer available 423 #define osKernelSysTickFrequency (configTICK_RATE_HZ) 428 #define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000) 430 #endif // System Timer available 441 #if defined (osObjectsExternal) // object is external 442 #define osThreadDef(name, thread, priority, instances, stacksz) \ 443 extern const osThreadDef_t os_thread_def_##name 444 #else // define the object 445 #define osThreadDef(name, thread, priority, instances, stacksz) \ 446 const osThreadDef_t os_thread_def_##name = \ 447 { #name, (thread), (priority), (instances), (stacksz) } 454 #define osThread(name) \ 455 &os_thread_def_##name 501 #if (defined (osFeature_Wait) && (osFeature_Wait != 0)) // Generic Wait available 507 osEvent osWait (uint32_t millisec);
509 #endif // Generic Wait available 518 #if defined (osObjectsExternal) // object is external 519 #define osTimerDef(name, function) \ 520 extern const osTimerDef_t os_timer_def_##name 521 #else // define the object 522 #define osTimerDef(name, function) \ 523 const osTimerDef_t os_timer_def_##name = \ 531 #define osTimer(name) \ 569 int32_t
osSignalSet (osThreadId thread_id, int32_t signals);
576 int32_t
osSignalClear (osThreadId thread_id, int32_t signals);
592 #if defined (osObjectsExternal) // object is external 593 #define osMutexDef(name) \ 594 extern const osMutexDef_t os_mutex_def_##name 595 #else // define the object 596 #define osMutexDef(name) \ 597 const osMutexDef_t os_mutex_def_##name = { 0 } 604 #define osMutex(name) \ 635 #if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) // Semaphore available 641 #if defined (osObjectsExternal) // object is external 642 #define osSemaphoreDef(name) \ 643 extern const osSemaphoreDef_t os_semaphore_def_##name 644 #else // define the object 645 #define osSemaphoreDef(name) \ 646 const osSemaphoreDef_t os_semaphore_def_##name = { 0 } 653 #define osSemaphore(name) \ 654 &os_semaphore_def_##name 668 int32_t
osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec);
682 #endif // Semaphore available 687 #if (defined (osFeature_Pool) && (osFeature_Pool != 0)) // Memory Pool Management available 695 #if defined (osObjectsExternal) // object is external 696 #define osPoolDef(name, no, type) \ 697 extern const osPoolDef_t os_pool_def_##name 698 #else // define the object 699 #define osPoolDef(name, no, type) \ 700 const osPoolDef_t os_pool_def_##name = \ 701 { (no), sizeof(type), NULL } 708 #define osPool(name) \ 736 #endif // Memory Pool Management available 741 #if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) // Message Queues available 749 #if defined (osObjectsExternal) // object is external 750 #define osMessageQDef(name, queue_sz, type) \ 751 extern const osMessageQDef_t os_messageQ_def_##name 752 #else // define the object 753 #define osMessageQDef(name, queue_sz, type) \ 754 const osMessageQDef_t os_messageQ_def_##name = \ 755 { (queue_sz), sizeof (type) } 762 #define osMessageQ(name) \ 763 &os_messageQ_def_##name 787 #endif // Message Queues available 792 #if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) // Mail Queues available 800 #if defined (osObjectsExternal) // object is external 801 #define osMailQDef(name, queue_sz, type) \ 802 extern struct os_mailQ_cb *os_mailQ_cb_##name \ 803 extern osMailQDef_t os_mailQ_def_##name 804 #else // define the object 805 #define osMailQDef(name, queue_sz, type) \ 806 struct os_mailQ_cb *os_mailQ_cb_##name; \ 807 const osMailQDef_t os_mailQ_def_##name = \ 808 { (queue_sz), sizeof (type), (&os_mailQ_cb_##name) } 815 #define osMailQ(name) \ 830 void *
osMailAlloc (osMailQId queue_id, uint32_t millisec);
837 void *
osMailCAlloc (osMailQId queue_id, uint32_t millisec);
860 #endif // Mail Queues available 870 #if ( INCLUDE_eTaskGetState == 1 ) 876 osThreadState osThreadGetState(osThreadId thread_id);
879 #if ( INCLUDE_eTaskGetState == 1 ) 886 osStatus osThreadIsSuspended(osThreadId thread_id);
969 #endif // _CMSIS_OS_H osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority)
Change priority of an active thread.
uint32_t item_sz
size of an item
CMSIS Cortex-M Core Function Access Header File.
uint32_t v
message as 32-bit value
resource not available: a specified resource was not available.
struct os_mailQ_cb * osMailQId
function completed; signal event occurred.
int32_t signals
signal flags
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
Delete a Semaphore.
struct os_thread_def osThreadDef_t
osPriority tpriority
initial thread priority
system cannot determine priority or thread has illegal priority.
value of a parameter is out of range.
system is out of memory: it was impossible to allocate or reserve memory for the operation.
void(* os_pthread)(void const *argument)
uint32_t item_sz
size of an item
uint32_t pool_sz
number of items (elements) in the pool
function completed; no error or event occurred.
priority: realtime (highest)
osStatus osRecursiveMutexWait(osMutexId mutex_id, uint32_t millisec)
Release a Recursive Mutex.
function completed; message event occurred.
osStatus osThreadTerminate(osThreadId thread_id)
Terminate execution of a thread and remove it from Active Threads.
osStatus osThreadSuspend(osThreadId thread_id)
Suspend execution of a thread.
os_pthread pthread
start address of thread function
struct os_mailQ_def osMailQDef_t
osStatus osMailPut(osMailQId queue_id, void *mail)
Put a mail to a queue.
osStatus osKernelInitialize(void)
unspecified RTOS error: run-time error but no other error message fits.
parameter error: a mandatory parameter was missing or specified an incorrect object.
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def, osThreadId thread_id)
Create and Initialize a Message Queue.
void * osPoolCAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool and set memory block to zero.
struct os_mutex_def osMutexDef_t
uint32_t instances
maximum number of instances of that thread function
void * p
message or mail as void pointer
void * osMailAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail.
osMailQId mail_id
mail id obtained by osMailCreate
osEvent osMessagePeek(osMessageQId queue_id, uint32_t millisec)
Receive an item from a queue without removing the item from the queue.
struct os_messageQ_def osMessageQDef_t
osStatus osMutexRelease(osMutexId mutex_id)
Release a Mutex that was obtained by osMutexWait.
uint32_t osKernelSysTick(void)
Get the value of the Kernel SysTick timer.
osStatus osThreadSuspendAll(void)
Suspend execution of a all active threads.
int32_t osKernelRunning(void)
Check if the RTOS kernel is already started.
int32_t osSignalClear(osThreadId thread_id, int32_t signals)
osStatus status
status code: event or error information
void osSystickHandler(void)
Handles the tick increment.
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
priority: normal (default)
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec)
Wait until a Mutex becomes available.
osMailQId osMailCreate(const osMailQDef_t *queue_def, osThreadId thread_id)
Create and Initialize mail queue.
osStatus osRecursiveMutexRelease(osMutexId mutex_id)
Release a Recursive Mutex.
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool.
SemaphoreHandle_t osSemaphoreId
SemaphoreHandle_t osMutexId
osStatus osMailFree(osMailQId queue_id, void *mail)
Free a memory block from a mail.
struct os_timer_def osTimerDef_t
osMessageQId message_id
message id obtained by osMessageCreate
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
function completed; timeout occurred.
osStatus osThreadList(uint8_t *buffer)
Lists all the current threads, along with their current state and stack usage high water mark...
struct os_pool_cb * osPoolId
not allowed in ISR context: the function cannot be called from interrupt service routines.
osPriority osThreadGetPriority(osThreadId thread_id)
Get current priority of an active thread.
resource not available within given time: a specified resource was not available within the timeout p...
QueueHandle_t osMessageQId
osStatus osTimerStart(osTimerId timer_id, uint32_t millisec)
Start or restart a timer.
int32_t osSignalSet(osThreadId thread_id, int32_t signals)
Set the specified Signal Flags of an active thread.
os_ptimer ptimer
start address of a timer function
uint32_t item_sz
size of an item
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *argument)
Create a thread and add it to Active Threads and set it to state READY.
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create and Initialize a Semaphore object used for managing resources.
uint32_t queue_sz
number of elements in the queue
osEvent osMessageGet(osMessageQId queue_id, uint32_t millisec)
Get a Message or Wait for a Message from a Queue.
osEvent osSignalWait(int32_t signals, uint32_t millisec)
Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
uint32_t queue_sz
number of elements in the queue
uint32_t dummy
dummy value.
uint32_t dummy
dummy value.
osStatus osTimerDelete(osTimerId timer_id)
Delete a timer.
osMutexId osMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Mutex object.
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
osStatus osMutexDelete(osMutexId mutex_id)
Delete a Mutex.
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec)
Wait until a Semaphore token becomes available.
void * osMailCAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail and set memory block to zero.
osMutexId osRecursiveMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Recursive Mutex.
prevent from enum down-size compiler optimization.
osTimerId osTimerCreate(const osTimerDef_t *timer_def, os_timer_type type, void *argument)
Create a timer.
void * pool
pointer to memory for pool
struct os_pool_def osPoolDef_t
osEvent osMailGet(osMailQId queue_id, uint32_t millisec)
Get a mail from a queue.
void(* os_ptimer)(void const *argument)
osStatus osTimerStop(osTimerId timer_id)
Stop a timer.
osThreadId osThreadGetId(void)
Return the thread ID of the current running thread.
osStatus osThreadResumeAll(void)
Resume execution of a all suspended threads.
osStatus osDelayUntil(uint32_t *PreviousWakeTime, uint32_t millisec)
Delay a task until a specified time.
struct os_semaphore_def osSemaphoreDef_t
osStatus osSemaphoreRelease(osSemaphoreId semaphore_id)
Release a Semaphore token.
osStatus osThreadYield(void)
Pass control to next thread that is in state READY.
function called multiple times from ISR with same object.
osStatus osKernelStart(void)
Start the RTOS Kernel with executing the specified thread.
function completed; mail event occurred.
osStatus osThreadResume(osThreadId thread_id)
Resume execution of a suspended thread.
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create and Initialize a memory pool.
QueueHandle_t SemaphoreHandle_t
osStatus osPoolFree(osPoolId pool_id, void *block)
Return an allocated memory block back to a specific memory pool.
system cannot determine priority or thread has illegal priority