mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-11 13:54:16 -04:00
Remove compiler warning by ensure prvInitialiseMutex() is not included if configUSE_MUTEXES is 0.
Reduce the number of xTaskCreateStatic() parameters by having the function return the task handle, rather than pass the task handle out using a parameter. This is also consistent with other objectCreate() functions.
This commit is contained in:
parent
07ac1399ee
commit
f1725afbe5
13 changed files with 180 additions and 148 deletions
|
@ -196,7 +196,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
|||
*/
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
struct xMEMORY_REGION;
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION;
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -363,16 +363,13 @@ is used in assert() statements. */
|
|||
/**
|
||||
* task. h
|
||||
*<pre>
|
||||
BaseType_t xTaskCreateStatic(
|
||||
TaskFunction_t pvTaskCode,
|
||||
const char * const pcName,
|
||||
uint16_t usStackDepth,
|
||||
void *pvParameters,
|
||||
UBaseType_t uxPriority,
|
||||
TaskHandle_t *pvCreatedTask,
|
||||
StackType_t *pxStackBuffer,
|
||||
StaticTask_t *pxTaskBuffer
|
||||
);</pre>
|
||||
TaskHandle_t xTaskCreateStatic( TaskFunction_t pvTaskCode,
|
||||
const char * const pcName,
|
||||
uint32_t ulStackDepth,
|
||||
void *pvParameters,
|
||||
UBaseType_t uxPriority,
|
||||
StackType_t *pxStackBuffer,
|
||||
StaticTask_t *pxTaskBuffer );</pre>
|
||||
*
|
||||
* Create a new task and add it to the list of tasks that are ready to run.
|
||||
*
|
||||
|
@ -393,9 +390,9 @@ is used in assert() statements. */
|
|||
* facilitate debugging. The maximum length of the string is defined by
|
||||
* configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.
|
||||
*
|
||||
* @param usStackDepth The size of the task stack specified as the number of
|
||||
* @param ulStackDepth The size of the task stack specified as the number of
|
||||
* variables the stack can hold - not the number of bytes. For example, if
|
||||
* the stack is 32-bits wide and usStackDepth is defined as 100 then 400 bytes
|
||||
* the stack is 32-bits wide and ulStackDepth is defined as 100 then 400 bytes
|
||||
* will be allocated for stack storage.
|
||||
*
|
||||
* @param pvParameters Pointer that will be used as the parameter for the task
|
||||
|
@ -403,11 +400,8 @@ is used in assert() statements. */
|
|||
*
|
||||
* @param uxPriority The priority at which the task will run.
|
||||
*
|
||||
* @param pvCreatedTask Used to pass back a handle by which the created task
|
||||
* can be referenced. Pass as NULL if the handle is not required.
|
||||
*
|
||||
* @param pxStackBuffer Must point to a StackType_t array that has at least
|
||||
* usStackDepth indexes - the array will then be used as the task's stack,
|
||||
* ulStackDepth indexes - the array will then be used as the task's stack,
|
||||
* removing the need for the stack to be allocated dynamically.
|
||||
*
|
||||
* @param pxTaskBuffer Must point to a variable of type StaticTask_t, which will
|
||||
|
@ -422,49 +416,59 @@ is used in assert() statements. */
|
|||
* Example usage:
|
||||
<pre>
|
||||
|
||||
// Dimensions the buffer that the task being created will use as its stack.
|
||||
// NOTE: This is the number of words the stack will hold, not the number of
|
||||
// bytes. For example, if each stack item is 32-bits, and this is set to 100,
|
||||
// then 400 bytes (100 * 32-bits) will be allocated.
|
||||
#define STACK_SIZE 200
|
||||
// Dimensions the buffer that the task being created will use as its stack.
|
||||
// NOTE: This is the number of words the stack will hold, not the number of
|
||||
// bytes. For example, if each stack item is 32-bits, and this is set to 100,
|
||||
// then 400 bytes (100 * 32-bits) will be allocated.
|
||||
#define STACK_SIZE 200
|
||||
|
||||
// Structure that will hold the TCB of the task being created.
|
||||
StaticTask_t xTaskBuffer;
|
||||
// Structure that will hold the TCB of the task being created.
|
||||
StaticTask_t xTaskBuffer;
|
||||
|
||||
// Buffer that the task being created will use as its stack.
|
||||
StackType_t xStack[ STACK_SIZE ];
|
||||
// Buffer that the task being created will use as its stack. Note this is
|
||||
// an array of StackType_t variables. The size of StackType_t is dependent on
|
||||
// the RTOS port.
|
||||
StackType_t xStack[ STACK_SIZE ];
|
||||
|
||||
// Task to be created.
|
||||
void vTaskCode( void * pvParameters )
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
// Task code goes here.
|
||||
}
|
||||
}
|
||||
// Function that implements the task being created.
|
||||
void vTaskCode( void * pvParameters )
|
||||
{
|
||||
// The parameter value is expected to be 1 as 1 is passed in the
|
||||
// pvParameters value in the call to xTaskCreateStatic().
|
||||
configASSERT( ( uint32_t ) pvParameters == 1UL );
|
||||
|
||||
// Function that creates a task.
|
||||
void vOtherFunction( void )
|
||||
{
|
||||
static uint8_t ucParameterToPass;
|
||||
TaskHandle_t xHandle = NULL;
|
||||
for( ;; )
|
||||
{
|
||||
// Task code goes here.
|
||||
}
|
||||
}
|
||||
|
||||
// Create the task without using any dynamic memory allocation.
|
||||
xTaskCreateStatic( vTaskCode, // As per xTaskCreate() parameter.
|
||||
"NAME", // As per xTaskCreate() parameter.
|
||||
STACK_SIZE, // As per xTaskCreate() parameter.
|
||||
&ucParameterToPass, // As per xTaskCreate() parameter.
|
||||
tskIDLE_PRIORITY, // As per xTaskCreate() parameter.
|
||||
&xHandle, // As per xTaskCreate() parameter.
|
||||
xStack, // Pointer to the buffer that the task being created will use as its stack.
|
||||
&xTaskBuffer ); // Pointer to a StaticTask_t structure for use as the memory require by the task.
|
||||
}
|
||||
// Function that creates a task.
|
||||
void vOtherFunction( void )
|
||||
{
|
||||
TaskHandle_t xHandle = NULL;
|
||||
|
||||
// Create the task without using any dynamic memory allocation.
|
||||
xHandle = xTaskCreateStatic(
|
||||
vTaskCode, // Function that implements the task.
|
||||
"NAME", // Text name for the task.
|
||||
STACK_SIZE, // Stack size in words, not bytes.
|
||||
( void * ) 1, // Parameter passed into the task.
|
||||
tskIDLE_PRIORITY,// Priority at which the task is created.
|
||||
xStack, // Array to use as the task's stack.
|
||||
&xTaskBuffer ); // Variable to hold the task's data structure.
|
||||
|
||||
// puxStackBuffer and pxTaskBuffer were not NULL, so the task will have
|
||||
// been created, and xHandle will be the task's handle. Use the handle
|
||||
// to suspend the task.
|
||||
vTaskSuspend( xHandle );
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xTaskCreateStatic xTaskCreateStatic
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
BaseType_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
*----------------------------------------------------------*/
|
||||
|
||||
#error This port is not supported in this V9.0.0 pre-release revision, but will be supported in the final release. For now use V8.2.3 instead.
|
||||
|
||||
|
||||
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
|
||||
all the API functions to use the MPU wrappers. That should only be done when
|
||||
task.h is included from an application file. */
|
||||
|
@ -581,7 +581,7 @@ static BaseType_t prvRaisePrivilege( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth )
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth )
|
||||
{
|
||||
extern uint32_t __SRAM_segment_start__[];
|
||||
extern uint32_t __SRAM_segment_end__[];
|
||||
|
@ -630,7 +630,7 @@ uint32_t ul;
|
|||
which case the stack region parameters will be valid. At all other
|
||||
times the stack parameters will not be valid and it is assumed that the
|
||||
stack region has already been configured. */
|
||||
if( usStackDepth > 0 )
|
||||
if( ulStackDepth > 0 )
|
||||
{
|
||||
/* Define the region that allows access to the stack. */
|
||||
xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress =
|
||||
|
@ -640,7 +640,7 @@ uint32_t ul;
|
|||
|
||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||
( portMPU_REGION_READ_WRITE ) | /* Read and write. */
|
||||
( prvGetMPURegionSizeSetting( ( uint32_t ) usStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
||||
( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||
( portMPU_REGION_ENABLE );
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
|
||||
|
||||
void *MPU_pvPortMalloc( size_t xSize )
|
||||
{
|
||||
void *pvReturn;
|
||||
|
@ -1171,7 +1171,7 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
|||
|
||||
return pvReturn;
|
||||
}
|
||||
|
||||
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -1185,7 +1185,7 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
|||
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
}
|
||||
|
||||
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -251,7 +251,9 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseT
|
|||
* queue is created, then prvInitialiseMutex() is called to configure the queue
|
||||
* as a mutex.
|
||||
*/
|
||||
static void prvInitialiseMutex( Queue_t *pxNewQueue );
|
||||
#if( configUSE_MUTEXES == 1 )
|
||||
static void prvInitialiseMutex( Queue_t *pxNewQueue ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -469,30 +471,34 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseT
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvInitialiseMutex( Queue_t *pxNewQueue )
|
||||
{
|
||||
if( pxNewQueue != NULL )
|
||||
#if( configUSE_MUTEXES == 1 )
|
||||
|
||||
static void prvInitialiseMutex( Queue_t *pxNewQueue )
|
||||
{
|
||||
/* The queue create function will set all the queue structure members
|
||||
correctly for a generic queue, but this function is creating a
|
||||
mutex. Overwrite those members that need to be set differently -
|
||||
in particular the information required for priority inheritance. */
|
||||
pxNewQueue->pxMutexHolder = NULL;
|
||||
pxNewQueue->uxQueueType = queueQUEUE_IS_MUTEX;
|
||||
if( pxNewQueue != NULL )
|
||||
{
|
||||
/* The queue create function will set all the queue structure members
|
||||
correctly for a generic queue, but this function is creating a
|
||||
mutex. Overwrite those members that need to be set differently -
|
||||
in particular the information required for priority inheritance. */
|
||||
pxNewQueue->pxMutexHolder = NULL;
|
||||
pxNewQueue->uxQueueType = queueQUEUE_IS_MUTEX;
|
||||
|
||||
/* In case this is a recursive mutex. */
|
||||
pxNewQueue->u.uxRecursiveCallCount = 0;
|
||||
/* In case this is a recursive mutex. */
|
||||
pxNewQueue->u.uxRecursiveCallCount = 0;
|
||||
|
||||
traceCREATE_MUTEX( pxNewQueue );
|
||||
traceCREATE_MUTEX( pxNewQueue );
|
||||
|
||||
/* Start with the semaphore in the expected state. */
|
||||
( void ) xQueueGenericSend( pxNewQueue, NULL, ( TickType_t ) 0U, queueSEND_TO_BACK );
|
||||
/* Start with the semaphore in the expected state. */
|
||||
( void ) xQueueGenericSend( pxNewQueue, NULL, ( TickType_t ) 0U, queueSEND_TO_BACK );
|
||||
}
|
||||
else
|
||||
{
|
||||
traceCREATE_MUTEX_FAILED();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
traceCREATE_MUTEX_FAILED();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* configUSE_MUTEXES */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
|
|
|
@ -413,7 +413,7 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
|
|||
#endif
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
extern void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize );
|
||||
extern void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );
|
||||
#endif
|
||||
|
||||
/* File private functions. --------------------------------*/
|
||||
|
@ -542,7 +542,7 @@ static void prvResetNextTaskUnblockTime( void );
|
|||
* Called after a Task_t structure has been allocated either statically or
|
||||
* dynamically to fill in the structure's members.
|
||||
*/
|
||||
static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/*
|
||||
* Called after a new task has been created and initialised to place the task
|
||||
|
@ -554,10 +554,10 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION;
|
|||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
|
||||
BaseType_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
{
|
||||
TCB_t *pxNewTCB;
|
||||
BaseType_t xReturn;
|
||||
TaskHandle_t xReturn;
|
||||
|
||||
configASSERT( puxStackBuffer != NULL );
|
||||
configASSERT( pxTaskBuffer != NULL );
|
||||
|
@ -577,13 +577,12 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION;
|
|||
}
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
|
||||
prvInitialiseNewTask( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB );
|
||||
prvInitialiseNewTask( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, &xReturn, pxNewTCB );
|
||||
prvAddNewTaskToReadyList( pxNewTCB );
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
||||
xReturn = NULL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
|
@ -665,7 +664,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION;
|
|||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
prvInitialiseNewTask( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB );
|
||||
prvInitialiseNewTask( pxTaskCode, pcName, ( uint32_t ) usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB );
|
||||
prvAddNewTaskToReadyList( pxNewTCB );
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
|
@ -680,7 +679,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION;
|
|||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
{
|
||||
StackType_t *pxTopOfStack;
|
||||
UBaseType_t x;
|
||||
|
@ -703,7 +702,7 @@ UBaseType_t x;
|
|||
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )
|
||||
{
|
||||
/* Fill the stack with a known value to assist debugging. */
|
||||
( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( StackType_t ) );
|
||||
( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) ulStackDepth * sizeof( StackType_t ) );
|
||||
}
|
||||
#endif /* ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) ) */
|
||||
|
||||
|
@ -713,7 +712,7 @@ UBaseType_t x;
|
|||
by the port. */
|
||||
#if( portSTACK_GROWTH < 0 )
|
||||
{
|
||||
pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( uint16_t ) 1 );
|
||||
pxTopOfStack = pxNewTCB->pxStack + ( ulStackDepth - ( uint32_t ) 1 );
|
||||
pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); /*lint !e923 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. */
|
||||
|
||||
/* Check the alignment of the calculated top of stack is correct. */
|
||||
|
@ -728,7 +727,7 @@ UBaseType_t x;
|
|||
|
||||
/* The other extreme of the stack space is required if stack checking is
|
||||
performed. */
|
||||
pxNewTCB->pxEndOfStack = pxNewTCB->pxStack + ( usStackDepth - ( uint16_t ) 1 );
|
||||
pxNewTCB->pxEndOfStack = pxNewTCB->pxStack + ( ulStackDepth - ( uint32_t ) 1 );
|
||||
}
|
||||
#endif /* portSTACK_GROWTH */
|
||||
|
||||
|
@ -804,7 +803,7 @@ UBaseType_t x;
|
|||
|
||||
#if ( portUSING_MPU_WRAPPERS == 1 )
|
||||
{
|
||||
vPortStoreTaskMPUSettings( &( pxNewTCB->xMPUSettings ), xRegions, pxNewTCB->pxStack, usStackDepth );
|
||||
vPortStoreTaskMPUSettings( &( pxNewTCB->xMPUSettings ), xRegions, pxNewTCB->pxStack, ulStackDepth );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1730,23 +1729,32 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
|
|||
void vTaskStartScheduler( void )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
uint16_t usIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
|
||||
/* Add the idle task at the lowest priority. */
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
{
|
||||
StaticTask_t *pxIdleTaskTCBBuffer = NULL;
|
||||
StackType_t *pxIdleTaskStackBuffer = NULL;
|
||||
uint32_t ulIdleTaskStackSize;
|
||||
|
||||
/* The Idle task is created using user provided RAM - obtain the
|
||||
address of the RAM then create the idle task. */
|
||||
vApplicationGetIdleTaskMemory( &pxIdleTaskTCBBuffer, &pxIdleTaskStackBuffer, &usIdleTaskStackSize );
|
||||
xReturn = xTaskCreateStatic( prvIdleTask, "IDLE", usIdleTaskStackSize, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle, pxIdleTaskStackBuffer, pxIdleTaskTCBBuffer ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||
vApplicationGetIdleTaskMemory( &pxIdleTaskTCBBuffer, &pxIdleTaskStackBuffer, &ulIdleTaskStackSize );
|
||||
xIdleTaskHandle = xTaskCreateStatic( prvIdleTask, "IDLE", ulIdleTaskStackSize, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), pxIdleTaskStackBuffer, pxIdleTaskTCBBuffer ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||
|
||||
if( xIdleTaskHandle != NULL )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* The Idle task is being created using dynamically allocated RAM. */
|
||||
xReturn = xTaskCreate( prvIdleTask, "IDLE", usIdleTaskStackSize, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||
xReturn = xTaskCreate( prvIdleTask, "IDLE", configMINIMAL_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL;
|
|||
following callback function - which enables the application to optionally
|
||||
provide the memory that will be used by the timer task as the task's stack
|
||||
and TCB. */
|
||||
extern void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize );
|
||||
extern void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize );
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -254,8 +254,6 @@ static void prvInitialiseNewTimer( const char * const pcTimerName, const TickTyp
|
|||
BaseType_t xTimerCreateTimerTask( void )
|
||||
{
|
||||
BaseType_t xReturn = pdFAIL;
|
||||
uint16_t usTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
|
||||
|
||||
/* This function is called when the scheduler is started if
|
||||
configUSE_TIMERS is set to 1. Check that the infrastructure used by the
|
||||
|
@ -270,13 +268,19 @@ uint16_t usTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
|||
{
|
||||
StaticTask_t *pxTimerTaskTCBBuffer = NULL;
|
||||
StackType_t *pxTimerTaskStackBuffer = NULL;
|
||||
uint32_t ulTimerTaskStackSize;
|
||||
|
||||
vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &usTimerTaskStackSize );
|
||||
xReturn = xTaskCreateStatic( prvTimerTask, "Tmr Svc", usTimerTaskStackSize, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle, pxTimerTaskStackBuffer, pxTimerTaskTCBBuffer );
|
||||
vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &ulTimerTaskStackSize );
|
||||
xTimerTaskHandle = xTaskCreateStatic( prvTimerTask, "Tmr Svc", ulTimerTaskStackSize, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, pxTimerTaskStackBuffer, pxTimerTaskTCBBuffer );
|
||||
|
||||
if( xTimerTaskHandle != NULL )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", usTimerTaskStackSize, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );
|
||||
xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", configTIMER_TASK_STACK_DEPTH, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );
|
||||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue