freertos(IDF): Sync cosmetic differences to v10.4.3

This commit synchronize the cosmetic differences of IDF FreeRTOS to upstream
Vanilla v10.4.3. Comsetic differences include:

- Out of date doxygen API descriptions
  - Misnamed parameters
  - Missing examples
  - Fixed/added missing @cond/@code directives
- Extra/missing comments/lines
- Code formatting (uncrustify)

Other changes:

- Some ESP_PLATFORM directives were also removed
- xTaskIncrementTickOtherCores() now depends on "configNUM_CORES > 1"
- Updated some multi-core dummy variable names in FreeRTOS.h
This commit is contained in:
Darian Leung
2022-11-08 17:35:06 +08:00
parent ae3383ddc5
commit fce4ee0b80
8 changed files with 485 additions and 320 deletions

View File

@@ -1213,7 +1213,7 @@ typedef struct xSTATIC_TCB
UBaseType_t uxDummy5; UBaseType_t uxDummy5;
void * pxDummy6; void * pxDummy6;
uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ]; uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
BaseType_t xDummyCore; BaseType_t xDummyCoreID;
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) ) #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
void * pxDummy8; void * pxDummy8;
#endif #endif
@@ -1297,7 +1297,7 @@ typedef struct xSTATIC_QUEUE
UBaseType_t uxDummy8; UBaseType_t uxDummy8;
uint8_t ucDummy9; uint8_t ucDummy9;
#endif #endif
portMUX_TYPE xDummy10; portMUX_TYPE xDummyQueueLock;
} StaticQueue_t; } StaticQueue_t;
typedef StaticQueue_t StaticSemaphore_t; typedef StaticQueue_t StaticSemaphore_t;
@@ -1327,7 +1327,7 @@ typedef struct xSTATIC_EVENT_GROUP
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
uint8_t ucDummy4; uint8_t ucDummy4;
#endif #endif
portMUX_TYPE xDummy5; portMUX_TYPE xDummyEventGroupLock;
} StaticEventGroup_t; } StaticEventGroup_t;
/* /*
@@ -1364,12 +1364,12 @@ typedef struct xSTATIC_TIMER
* internally by FreeRTOS is not accessible to application code. However, if * internally by FreeRTOS is not accessible to application code. However, if
* the application writer wants to statically allocate the memory required to * 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 * 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 * known. The StaticStreamBuffer_t structure below is provided for this purpose.
* purpose. Its size and alignment requirements are guaranteed to match those * Its size and alignment requirements are guaranteed to match those of the
* of the genuine structure, no matter which architecture is being used, and * genuine structure, no matter which architecture is being used, and no matter
* no matter how the values in FreeRTOSConfig.h are set. Its contents are * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
* somewhat obfuscated in the hope users will recognise that it would be unwise * obfuscated in the hope users will recognise that it would be unwise to make
* to make direct use of the structure members. * direct use of the structure members.
*/ */
typedef struct xSTATIC_STREAM_BUFFER typedef struct xSTATIC_STREAM_BUFFER
{ {
@@ -1379,7 +1379,7 @@ typedef struct xSTATIC_STREAM_BUFFER
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxDummy4; UBaseType_t uxDummy4;
#endif #endif
portMUX_TYPE xDummy5; portMUX_TYPE xStreamBufferLock;
} StaticStreamBuffer_t; } StaticStreamBuffer_t;
/* Message buffers are built on stream buffers. */ /* 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 /* This file redefines API functions to be called through a wrapper macro, but
* only for ports that are using the MPU. */ * 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 /* 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 * 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. */ /* Map standard tasks.h API functions to the MPU equivalents. */
#define xTaskCreate MPU_xTaskCreate #define xTaskCreate MPU_xTaskCreate
#define xTaskCreateStatic MPU_xTaskCreateStatic #define xTaskCreateStatic MPU_xTaskCreateStatic
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
#define vTaskDelete MPU_vTaskDelete #define vTaskDelete MPU_vTaskDelete
#define vTaskDelay MPU_vTaskDelay #define vTaskDelay MPU_vTaskDelay
#define vTaskDelayUntil MPU_vTaskDelayUntil #define xTaskDelayUntil MPU_xTaskDelayUntil
#define xTaskAbortDelay MPU_xTaskAbortDelay #define xTaskAbortDelay MPU_xTaskAbortDelay
#define uxTaskPriorityGet MPU_uxTaskPriorityGet #define uxTaskPriorityGet MPU_uxTaskPriorityGet
#define eTaskGetState MPU_eTaskGetState #define eTaskGetState MPU_eTaskGetState
@@ -77,8 +75,8 @@
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2 #define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag #define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag #define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
/* #define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer */ #define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
/* #define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer */ #define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook #define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle #define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
#define uxTaskGetSystemState MPU_uxTaskGetSystemState #define uxTaskGetSystemState MPU_uxTaskGetSystemState
@@ -86,9 +84,10 @@
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats #define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
#define ulTaskGetIdleRunTimeCounter MPU_ulTaskGetIdleRunTimeCounter #define ulTaskGetIdleRunTimeCounter MPU_ulTaskGetIdleRunTimeCounter
#define xTaskGenericNotify MPU_xTaskGenericNotify #define xTaskGenericNotify MPU_xTaskGenericNotify
#define xTaskNotifyWait MPU_xTaskNotifyWait #define xTaskGenericNotifyWait MPU_xTaskGenericNotifyWait
#define ulTaskNotifyTake MPU_ulTaskNotifyTake #define ulTaskGenericNotifyTake MPU_ulTaskGenericNotifyTake
#define xTaskNotifyStateClear MPU_xTaskNotifyStateClear #define xTaskGenericNotifyStateClear MPU_xTaskGenericNotifyStateClear
#define ulTaskGenericNotifyValueClear MPU_ulTaskGenericNotifyValueClear
#define xTaskCatchUpTicks MPU_xTaskCatchUpTicks #define xTaskCatchUpTicks MPU_xTaskCatchUpTicks
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle #define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
@@ -135,6 +134,7 @@
#define xTimerPendFunctionCall MPU_xTimerPendFunctionCall #define xTimerPendFunctionCall MPU_xTimerPendFunctionCall
#define pcTimerGetName MPU_pcTimerGetName #define pcTimerGetName MPU_pcTimerGetName
#define vTimerSetReloadMode MPU_vTimerSetReloadMode #define vTimerSetReloadMode MPU_vTimerSetReloadMode
#define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
#define xTimerGetPeriod MPU_xTimerGetPeriod #define xTimerGetPeriod MPU_xTimerGetPeriod
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime #define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
#define xTimerGenericCommand MPU_xTimerGenericCommand #define xTimerGenericCommand MPU_xTimerGenericCommand

View File

@@ -47,13 +47,13 @@ typedef QueueHandle_t SemaphoreHandle_t;
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U ) #define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U )
#define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U ) #define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U )
/** @cond !DOC_EXCLUDE_HEADER_SECTION */
/** /**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* semphr. h * semphr. h
* @code{c} * @code{c}
* vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore ); * vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore );
* @endcode * @endcode
* @endcond
* *
* In many usage scenarios it is faster and more memory efficient to use a * In many usage scenarios it is faster and more memory efficient to use a
* direct to task notification in place of a binary semaphore! * direct to task notification in place of a binary semaphore!
@@ -112,7 +112,6 @@ typedef QueueHandle_t SemaphoreHandle_t;
} \ } \
} }
#endif #endif
/** @endcond */
/** /**
* @cond !DOC_EXCLUDE_HEADER_SECTION * @cond !DOC_EXCLUDE_HEADER_SECTION
@@ -161,7 +160,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* *
* void vATask( void * pvParameters ) * 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. * // This is a macro so pass the variable in directly.
* xSemaphore = xSemaphoreCreateBinary(); * xSemaphore = xSemaphoreCreateBinary();
* *
@@ -226,8 +225,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* *
* void vATask( void * pvParameters ) * void vATask( void * pvParameters )
* { * {
* // Semaphore cannot be used before a call to xSemaphoreCreateBinary() or * // Semaphore cannot be used before a call to xSemaphoreCreateBinaryStatic().
* // xSemaphoreCreateBinaryStatic().
* // The semaphore's data structures will be placed in the xSemaphoreBuffer * // The semaphore's data structures will be placed in the xSemaphoreBuffer
* // variable, the address of which is passed into the function. The * // variable, the address of which is passed into the function. The
* // function's parameter is not NULL, so the function will not attempt any * // 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 * created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
* xSemaphoreCreateCounting(). * 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. * 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 * 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 * 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 * time of portMAX_DELAY can be used to block indefinitely (provided
@@ -282,7 +280,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* void vATask( void * pvParameters ) * void vATask( void * pvParameters )
* { * {
* // Create the semaphore to guard a shared resource. * // Create the semaphore to guard a shared resource.
* vSemaphoreCreateBinary( xSemaphore ); * xSemaphore = xSemaphoreCreateBinary();
* } * }
* *
* // A task that uses the semaphore. * // A task that uses the semaphore.
@@ -417,9 +415,18 @@ typedef QueueHandle_t SemaphoreHandle_t;
* @endcond * @endcond
* \ingroup Semaphores * \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 * <i>Macro</i> to release a semaphore. The semaphore must have previously been
* created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or * created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
* xSemaphoreCreateCounting(). and obtained using sSemaphoreTake(). * xSemaphoreCreateCounting(). and obtained using sSemaphoreTake().
@@ -445,7 +452,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* void vATask( void * pvParameters ) * void vATask( void * pvParameters )
* { * {
* // Create the semaphore to guard a shared resource. * // Create the semaphore to guard a shared resource.
* vSemaphoreCreateBinary( xSemaphore ); * xSemaphore = vSemaphoreCreateBinary();
* *
* if( xSemaphore != NULL ) * if( xSemaphore != NULL )
* { * {
@@ -569,9 +576,20 @@ typedef QueueHandle_t SemaphoreHandle_t;
* @endcond * @endcond
* \ingroup Semaphores * \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 * <i>Macro</i> to release a semaphore. The semaphore must have previously been
* created with a call to xSemaphoreCreateBinary() or xSemaphoreCreateCounting(). * 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 * Creates a new recursive mutex type semaphore instance, and returns a handle
* by which the new recursive mutex can be referenced. * 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 * created using xSemaphoreCreateRecursiveMutex() then the required memory is
* automatically dynamically allocated inside the * automatically dynamically allocated inside the
* xSemaphoreCreateRecursiveMutex() function. (see * 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 * xSemaphoreCreateRecursiveMutexStatic() then the application writer must
* provide the memory that will get used by the mutex. * provide the memory that will get used by the mutex.
* xSemaphoreCreateRecursiveMutexStatic() therefore allows a recursive mutex to * xSemaphoreCreateRecursiveMutexStatic() therefore allows a recursive mutex to
@@ -859,7 +884,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* *
* Mutex type semaphores cannot be used from within interrupt service routines. * 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 * used for pure synchronisation (where one task or interrupt always 'gives' the
* semaphore and another always 'takes' the semaphore) and from within interrupt * semaphore and another always 'takes' the semaphore) and from within interrupt
* service routines. * service routines.
@@ -884,6 +909,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
* } * }
* } * }
* @endcode * @endcode
* @cond !DOC_SINGLE_GROUP
* \defgroup xSemaphoreCreateRecursiveMutex xSemaphoreCreateRecursiveMutex
* @endcond
* \ingroup Semaphores * \ingroup Semaphores
*/ */
#if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) ) #if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) )
@@ -891,6 +919,13 @@ typedef QueueHandle_t SemaphoreHandle_t;
#endif #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 * Creates a new recursive mutex type semaphore instance, and returns a handle
* by which the new recursive mutex can be referenced. * by which the new recursive mutex can be referenced.
* *
@@ -953,6 +988,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // so there is no need to check it. * // so there is no need to check it.
* } * }
* @endcode * @endcode
* @cond !DOC_SINGLE_GROUP
* \defgroup xSemaphoreCreateRecursiveMutexStatic xSemaphoreCreateRecursiveMutexStatic
* @endcond
* \ingroup Semaphores * \ingroup Semaphores
*/ */
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) ) #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. * @param xSemaphore A handle to the semaphore to be deleted.
* *
* @cond !DOC_EXCLUDE_HEADER_SECTION * @cond !DOC_SINGLE_GROUP
* \defgroup vSemaphoreDelete vSemaphoreDelete * \defgroup vSemaphoreDelete vSemaphoreDelete
* @endcond * @endcond
* \ingroup Semaphores * \ingroup Semaphores

View File

@@ -5,6 +5,7 @@
* *
* SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
*/ */
/* /*
* FreeRTOS Kernel V10.4.3 * FreeRTOS Kernel V10.4.3
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -116,6 +117,7 @@ typedef enum
} eNotifyAction; } eNotifyAction;
/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** @cond !DOC_EXCLUDE_HEADER_SECTION */
/** /**
* Used internally only. * 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. */ 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. */ 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. */ 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 #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. */ 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 #endif
} TaskStatus_t; } TaskStatus_t;
/** @endcond */ /** @endcond */
@@ -219,18 +221,9 @@ typedef enum
* @endcond * @endcond
* \ingroup SchedulerControl * \ingroup SchedulerControl
*/ */
#ifdef ESP_PLATFORM
#define taskENTER_CRITICAL( x ) portENTER_CRITICAL( x ) #define taskENTER_CRITICAL( x ) portENTER_CRITICAL( x )
#else #define taskENTER_CRITICAL_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
#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 ) #define taskENTER_CRITICAL_ISR( x ) portENTER_CRITICAL_ISR( x )
#else
#define taskENTER_CRITICAL_ISR( ) portENTER_CRITICAL_ISR( )
#endif // ESP_PLATFORM
/** /**
* @cond !DOC_EXCLUDE_HEADER_SECTION * @cond !DOC_EXCLUDE_HEADER_SECTION
@@ -248,19 +241,10 @@ typedef enum
* @endcond * @endcond
* \ingroup SchedulerControl * \ingroup SchedulerControl
*/ */
#ifdef ESP_PLATFORM
#define taskEXIT_CRITICAL( x ) portEXIT_CRITICAL( x ) #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 ) #define taskEXIT_CRITICAL_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( x )
#ifdef ESP_PLATFORM
#define taskEXIT_CRITICAL_ISR( x ) portEXIT_CRITICAL_ISR( x ) #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 * @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h * 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 * This function is similar to xTaskCreate, but allows setting task affinity
* in SMP system. * 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 * must be implemented to never return (i.e. continuous loop), or should be
* terminated using vTaskDelete function. * terminated using vTaskDelete function.
* *
@@ -327,32 +312,192 @@ typedef enum
* example, to create a privileged task at priority 2 the uxPriority parameter * example, to create a privileged task at priority 2 the uxPriority parameter
* should be set to ( 2 | portPRIVILEGE_BIT ). * 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. * can be referenced.
* *
* @param xCoreID If the value is tskNO_AFFINITY, the created task is not * @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. * 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 * 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. * cause the function to fail.
* *
* @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 * 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 * \ingroup Tasks
*/ */
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pvTaskCode, BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pxTaskCode,
const char * const pcName, const char * const pcName,
const uint32_t usStackDepth, const configSTACK_DEPTH_TYPE usStackDepth,
void * const pvParameters, void * const pvParameters,
UBaseType_t uxPriority, UBaseType_t uxPriority,
TaskHandle_t * const pvCreatedTask, TaskHandle_t * const pvCreatedTask,
const BaseType_t xCoreID); const BaseType_t xCoreID );
#endif #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. * 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 * 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 * support can alternatively create an MPU constrained task using
* xTaskCreateRestricted(). * 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 * must be implemented to never return (i.e. continuous loop), or should be
* terminated using vTaskDelete function. * terminated using vTaskDelete function.
* *
@@ -439,78 +584,32 @@ typedef enum
* \ingroup Tasks * \ingroup Tasks
*/ */
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
static inline __attribute__( ( always_inline ) )
static inline IRAM_ATTR BaseType_t xTaskCreate( BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
TaskFunction_t pvTaskCode,
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
const uint32_t usStackDepth, const configSTACK_DEPTH_TYPE usStackDepth,
void * const pvParameters, void * const pvParameters,
UBaseType_t uxPriority, 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 /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
#endif
/** /**
* 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. * 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 * 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 * 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 * xTaskCreate() then both blocks of memory are automatically dynamically
* allocated inside the xTaskCreate() function. (see * 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 * xTaskCreateStatic() then the application writer must provide the required
* memory. xTaskCreateStatic() therefore allows a task to be created without * memory. xTaskCreateStatic() therefore allows a task to be created without
* using any dynamic memory allocation. * 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 * must be implemented to never return (i.e. continuous loop), or should be
* terminated using vTaskDelete function. * terminated using vTaskDelete function.
* *
@@ -608,17 +707,17 @@ typedef enum
* \ingroup Tasks * \ingroup Tasks
*/ */
#if( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
static inline IRAM_ATTR TaskHandle_t xTaskCreateStatic( static inline __attribute__( ( always_inline ) )
TaskFunction_t pvTaskCode, TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
const uint32_t ulStackDepth, const uint32_t ulStackDepth,
void * const pvParameters, void * const pvParameters,
UBaseType_t uxPriority, UBaseType_t uxPriority,
StackType_t * const puxStackBuffer, 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 */ #endif /* configSUPPORT_STATIC_ALLOCATION */
@@ -650,7 +749,7 @@ typedef enum
* @param pxCreatedTask Used to pass back a handle by which the created task * @param pxCreatedTask Used to pass back a handle by which the created task
* can be referenced. * 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 * list, otherwise an error code defined in the file projdefs.h
* *
* Example usage: * Example usage:
@@ -738,7 +837,7 @@ typedef enum
* @param pxCreatedTask Used to pass back a handle by which the created task * @param pxCreatedTask Used to pass back a handle by which the created task
* can be referenced. * 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 * list, otherwise an error code defined in the file projdefs.h
* *
* Example usage: * Example usage:
@@ -1428,6 +1527,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
* SCHEDULER CONTROL * SCHEDULER CONTROL
*----------------------------------------------------------*/ *----------------------------------------------------------*/
/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** @cond !DOC_EXCLUDE_HEADER_SECTION */
/** /**
* @cond !DOC_EXCLUDE_HEADER_SECTION * @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h * 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 * Starts the real time kernel tick processing. After calling the kernel
* has control over which tasks are executed and when. * 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 * application startup, vTaskStartScheduler() should not be called from
* ESP-IDF applications. * 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. */ 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. * Returns the high water mark of the stack associated with xTask.
* *
* INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for * INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for
* this function to be available. * this function to be available.
* *
* Returns the high water mark of the stack associated with xTask. That is, * 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 * the minimum free stack space there has been (in bytes not words, unlike
* FreeRTOS) since the task started. The smaller the returned * vanilla FreeRTOS) since the task started. The smaller the returned
* number the closer the task has come to overflowing its stack. * number the closer the task has come to overflowing its stack.
* *
* uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are the * 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. * @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. * 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, * @return The smallest amount of free stack space there has been (in bytes not
* unlike vanilla FreeRTOS) since the task referenced by * words, unlike vanilla FreeRTOS) since the task referenced by
* xTask was created. * xTask was created.
*/ */
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; 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. * Returns the start of the stack associated with xTask.
* *
* INCLUDE_uxTaskGetStackHighWaterMark2 must be set to 1 in FreeRTOSConfig.h for * INCLUDE_uxTaskGetStackHighWaterMark2 must be set to 1 in FreeRTOSConfig.h for
* this function to be available. * this function to be available.
* *
* Returns the high water mark of the stack associated with xTask. That is, * 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 * the minimum free stack space there has been (in bytes not words, unlike
* a value of 1 means 4 bytes) since the task started. The smaller the returned * vanilla FreeRTOS) since the task started. The smaller the returned
* number the closer the task has come to overflowing its stack. * number the closer the task has come to overflowing its stack.
* *
* uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are the * 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. * @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. * 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 * @return The smallest amount of free stack space there has been (in bytes not
* actual spaces on the stack rather than bytes) since the task referenced by * words, unlike vanilla FreeRTOS) since the task referenced by
* xTask was created. * xTask was created.
*/ */
configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; 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. * @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 /* 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, * 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. */ * constant. */
#ifdef configUSE_APPLICATION_TASK_TAG #ifdef configUSE_APPLICATION_TASK_TAG
#if configUSE_APPLICATION_TASK_TAG == 1 #if configUSE_APPLICATION_TASK_TAG == 1
/** /**
* @cond !DOC_EXCLUDE_HEADER_SECTION * @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h * task.h
@@ -1942,11 +2057,11 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue, TlsDeleteCallbackFunction_t pvDelCallback); void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue, TlsDeleteCallbackFunction_t pvDelCallback);
#endif #endif
#endif #endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) */
#if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) #if ( configCHECK_FOR_STACK_OVERFLOW > 0 )
/** /**
* @cond !DOC_EXCLUDE_HEADER_SECTION * @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h * task.h
* @code{c} * @code{c}
@@ -1966,7 +2081,8 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
#endif #endif
#if ( configUSE_TICK_HOOK > 0 ) #if ( configUSE_TICK_HOOK > 0 )
/**
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION * @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h * task.h
* @code{c} * @code{c}
@@ -1981,7 +2097,8 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
#endif #endif
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/**
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION * @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h * task.h
* @code{c} * @code{c}
@@ -2038,7 +2155,7 @@ TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
* of run time consumed by the task. See the TaskStatus_t structure * of run time consumed by the task. See the TaskStatus_t structure
* definition in this file for the full member list. * 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. * the scheduler remaining suspended for an extended period.
* *
* @param pxTaskStatusArray A pointer to an array of TaskStatus_t structures. * @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; 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. * List all the current tasks.
* *
* configUSE_TRACE_FACILITY and configUSE_STATS_FORMATTING_FUNCTIONS must * 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. */ 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 * Get the state of running tasks as a string
* *
* configGENERATE_RUN_TIME_STATS and configUSE_STATS_FORMATTING_FUNCTIONS * 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 * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
*----------------------------------------------------------*/ *----------------------------------------------------------*/
/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** @cond !DOC_EXCLUDE_HEADER_SECTION */
/* /*
* Return the handle of the task running on a certain CPU. Because of * Return the handle of the task running on a certain CPU. Because of
* the nature of SMP processing, there is no guarantee that this * 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; 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 * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY
* INTENDED FOR USE WHEN IMPLEMENTING A PORT OF THE SCHEDULER AND IS * 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, * occurs. This function will check if the current core requires time slicing,
* and also call the application tick hook. * and also call the application tick hook.
*/ */
BaseType_t xTaskIncrementTickOtherCores( void ) PRIVILEGED_FUNCTION; BaseType_t xTaskIncrementTickOtherCores( void ) PRIVILEGED_FUNCTION;
#endif // ESP_PLATFORM #endif /* configNUM_CORES > 1 */
/* /*
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN * 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, TickType_t xTicksToWait,
const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION; const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;
#ifdef ESP_PLATFORM
/* /*
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
* INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER. * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
@@ -3403,7 +3535,6 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList,
*/ */
void vTaskTakeKernelLock( void ); void vTaskTakeKernelLock( void );
void vTaskReleaseKernelLock( void ); void vTaskReleaseKernelLock( void );
#endif // ESP_PLATFORM
/* /*
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN * 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 );". * which is "void vCallbackFunction( TimerHandle_t xTimer );".
* *
* @return If the timer is successfully created then a handle to the newly * @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 * created timer is returned. If the timer cannot be created because there is
* there is insufficient FreeRTOS heap remaining to allocate the timer * insufficient FreeRTOS heap remaining to allocate the timer
* structures, or the timer period was set to 0) then NULL is returned. * structures then NULL is returned.
* *
* Example usage: * Example usage:
* @verbatim * @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 * 4) Using a queue or semaphore before it has been initialised or
* before the scheduler has been started (are interrupts firing * before the scheduler has been started (are interrupts firing
* before vTaskStartScheduler() has been called?). * 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. */ 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; pucAllocatedMemory = NULL;
} }
if( 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. */ 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

@@ -3360,8 +3360,7 @@ BaseType_t xTaskIncrementTick( void )
return xSwitchRequired; return xSwitchRequired;
} }
#ifdef ESP_PLATFORM #if ( configNUM_CORES > 1 )
#if ( configNUM_CORES > 1 )
BaseType_t xTaskIncrementTickOtherCores( void ) BaseType_t xTaskIncrementTickOtherCores( void )
{ {
/* Minor optimization. This function can never switch cores mid /* Minor optimization. This function can never switch cores mid
@@ -3445,8 +3444,7 @@ BaseType_t xTaskIncrementTick( void )
return xSwitchRequired; return xSwitchRequired;
} }
#endif /* ( configNUM_CORES > 1 ) */ #endif /* ( configNUM_CORES > 1 ) */
#endif // ESP_PLATFORM
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/