Merge branch 'refactor/freertos_10.4.3_sync_non_behavioral_changes' into 'master'

FreeRTOS(IDF): Sync remaning v10.4.3 cosmetic differences

See merge request espressif/esp-idf!20983
This commit is contained in:
Darian 2022-11-11 02:35:46 +08:00
commit bae4a5c30c
9 changed files with 503 additions and 332 deletions

View File

@ -228,6 +228,10 @@
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
#endif
#ifndef configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 0
#endif
#ifndef configUSE_RECURSIVE_MUTEXES
#define configUSE_RECURSIVE_MUTEXES 0
#endif
@ -1213,7 +1217,7 @@ typedef struct xSTATIC_TCB
UBaseType_t uxDummy5;
void * pxDummy6;
uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
BaseType_t xDummyCore;
BaseType_t xDummyCoreID;
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
void * pxDummy8;
#endif
@ -1231,7 +1235,7 @@ typedef struct xSTATIC_TCB
#endif
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
void * pvDummyLocalStorageCallBack[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#endif
#endif
@ -1297,7 +1301,7 @@ typedef struct xSTATIC_QUEUE
UBaseType_t uxDummy8;
uint8_t ucDummy9;
#endif
portMUX_TYPE xDummy10;
portMUX_TYPE xDummyQueueLock;
} StaticQueue_t;
typedef StaticQueue_t StaticSemaphore_t;
@ -1327,7 +1331,7 @@ typedef struct xSTATIC_EVENT_GROUP
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
uint8_t ucDummy4;
#endif
portMUX_TYPE xDummy5;
portMUX_TYPE xDummyEventGroupLock;
} StaticEventGroup_t;
/*
@ -1364,12 +1368,12 @@ typedef struct xSTATIC_TIMER
* internally by FreeRTOS is not accessible to application code. However, if
* the application writer wants to statically allocate the memory required to
* create a stream buffer then the size of the stream buffer object needs to be
* known. The StaticStreamBuffer_t structure below is provided for this
* purpose. Its size and alignment requirements are guaranteed to match those
* of the genuine structure, no matter which architecture is being used, and
* no matter how the values in FreeRTOSConfig.h are set. Its contents are
* somewhat obfuscated in the hope users will recognise that it would be unwise
* to make direct use of the structure members.
* known. The StaticStreamBuffer_t structure below is provided for this purpose.
* Its size and alignment requirements are guaranteed to match those of the
* genuine structure, no matter which architecture is being used, and no matter
* how the values in FreeRTOSConfig.h are set. Its contents are somewhat
* obfuscated in the hope users will recognise that it would be unwise to make
* direct use of the structure members.
*/
typedef struct xSTATIC_STREAM_BUFFER
{
@ -1379,7 +1383,7 @@ typedef struct xSTATIC_STREAM_BUFFER
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxDummy4;
#endif
portMUX_TYPE xDummy5;
portMUX_TYPE xStreamBufferLock;
} StaticStreamBuffer_t;
/* Message buffers are built on stream buffers. */

View File

@ -37,7 +37,7 @@
/* This file redefines API functions to be called through a wrapper macro, but
* only for ports that are using the MPU. */
#if portUSING_MPU_WRAPPERS
#ifdef portUSING_MPU_WRAPPERS
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
* included from queue.c or task.c to prevent it from having an effect within
@ -55,11 +55,9 @@
/* Map standard tasks.h API functions to the MPU equivalents. */
#define xTaskCreate MPU_xTaskCreate
#define xTaskCreateStatic MPU_xTaskCreateStatic
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
#define vTaskDelete MPU_vTaskDelete
#define vTaskDelay MPU_vTaskDelay
#define vTaskDelayUntil MPU_vTaskDelayUntil
#define xTaskDelayUntil MPU_xTaskDelayUntil
#define xTaskAbortDelay MPU_xTaskAbortDelay
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
#define eTaskGetState MPU_eTaskGetState
@ -77,8 +75,8 @@
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
/* #define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer */
/* #define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer */
#define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
#define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
#define uxTaskGetSystemState MPU_uxTaskGetSystemState
@ -86,9 +84,10 @@
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
#define ulTaskGetIdleRunTimeCounter MPU_ulTaskGetIdleRunTimeCounter
#define xTaskGenericNotify MPU_xTaskGenericNotify
#define xTaskNotifyWait MPU_xTaskNotifyWait
#define ulTaskNotifyTake MPU_ulTaskNotifyTake
#define xTaskNotifyStateClear MPU_xTaskNotifyStateClear
#define xTaskGenericNotifyWait MPU_xTaskGenericNotifyWait
#define ulTaskGenericNotifyTake MPU_ulTaskGenericNotifyTake
#define xTaskGenericNotifyStateClear MPU_xTaskGenericNotifyStateClear
#define ulTaskGenericNotifyValueClear MPU_ulTaskGenericNotifyValueClear
#define xTaskCatchUpTicks MPU_xTaskCatchUpTicks
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
@ -135,6 +134,7 @@
#define xTimerPendFunctionCall MPU_xTimerPendFunctionCall
#define pcTimerGetName MPU_pcTimerGetName
#define vTimerSetReloadMode MPU_vTimerSetReloadMode
#define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
#define xTimerGetPeriod MPU_xTimerGetPeriod
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
#define xTimerGenericCommand MPU_xTimerGenericCommand

View File

@ -47,13 +47,13 @@ typedef QueueHandle_t SemaphoreHandle_t;
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U )
#define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U )
/** @cond !DOC_EXCLUDE_HEADER_SECTION */
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* semphr. h
* @code{c}
* vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore );
* @endcode
* @endcond
*
* In many usage scenarios it is faster and more memory efficient to use a
* direct to task notification in place of a binary semaphore!
@ -112,7 +112,6 @@ typedef QueueHandle_t SemaphoreHandle_t;
} \
}
#endif
/** @endcond */
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
@ -161,7 +160,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
*
* void vATask( void * pvParameters )
* {
* // Semaphore cannot be used before a call to vSemaphoreCreateBinary().
* // Semaphore cannot be used before a call to xSemaphoreCreateBinary().
* // This is a macro so pass the variable in directly.
* xSemaphore = xSemaphoreCreateBinary();
*
@ -226,8 +225,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
*
* void vATask( void * pvParameters )
* {
* // Semaphore cannot be used before a call to xSemaphoreCreateBinary() or
* // xSemaphoreCreateBinaryStatic().
* // Semaphore cannot be used before a call to xSemaphoreCreateBinaryStatic().
* // The semaphore's data structures will be placed in the xSemaphoreBuffer
* // variable, the address of which is passed into the function. The
* // function's parameter is not NULL, so the function will not attempt any
@ -262,10 +260,10 @@ typedef QueueHandle_t SemaphoreHandle_t;
* created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
* xSemaphoreCreateCounting().
*
* param xSemaphore A handle to the semaphore being taken - obtained when
* @param xSemaphore A handle to the semaphore being taken - obtained when
* the semaphore was created.
*
* param xBlockTime The time in ticks to wait for the semaphore to become
* @param xBlockTime The time in ticks to wait for the semaphore to become
* available. The macro portTICK_PERIOD_MS can be used to convert this to a
* real time. A block time of zero can be used to poll the semaphore. A block
* time of portMAX_DELAY can be used to block indefinitely (provided
@ -282,7 +280,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* void vATask( void * pvParameters )
* {
* // Create the semaphore to guard a shared resource.
* vSemaphoreCreateBinary( xSemaphore );
* xSemaphore = xSemaphoreCreateBinary();
* }
*
* // A task that uses the semaphore.
@ -417,9 +415,18 @@ typedef QueueHandle_t SemaphoreHandle_t;
* @endcond
* \ingroup Semaphores
*/
#define xSemaphoreTakeRecursive( xMutex, xBlockTime ) xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )
#if ( configUSE_RECURSIVE_MUTEXES == 1 )
#define xSemaphoreTakeRecursive( xMutex, xBlockTime ) xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )
#endif
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* semphr. h
* @code{c}
* xSemaphoreGive( SemaphoreHandle_t xSemaphore );
* @endcode
* @endcond
*
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
* created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
* xSemaphoreCreateCounting(). and obtained using sSemaphoreTake().
@ -445,7 +452,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* void vATask( void * pvParameters )
* {
* // Create the semaphore to guard a shared resource.
* vSemaphoreCreateBinary( xSemaphore );
* xSemaphore = vSemaphoreCreateBinary();
*
* if( xSemaphore != NULL )
* {
@ -569,9 +576,20 @@ typedef QueueHandle_t SemaphoreHandle_t;
* @endcond
* \ingroup Semaphores
*/
#define xSemaphoreGiveRecursive( xMutex ) xQueueGiveMutexRecursive( ( xMutex ) )
#if ( configUSE_RECURSIVE_MUTEXES == 1 )
#define xSemaphoreGiveRecursive( xMutex ) xQueueGiveMutexRecursive( ( xMutex ) )
#endif
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* semphr. h
* @code{c}
* xSemaphoreGiveFromISR(
* SemaphoreHandle_t xSemaphore,
* BaseType_t *pxHigherPriorityTaskWoken
* );
* @endcode
* @endcond
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
* created with a call to xSemaphoreCreateBinary() or xSemaphoreCreateCounting().
*
@ -828,6 +846,13 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* semphr. h
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void );
* @endcode
* @endcond
*
* Creates a new recursive mutex type semaphore instance, and returns a handle
* by which the new recursive mutex can be referenced.
*
@ -836,7 +861,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* created using xSemaphoreCreateRecursiveMutex() then the required memory is
* automatically dynamically allocated inside the
* xSemaphoreCreateRecursiveMutex() function. (see
* http://www.freertos.org/a00111.html). If a recursive mutex is created using
* https://www.FreeRTOS.org/a00111.html). If a recursive mutex is created using
* xSemaphoreCreateRecursiveMutexStatic() then the application writer must
* provide the memory that will get used by the mutex.
* xSemaphoreCreateRecursiveMutexStatic() therefore allows a recursive mutex to
@ -859,31 +884,34 @@ typedef QueueHandle_t SemaphoreHandle_t;
*
* Mutex type semaphores cannot be used from within interrupt service routines.
*
* See vSemaphoreCreateBinary() for an alternative implementation that can be
* See xSemaphoreCreateBinary() for an alternative implementation that can be
* used for pure synchronisation (where one task or interrupt always 'gives' the
* semaphore and another always 'takes' the semaphore) and from within interrupt
* service routines.
*
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
* SemaphoreHandle_t.
* SemaphoreHandle_t.
*
* Example usage:
* @code{c}
* SemaphoreHandle_t xSemaphore;
* SemaphoreHandle_t xSemaphore;
*
* void vATask( void * pvParameters )
* void vATask( void * pvParameters )
* {
* // Semaphore cannot be used before a call to xSemaphoreCreateMutex().
* // This is a macro so pass the variable in directly.
* xSemaphore = xSemaphoreCreateRecursiveMutex();
*
* if( xSemaphore != NULL )
* {
* // Semaphore cannot be used before a call to xSemaphoreCreateMutex().
* // This is a macro so pass the variable in directly.
* xSemaphore = xSemaphoreCreateRecursiveMutex();
*
* if( xSemaphore != NULL )
* {
* // The semaphore was created successfully.
* // The semaphore can now be used.
* }
* // The semaphore was created successfully.
* // The semaphore can now be used.
* }
* }
* @endcode
* @cond !DOC_SINGLE_GROUP
* \defgroup xSemaphoreCreateRecursiveMutex xSemaphoreCreateRecursiveMutex
* @endcond
* \ingroup Semaphores
*/
#if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) )
@ -891,6 +919,13 @@ typedef QueueHandle_t SemaphoreHandle_t;
#endif
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* semphr. h
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateRecursiveMutexStatic( StaticSemaphore_t *pxMutexBuffer );
* @endcode
* @endcond
*
* Creates a new recursive mutex type semaphore instance, and returns a handle
* by which the new recursive mutex can be referenced.
*
@ -937,22 +972,25 @@ typedef QueueHandle_t SemaphoreHandle_t;
*
* Example usage:
* @code{c}
* SemaphoreHandle_t xSemaphore;
* StaticSemaphore_t xMutexBuffer;
* SemaphoreHandle_t xSemaphore;
* StaticSemaphore_t xMutexBuffer;
*
* void vATask( void * pvParameters )
* {
* // A recursive semaphore cannot be used before it is created. Here a
* // recursive mutex is created using xSemaphoreCreateRecursiveMutexStatic().
* // The address of xMutexBuffer is passed into the function, and will hold
* // the mutexes data structures - so no dynamic memory allocation will be
* // attempted.
* xSemaphore = xSemaphoreCreateRecursiveMutexStatic( &xMutexBuffer );
* void vATask( void * pvParameters )
* {
* // A recursive semaphore cannot be used before it is created. Here a
* // recursive mutex is created using xSemaphoreCreateRecursiveMutexStatic().
* // The address of xMutexBuffer is passed into the function, and will hold
* // the mutexes data structures - so no dynamic memory allocation will be
* // attempted.
* xSemaphore = xSemaphoreCreateRecursiveMutexStatic( &xMutexBuffer );
*
* // As no dynamic memory allocation was performed, xSemaphore cannot be NULL,
* // so there is no need to check it.
* }
* // As no dynamic memory allocation was performed, xSemaphore cannot be NULL,
* // so there is no need to check it.
* }
* @endcode
* @cond !DOC_SINGLE_GROUP
* \defgroup xSemaphoreCreateRecursiveMutexStatic xSemaphoreCreateRecursiveMutexStatic
* @endcond
* \ingroup Semaphores
*/
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) )
@ -1149,7 +1187,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
*
* @param xSemaphore A handle to the semaphore to be deleted.
*
* @cond !DOC_EXCLUDE_HEADER_SECTION
* @cond !DOC_SINGLE_GROUP
* \defgroup vSemaphoreDelete vSemaphoreDelete
* @endcond
* \ingroup Semaphores

View File

@ -5,6 +5,7 @@
*
* SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
*/
/*
* FreeRTOS Kernel V10.4.3
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@ -116,6 +117,7 @@ typedef enum
} eNotifyAction;
/** @cond !DOC_EXCLUDE_HEADER_SECTION */
/**
* Used internally only.
*/
@ -165,9 +167,9 @@ typedef struct xTASK_STATUS
uint32_t ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See https://www.FreeRTOS.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
StackType_t * pxStackBase; /* Points to the lowest address of the task's stack area. */
configSTACK_DEPTH_TYPE usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
#if configTASKLIST_INCLUDE_COREID
BaseType_t xCoreID; /*!< Core this task is pinned to (0, 1, or -1 for tskNO_AFFINITY). This field is present if CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID is set. */
#endif
#if ( configTASKLIST_INCLUDE_COREID == 1 )
BaseType_t xCoreID; /*!< Core this task is pinned to (0, 1, or -1 for tskNO_AFFINITY). This field is present if CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID is set. */
#endif
} TaskStatus_t;
/** @endcond */
@ -219,18 +221,9 @@ typedef enum
* @endcond
* \ingroup SchedulerControl
*/
#ifdef ESP_PLATFORM
#define taskENTER_CRITICAL( x ) portENTER_CRITICAL( x )
#else
#define taskENTER_CRITICAL( ) portENTER_CRITICAL( )
#endif // ESP_PLATFORM
#define taskENTER_CRITICAL_FROM_ISR( ) portSET_INTERRUPT_MASK_FROM_ISR()
#ifdef ESP_PLATFORM
#define taskENTER_CRITICAL_ISR( x ) portENTER_CRITICAL_ISR( x )
#else
#define taskENTER_CRITICAL_ISR( ) portENTER_CRITICAL_ISR( )
#endif // ESP_PLATFORM
#define taskENTER_CRITICAL( x ) portENTER_CRITICAL( x )
#define taskENTER_CRITICAL_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
#define taskENTER_CRITICAL_ISR( x ) portENTER_CRITICAL_ISR( x )
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
@ -248,19 +241,10 @@ typedef enum
* @endcond
* \ingroup SchedulerControl
*/
#define taskEXIT_CRITICAL( x ) portEXIT_CRITICAL( x )
#define taskEXIT_CRITICAL_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( x )
#define taskEXIT_CRITICAL_ISR( x ) portEXIT_CRITICAL_ISR( x )
#ifdef ESP_PLATFORM
#define taskEXIT_CRITICAL( x ) portEXIT_CRITICAL( x )
#else
#define taskEXIT_CRITICAL( ) portEXIT_CRITICAL( )
#endif // ESP_PLATFORM
#define taskEXIT_CRITICAL_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( x )
#ifdef ESP_PLATFORM
#define taskEXIT_CRITICAL_ISR( x ) portEXIT_CRITICAL_ISR( x )
#else
#define taskEXIT_CRITICAL_ISR( ) portEXIT_CRITICAL_ISR( )
#endif // ESP_PLATFORM
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h
@ -302,12 +286,13 @@ typedef enum
*----------------------------------------------------------*/
/**
* Create a new task with a specified affinity.
* Create a new task with a specified affinity and add it to the list of tasks
* that are ready to run.
*
* This function is similar to xTaskCreate, but allows setting task affinity
* in SMP system.
*
* @param pvTaskCode Pointer to the task entry function. Tasks
* @param pxTaskCode Pointer to the task entry function. Tasks
* must be implemented to never return (i.e. continuous loop), or should be
* terminated using vTaskDelete function.
*
@ -327,32 +312,192 @@ typedef enum
* example, to create a privileged task at priority 2 the uxPriority parameter
* should be set to ( 2 | portPRIVILEGE_BIT ).
*
* @param pvCreatedTask Used to pass back a handle by which the created task
* @param[out] pvCreatedTask Used to pass back a handle by which the created task
* can be referenced.
*
* @param xCoreID If the value is tskNO_AFFINITY, the created task is not
* pinned to any CPU, and the scheduler can run it on any core available.
* Values 0 or 1 indicate the index number of the CPU which the task should
* be pinned to. Specifying values larger than (portNUM_PROCESSORS - 1) will
* be pinned to. Specifying values larger than (configNUM_CORES - 1) will
* cause the function to fail.
*
* @return pdPASS if the task was successfully created and added to a ready
* list, otherwise an error code defined in the file projdefs.h
*
* @note If program uses thread local variables (ones specified with "__thread" keyword)
* then storage for them will be allocated on the task's stack.
*
* Example usage:
* @code{c}
* // Task to be created.
* void vTaskCode( void * pvParameters )
* {
* for( ;; )
* {
* // Task code goes here.
* }
* }
*
* // Function that creates a task.
* void vOtherFunction( void )
* {
* static uint8_t ucParameterToPass;
* TaskHandle_t xHandle = NULL;
*
* // Create the task pinned to core 0, storing the handle. Note that the passed parameter ucParameterToPass
* // must exist for the lifetime of the task, so in this case is declared static. If it was just an
* // an automatic stack variable it might no longer exist, or at least have been corrupted, by the time
* // the new task attempts to access it.
* xTaskCreatePinnedToCore( vTaskCode, "NAME", STACK_SIZE, &ucParameterToPass, tskIDLE_PRIORITY, &xHandle, 0 );
* configASSERT( xHandle );
*
* // Use the handle to delete the task.
* if( xHandle != NULL )
* {
* vTaskDelete( xHandle );
* }
* }
* @endcode
* @cond !DOC_SINGLE_GROUP
* \defgroup xTaskCreatePinnedToCore xTaskCreatePinnedToCore
* @endcond
* \ingroup Tasks
*/
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pvTaskCode,
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pxTaskCode,
const char * const pcName,
const uint32_t usStackDepth,
const configSTACK_DEPTH_TYPE usStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
TaskHandle_t * const pvCreatedTask,
const BaseType_t xCoreID);
const BaseType_t xCoreID );
#endif
/**
* Create a new task with a specified affinity and add it to the list of tasks
* that are ready to run.
*
* This function is similar to xTaskCreateStatic, but allows specifying
* task affinity in an SMP system.
*
* @param pxTaskCode Pointer to the task entry function. Tasks
* must be implemented to never return (i.e. continuous loop), or should be
* terminated using vTaskDelete function.
*
* @param pcName A descriptive name for the task. This is mainly used to
* facilitate debugging. The maximum length of the string is defined by
* configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.
*
* @param ulStackDepth The size of the task stack specified as the number of
* bytes. Note that this differs from vanilla FreeRTOS.
*
* @param pvParameters Pointer that will be used as the parameter for the task
* being created.
*
* @param uxPriority The priority at which the task will run.
*
* @param pxStackBuffer Must point to a StackType_t array that has at least
* 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
* then be used to hold the task's data structures, removing the need for the
* memory to be allocated dynamically.
*
* @param xCoreID If the value is tskNO_AFFINITY, the created task is not
* pinned to any CPU, and the scheduler can run it on any core available.
* Values 0 or 1 indicate the index number of the CPU which the task should
* be pinned to. Specifying values larger than (configNUM_CORES - 1) will
* cause the function to fail.
*
* @return If neither pxStackBuffer or pxTaskBuffer are NULL, then the task will
* be created and pdPASS is returned. If either pxStackBuffer or pxTaskBuffer
* are NULL then the task will not be created and
* errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY is returned.
*
* Example usage:
* @code{c}
*
* // 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;
*
* // 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 ];
*
* // 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 xTaskCreateStaticPinnedToCore().
* configASSERT( ( uint32_t ) pvParameters == 1UL );
*
* for( ;; )
* {
* // Task code goes here.
* }
* }
*
* // Function that creates a task.
* void vOtherFunction( void )
* {
* TaskHandle_t xHandle = NULL;
*
* // Create the task pinned to core 0 without using any dynamic memory allocation.
* xHandle = xTaskCreateStaticPinnedToCore(
* vTaskCode, // Function that implements the task.
* "NAME", // Text name for the task.
* STACK_SIZE, // Stack size in bytes, not words.
* ( 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.
* 0 ); // Specify the task's core affinity
*
* // 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 );
* }
* @endcode
* @cond !DOC_SINGLE_GROUP
* \defgroup xTaskCreateStaticPinnedToCore xTaskCreateStaticPinnedToCore
* @endcond
* \ingroup Tasks
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pxTaskCode,
const char * const pcName,
const uint32_t ulStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
StackType_t * const pxStackBuffer,
StaticTask_t * const pxTaskBuffer,
const BaseType_t xCoreID );
#endif /* configSUPPORT_STATIC_ALLOCATION */
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h
* @code{c}
* BaseType_t xTaskCreate(
* TaskFunction_t pvTaskCode,
* const char * const pcName,
* configSTACK_DEPTH_TYPE usStackDepth,
* void *pvParameters,
* UBaseType_t uxPriority,
* TaskHandle_t *pvCreatedTask
* );
* @endcode
* @endcond
*
* Create a new task and add it to the list of tasks that are ready to run.
*
* Internally, within the FreeRTOS implementation, tasks use two blocks of
@ -373,7 +518,7 @@ typedef enum
* support can alternatively create an MPU constrained task using
* xTaskCreateRestricted().
*
* @param pvTaskCode Pointer to the task entry function. Tasks
* @param pxTaskCode Pointer to the task entry function. Tasks
* must be implemented to never return (i.e. continuous loop), or should be
* terminated using vTaskDelete function.
*
@ -439,78 +584,32 @@ typedef enum
* \ingroup Tasks
*/
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
static inline IRAM_ATTR BaseType_t xTaskCreate(
TaskFunction_t pvTaskCode,
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
const uint32_t usStackDepth,
static inline __attribute__( ( always_inline ) )
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
const configSTACK_DEPTH_TYPE usStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
TaskHandle_t * const pxCreatedTask) PRIVILEGED_FUNCTION
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION
{
return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, tskNO_AFFINITY );
return xTaskCreatePinnedToCore( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, tskNO_AFFINITY );
}
#endif
#endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
/**
* Create a new task with a specified affinity.
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h
* @code{c}
* TaskHandle_t xTaskCreateStatic( TaskFunction_t pvTaskCode,
* const char * const pcName,
* uint32_t ulStackDepth,
* void *pvParameters,
* UBaseType_t uxPriority,
* StackType_t *pxStackBuffer,
* StaticTask_t *pxTaskBuffer );
* @endcode
* @endcond
*
* This function is similar to xTaskCreateStatic, but allows specifying
* task affinity in an SMP system.
*
* @param pvTaskCode Pointer to the task entry function. Tasks
* must be implemented to never return (i.e. continuous loop), or should be
* terminated using vTaskDelete function.
*
* @param pcName A descriptive name for the task. This is mainly used to
* facilitate debugging. The maximum length of the string is defined by
* configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.
*
* @param ulStackDepth The size of the task stack specified as the number of
* bytes. Note that this differs from vanilla FreeRTOS.
*
* @param pvParameters Pointer that will be used as the parameter for the task
* being created.
*
* @param uxPriority The priority at which the task will run.
*
* @param pxStackBuffer Must point to a StackType_t array that has at least
* 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
* then be used to hold the task's data structures, removing the need for the
* memory to be allocated dynamically.
*
* @param xCoreID If the value is tskNO_AFFINITY, the created task is not
* pinned to any CPU, and the scheduler can run it on any core available.
* Values 0 or 1 indicate the index number of the CPU which the task should
* be pinned to. Specifying values larger than (portNUM_PROCESSORS - 1) will
* cause the function to fail.
*
* @return If neither pxStackBuffer or pxTaskBuffer are NULL, then the task will
* be created and pdPASS is returned. If either pxStackBuffer or pxTaskBuffer
* are NULL then the task will not be created and
* errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY is returned.
*
* \ingroup Tasks
*/
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pvTaskCode,
const char * const pcName,
const uint32_t ulStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
StackType_t * const pxStackBuffer,
StaticTask_t * const pxTaskBuffer,
const BaseType_t xCoreID );
#endif /* configSUPPORT_STATIC_ALLOCATION */
/**
* Create a new task and add it to the list of tasks that are ready to run.
*
* Internally, within the FreeRTOS implementation, tasks use two blocks of
@ -518,12 +617,12 @@ typedef enum
* second block is used by the task as its stack. If a task is created using
* xTaskCreate() then both blocks of memory are automatically dynamically
* allocated inside the xTaskCreate() function. (see
* http://www.freertos.org/a00111.html). If a task is created using
* https://www.FreeRTOS.org/a00111.html). If a task is created using
* xTaskCreateStatic() then the application writer must provide the required
* memory. xTaskCreateStatic() therefore allows a task to be created without
* using any dynamic memory allocation.
*
* @param pvTaskCode Pointer to the task entry function. Tasks
* @param pxTaskCode Pointer to the task entry function. Tasks
* must be implemented to never return (i.e. continuous loop), or should be
* terminated using vTaskDelete function.
*
@ -608,17 +707,17 @@ typedef enum
* \ingroup Tasks
*/
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
static inline IRAM_ATTR TaskHandle_t xTaskCreateStatic(
TaskFunction_t pvTaskCode,
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
static inline __attribute__( ( always_inline ) )
TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
const uint32_t ulStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
StackType_t * const puxStackBuffer,
StaticTask_t * const pxTaskBuffer) PRIVILEGED_FUNCTION
StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION
{
return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, tskNO_AFFINITY );
return xTaskCreateStaticPinnedToCore( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, tskNO_AFFINITY );
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
@ -650,7 +749,7 @@ typedef enum
* @param pxCreatedTask Used to pass back a handle by which the created task
* can be referenced.
*
* return pdPASS if the task was successfully created and added to a ready
* @return pdPASS if the task was successfully created and added to a ready
* list, otherwise an error code defined in the file projdefs.h
*
* Example usage:
@ -738,7 +837,7 @@ typedef enum
* @param pxCreatedTask Used to pass back a handle by which the created task
* can be referenced.
*
* return pdPASS if the task was successfully created and added to a ready
* @return pdPASS if the task was successfully created and added to a ready
* list, otherwise an error code defined in the file projdefs.h
*
* Example usage:
@ -752,7 +851,7 @@ typedef enum
* {
* vATask, // pvTaskCode - the function that implements the task.
* "ATask", // pcName - just a text name for the task to assist debugging.
* 100, // usStackDepth - the stack size DEFINED IN BYTES.
* 100, // usStackDepth - the stack size DEFINED IN BYTES.
* NULL, // pvParameters - passed into the task function as the function parameters.
* ( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.
* cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.
@ -1428,6 +1527,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
* SCHEDULER CONTROL
*----------------------------------------------------------*/
/** @cond !DOC_EXCLUDE_HEADER_SECTION */
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h
@ -1438,8 +1538,8 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
*
* Starts the real time kernel tick processing. After calling the kernel
* has control over which tasks are executed and when.
* NOTE: In ESP-IDF the scheduler is started automatically during
*
* @note: In ESP-IDF the scheduler is started automatically during
* application startup, vTaskStartScheduler() should not be called from
* ESP-IDF applications.
*
@ -1753,14 +1853,21 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lin
TaskHandle_t xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
* @code{c}
* UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask );
* @endcode
* @endcond
*
* Returns the high water mark of the stack associated with xTask.
*
* INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for
* this function to be available.
*
* Returns the high water mark of the stack associated with xTask. That is,
* the minimum free stack space there has been (in bytes not words, unlike vanilla
* FreeRTOS) since the task started. The smaller the returned
* the minimum free stack space there has been (in bytes not words, unlike
* vanilla FreeRTOS) since the task started. The smaller the returned
* number the closer the task has come to overflowing its stack.
*
* uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are the
@ -1772,21 +1879,28 @@ TaskHandle_t xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION;
* @param xTask Handle of the task associated with the stack to be checked.
* Set xTask to NULL to check the stack of the calling task.
*
* @return The smallest amount of free stack space there has been (in bytes not words,
* unlike vanilla FreeRTOS) since the task referenced by
* @return The smallest amount of free stack space there has been (in bytes not
* words, unlike vanilla FreeRTOS) since the task referenced by
* xTask was created.
*/
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
* @code{c}
* configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask );
* @endcode
* @endcond
*
* Returns the start of the stack associated with xTask.
*
* INCLUDE_uxTaskGetStackHighWaterMark2 must be set to 1 in FreeRTOSConfig.h for
* this function to be available.
*
* Returns the high water mark of the stack associated with xTask. That is,
* the minimum free stack space there has been (in words, so on a 32 bit machine
* a value of 1 means 4 bytes) since the task started. The smaller the returned
* the minimum free stack space there has been (in bytes not words, unlike
* vanilla FreeRTOS) since the task started. The smaller the returned
* number the closer the task has come to overflowing its stack.
*
* uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are the
@ -1798,8 +1912,8 @@ UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTIO
* @param xTask Handle of the task associated with the stack to be checked.
* Set xTask to NULL to check the stack of the calling task.
*
* @return The smallest amount of free stack space there has been (in words, so
* actual spaces on the stack rather than bytes) since the task referenced by
* @return The smallest amount of free stack space there has been (in bytes not
* words, unlike vanilla FreeRTOS) since the task referenced by
* xTask was created.
*/
configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
@ -1817,7 +1931,7 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
*
* @return A pointer to the start of the stack.
*/
uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
uint8_t * pxTaskGetStackStart( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
/* When using trace macros it is sometimes necessary to include task.h before
* FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
@ -1827,6 +1941,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
* constant. */
#ifdef configUSE_APPLICATION_TASK_TAG
#if configUSE_APPLICATION_TASK_TAG == 1
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
@ -1909,7 +2024,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
void * pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery,
BaseType_t xIndex ) PRIVILEGED_FUNCTION;
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
/**
* Prototype of local storage pointer deletion callback.
@ -1942,62 +2057,64 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue, TlsDeleteCallbackFunction_t pvDelCallback);
#endif
#endif
#endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) */
#if ( configCHECK_FOR_STACK_OVERFLOW > 0 )
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
* @code{c}
* void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName);
* @endcode
* @endcond
* The application stack overflow hook is called when a stack overflow is detected for a task.
*
* Details on stack overflow detection can be found here: https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html
*
* @param xTask the task that just exceeded its stack boundaries.
* @param pcTaskName A character string containing the name of the offending task.
*/
void vApplicationStackOverflowHook( TaskHandle_t xTask,
char * pcTaskName );
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
* @code{c}
* void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName);
* @endcode
* @endcond
* The application stack overflow hook is called when a stack overflow is detected for a task.
*
* Details on stack overflow detection can be found here: https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html
*
* @param xTask the task that just exceeded its stack boundaries.
* @param pcTaskName A character string containing the name of the offending task.
*/
void vApplicationStackOverflowHook( TaskHandle_t xTask,
char * pcTaskName );
#endif
#if ( configUSE_TICK_HOOK > 0 )
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
* @code{c}
* void vApplicationTickHook( void );
* @endcode
* @endcond
*
* This hook function is called in the system tick handler after any OS work is completed.
*/
#if ( configUSE_TICK_HOOK > 0 )
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
* @code{c}
* void vApplicationTickHook( void );
* @endcode
* @endcond
*
* This hook function is called in the system tick handler after any OS work is completed.
*/
void vApplicationTickHook( void ); /*lint !e526 Symbol not defined as it is an application callback. */
#endif
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
* @code{c}
* void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
* @endcode
* @endcond
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Idle Task TCB. This function is required when
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
*
* @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for thie idle task
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
*/
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
* @code{c}
* void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
* @endcode
* @endcond
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Idle Task TCB. This function is required when
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
*
* @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for thie idle task
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
*/
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */
#endif
/**
@ -2038,7 +2155,7 @@ TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
* of run time consumed by the task. See the TaskStatus_t structure
* definition in this file for the full member list.
*
* NOTE: This function is intended for debugging use only as its use results in
* @note This function is intended for debugging use only as its use results in
* the scheduler remaining suspended for an extended period.
*
* @param pxTaskStatusArray A pointer to an array of TaskStatus_t structures.
@ -2130,6 +2247,13 @@ UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray,
uint32_t * const pulTotalRunTime ) PRIVILEGED_FUNCTION;
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h
* @code{c}
* void vTaskList( char *pcWriteBuffer );
* @endcode
* @endcond
*
* List all the current tasks.
*
* configUSE_TRACE_FACILITY and configUSE_STATS_FORMATTING_FUNCTIONS must
@ -2178,6 +2302,13 @@ UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray,
void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h
* @code{c}
* void vTaskGetRunTimeStats( char *pcWriteBuffer );
* @endcode
* @endcond
*
* Get the state of running tasks as a string
*
* configGENERATE_RUN_TIME_STATS and configUSE_STATS_FORMATTING_FUNCTIONS
@ -3275,6 +3406,7 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) PRIVILEGED_FUNCTION;
* SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
*----------------------------------------------------------*/
/** @cond !DOC_EXCLUDE_HEADER_SECTION */
/*
* Return the handle of the task running on a certain CPU. Because of
* the nature of SMP processing, there is no guarantee that this
@ -3321,7 +3453,8 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
*/
BaseType_t xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
#ifdef ESP_PLATFORM
#if ( configNUM_CORES > 1 )
/*
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY
* INTENDED FOR USE WHEN IMPLEMENTING A PORT OF THE SCHEDULER AND IS
@ -3331,8 +3464,8 @@ BaseType_t xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
* occurs. This function will check if the current core requires time slicing,
* and also call the application tick hook.
*/
BaseType_t xTaskIncrementTickOtherCores( void ) PRIVILEGED_FUNCTION;
#endif // ESP_PLATFORM
BaseType_t xTaskIncrementTickOtherCores( void ) PRIVILEGED_FUNCTION;
#endif /* configNUM_CORES > 1 */
/*
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
@ -3386,7 +3519,6 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList,
TickType_t xTicksToWait,
const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;
#ifdef ESP_PLATFORM
/*
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
* INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
@ -3403,7 +3535,6 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList,
*/
void vTaskTakeKernelLock( void );
void vTaskReleaseKernelLock( void );
#endif // ESP_PLATFORM
/*
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN

View File

@ -147,9 +147,9 @@ typedef void (* PendedFunction_t)( void *,
* which is "void vCallbackFunction( TimerHandle_t xTimer );".
*
* @return If the timer is successfully created then a handle to the newly
* created timer is returned. If the timer cannot be created (because either
* there is insufficient FreeRTOS heap remaining to allocate the timer
* structures, or the timer period was set to 0) then NULL is returned.
* created timer is returned. If the timer cannot be created because there is
* insufficient FreeRTOS heap remaining to allocate the timer
* structures then NULL is returned.
*
* Example usage:
* @verbatim

View File

@ -166,9 +166,6 @@ void vListInsert( List_t * const pxList,
* 4) Using a queue or semaphore before it has been initialised or
* before the scheduler has been started (are interrupts firing
* before vTaskStartScheduler() has been called?).
* 5) If the FreeRTOS port supports interrupt nesting then ensure that
* the priority of the tick interrupt is at or below
* configMAX_SYSCALL_INTERRUPT_PRIORITY.
**********************************************************************/
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. *//*lint !e440 The iterator moves to a different value, not xValueOfInsertion. */

View File

@ -309,6 +309,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
pucAllocatedMemory = NULL;
}
if( pucAllocatedMemory != NULL )
{
prvInitialiseNewStreamBuffer( ( StreamBuffer_t * ) pucAllocatedMemory, /* Structure at the start of the allocated memory. */ /*lint !e9087 Safe cast as allocated memory is aligned. */ /*lint !e826 Area is not too small and alignment is guaranteed provided malloc() behaves as expected and returns aligned buffer. */

View File

@ -340,7 +340,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
void * pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
TlsDeleteCallbackFunction_t pvThreadLocalStoragePointersDelCallback[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#endif
#endif
@ -539,7 +539,7 @@ static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
/* Function to call the Thread Local Storage Pointer Deletion Callbacks. Will be
* called during task deletion before prvDeleteTCB is called.
*/
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
static void prvDeleteTLS( TCB_t * pxTCB );
#endif
@ -1486,7 +1486,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
if( xFreeNow == pdTRUE )
{
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
prvDeleteTLS( pxTCB );
#endif
@ -3360,93 +3360,91 @@ BaseType_t xTaskIncrementTick( void )
return xSwitchRequired;
}
#ifdef ESP_PLATFORM
#if ( configNUM_CORES > 1 )
BaseType_t xTaskIncrementTickOtherCores( void )
#if ( configNUM_CORES > 1 )
BaseType_t xTaskIncrementTickOtherCores( void )
{
/* Minor optimization. This function can never switch cores mid
* execution */
BaseType_t xCoreID = xPortGetCoreID();
BaseType_t xSwitchRequired = pdFALSE;
/* This function should never be called by Core 0. */
configASSERT( xCoreID != 0 );
/* Called by the portable layer each time a tick interrupt occurs.
* Increments the tick then checks to see if the new tick value will cause any
* tasks to be unblocked. */
traceTASK_INCREMENT_TICK( xTickCount );
if( uxSchedulerSuspended[ xCoreID ] == ( UBaseType_t ) pdFALSE )
{
/* Minor optimization. This function can never switch cores mid
* execution */
BaseType_t xCoreID = xPortGetCoreID();
BaseType_t xSwitchRequired = pdFALSE;
/* We need a critical section here as we are about to access kernel data
* structures:
* - Other cores could be accessing them simultaneously
* - Unlike other ports, we call xTaskIncrementTick() without disabling
* nested interrupts, which in turn is disabled by the critical
* section. */
taskENTER_CRITICAL_ISR( &xKernelLock );
/* This function should never be called by Core 0. */
configASSERT( xCoreID != 0 );
/* Called by the portable layer each time a tick interrupt occurs.
* Increments the tick then checks to see if the new tick value will cause any
* tasks to be unblocked. */
traceTASK_INCREMENT_TICK( xTickCount );
if( uxSchedulerSuspended[ xCoreID ] == ( UBaseType_t ) pdFALSE )
{
/* We need a critical section here as we are about to access kernel data
* structures:
* - Other cores could be accessing them simultaneously
* - Unlike other ports, we call xTaskIncrementTick() without disabling
* nested interrupts, which in turn is disabled by the critical
* section. */
taskENTER_CRITICAL_ISR( &xKernelLock );
/* A task being unblocked cannot cause an immediate context switch
* if preemption is turned off. */
#if ( configUSE_PREEMPTION == 1 )
{
/* Check if core 0 calling xTaskIncrementTick() has
* unblocked a task that can be run. */
if( uxTopReadyPriority > pxCurrentTCB[ xCoreID ]->uxPriority )
{
xSwitchRequired = pdTRUE;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* if ( configUSE_PREEMPTION == 1 ) */
/* Tasks of equal priority to the currently running task will share
* processing time (time slice) if preemption is on, and the application
* writer has not explicitly turned time slicing off. */
#if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )
{
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB[ xCoreID ]->uxPriority ] ) ) > ( UBaseType_t ) 1 )
{
xSwitchRequired = pdTRUE;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) ) */
/* Exit the critical section as we have finished accessing the kernel data structures. */
taskEXIT_CRITICAL_ISR( &xKernelLock );
#if ( configUSE_PREEMPTION == 1 )
{
if( xYieldPending[ xCoreID ] != pdFALSE )
{
xSwitchRequired = pdTRUE;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* configUSE_PREEMPTION */
}
#if ( configUSE_TICK_HOOK == 1 )
/* A task being unblocked cannot cause an immediate context switch
* if preemption is turned off. */
#if ( configUSE_PREEMPTION == 1 )
{
vApplicationTickHook();
/* Check if core 0 calling xTaskIncrementTick() has
* unblocked a task that can be run. */
if( uxTopReadyPriority > pxCurrentTCB[ xCoreID ]->uxPriority )
{
xSwitchRequired = pdTRUE;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif
#endif /* if ( configUSE_PREEMPTION == 1 ) */
return xSwitchRequired;
/* Tasks of equal priority to the currently running task will share
* processing time (time slice) if preemption is on, and the application
* writer has not explicitly turned time slicing off. */
#if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )
{
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB[ xCoreID ]->uxPriority ] ) ) > ( UBaseType_t ) 1 )
{
xSwitchRequired = pdTRUE;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) ) */
/* Exit the critical section as we have finished accessing the kernel data structures. */
taskEXIT_CRITICAL_ISR( &xKernelLock );
#if ( configUSE_PREEMPTION == 1 )
{
if( xYieldPending[ xCoreID ] != pdFALSE )
{
xSwitchRequired = pdTRUE;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* configUSE_PREEMPTION */
}
#endif /* ( configNUM_CORES > 1 ) */
#endif // ESP_PLATFORM
#if ( configUSE_TICK_HOOK == 1 )
{
vApplicationTickHook();
}
#endif
return xSwitchRequired;
}
#endif /* ( configNUM_CORES > 1 ) */
/*-----------------------------------------------------------*/
@ -4380,7 +4378,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet,
BaseType_t xIndex,
@ -4407,7 +4405,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
}
#else /* if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) */
#else /* if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 ) */
void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet,
BaseType_t xIndex,
void * pvValue )
@ -4422,7 +4420,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
taskEXIT_CRITICAL( &xKernelLock );
}
}
#endif /* configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS */
#endif /* configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 */
#endif /* configNUM_THREAD_LOCAL_STORAGE_POINTERS */
/*-----------------------------------------------------------*/
@ -4559,7 +4557,7 @@ static void prvCheckTasksWaitingTermination( void )
if( pxTCB != NULL ) /*Call deletion callbacks and free TCB memory */
{
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
prvDeleteTLS( pxTCB );
#endif
prvDeleteTCB( pxTCB );
@ -4894,7 +4892,7 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
#endif /* INCLUDE_vTaskDelete */
/*-----------------------------------------------------------*/
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
static void prvDeleteTLS( TCB_t * pxTCB )
{
@ -4909,7 +4907,7 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
}
}
#endif /* ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) */
#endif /* ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 ) */
/*-----------------------------------------------------------*/

View File

@ -266,7 +266,9 @@ Note: Include trace macros here and not above as trace macros are dependent on s
// ---------------------- Features -------------------------
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS
#ifdef CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1
#endif
#if CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER
#define configCHECK_MUTEX_GIVEN_BY_OWNER 1