|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
#include <stdlib.h>#include <string.h>#include "FreeRTOS.h"#include "task.h"#include "timers.h"#include "stack_macros.h"Go to the source code of this file.
Classes | |
| struct | tskTaskControlBlock |
Typedefs | |
| typedef struct tskTaskControlBlock | tskTCB |
| typedef tskTCB | TCB_t |
| #define configIDLE_TASK_NAME "IDLE" |
Definition at line 115 of file tasks.c.
Referenced by vTaskStartScheduler().
| #define portRESET_READY_PRIORITY | ( | uxPriority, | |
| uxTopReadyPriority ) |
Definition at line 158 of file tasks.c.
Referenced by prvAddCurrentTaskToDelayedList().
| #define prvAddTaskToReadyList | ( | pxTCB | ) |
Definition at line 220 of file tasks.c.
Referenced by prvAddNewTaskToReadyList(), vTaskRemoveFromUnorderedEventList(), xTaskIncrementTick(), xTaskRemoveFromEventList(), and xTaskResumeAll().
| #define prvGetTCBFromHandle | ( | pxHandle | ) |
Definition at line 235 of file tasks.c.
Referenced by pcTaskGetName().
| #define taskEVENT_LIST_ITEM_VALUE_IN_USE 0x8000U |
Definition at line 246 of file tasks.c.
Referenced by vTaskPlaceOnUnorderedEventList(), and vTaskRemoveFromUnorderedEventList().
| #define taskNOT_WAITING_NOTIFICATION ( ( uint8_t ) 0 ) /* Must be zero as it is the initialised value. */ |
| #define taskRECORD_READY_PRIORITY | ( | uxPriority | ) |
| #define taskSELECT_HIGHEST_PRIORITY_TASK | ( | ) |
Definition at line 136 of file tasks.c.
Referenced by vTaskSwitchContext().
| #define taskSWITCH_DELAYED_LISTS | ( | ) |
Definition at line 200 of file tasks.c.
Referenced by xTaskIncrementTick().
| #define taskYIELD_IF_USING_PREEMPTION | ( | ) |
Definition at line 65 of file tasks.c.
Referenced by prvAddNewTaskToReadyList(), and xTaskResumeAll().
| #define tskDYNAMICALLY_ALLOCATED_STACK_AND_TCB ( ( uint8_t ) 0 ) |
| #define tskSTATICALLY_ALLOCATED_STACK_AND_TCB ( ( uint8_t ) 2 ) |
Definition at line 84 of file tasks.c.
Referenced by prvInitialiseTaskLists().
| typedef struct tskTaskControlBlock tskTCB |
| char * pcTaskGetName | ( | TaskHandle_t | xTaskToQuery | ) |
Definition at line 2353 of file tasks.c.
References configASSERT, tskTaskControlBlock::pcTaskName, and prvGetTCBFromHandle.
Referenced by osThreadGetName().
|
static |
THIS IS THE RTOS IDLE TASK - WHICH IS CREATED AUTOMATICALLY WHEN THE SCHEDULER IS STARTED.
Definition at line 3488 of file tasks.c.
References configASSERT, configEXPECTED_IDLE_TIME_BEFORE_SLEEP, configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING, listCURRENT_LIST_LENGTH, mtCOVERAGE_TEST_MARKER, portALLOCATE_SECURE_CONTEXT, portSUPPRESS_TICKS_AND_SLEEP, prvCheckTasksWaitingTermination(), pxReadyTasksLists, taskYIELD, traceLOW_POWER_IDLE_BEGIN, traceLOW_POWER_IDLE_END, tskIDLE_PRIORITY, vApplicationIdleHook(), vTaskSuspendAll(), xNextTaskUnblockTime, xTaskResumeAll(), and xTickCount.
|
static |
Definition at line 5386 of file tasks.c.
References listINSERT_END, listSET_LIST_ITEM_VALUE, mtCOVERAGE_TEST_MARKER, pdFALSE, portMAX_DELAY, portRESET_READY_PRIORITY, pxCurrentTCB, pxDelayedTaskList, pxOverflowDelayedTaskList, uxListRemove(), uxTopReadyPriority, vListInsert(), xNextTaskUnblockTime, and xTickCount.
Referenced by vTaskPlaceOnEventList(), and vTaskPlaceOnUnorderedEventList().
|
static |
Definition at line 1029 of file tasks.c.
References mtCOVERAGE_TEST_MARKER, NULL, pdFALSE, portSETUP_TCB, prvAddTaskToReadyList, prvInitialiseTaskLists(), pxCurrentTCB, taskENTER_CRITICAL, taskEXIT_CRITICAL, taskYIELD_IF_USING_PREEMPTION, traceTASK_CREATE, uxCurrentNumberOfTasks, tskTaskControlBlock::uxPriority, uxTaskNumber, and xSchedulerRunning.
Referenced by prvInitialiseTaskLists().
|
static |
THIS FUNCTION IS CALLED FROM THE RTOS IDLE TASK
Definition at line 3744 of file tasks.c.
References listGET_OWNER_OF_HEAD_ENTRY, taskENTER_CRITICAL, taskEXIT_CRITICAL, uxCurrentNumberOfTasks, uxListRemove(), and tskTaskControlBlock::xStateListItem.
Referenced by portTASK_FUNCTION().
|
static |
Utility task that simply returns pdTRUE if the task referenced by xTask is currently in the Suspended state, or pdFALSE if the task referenced by xTask is in any other state.
Definition at line 421 of file tasks.c.
References configASSERT, configSTACK_DEPTH_TYPE, NULL, PRIVILEGED_FUNCTION, prvAddNewTaskToReadyList(), and tskSTATICALLY_ALLOCATED_STACK_AND_TCB.
|
static |
Definition at line 3712 of file tasks.c.
References configMAX_PRIORITIES, pxDelayedTaskList, pxOverflowDelayedTaskList, pxReadyTasksLists, vListInitialise(), xDelayedTaskList1, xDelayedTaskList2, and xPendingReadyList.
Referenced by prvAddNewTaskToReadyList().
|
static |
Definition at line 4066 of file tasks.c.
References listGET_ITEM_VALUE_OF_HEAD_ENTRY, listLIST_IS_EMPTY, pdFALSE, portMAX_DELAY, pxDelayedTaskList, and xNextTaskUnblockTime.
Referenced by vTaskRemoveFromUnorderedEventList(), xTaskRemoveFromEventList(), and xTaskResumeAll().
| UBaseType_t uxTaskGetNumberOfTasks | ( | void | ) |
Definition at line 2345 of file tasks.c.
References uxCurrentNumberOfTasks.
Referenced by osThreadEnumerate(), and osThreadGetCount().
| TickType_t uxTaskResetEventItemValue | ( | void | ) |
Definition at line 4725 of file tasks.c.
References configMAX_PRIORITIES, listGET_LIST_ITEM_VALUE, listSET_LIST_ITEM_VALUE, and pxCurrentTCB.
Referenced by xEventGroupSync(), and xEventGroupWaitBits().
| void vTaskEndScheduler | ( | void | ) |
Definition at line 2092 of file tasks.c.
References pdFALSE, portDISABLE_INTERRUPTS, vPortEndScheduler(), and xSchedulerRunning.
| void vTaskInternalSetTimeOutState | ( | TimeOut_t *const | pxTimeOut | ) |
Definition at line 3358 of file tasks.c.
References xNumOfOverflows, xTIME_OUT::xOverflowCount, xTickCount, and xTIME_OUT::xTimeOnEntering.
Referenced by xQueueGenericSend(), xQueuePeek(), xQueueReceive(), xQueueSemaphoreTake(), and xTaskCheckForTimeOut().
| void vTaskMissedYield | ( | void | ) |
Definition at line 3431 of file tasks.c.
References pdTRUE, and xYieldPending.
Referenced by prvUnlockQueue().
| void vTaskPlaceOnEventList | ( | List_t *const | pxEventList, |
| const TickType_t | xTicksToWait ) |
Definition at line 3143 of file tasks.c.
References configASSERT, pdTRUE, prvAddCurrentTaskToDelayedList(), pxCurrentTCB, and vListInsert().
Referenced by xQueueGenericSend(), xQueuePeek(), xQueueReceive(), and xQueueSemaphoreTake().
| void vTaskPlaceOnUnorderedEventList | ( | List_t * | pxEventList, |
| const TickType_t | xItemValue, | ||
| const TickType_t | xTicksToWait ) |
Definition at line 3168 of file tasks.c.
References configASSERT, listINSERT_END, listSET_LIST_ITEM_VALUE, pdTRUE, prvAddCurrentTaskToDelayedList(), pxCurrentTCB, taskEVENT_LIST_ITEM_VALUE_IN_USE, and uxSchedulerSuspended.
Referenced by xEventGroupSync(), and xEventGroupWaitBits().
| void vTaskRemoveFromUnorderedEventList | ( | ListItem_t * | pxEventListItem, |
| const TickType_t | xItemValue ) |
Definition at line 3297 of file tasks.c.
References configASSERT, listGET_LIST_ITEM_OWNER, listREMOVE_ITEM, listSET_LIST_ITEM_VALUE, pdTRUE, prvAddTaskToReadyList, prvResetNextTaskUnblockTime(), pxCurrentTCB, taskEVENT_LIST_ITEM_VALUE_IN_USE, tskTaskControlBlock::uxPriority, uxSchedulerSuspended, tskTaskControlBlock::xStateListItem, and xYieldPending.
Referenced by vEventGroupDelete(), and xEventGroupSetBits().
| void vTaskSetTimeOutState | ( | TimeOut_t *const | pxTimeOut | ) |
Definition at line 3346 of file tasks.c.
References configASSERT, taskENTER_CRITICAL, taskEXIT_CRITICAL, xNumOfOverflows, xTIME_OUT::xOverflowCount, xTickCount, and xTIME_OUT::xTimeOnEntering.
Referenced by xStreamBufferSend().
| void vTaskStartScheduler | ( | void | ) |
Definition at line 1967 of file tasks.c.
References configASSERT, configIDLE_TASK_NAME, configINITIAL_TICK_COUNT, configMINIMAL_STACK_SIZE, configSET_TLS_BLOCK, errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY, mtCOVERAGE_TEST_MARKER, NULL, pdFAIL, pdPASS, pdTRUE, portCONFIGURE_TIMER_FOR_RUN_TIME_STATS, portDISABLE_INTERRUPTS, portMAX_DELAY, portPRIVILEGE_BIT, pxCurrentTCB, traceTASK_SWITCHED_IN, uxTopUsedPriority, xIdleTaskHandle, xNextTaskUnblockTime, xPortStartScheduler(), xSchedulerRunning, xTickCount, and xTimerCreateTimerTask().
Referenced by osKernelStart().
| void vTaskSuspendAll | ( | void | ) |
Definition at line 2103 of file tasks.c.
References portMEMORY_BARRIER, portSOFTWARE_BARRIER, and uxSchedulerSuspended.
Referenced by board_sleep(), osKernelLock(), osKernelRestoreLock(), osThreadEnumerate(), portTASK_FUNCTION(), prvHeapInit(), vEventGroupDelete(), vPortFree(), vPortGetHeapStats(), xEventGroupSetBits(), xEventGroupSync(), xEventGroupWaitBits(), xQueueGenericSend(), xQueuePeek(), xQueueReceive(), xQueueSemaphoreTake(), and xTaskCatchUpTicks().
| void vTaskSwitchContext | ( | void | ) |
Definition at line 3069 of file tasks.c.
References configRUN_TIME_COUNTER_TYPE, configSET_TLS_BLOCK, mtCOVERAGE_TEST_MARKER, pdFALSE, pdTRUE, pxCurrentTCB, taskCHECK_FOR_STACK_OVERFLOW, taskSELECT_HIGHEST_PRIORITY_TASK, traceTASK_SWITCHED_IN, traceTASK_SWITCHED_OUT, uxSchedulerSuspended, and xYieldPending.
Referenced by xPortStartScheduler().
| BaseType_t xTaskCatchUpTicks | ( | TickType_t | xTicksToCatchUp | ) |
Definition at line 2676 of file tasks.c.
References configASSERT, taskENTER_CRITICAL, taskEXIT_CRITICAL, uxSchedulerSuspended, vTaskSuspendAll(), xPendedTicks, and xTaskResumeAll().
Referenced by board_sleep().
| BaseType_t xTaskCheckForTimeOut | ( | TimeOut_t *const | pxTimeOut, |
| TickType_t *const | pxTicksToWait ) |
Definition at line 3366 of file tasks.c.
References configASSERT, pdFALSE, pdTRUE, portMAX_DELAY, pxCurrentTCB, taskENTER_CRITICAL, taskEXIT_CRITICAL, vTaskInternalSetTimeOutState(), xNumOfOverflows, xTIME_OUT::xOverflowCount, xTickCount, and xTIME_OUT::xTimeOnEntering.
Referenced by xQueueGenericSend(), xQueuePeek(), xQueueReceive(), xQueueSemaphoreTake(), and xStreamBufferSend().
| TickType_t xTaskGetTickCount | ( | void | ) |
Definition at line 2299 of file tasks.c.
References portTICK_TYPE_ENTER_CRITICAL, portTICK_TYPE_EXIT_CRITICAL, and xTickCount.
Referenced by osDelayUntil(), osKernelGetSysTimerCount(), and osKernelGetTickCount().
| TickType_t xTaskGetTickCountFromISR | ( | void | ) |
Definition at line 2314 of file tasks.c.
References portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR, portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR, and xTickCount.
Referenced by osKernelGetTickCount().
| BaseType_t xTaskIncrementTick | ( | void | ) |
Definition at line 2780 of file tasks.c.
References listCURRENT_LIST_LENGTH, listGET_LIST_ITEM_VALUE, listGET_OWNER_OF_HEAD_ENTRY, listLIST_IS_EMPTY, listLIST_ITEM_CONTAINER, listREMOVE_ITEM, mtCOVERAGE_TEST_MARKER, NULL, pdFALSE, pdTRUE, portMAX_DELAY, prvAddTaskToReadyList, pxCurrentTCB, pxDelayedTaskList, pxReadyTasksLists, taskSWITCH_DELAYED_LISTS, traceTASK_INCREMENT_TICK, tskTaskControlBlock::uxPriority, uxSchedulerSuspended, tskTaskControlBlock::xEventListItem, xNextTaskUnblockTime, xPendedTicks, tskTaskControlBlock::xStateListItem, xTickCount, and xYieldPending.
Referenced by xPortSysTickHandler(), and xTaskResumeAll().
| BaseType_t xTaskRemoveFromEventList | ( | const List_t *const | pxEventList | ) |
Definition at line 3229 of file tasks.c.
References configASSERT, listGET_OWNER_OF_HEAD_ENTRY, listINSERT_END, listREMOVE_ITEM, pdFALSE, pdTRUE, prvAddTaskToReadyList, prvResetNextTaskUnblockTime(), pxCurrentTCB, tskTaskControlBlock::uxPriority, uxSchedulerSuspended, tskTaskControlBlock::xEventListItem, xPendingReadyList, tskTaskControlBlock::xStateListItem, and xYieldPending.
Referenced by prvUnlockQueue(), xQueueGenericReset(), xQueueGenericSend(), xQueueGenericSendFromISR(), xQueueGiveFromISR(), xQueuePeek(), xQueueReceive(), xQueueReceiveFromISR(), and xQueueSemaphoreTake().
| BaseType_t xTaskResumeAll | ( | void | ) |
Definition at line 2187 of file tasks.c.
References configASSERT, listGET_OWNER_OF_HEAD_ENTRY, listLIST_IS_EMPTY, listREMOVE_ITEM, mtCOVERAGE_TEST_MARKER, NULL, pdFALSE, pdTRUE, portMEMORY_BARRIER, prvAddTaskToReadyList, prvResetNextTaskUnblockTime(), pxCurrentTCB, taskENTER_CRITICAL, taskEXIT_CRITICAL, taskYIELD_IF_USING_PREEMPTION, uxCurrentNumberOfTasks, tskTaskControlBlock::uxPriority, uxSchedulerSuspended, tskTaskControlBlock::xEventListItem, xPendedTicks, xPendingReadyList, tskTaskControlBlock::xStateListItem, xTaskIncrementTick(), and xYieldPending.
Referenced by board_sleep(), osKernelRestoreLock(), osKernelUnlock(), osThreadEnumerate(), portTASK_FUNCTION(), prvHeapInit(), vEventGroupDelete(), vPortFree(), vPortGetHeapStats(), xEventGroupSetBits(), xEventGroupSync(), xEventGroupWaitBits(), xQueueGenericSend(), xQueuePeek(), xQueueReceive(), xQueueSemaphoreTake(), and xTaskCatchUpTicks().
| portDONT_DISCARD PRIVILEGED_DATA TCB_t* volatile pxCurrentTCB = NULL |
Definition at line 332 of file tasks.c.
Referenced by prvAddCurrentTaskToDelayedList(), prvAddNewTaskToReadyList(), uxTaskResetEventItemValue(), vTaskPlaceOnEventList(), vTaskPlaceOnUnorderedEventList(), vTaskRemoveFromUnorderedEventList(), vTaskStartScheduler(), vTaskSwitchContext(), xTaskCheckForTimeOut(), xTaskIncrementTick(), xTaskRemoveFromEventList(), and xTaskResumeAll().
|
static |
Points to the delayed task list currently being used.
Definition at line 341 of file tasks.c.
Referenced by prvAddCurrentTaskToDelayedList(), prvInitialiseTaskLists(), prvResetNextTaskUnblockTime(), and xTaskIncrementTick().
|
static |
Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count.
Definition at line 342 of file tasks.c.
Referenced by prvAddCurrentTaskToDelayedList(), and prvInitialiseTaskLists().
|
static |
Prioritised ready tasks.
Definition at line 338 of file tasks.c.
Referenced by portTASK_FUNCTION(), prvInitialiseTaskLists(), and xTaskIncrementTick().
|
static |
Definition at line 365 of file tasks.c.
Referenced by prvAddNewTaskToReadyList(), prvCheckTasksWaitingTermination(), uxTaskGetNumberOfTasks(), and xTaskResumeAll().
|
static |
Definition at line 389 of file tasks.c.
Referenced by vTaskPlaceOnUnorderedEventList(), vTaskRemoveFromUnorderedEventList(), vTaskSuspendAll(), vTaskSwitchContext(), xTaskCatchUpTicks(), xTaskIncrementTick(), xTaskRemoveFromEventList(), and xTaskResumeAll().
|
static |
Definition at line 372 of file tasks.c.
Referenced by prvAddNewTaskToReadyList().
|
static |
Definition at line 367 of file tasks.c.
Referenced by prvAddCurrentTaskToDelayedList().
| const volatile UBaseType_t uxTopUsedPriority = configMAX_PRIORITIES - 1U |
Definition at line 379 of file tasks.c.
Referenced by vTaskStartScheduler().
|
static |
|
static |
Delayed tasks (two lists are used - one for delays that have overflowed the current tick count.
Definition at line 340 of file tasks.c.
Referenced by prvInitialiseTaskLists().
|
static |
Holds the handle of the idle task.
The idle task is created automatically when the scheduler is started.
Definition at line 374 of file tasks.c.
Referenced by vTaskStartScheduler().
|
static |
Definition at line 373 of file tasks.c.
Referenced by portTASK_FUNCTION(), prvAddCurrentTaskToDelayedList(), prvResetNextTaskUnblockTime(), vTaskStartScheduler(), and xTaskIncrementTick().
|
static |
Definition at line 371 of file tasks.c.
Referenced by vTaskInternalSetTimeOutState(), vTaskSetTimeOutState(), and xTaskCheckForTimeOut().
|
static |
Definition at line 369 of file tasks.c.
Referenced by xTaskCatchUpTicks(), xTaskIncrementTick(), and xTaskResumeAll().
|
static |
Tasks that have been readied while the scheduler was suspended.
They will be moved to the ready list when the scheduler is resumed.
Definition at line 343 of file tasks.c.
Referenced by prvInitialiseTaskLists(), xTaskRemoveFromEventList(), and xTaskResumeAll().
|
static |
Definition at line 368 of file tasks.c.
Referenced by prvAddNewTaskToReadyList(), vTaskEndScheduler(), and vTaskStartScheduler().
|
static |
Definition at line 366 of file tasks.c.
Referenced by portTASK_FUNCTION(), prvAddCurrentTaskToDelayedList(), vTaskInternalSetTimeOutState(), vTaskSetTimeOutState(), vTaskStartScheduler(), xTaskCheckForTimeOut(), xTaskGetTickCount(), xTaskGetTickCountFromISR(), and xTaskIncrementTick().
|
static |
Definition at line 370 of file tasks.c.
Referenced by vTaskMissedYield(), vTaskRemoveFromUnorderedEventList(), vTaskSwitchContext(), xTaskIncrementTick(), xTaskRemoveFromEventList(), and xTaskResumeAll().