|
|
|
@ -131,7 +131,9 @@ made to free the RAM that was allocated statically.
|
|
|
|
|
tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
|
|
|
|
|
task to be created using either statically or dynamically allocated RAM. Note
|
|
|
|
|
that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
|
|
|
|
|
a statically allocated stack and a dynamically allocated TCB. */
|
|
|
|
|
a statically allocated stack and a dynamically allocated TCB.
|
|
|
|
|
!!!NOTE!!! If the definition of tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is
|
|
|
|
|
changed then the definition of StaticTask_t must also be updated. */
|
|
|
|
|
#define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE ( ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) || ( portUSING_MPU_WRAPPERS == 1 ) )
|
|
|
|
|
#define tskDYNAMICALLY_ALLOCATED_STACK_AND_TCB ( ( uint8_t ) 0 )
|
|
|
|
|
#define tskSTATICALLY_ALLOCATED_STACK_ONLY ( ( uint8_t ) 1 )
|
|
|
|
@ -436,15 +438,21 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
|
|
|
|
|
|
|
|
|
|
/* Callback function prototypes. --------------------------*/
|
|
|
|
|
#if( configCHECK_FOR_STACK_OVERFLOW > 0 )
|
|
|
|
|
|
|
|
|
|
extern void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName );
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if( configUSE_TICK_HOOK > 0 )
|
|
|
|
|
|
|
|
|
|
extern void vApplicationTickHook( void );
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
|
|
|
|
|
|
|
|
|
extern void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* File private functions. --------------------------------*/
|
|
|
|
@ -455,7 +463,9 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
|
|
|
|
|
* is in any other state.
|
|
|
|
|
*/
|
|
|
|
|
#if ( INCLUDE_vTaskSuspend == 1 )
|
|
|
|
|
|
|
|
|
|
static BaseType_t prvTaskIsTaskSuspended( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
|
|
|
|
|
|
|
|
|
#endif /* INCLUDE_vTaskSuspend */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -588,6 +598,17 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|
|
|
|
*/
|
|
|
|
|
static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* freertos_tasks_c_additions_init() should only be called if the user definable
|
|
|
|
|
* macro FREERTOS_TASKS_C_ADDITIONS_INIT() is defined, as that is the only macro
|
|
|
|
|
* called by the function.
|
|
|
|
|
*/
|
|
|
|
|
#ifdef FREERTOS_TASKS_C_ADDITIONS_INIT
|
|
|
|
|
|
|
|
|
|
static void freertos_tasks_c_additions_init( void ) PRIVILEGED_FUNCTION;
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
|
|
|
@ -606,6 +627,17 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
configASSERT( puxStackBuffer != NULL );
|
|
|
|
|
configASSERT( pxTaskBuffer != NULL );
|
|
|
|
|
|
|
|
|
|
#if( configASSERT_DEFINED == 1 )
|
|
|
|
|
{
|
|
|
|
|
/* Sanity check that the size of the structure used to declare a
|
|
|
|
|
variable of type StaticTask_t equals the size of the real task
|
|
|
|
|
structure. */
|
|
|
|
|
volatile size_t xSize = sizeof( StaticTask_t );
|
|
|
|
|
configASSERT( xSize == sizeof( TCB_t ) );
|
|
|
|
|
}
|
|
|
|
|
#endif /* configASSERT_DEFINED */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( ( pxTaskBuffer != NULL ) && ( puxStackBuffer != NULL ) )
|
|
|
|
|
{
|
|
|
|
|
/* The memory used for the task's TCB and stack are passed into this
|
|
|
|
@ -1897,6 +1929,15 @@ BaseType_t xReturn;
|
|
|
|
|
|
|
|
|
|
if( xReturn == pdPASS )
|
|
|
|
|
{
|
|
|
|
|
/* freertos_tasks_c_additions_init() should only be called if the user
|
|
|
|
|
definable macro FREERTOS_TASKS_C_ADDITIONS_INIT() is defined, as that is
|
|
|
|
|
the only macro called by the function. */
|
|
|
|
|
#ifdef FREERTOS_TASKS_C_ADDITIONS_INIT
|
|
|
|
|
{
|
|
|
|
|
freertos_tasks_c_additions_init();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Interrupts are turned off here, to ensure a tick does not occur
|
|
|
|
|
before or during the call to xPortStartScheduler(). The stacks of
|
|
|
|
|
the created tasks contain a status word with interrupts switched on
|
|
|
|
|