Microchip® Advanced Software Framework

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

Data Structures

struct  tskTaskControlBlock
 

Macros

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
 
#define portRESET_READY_PRIORITY(uxPriority, uxTopReadyPriority)
 
#define prvAddTaskToReadyQueue(pxTCB)
 
#define prvCheckDelayedTasks()
 
#define prvGetTCBFromHandle(pxHandle)   ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )
 
#define taskRECORD_READY_PRIORITY(uxPriority)
 
#define taskRESET_READY_PRIORITY(uxPriority)
 
#define taskSELECT_HIGHEST_PRIORITY_TASK()
 
#define tskBLOCKED_CHAR   ( ( signed char ) 'B' )
 
#define tskDELETED_CHAR   ( ( signed char ) 'D' )
 
#define tskIDLE_STACK_SIZE   configMINIMAL_STACK_SIZE
 
#define tskREADY_CHAR   ( ( signed char ) 'R' )
 
#define tskSTACK_FILL_BYTE   ( 0xa5U )
 
#define tskSUSPENDED_CHAR   ( ( signed char ) 'S' )
 

Typedefs

typedef struct tskTaskControlBlock tskTCB
 

Functions

static portTASK_FUNCTION (prvIdleTask, pvParameters)
 
static void prvAddCurrentTaskToDelayedList (portTickType xTimeToWake)
 
static tskTCBprvAllocateTCBAndStack (unsigned short usStackDepth, portSTACK_TYPE *puxStackBuffer)
 
static void prvCheckTasksWaitingTermination (void)
 
static void prvInitialiseTaskLists (static void prvCheckTasksWaitingTermination void)
 
static void prvInitialiseTaskLists (void)
 
static void prvInitialiseTCBVariables (tskTCB *pxTCB, const signed char *const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion *const xRegions, unsigned short usStackDepth) PRIVILEGED_FUNCTION
 
unsigned portBASE_TYPE uxTaskGetNumberOfTasks (void)
 
void vApplicationStackOverflowHook (xTaskHandle pxTask, signed char *pcTaskName)
 
void vApplicationTickHook (void)
 
void vTaskEndScheduler (void)
 
void vTaskIncrementTick (void)
 
void vTaskMissedYield (void)
 
void vTaskPlaceOnEventList (const xList *const pxEventList, portTickType xTicksToWait)
 
void vTaskSetTimeOutState (xTimeOutType *const pxTimeOut)
 
void vTaskStartScheduler (void)
 
void vTaskSuspendAll (void)
 
void vTaskSwitchContext (void)
 
portBASE_TYPE xTaskCheckForTimeOut (xTimeOutType *const pxTimeOut, portTickType *const pxTicksToWait)
 
portTickType xTaskGetTickCount (void)
 
portTickType xTaskGetTickCountFromISR (void)
 
signed portBASE_TYPE xTaskRemoveFromEventList (const xList *const pxEventList)
 
signed portBASE_TYPE xTaskResumeAll (void)
 

Variables

PRIVILEGED_DATA tskTCB *volatile pxCurrentTCB = NULL
 
static PRIVILEGED_DATA xList
*volatile 
pxDelayedTaskList
 
static PRIVILEGED_DATA xList
*volatile 
pxOverflowDelayedTaskList
 
static PRIVILEGED_DATA xList pxReadyTasksLists [configMAX_PRIORITIES]
 
static PRIVILEGED_DATA
volatile unsigned
portBASE_TYPE 
uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0U
 
static PRIVILEGED_DATA
volatile unsigned
portBASE_TYPE 
uxMissedTicks = ( unsigned portBASE_TYPE ) 0U
 
static PRIVILEGED_DATA
volatile unsigned
portBASE_TYPE 
uxSchedulerSuspended = ( unsigned portBASE_TYPE ) pdFALSE
 
static PRIVILEGED_DATA
unsigned portBASE_TYPE 
uxTaskNumber = ( unsigned portBASE_TYPE ) 0U
 
static PRIVILEGED_DATA
volatile unsigned
portBASE_TYPE 
uxTopReadyPriority = tskIDLE_PRIORITY
 
static PRIVILEGED_DATA
unsigned portBASE_TYPE 
uxTopUsedPriority = tskIDLE_PRIORITY
 
static PRIVILEGED_DATA xList xDelayedTaskList1
 
static PRIVILEGED_DATA xList xDelayedTaskList2
 
static PRIVILEGED_DATA
volatile portBASE_TYPE 
xMissedYield = ( portBASE_TYPE ) pdFALSE
 
static PRIVILEGED_DATA
volatile portTickType 
xNextTaskUnblockTime = ( portTickType ) portMAX_DELAY
 
static PRIVILEGED_DATA
volatile portBASE_TYPE 
xNumOfOverflows = ( portBASE_TYPE ) 0
 
static PRIVILEGED_DATA xList xPendingReadyList
 
static PRIVILEGED_DATA
volatile signed portBASE_TYPE 
xSchedulerRunning = pdFALSE
 
static PRIVILEGED_DATA
volatile portTickType 
xTickCount = ( portTickType ) 0U
 

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#define portRESET_READY_PRIORITY (   uxPriority,
  uxTopReadyPriority 
)

Referenced by vTaskPlaceOnEventList().

#define prvAddTaskToReadyQueue (   pxTCB)
Value:
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
#define taskRECORD_READY_PRIORITY(uxPriority)
Definition: freertos-7.3.0/source/tasks.c:224
void vListInsertEnd(xList *const pxList, xListItem *const pxNewListItem)
Definition: freertos-7.5.2/Source/list.c:101
#define traceMOVED_TASK_TO_READY_STATE(pxTCB)
Definition: freertos-7.5.2/Source/include/FreeRTOS.h:363
Definition: freertos-7.5.2/Source/include/list.h:156
static PRIVILEGED_DATA xList pxReadyTasksLists[configMAX_PRIORITIES]
Definition: freertos-7.3.0/source/tasks.c:151

Referenced by prvInitialiseTaskLists(), xTaskRemoveFromEventList(), and xTaskResumeAll().

#define prvCheckDelayedTasks ( )

Referenced by vTaskIncrementTick().

#define prvGetTCBFromHandle (   pxHandle)    ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )
#define taskRECORD_READY_PRIORITY (   uxPriority)
Value:
{ \
if( ( uxPriority ) > uxTopReadyPriority ) \
{ \
uxTopReadyPriority = ( uxPriority ); \
} \
} /* taskRECORD_READY_PRIORITY */
static PRIVILEGED_DATA volatile unsigned portBASE_TYPE uxTopReadyPriority
Definition: freertos-7.3.0/source/tasks.c:181
if(memp!=NULL)
Definition: 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.5.2/Source/include/FreeRTOS.h:221
#define listLIST_IS_EMPTY(pxList)
Definition: freertos-7.5.2/Source/include/list.h:216
static PRIVILEGED_DATA volatile unsigned portBASE_TYPE uxTopReadyPriority
Definition: freertos-7.3.0/source/tasks.c:181
PRIVILEGED_DATA tskTCB *volatile pxCurrentTCB
Definition: freertos-7.5.2/Source/tasks.c:175
#define listGET_OWNER_OF_NEXT_ENTRY(pxTCB, pxList)
Definition: freertos-7.5.2/Source/include/list.h:242
static PRIVILEGED_DATA xList pxReadyTasksLists[configMAX_PRIORITIES]
Definition: freertos-7.3.0/source/tasks.c:151

Referenced by vTaskSwitchContext().

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

Referenced by vTaskStartScheduler().

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

Referenced by prvAllocateTCBAndStack().

#define tskSUSPENDED_CHAR   ( ( signed char ) 'S' )

typedef struct tskTaskControlBlock tskTCB

static tskTCB* prvAllocateTCBAndStack ( unsigned short  usStackDepth,
portSTACK_TYPE *  puxStackBuffer 
)
static
static void prvInitialiseTCBVariables ( tskTCB pxTCB,
const signed char *const  pcName,
unsigned portBASE_TYPE  uxPriority,
const xMemoryRegion *const  xRegions,
unsigned short  usStackDepth 
)
static
unsigned portBASE_TYPE uxTaskGetNumberOfTasks ( void  )
void vApplicationStackOverflowHook ( xTaskHandle  pxTask,
signed char *  pcTaskName 
)
void vApplicationTickHook ( void  )
void vTaskEndScheduler ( void  )
void vTaskMissedYield ( void  )

References pdTRUE, and xMissedYield.

void vTaskSetTimeOutState ( xTimeOutType *const  pxTimeOut)
void vTaskSuspendAll ( void  )

References uxSchedulerSuspended.

portTickType xTaskGetTickCount ( void  )

PRIVILEGED_DATA tskTCB* volatile pxCurrentTCB = NULL
PRIVILEGED_DATA xList* volatile pxOverflowDelayedTaskList
static
PRIVILEGED_DATA xList pxReadyTasksLists[configMAX_PRIORITIES]
static
PRIVILEGED_DATA volatile unsigned portBASE_TYPE uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0U
static
PRIVILEGED_DATA volatile unsigned portBASE_TYPE uxMissedTicks = ( unsigned portBASE_TYPE ) 0U
static
PRIVILEGED_DATA volatile unsigned portBASE_TYPE uxSchedulerSuspended = ( unsigned portBASE_TYPE ) pdFALSE
static
PRIVILEGED_DATA unsigned portBASE_TYPE uxTaskNumber = ( unsigned portBASE_TYPE ) 0U
static

Referenced by prvInitialiseTaskLists().

PRIVILEGED_DATA volatile unsigned portBASE_TYPE uxTopReadyPriority = tskIDLE_PRIORITY
static

Referenced by vTaskPlaceOnEventList().

PRIVILEGED_DATA unsigned portBASE_TYPE uxTopUsedPriority = tskIDLE_PRIORITY
static

Referenced by prvInitialiseTaskLists().

PRIVILEGED_DATA xList xDelayedTaskList1
static

Referenced by prvInitialiseTaskLists().

PRIVILEGED_DATA xList xDelayedTaskList2
static

Referenced by prvInitialiseTaskLists().

PRIVILEGED_DATA volatile portBASE_TYPE xMissedYield = ( portBASE_TYPE ) pdFALSE
static
PRIVILEGED_DATA volatile portTickType xNextTaskUnblockTime = ( portTickType ) portMAX_DELAY
static
PRIVILEGED_DATA volatile portBASE_TYPE xNumOfOverflows = ( portBASE_TYPE ) 0
static
PRIVILEGED_DATA volatile signed portBASE_TYPE xSchedulerRunning = pdFALSE
static