Microchip® Advanced Software Framework

freertos-8.2.3/Source/tasks.c File Reference
#include <stdlib.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "StackMacros.h"

Data Structures

struct  tskTaskControlBlock
 

Macros

#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 taskRECORD_READY_PRIORITY(uxPriority)
 
#define taskRESET_READY_PRIORITY(uxPriority)
 
#define taskSELECT_HIGHEST_PRIORITY_TASK()
 
#define taskSWITCH_DELAYED_LISTS()
 
#define taskYIELD_IF_USING_PREEMPTION()
 
#define tskBLOCKED_CHAR   ( 'B' )
 
#define tskDELETED_CHAR   ( 'D' )
 
#define tskIDLE_STACK_SIZE   configMINIMAL_STACK_SIZE
 
#define tskREADY_CHAR   ( 'R' )
 
#define tskSTACK_FILL_BYTE   ( 0xa5U )
 
#define tskSUSPENDED_CHAR   ( 'S' )
 

Typedefs

typedef tskTCB TCB_t
 
typedef struct tskTaskControlBlock tskTCB
 

Enumerations

enum  eNotifyValue {
  eNotWaitingNotification = 0,
  eWaitingNotification,
  eNotified
}
 

Functions

static portTASK_FUNCTION (prvIdleTask, pvParameters)
 
static void prvAddCurrentTaskToDelayedList (const TickType_t xTimeToWake)
 
static TCB_tprvAllocateTCBAndStack (const uint16_t usStackDepth, StackType_t *const puxStackBuffer)
 
static void prvCheckTasksWaitingTermination (void)
 
static void prvInitialiseTaskLists (static void prvCheckTasksWaitingTermination void)
 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. More...
 
static void prvInitialiseTaskLists (void)
 
static void prvInitialiseTCBVariables (TCB_t *const pxTCB, const char *const pcName, UBaseType_t uxPriority, const MemoryRegion_t *const xRegions, const uint16_t usStackDepth) PRIVILEGED_FUNCTION
 
static void prvResetNextTaskUnblockTime (void)
 
UBaseType_t uxTaskGetNumberOfTasks (void)
 
TickType_t uxTaskResetEventItemValue (void)
 
void vTaskEndScheduler (void)
 
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 vTaskSetTimeOutState (TimeOut_t *const pxTimeOut)
 
void vTaskStartScheduler (void)
 
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 xTaskRemoveFromUnorderedEventList (ListItem_t *pxEventListItem, const TickType_t xItemValue)
 
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
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 ) 0U
 
static PRIVILEGED_DATA
volatile BaseType_t 
xYieldPending = pdFALSE
 

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#define portRESET_READY_PRIORITY (   uxPriority,
  uxTopReadyPriority 
)
#define prvAddTaskToReadyList (   pxTCB)
Value:
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
void vListInsertEnd(xList *pxList, xListItem *pxNewListItem)
Definition: freertos-7.3.0/source/list.c:105
static PRIVILEGED_DATA List_t pxReadyTasksLists[configMAX_PRIORITIES]
Definition: freertos-8.2.3/Source/tasks.c:215
#define taskRECORD_READY_PRIORITY(uxPriority)
Definition: freertos-8.2.3/Source/tasks.c:297
#define traceMOVED_TASK_TO_READY_STATE(pxTCB)
Definition: freertos-7.3.0/source/include/FreeRTOS.h:348

Referenced by xTaskIncrementTick(), xTaskRemoveFromEventList(), xTaskRemoveFromUnorderedEventList(), and xTaskResumeAll().

#define prvGetTCBFromHandle (   pxHandle)    ( ( ( pxHandle ) == NULL ) ? ( TCB_t * ) pxCurrentTCB : ( TCB_t * ) ( pxHandle ) )
#define taskEVENT_LIST_ITEM_VALUE_IN_USE   0x80000000UL
#define taskRECORD_READY_PRIORITY (   uxPriority)
Value:
{ \
if( ( uxPriority ) > uxTopReadyPriority ) \
{ \
uxTopReadyPriority = ( uxPriority ); \
} \
} /* taskRECORD_READY_PRIORITY */
static PRIVILEGED_DATA volatile UBaseType_t uxTopReadyPriority
Definition: freertos-8.2.3/Source/tasks.c:244
if(memp!=NULL)
Definition: src/core/memp.c:407
#define taskRESET_READY_PRIORITY (   uxPriority)
#define taskSELECT_HIGHEST_PRIORITY_TASK ( )
Value:
{ \
/* Find the highest priority queue that contains ready tasks. */ \
{ \
} \
\
/* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of \
the same priority get an equal share of the processor time. */ \
} /* taskSELECT_HIGHEST_PRIORITY_TASK */
#define configASSERT(x)
Definition: freertos-7.3.0/source/include/FreeRTOS.h:221
PRIVILEGED_DATA tskTCB *volatile pxCurrentTCB
Definition: freertos-7.3.0/source/tasks.c:148
#define listGET_OWNER_OF_NEXT_ENTRY(pxTCB, pxList)
Definition: freertos-7.3.0/source/include/list.h:214
static PRIVILEGED_DATA List_t pxReadyTasksLists[configMAX_PRIORITIES]
Definition: freertos-8.2.3/Source/tasks.c:215
#define listLIST_IS_EMPTY(pxList)
Definition: freertos-7.3.0/source/include/list.h:188
static PRIVILEGED_DATA volatile UBaseType_t uxTopReadyPriority
Definition: freertos-8.2.3/Source/tasks.c:244

Referenced by vTaskSwitchContext().

#define taskSWITCH_DELAYED_LISTS ( )
Value:
{ \
List_t *pxTemp; \
\
/* The delayed tasks list should be empty when the lists are switched. */ \
\
pxTemp = pxDelayedTaskList; \
}
static PRIVILEGED_DATA volatile BaseType_t xNumOfOverflows
Definition: freertos-8.2.3/Source/tasks.c:248
struct xLIST List_t
#define configASSERT(x)
Definition: freertos-7.3.0/source/include/FreeRTOS.h:221
static PRIVILEGED_DATA List_t *volatile pxOverflowDelayedTaskList
Definition: freertos-8.2.3/Source/tasks.c:219
static void prvResetNextTaskUnblockTime(void)
Definition: freertos-8.2.3/Source/tasks.c:3347
static PRIVILEGED_DATA List_t *volatile pxDelayedTaskList
Definition: freertos-8.2.3/Source/tasks.c:218
#define listLIST_IS_EMPTY(pxList)
Definition: freertos-7.3.0/source/include/list.h:188

Referenced by xTaskIncrementTick().

#define taskYIELD_IF_USING_PREEMPTION ( )

Referenced by xTaskResumeAll().

#define tskBLOCKED_CHAR   ( 'B' )
#define tskDELETED_CHAR   ( 'D' )
#define tskIDLE_STACK_SIZE   configMINIMAL_STACK_SIZE

Referenced by vTaskStartScheduler().

#define tskREADY_CHAR   ( 'R' )
#define tskSTACK_FILL_BYTE   ( 0xa5U )

Referenced by prvAllocateTCBAndStack().

#define tskSUSPENDED_CHAR   ( 'S' )

typedef tskTCB TCB_t
typedef struct tskTaskControlBlock tskTCB

Enumerator
eNotWaitingNotification 
eWaitingNotification 
eNotified 

static TCB_t* prvAllocateTCBAndStack ( const uint16_t  usStackDepth,
StackType_t *const  puxStackBuffer 
)
static
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.

static void prvResetNextTaskUnblockTime ( void  )
static
UBaseType_t uxTaskGetNumberOfTasks ( void  )
TickType_t uxTaskResetEventItemValue ( void  )
void vTaskEndScheduler ( void  )
void vTaskMissedYield ( void  )

References pdTRUE, and xYieldPending.

void vTaskPlaceOnEventList ( List_t *const  pxEventList,
const TickType_t  xTicksToWait 
)
void vTaskPlaceOnUnorderedEventList ( List_t pxEventList,
const TickType_t  xItemValue,
const TickType_t  xTicksToWait 
)
void vTaskSetTimeOutState ( TimeOut_t *const  pxTimeOut)
void vTaskSuspendAll ( void  )

References uxSchedulerSuspended.

BaseType_t xTaskCheckForTimeOut ( TimeOut_t *const  pxTimeOut,
TickType_t *const  pxTicksToWait 
)
TickType_t xTaskGetTickCount ( void  )
BaseType_t xTaskIncrementTick ( void  )

Referenced by xTaskResumeAll().

PRIVILEGED_DATA TCB_t* volatile pxCurrentTCB = NULL
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 UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U
static
PRIVILEGED_DATA volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY
static
PRIVILEGED_DATA List_t xDelayedTaskList1
static

Referenced by prvInitialiseTaskLists().

PRIVILEGED_DATA List_t xDelayedTaskList2
static

Referenced by prvInitialiseTaskLists().

PRIVILEGED_DATA volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U
static
PRIVILEGED_DATA volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0
static
PRIVILEGED_DATA volatile BaseType_t xSchedulerRunning = pdFALSE
static