Classes | Macros | Typedefs | Functions | Variables
tasks.c File Reference
#include <stdlib.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "stack_macros.h"
Include dependency graph for tasks.c:

Go to the source code of this file.

Classes

struct  tskTaskControlBlock
 

Macros

#define configIDLE_TASK_NAME   "IDLE"
 
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
 
#define portRESET_READY_PRIORITY(uxPriority, uxTopReadyPriority)
 
#define prvAddTaskToReadyList(pxTCB)
 
#define prvGetTCBFromHandle(pxHandle)   ( ( ( pxHandle ) == NULL ) ? ( TCB_t * ) pxCurrentTCB : ( TCB_t * ) ( pxHandle ) )
 
#define taskEVENT_LIST_ITEM_VALUE_IN_USE   0x80000000UL
 
#define taskNOT_WAITING_NOTIFICATION   ( ( uint8_t ) 0 )
 
#define taskNOTIFICATION_RECEIVED   ( ( uint8_t ) 2 )
 
#define taskRECORD_READY_PRIORITY(uxPriority)
 
#define taskRESET_READY_PRIORITY(uxPriority)
 
#define taskSELECT_HIGHEST_PRIORITY_TASK()
 
#define taskSWITCH_DELAYED_LISTS()
 
#define taskWAITING_NOTIFICATION   ( ( uint8_t ) 1 )
 
#define taskYIELD_IF_USING_PREEMPTION()
 
#define tskBLOCKED_CHAR   ( 'B' )
 
#define tskDELETED_CHAR   ( 'D' )
 
#define tskDYNAMICALLY_ALLOCATED_STACK_AND_TCB   ( ( uint8_t ) 0 )
 
#define tskREADY_CHAR   ( 'R' )
 
#define tskSET_NEW_STACKS_TO_KNOWN_VALUE   0
 
#define tskSTACK_FILL_BYTE   ( 0xa5U )
 
#define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE   ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
 
#define tskSTATICALLY_ALLOCATED_STACK_AND_TCB   ( ( uint8_t ) 2 )
 
#define tskSTATICALLY_ALLOCATED_STACK_ONLY   ( ( uint8_t ) 1 )
 
#define tskSUSPENDED_CHAR   ( 'S' )
 

Typedefs

typedef tskTCB TCB_t
 
typedef struct tskTaskControlBlock tskTCB
 

Functions

char * pcTaskGetName (TaskHandle_t xTaskToQuery)
 
static portTASK_FUNCTION (prvIdleTask, pvParameters)
 
static void prvAddCurrentTaskToDelayedList (TickType_t xTicksToWait, const BaseType_t xCanBlockIndefinitely)
 
static void prvAddNewTaskToReadyList (TCB_t *pxNewTCB)
 
static void prvCheckTasksWaitingTermination (void)
 
static void prvInitialiseTaskLists (static void prvCheckTasksWaitingTermination void)
 
static void prvInitialiseTaskLists (void)
 
static void prvResetNextTaskUnblockTime (void)
 
UBaseType_t uxTaskGetNumberOfTasks (void)
 
TickType_t uxTaskResetEventItemValue (void)
 
void vTaskEndScheduler (void)
 
void vTaskInternalSetTimeOutState (TimeOut_t *const pxTimeOut)
 
void vTaskMissedYield (void)
 
void vTaskPlaceOnEventList (List_t *const pxEventList, const TickType_t xTicksToWait)
 
void vTaskPlaceOnUnorderedEventList (List_t *pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait)
 
void vTaskRemoveFromUnorderedEventList (ListItem_t *pxEventListItem, const TickType_t xItemValue)
 
void vTaskSetTimeOutState (TimeOut_t *const pxTimeOut)
 
void vTaskStartScheduler (TaskHandle_t *idleTaskHandle, TaskHandle_t *timerTaskHandle)
 
void vTaskSuspendAll (void)
 
void vTaskSwitchContext (void)
 
BaseType_t xTaskCheckForTimeOut (TimeOut_t *const pxTimeOut, TickType_t *const pxTicksToWait)
 
TickType_t xTaskGetTickCount (void)
 
TickType_t xTaskGetTickCountFromISR (void)
 
BaseType_t xTaskIncrementTick (void)
 
BaseType_t xTaskRemoveFromEventList (const List_t *const pxEventList)
 
BaseType_t xTaskResumeAll (void)
 

Variables

PRIVILEGED_DATA TCB_t *volatile pxCurrentTCB = NULL
 
static PRIVILEGED_DATA List_t *volatile pxDelayedTaskList
 
static PRIVILEGED_DATA List_t *volatile pxOverflowDelayedTaskList
 
static PRIVILEGED_DATA List_t pxReadyTasksLists [configMAX_PRIORITIES]
 
static PRIVILEGED_DATA volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U
 
static PRIVILEGED_DATA volatile UBaseType_t uxPendedTicks = ( UBaseType_t ) 0U
 
static PRIVILEGED_DATA volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE
 
static PRIVILEGED_DATA UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U
 
static PRIVILEGED_DATA volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY
 
static PRIVILEGED_DATA List_t xDelayedTaskList1
 
static PRIVILEGED_DATA List_t xDelayedTaskList2
 
static PRIVILEGED_DATA TaskHandle_t xIdleTaskHandle = NULL
 
static PRIVILEGED_DATA volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U
 
static PRIVILEGED_DATA volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0
 
static PRIVILEGED_DATA List_t xPendingReadyList
 
static PRIVILEGED_DATA volatile BaseType_t xSchedulerRunning = pdFALSE
 
static PRIVILEGED_DATA volatile TickType_t xTickCount = ( TickType_t ) configINITIAL_TICK_COUNT
 
static PRIVILEGED_DATA volatile BaseType_t xYieldPending = pdFALSE
 

Macro Definition Documentation

◆ configIDLE_TASK_NAME

#define configIDLE_TASK_NAME   "IDLE"

Definition at line 129 of file tasks.c.

◆ MPU_WRAPPERS_INCLUDED_FROM_API_FILE

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE

Definition at line 36 of file tasks.c.

◆ portRESET_READY_PRIORITY

#define portRESET_READY_PRIORITY (   uxPriority,
  uxTopReadyPriority 
)

Definition at line 173 of file tasks.c.

◆ prvAddTaskToReadyList

#define prvAddTaskToReadyList (   pxTCB)
Value:
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
static PRIVILEGED_DATA List_t pxReadyTasksLists[configMAX_PRIORITIES]
Definition: tasks.c:351
#define traceMOVED_TASK_TO_READY_STATE(pxTCB)
Definition: FreeRTOS.h:389

Definition at line 235 of file tasks.c.

◆ prvGetTCBFromHandle

#define prvGetTCBFromHandle (   pxHandle)    ( ( ( pxHandle ) == NULL ) ? ( TCB_t * ) pxCurrentTCB : ( TCB_t * ) ( pxHandle ) )

Definition at line 248 of file tasks.c.

◆ taskEVENT_LIST_ITEM_VALUE_IN_USE

#define taskEVENT_LIST_ITEM_VALUE_IN_USE   0x80000000UL

Definition at line 261 of file tasks.c.

◆ taskNOT_WAITING_NOTIFICATION

#define taskNOT_WAITING_NOTIFICATION   ( ( uint8_t ) 0 )

Definition at line 69 of file tasks.c.

◆ taskNOTIFICATION_RECEIVED

#define taskNOTIFICATION_RECEIVED   ( ( uint8_t ) 2 )

Definition at line 71 of file tasks.c.

◆ taskRECORD_READY_PRIORITY

#define taskRECORD_READY_PRIORITY (   uxPriority)
Value:
{ \
if( ( uxPriority ) > uxTopReadyPriority ) \
{ \
uxTopReadyPriority = ( uxPriority ); \
} \
} /* taskRECORD_READY_PRIORITY */
static PRIVILEGED_DATA volatile UBaseType_t uxTopReadyPriority
Definition: tasks.c:374

Definition at line 140 of file tasks.c.

◆ taskRESET_READY_PRIORITY

#define taskRESET_READY_PRIORITY (   uxPriority)

Definition at line 172 of file tasks.c.

◆ taskSELECT_HIGHEST_PRIORITY_TASK

#define taskSELECT_HIGHEST_PRIORITY_TASK ( )
Value:
{ \
UBaseType_t uxTopPriority = uxTopReadyPriority; \
\
/* Find the highest priority queue that contains ready tasks. */ \
while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopPriority ] ) ) ) \
{ \
configASSERT( uxTopPriority ); \
--uxTopPriority; \
} \
\
/* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of \
the same priority get an equal share of the processor time. */ \
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
uxTopReadyPriority = uxTopPriority; \
} /* taskSELECT_HIGHEST_PRIORITY_TASK */
static PRIVILEGED_DATA List_t pxReadyTasksLists[configMAX_PRIORITIES]
Definition: tasks.c:351
PRIVILEGED_DATA TCB_t *volatile pxCurrentTCB
Definition: tasks.c:348
#define listLIST_IS_EMPTY(pxList)
Definition: list.h:250
static PRIVILEGED_DATA volatile UBaseType_t uxTopReadyPriority
Definition: tasks.c:374

Definition at line 150 of file tasks.c.

◆ taskSWITCH_DELAYED_LISTS

#define taskSWITCH_DELAYED_LISTS ( )
Value:
{ \
List_t *pxTemp; \
\
/* The delayed tasks list should be empty when the lists are switched. */ \
configASSERT( ( listLIST_IS_EMPTY( pxDelayedTaskList ) ) ); \
\
pxTemp = pxDelayedTaskList; \
pxDelayedTaskList = pxOverflowDelayedTaskList; \
pxOverflowDelayedTaskList = pxTemp; \
xNumOfOverflows++; \
prvResetNextTaskUnblockTime(); \
}
#define listLIST_IS_EMPTY(pxList)
Definition: list.h:250
static PRIVILEGED_DATA List_t *volatile pxDelayedTaskList
Definition: tasks.c:354
static PRIVILEGED_DATA List_t *volatile pxOverflowDelayedTaskList
Definition: tasks.c:355

Definition at line 215 of file tasks.c.

◆ taskWAITING_NOTIFICATION

#define taskWAITING_NOTIFICATION   ( ( uint8_t ) 1 )

Definition at line 70 of file tasks.c.

◆ taskYIELD_IF_USING_PREEMPTION

#define taskYIELD_IF_USING_PREEMPTION ( )

Definition at line 63 of file tasks.c.

◆ tskBLOCKED_CHAR

#define tskBLOCKED_CHAR   ( 'B' )

Definition at line 113 of file tasks.c.

◆ tskDELETED_CHAR

#define tskDELETED_CHAR   ( 'D' )

Definition at line 115 of file tasks.c.

◆ tskDYNAMICALLY_ALLOCATED_STACK_AND_TCB

#define tskDYNAMICALLY_ALLOCATED_STACK_AND_TCB   ( ( uint8_t ) 0 )

Definition at line 97 of file tasks.c.

◆ tskREADY_CHAR

#define tskREADY_CHAR   ( 'R' )

Definition at line 114 of file tasks.c.

◆ tskSET_NEW_STACKS_TO_KNOWN_VALUE

#define tskSET_NEW_STACKS_TO_KNOWN_VALUE   0

Definition at line 107 of file tasks.c.

◆ tskSTACK_FILL_BYTE

#define tskSTACK_FILL_BYTE   ( 0xa5U )

Definition at line 77 of file tasks.c.

◆ tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE

#define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE   ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )

Definition at line 96 of file tasks.c.

◆ tskSTATICALLY_ALLOCATED_STACK_AND_TCB

#define tskSTATICALLY_ALLOCATED_STACK_AND_TCB   ( ( uint8_t ) 2 )

Definition at line 99 of file tasks.c.

◆ tskSTATICALLY_ALLOCATED_STACK_ONLY

#define tskSTATICALLY_ALLOCATED_STACK_ONLY   ( ( uint8_t ) 1 )

Definition at line 98 of file tasks.c.

◆ tskSUSPENDED_CHAR

#define tskSUSPENDED_CHAR   ( 'S' )

Definition at line 116 of file tasks.c.

Typedef Documentation

◆ TCB_t

typedef tskTCB TCB_t

Definition at line 343 of file tasks.c.

◆ tskTCB

typedef struct tskTaskControlBlock tskTCB

Function Documentation

◆ pcTaskGetName()

char* pcTaskGetName ( TaskHandle_t  xTaskToQuery)

Definition at line 2271 of file tasks.c.

◆ portTASK_FUNCTION()

static portTASK_FUNCTION ( prvIdleTask  ,
pvParameters   
)
static

THIS IS THE RTOS IDLE TASK - WHICH IS CREATED AUTOMATICALLY WHEN THE SCHEDULER IS STARTED.

Definition at line 3226 of file tasks.c.

◆ prvAddCurrentTaskToDelayedList()

static void prvAddCurrentTaskToDelayedList ( TickType_t  xTicksToWait,
const BaseType_t  xCanBlockIndefinitely 
)
static

Definition at line 4918 of file tasks.c.

◆ prvAddNewTaskToReadyList()

static void prvAddNewTaskToReadyList ( TCB_t pxNewTCB)
static

Definition at line 1027 of file tasks.c.

◆ prvCheckTasksWaitingTermination()

static void prvCheckTasksWaitingTermination ( void  )
static

THIS FUNCTION IS CALLED FROM THE RTOS IDLE TASK

Definition at line 3477 of file tasks.c.

◆ prvInitialiseTaskLists() [1/2]

static void prvInitialiseTaskLists ( static void prvCheckTasksWaitingTermination  void)
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 440 of file tasks.c.

◆ prvInitialiseTaskLists() [2/2]

static void prvInitialiseTaskLists ( void  )
static

Definition at line 3445 of file tasks.c.

◆ prvResetNextTaskUnblockTime()

static void prvResetNextTaskUnblockTime ( void  )
static

Definition at line 3739 of file tasks.c.

◆ uxTaskGetNumberOfTasks()

UBaseType_t uxTaskGetNumberOfTasks ( void  )

Definition at line 2263 of file tasks.c.

◆ uxTaskResetEventItemValue()

TickType_t uxTaskResetEventItemValue ( void  )

Definition at line 4388 of file tasks.c.

◆ vTaskEndScheduler()

void vTaskEndScheduler ( void  )

Definition at line 2023 of file tasks.c.

◆ vTaskInternalSetTimeOutState()

void vTaskInternalSetTimeOutState ( TimeOut_t *const  pxTimeOut)

Definition at line 3100 of file tasks.c.

◆ vTaskMissedYield()

void vTaskMissedYield ( void  )

Definition at line 3171 of file tasks.c.

◆ vTaskPlaceOnEventList()

void vTaskPlaceOnEventList ( List_t *const  pxEventList,
const TickType_t  xTicksToWait 
)

Definition at line 2912 of file tasks.c.

◆ vTaskPlaceOnUnorderedEventList()

void vTaskPlaceOnUnorderedEventList ( List_t pxEventList,
const TickType_t  xItemValue,
const TickType_t  xTicksToWait 
)

Definition at line 2929 of file tasks.c.

◆ vTaskRemoveFromUnorderedEventList()

void vTaskRemoveFromUnorderedEventList ( ListItem_t pxEventListItem,
const TickType_t  xItemValue 
)

Definition at line 3054 of file tasks.c.

◆ vTaskSetTimeOutState()

void vTaskSetTimeOutState ( TimeOut_t *const  pxTimeOut)

Definition at line 3088 of file tasks.c.

◆ vTaskStartScheduler()

void vTaskStartScheduler ( TaskHandle_t idleTaskHandle,
TaskHandle_t timerTaskHandle 
)

Definition at line 1901 of file tasks.c.

◆ vTaskSuspendAll()

void vTaskSuspendAll ( void  )

Definition at line 2034 of file tasks.c.

◆ vTaskSwitchContext()

void vTaskSwitchContext ( void  )

Definition at line 2853 of file tasks.c.

◆ xTaskCheckForTimeOut()

BaseType_t xTaskCheckForTimeOut ( TimeOut_t *const  pxTimeOut,
TickType_t *const  pxTicksToWait 
)

Definition at line 3108 of file tasks.c.

◆ xTaskGetTickCount()

TickType_t xTaskGetTickCount ( void  )

Definition at line 2217 of file tasks.c.

◆ xTaskGetTickCountFromISR()

TickType_t xTaskGetTickCountFromISR ( void  )

Definition at line 2232 of file tasks.c.

◆ xTaskIncrementTick()

BaseType_t xTaskIncrementTick ( void  )

Definition at line 2591 of file tasks.c.

◆ xTaskRemoveFromEventList()

BaseType_t xTaskRemoveFromEventList ( const List_t *const  pxEventList)

Definition at line 2986 of file tasks.c.

◆ xTaskResumeAll()

BaseType_t xTaskResumeAll ( void  )

Definition at line 2107 of file tasks.c.

Variable Documentation

◆ pxCurrentTCB

PRIVILEGED_DATA TCB_t* volatile pxCurrentTCB = NULL

Definition at line 348 of file tasks.c.

◆ pxDelayedTaskList

PRIVILEGED_DATA List_t* volatile pxDelayedTaskList
static

Definition at line 354 of file tasks.c.

◆ pxOverflowDelayedTaskList

PRIVILEGED_DATA List_t* volatile pxOverflowDelayedTaskList
static

Definition at line 355 of file tasks.c.

◆ pxReadyTasksLists

PRIVILEGED_DATA List_t pxReadyTasksLists[configMAX_PRIORITIES]
static

Definition at line 351 of file tasks.c.

◆ uxCurrentNumberOfTasks

PRIVILEGED_DATA volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U
static

Definition at line 372 of file tasks.c.

◆ uxPendedTicks

PRIVILEGED_DATA volatile UBaseType_t uxPendedTicks = ( UBaseType_t ) 0U
static

Definition at line 376 of file tasks.c.

◆ uxSchedulerSuspended

PRIVILEGED_DATA volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE
static

Definition at line 391 of file tasks.c.

◆ uxTaskNumber

PRIVILEGED_DATA UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U
static

Definition at line 379 of file tasks.c.

◆ uxTopReadyPriority

PRIVILEGED_DATA volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY
static

Definition at line 374 of file tasks.c.

◆ xDelayedTaskList1

PRIVILEGED_DATA List_t xDelayedTaskList1
static

Definition at line 352 of file tasks.c.

◆ xDelayedTaskList2

PRIVILEGED_DATA List_t xDelayedTaskList2
static

Definition at line 353 of file tasks.c.

◆ xIdleTaskHandle

PRIVILEGED_DATA TaskHandle_t xIdleTaskHandle = NULL
static

Definition at line 381 of file tasks.c.

◆ xNextTaskUnblockTime

PRIVILEGED_DATA volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U
static

Definition at line 380 of file tasks.c.

◆ xNumOfOverflows

PRIVILEGED_DATA volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0
static

Definition at line 378 of file tasks.c.

◆ xPendingReadyList

PRIVILEGED_DATA List_t xPendingReadyList
static

Definition at line 356 of file tasks.c.

◆ xSchedulerRunning

PRIVILEGED_DATA volatile BaseType_t xSchedulerRunning = pdFALSE
static

Definition at line 375 of file tasks.c.

◆ xTickCount

Definition at line 373 of file tasks.c.

◆ xYieldPending

PRIVILEGED_DATA volatile BaseType_t xYieldPending = pdFALSE
static

Definition at line 377 of file tasks.c.



inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:07