Microchip® Advanced Software Framework

freertos-7.5.2/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 ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )
 
#define taskRECORD_READY_PRIORITY(uxPriority)
 
#define taskRESET_READY_PRIORITY(uxPriority)
 
#define taskSELECT_HIGHEST_PRIORITY_TASK()
 
#define taskSWITCH_DELAYED_LISTS()
 
#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 xTask, signed char *pcTaskName)
 
void vApplicationTickHook (void)
 
void vTaskEndScheduler (void)
 
void vTaskMissedYield (void)
 
void vTaskPlaceOnEventList (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)
 
portBASE_TYPE xTaskIncrementTick (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 
uxPendedTicks = ( 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 xList xDelayedTaskList1
 
static PRIVILEGED_DATA xList xDelayedTaskList2
 
static PRIVILEGED_DATA
volatile portTickType 
xNextTaskUnblockTime = 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
 
static PRIVILEGED_DATA
volatile portBASE_TYPE 
xYieldPending = pdFALSE
 

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#define portRESET_READY_PRIORITY (   uxPriority,
  uxTopReadyPriority 
)

Referenced by vTaskPlaceOnEventList().

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

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

#define prvGetTCBFromHandle (   pxHandle)    ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )
#define taskRECORD_READY_PRIORITY (   uxPriority)
Value:
{ \
if( ( uxPriority ) > uxTopReadyPriority ) \
{ \
uxTopReadyPriority = ( uxPriority ); \
} \
} /* taskRECORD_READY_PRIORITY */
if((SERIAL_RX_BUF_SIZE_HOST-1)==serial_rx_buf_tail)
Definition: sio2host.c:258
static PRIVILEGED_DATA volatile unsigned portBASE_TYPE uxTopReadyPriority
Definition: freertos-7.5.2/Source/tasks.c:207
#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
PRIVILEGED_DATA tskTCB *volatile pxCurrentTCB
Definition: freertos-7.5.2/Source/tasks.c:175
static PRIVILEGED_DATA xList pxReadyTasksLists[configMAX_PRIORITIES]
Definition: freertos-7.5.2/Source/tasks.c:178
static PRIVILEGED_DATA volatile unsigned portBASE_TYPE uxTopReadyPriority
Definition: freertos-7.5.2/Source/tasks.c:207
#define listGET_OWNER_OF_NEXT_ENTRY(pxTCB, pxList)
Definition: freertos-7.5.2/Source/include/list.h:242

Referenced by vTaskSwitchContext().

#define taskSWITCH_DELAYED_LISTS ( )
Value:
{ \
xList *pxTemp; \
\
/* The delayed tasks list should be empty when the lists are switched. */ \
\
pxTemp = pxDelayedTaskList; \
{ \
/* The new current delayed list is empty. Set \
xNextTaskUnblockTime to the maximum possible value so it is \
extremely unlikely that the \
if( xTickCount >= xNextTaskUnblockTime ) test will pass until \
there is an item in the delayed list. */ \
xNextTaskUnblockTime = portMAX_DELAY; \
} \
{ \
/* The new current delayed list is not empty, get the value of \
the item at the head of the delayed list. This is the time at \
which the task at the head of the delayed list should be removed \
from the Blocked state. */ \
xNextTaskUnblockTime = listGET_LIST_ITEM_VALUE( &( pxTCB->xGenericListItem ) ); \
} \
}
Definition: freertos-7.5.2/Source/tasks.c:111
static PRIVILEGED_DATA volatile portTickType xNextTaskUnblockTime
Definition: freertos-7.5.2/Source/tasks.c:214
else
Definition: sio2host.c:262
if((SERIAL_RX_BUF_SIZE_HOST-1)==serial_rx_buf_tail)
Definition: sio2host.c:258
static PRIVILEGED_DATA xList *volatile pxOverflowDelayedTaskList
Definition: freertos-7.5.2/Source/tasks.c:182
#define xList
Definition: freertos-10.0.0/Source/include/FreeRTOS.h:924
static PRIVILEGED_DATA xList *volatile pxDelayedTaskList
Definition: freertos-7.5.2/Source/tasks.c:181
#define pdFALSE
Definition: freertos-7.5.2/Source/include/projdefs.h:71
#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 portBASE_TYPE xNumOfOverflows
Definition: freertos-7.5.2/Source/tasks.c:212
#define listGET_OWNER_OF_HEAD_ENTRY(pxList)
Definition: freertos-7.5.2/Source/include/list.h:272
#define listGET_LIST_ITEM_VALUE(pxListItem)
Definition: freertos-7.5.2/Source/include/list.h:198

Referenced by xTaskIncrementTick().

#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  xTask,
signed char *  pcTaskName 
)
void vApplicationTickHook ( void  )
void vTaskEndScheduler ( void  )
void vTaskMissedYield ( void  )

Referenced by prvUnlockQueue().

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

Referenced by main().

void vTaskSwitchContext ( void  )
portBASE_TYPE xTaskCheckForTimeOut ( xTimeOutType *const  pxTimeOut,
portTickType *const  pxTicksToWait 
)
portTickType xTaskGetTickCount ( void  )

Referenced by prvCheckDelayedList().

portTickType xTaskGetTickCountFromISR ( void  )
portBASE_TYPE xTaskIncrementTick ( void  )

Referenced by xTaskResumeAll().

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 uxPendedTicks = ( 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 xList xDelayedTaskList1
static

Referenced by prvInitialiseTaskLists().

PRIVILEGED_DATA xList xDelayedTaskList2
static

Referenced by prvInitialiseTaskLists().

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