116 #if (INCLUDE_uxTaskPriorityGet == 1) 132 static int inHandlerMode (
void)
169 #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) 179 #if (defined (osFeature_SysTick) && (osFeature_SysTick != 0)) // System Timer available 188 if (inHandlerMode()) {
195 #endif // System Timer available 225 #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) 240 #if (INCLUDE_vTaskDelete == 1) 269 #if (INCLUDE_vTaskPrioritySet == 1) 285 #if (INCLUDE_uxTaskPriorityGet == 1) 307 #if INCLUDE_vTaskDelay 320 #if (defined (osFeature_Wait) && (osFeature_Wait != 0)) 327 osEvent osWait (uint32_t millisec);
342 #if (configUSE_TIMERS == 1) 363 #if (configUSE_TIMERS == 1) 402 #if (configUSE_TIMERS == 1) 405 if (inHandlerMode()) {
432 #if (configUSE_TIMERS == 1) 434 if (inHandlerMode()) {
460 #if( configUSE_TASK_NOTIFICATIONS == 1 ) 504 #if( configUSE_TASK_NOTIFICATIONS == 1 ) 513 else if (millisec != 0) {
556 #if ( configUSE_MUTEXES == 1) 576 if (mutex_id ==
NULL) {
584 else if (millisec != 0) {
591 if (inHandlerMode()) {
615 if (inHandlerMode()) {
636 if (inHandlerMode()) {
647 #if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) 658 (void) semaphore_def;
666 #if (configUSE_COUNTING_SEMAPHORES == 1 ) 686 if (semaphore_id ==
NULL) {
694 else if (millisec != 0) {
701 if (inHandlerMode()) {
726 if (inHandlerMode()) {
749 if (inHandlerMode()) {
762 #if (defined (osFeature_Pool) && (osFeature_Pool != 0)) 787 int itemSize = 4 * ((pool_def->
item_sz + 3) / 4);
804 for (i = 0; i < pool_def->
pool_sz; i++) {
836 if (inHandlerMode()) {
843 for (i = 0; i < pool_id->
pool_sz; i++) {
845 if (index >= pool_id->
pool_sz) {
849 if (pool_id->
markers[index] == 0) {
851 p = (
void *)((uint32_t)(pool_id->
pool) + (index * pool_id->
item_sz));
857 if (inHandlerMode()) {
879 memset(p, 0,
sizeof(pool_id->
pool_sz));
896 if (pool_id ==
NULL) {
904 if (block < pool_id->
pool) {
908 index = (uint32_t)block - (uint32_t)(pool_id->
pool);
909 if (index % pool_id->
item_sz) {
912 index = index / pool_id->
item_sz;
913 if (index >= pool_id->
pool_sz) {
927 #if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) 961 if (inHandlerMode()) {
992 if (queue_id ==
NULL) {
1003 else if (millisec != 0) {
1010 if (inHandlerMode()) {
1016 event.status =
osOK;
1036 #if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) 1061 if (*(queue_def->
cb) ==
NULL) {
1064 (*(queue_def->
cb))->queue_def = queue_def;
1068 if ((*(queue_def->
cb))->handle ==
NULL) {
1075 if ((*(queue_def->
cb))->pool ==
NULL) {
1081 return *(queue_def->
cb);
1097 if (queue_id ==
NULL) {
1120 ((uint8_t *)p)[i] = 0;
1139 if (queue_id ==
NULL) {
1145 if (inHandlerMode()) {
1175 if (queue_id ==
NULL) {
1186 else if (millisec != 0) {
1193 if (inHandlerMode()) {
1199 event.status =
osOK;
1225 if (queue_id ==
NULL) {
1242 #if (INCLUDE_xTaskGetSchedulerState == 1 ) 1247 #if (INCLUDE_xTaskGetSchedulerState == 1 ) 1252 #if ( INCLUDE_eTaskGetState == 1 ) 1258 osThreadState osThreadGetState(
osThreadId thread_id)
1261 osThreadState result;
1265 switch (ThreadState)
1268 result = osThreadRunning;
1271 result = osThreadReady;
1274 result = osThreadBlocked;
1277 result = osThreadSuspended;
1280 result = osThreadDeleted;
1283 result = osThreadError;
1290 #if (INCLUDE_eTaskGetState == 1) 1311 #if (INCLUDE_vTaskSuspend == 1) 1327 #if (INCLUDE_vTaskSuspend == 1) 1379 #if INCLUDE_vTaskDelayUntil 1386 (void) PreviousWakeTime;
1401 #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) 1420 if (queue_id ==
NULL) {
1429 else if (millisec != 0) {
1457 #if (configUSE_RECURSIVE_MUTEXES == 1) 1471 #if (configUSE_RECURSIVE_MUTEXES == 1) 1492 #if (configUSE_RECURSIVE_MUTEXES == 1) 1495 if (mutex_id ==
NULL)
1505 else if (millisec != 0)
Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specifi...
osStatus osKernelStart(void)
Start the RTOS Kernel with executing the specified thread.
osThreadId osThreadGetId(void)
Return the thread ID of the current running thread.
void vPortFree(void *pv) PRIVILEGED_FUNCTION
#define xTimerChangePeriod(xTimer, xNewPeriod, xTicksToWait)
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create and Initialize a memory pool.
osStatus osDelayUntil(uint32_t *PreviousWakeTime, uint32_t millisec)
Delay a task until a specified time.
uint32_t item_sz
size of an item
#define portTICK_PERIOD_MS
uint32_t v
message as 32-bit value
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
Delete a Semaphore.
resource not available: a specified resource was not available.
UBaseType_t uxTaskPriorityGetFromISR(TaskHandle_t xTask) PRIVILEGED_FUNCTION
void vQueueDelete(QueueHandle_t xQueue) PRIVILEGED_FUNCTION
function completed; signal event occurred.
osTimerId osTimerCreate(const osTimerDef_t *timer_def, os_timer_type type, void *argument)
Create a timer.
#define xSemaphoreCreateCounting(uxMaxCount, uxInitialCount)
int32_t signals
signal flags
TaskHandle_t xTaskGetCurrentTaskHandle(void) PRIVILEGED_FUNCTION
#define xTimerStopFromISR(xTimer, pxHigherPriorityTaskWoken)
osPriority tpriority
initial thread priority
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create and Initialize a Semaphore object used for managing resources.
value of a parameter is out of range.
osStatus osMailPut(osMailQId queue_id, void *mail)
Put a mail to a queue.
union osEvent::@45 def
event definition
void vTaskPrioritySet(TaskHandle_t xTask, UBaseType_t uxNewPriority) PRIVILEGED_FUNCTION
osStatus osRecursiveMutexWait(osMutexId mutex_id, uint32_t millisec)
Release a Recursive Mutex.
void vTaskSuspendAll(void) PRIVILEGED_FUNCTION
int32_t osSignalSet(osThreadId thread_id, int32_t signal)
Set the specified Signal Flags of an active thread.
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.
osStatus osKernelInitialize(void)
Initialize the RTOS Kernel for creating objects.
TimerHandle_t xTimerCreate(const char *const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void *const pvTimerID, TimerCallbackFunction_t pxCallbackFunction) PRIVILEGED_FUNCTION
struct os_pool_cb os_pool_cb_t
priority: realtime (highest)
uint32_t osKernelSysTick(void)
Get the value of the Kernel SysTick timer.
#define taskSCHEDULER_NOT_STARTED
function completed; message event occurred.
void osSystickHandler(void)
Handles the tick increment.
#define vSemaphoreDelete(xSemaphore)
os_pthread pthread
start address of thread function
BaseType_t xTaskResumeFromISR(TaskHandle_t xTaskToResume) PRIVILEGED_FUNCTION
void * pvPortMalloc(size_t xSize) PRIVILEGED_FUNCTION
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedStatusValue)
osMailQId osMailCreate(const osMailQDef_t *queue_def, osThreadId thread_id)
Create and Initialize mail queue.
osStatus osThreadResumeAll(void)
Resume execution of a all suspended threads.
void vTaskList(char *pcWriteBuffer) PRIVILEGED_FUNCTION
unspecified RTOS error: run-time error but no other error message fits.
void vPortEnterCritical(void)
parameter error: a mandatory parameter was missing or specified an incorrect object.
#define xQueueReceive(xQueue, pvBuffer, xTicksToWait)
#define xTaskNotifyFromISR(xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken)
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec)
Wait until a Mutex becomes available.
void * p
message or mail as void pointer
osStatus osMutexRelease(osMutexId mutex_id)
Release a Mutex that was obtained by osMutexWait.
osMailQId mail_id
mail id obtained by osMailCreate
#define portSET_INTERRUPT_MASK_FROM_ISR()
#define xTimerChangePeriodFromISR(xTimer, xNewPeriod, pxHigherPriorityTaskWoken)
osMutexId osRecursiveMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Recursive Mutex.
void vTaskStartScheduler(void) PRIVILEGED_FUNCTION
BaseType_t xTaskNotifyWait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait) PRIVILEGED_FUNCTION
#define xTimerDelete(xTimer, xTicksToWait)
UBaseType_t uxTaskPriorityGet(TaskHandle_t xTask) PRIVILEGED_FUNCTION
TickType_t xTaskGetTickCountFromISR(void) PRIVILEGED_FUNCTION
osStatus status
status code: event or error information
#define xSemaphoreTakeRecursive(xMutex, xBlockTime)
osStatus osThreadSuspendAll(void)
Suspend execution of a all active threads.
osStatus osThreadSuspend(osThreadId thread_id)
Suspend execution of a thread.
TickType_t xTaskGetTickCount(void) PRIVILEGED_FUNCTION
int32_t osKernelRunning(void)
Check if the RTOS kernel is already started.
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def, osThreadId thread_id)
Create and Initialize a Message Queue.
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool.
#define portYIELD_FROM_ISR(x)
osStatus osSemaphoreRelease(osSemaphoreId semaphore_id)
Release a Semaphore token.
osStatus osMailFree(osMailQId queue_id, void *mail)
Free a memory block from a mail.
void vTaskDelete(TaskHandle_t xTaskToDelete) PRIVILEGED_FUNCTION
#define osWaitForever
wait forever timeout value
SemaphoreHandle_t osSemaphoreId
#define xTimerStop(xTimer, xTicksToWait)
SemaphoreHandle_t osMutexId
void vTaskDelayUntil(TickType_t *const pxPreviousWakeTime, const TickType_t xTimeIncrement) PRIVILEGED_FUNCTION
osStatus osThreadList(uint8_t *buffer)
Lists all the current threads, along with their current state and stack usage high water mark...
#define xQueuePeek(xQueue, pvBuffer, xTicksToWait)
void vTaskSuspend(TaskHandle_t xTaskToSuspend) PRIVILEGED_FUNCTION
osEvent osSignalWait(int32_t signals, uint32_t millisec)
Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
osMessageQId message_id
message id obtained by osMessageCreate
void * osMailAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail.
#define xQueueSend(xQueue, pvItemToQueue, xTicksToWait)
function completed; timeout occurred.
union osEvent::@44 value
event value
int32_t osSignalClear(osThreadId thread_id, int32_t signal)
Clear the specified Signal Flags of an active thread.
not allowed in ISR context: the function cannot be called from interrupt service routines.
osStatus osThreadTerminate(osThreadId thread_id)
Terminate execution of a thread and remove it from Active Threads.
osStatus osTimerDelete(osTimerId timer_id)
Delete a timer.
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *argument)
Create a thread and add it to Active Threads and set it to state READY.
struct os_mailQ_cb os_mailQ_cb_t
QueueHandle_t osMessageQId
os_ptimer ptimer
start address of a timer function
#define xSemaphoreGive(xSemaphore)
#define xSemaphoreTake(xSemaphore, xBlockTime)
osPriority osThreadGetPriority(osThreadId thread_id)
Get current priority of an active thread.
void vTaskResume(TaskHandle_t xTaskToResume) PRIVILEGED_FUNCTION
uint32_t item_sz
size of an item
#define xSemaphoreTakeFromISR(xSemaphore, pxHigherPriorityTaskWoken)
BaseType_t xQueueReceiveFromISR(QueueHandle_t xQueue, void *const pvBuffer, BaseType_t *const pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION
#define xTaskNotify(xTaskToNotify, ulValue, eAction)
osStatus osTimerStart(osTimerId timer_id, uint32_t millisec)
Start or restart a timer.
BaseType_t xTaskResumeAll(void) PRIVILEGED_FUNCTION
uint32_t queue_sz
number of elements in the queue
BaseType_t xTaskGetSchedulerState(void) PRIVILEGED_FUNCTION
uint32_t queue_sz
number of elements in the queue
osStatus osRecursiveMutexRelease(osMutexId mutex_id)
Release a Recursive Mutex.
osStatus osMutexDelete(osMutexId mutex_id)
Delete a Mutex.
#define xSemaphoreCreateRecursiveMutex()
const osMailQDef_t * queue_def
void * osPoolCAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool and set memory block to zero.
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority)
Change priority of an active thread.
osStatus osThreadYield(void)
Pass control to next thread that is in state READY.
osEvent osMessagePeek(osMessageQId queue_id, uint32_t millisec)
Receive an item from a queue without removing the item from the queue.
__STATIC_INLINE uint32_t __get_IPSR(void)
Get IPSR Register.
osEvent osMailGet(osMailQId queue_id, uint32_t millisec)
Get a mail from a queue.
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
void vTaskDelay(const TickType_t xTicksToDelay) PRIVILEGED_FUNCTION
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec)
Wait until a Semaphore token becomes available.
#define xSemaphoreGiveRecursive(xMutex)
osEvent osMessageGet(osMessageQId queue_id, uint32_t millisec)
Get a Message or Wait for a Message from a Queue.
#define vSemaphoreCreateBinary(xSemaphore)
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
#define portEND_SWITCHING_ISR(xSwitchRequired)
#define xQueueCreate(uxQueueLength, uxItemSize)
void xPortSysTickHandler(void)
osMutexId osMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Mutex object.
#define xTaskCreate(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask)
osStatus osTimerStop(osTimerId timer_id)
Stop a timer.
osStatus osThreadResume(osThreadId thread_id)
Resume execution of a suspended thread.
void * osMailCAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail and set memory block to zero.
#define xQueueSendFromISR(xQueue, pvItemToQueue, pxHigherPriorityTaskWoken)
#define xSemaphoreCreateMutex()
void(* TaskFunction_t)(void *)
osStatus osPoolFree(osPoolId pool_id, void *block)
Return an allocated memory block back to a specific memory pool.
#define xSemaphoreGiveFromISR(xSemaphore, pxHigherPriorityTaskWoken)
eTaskState eTaskGetState(TaskHandle_t xTask) PRIVILEGED_FUNCTION
function completed; mail event occurred.
void vPortExitCritical(void)
system cannot determine priority or thread has illegal priority