Jelajahi Sumber

Merge branch 'feature/freertos-upgrade-to-10.4.3-xTaskRemoveFromUnorderedEventList-update' into 'master'

freertos: upgrade to 10.4.3 - rename xTaskRemoveFromUnorderedEventList

See merge request espressif/esp-idf!15101
Zim Kalinowski 4 tahun lalu
induk
melakukan
d4b47c42eb

+ 2 - 2
components/freertos/event_groups.c

@@ -661,7 +661,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
                  * eventUNBLOCKED_DUE_TO_BIT_SET bit is set so the task knows
                  * that is was unblocked due to its required bits matching, rather
                  * than because it timed out. */
-                xTaskRemoveFromUnorderedEventList( pxListItem, pxEventBits->uxEventBits | eventUNBLOCKED_DUE_TO_BIT_SET );
+                vTaskRemoveFromUnorderedEventList( pxListItem, pxEventBits->uxEventBits | eventUNBLOCKED_DUE_TO_BIT_SET );
             }
 
             /* Move onto the next list item.  Note pxListItem->pxNext is not
@@ -699,7 +699,7 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
             /* Unblock the task, returning 0 as the event list is being deleted
              * and cannot therefore have any bits set. */
             configASSERT( pxTasksWaitingForBits->xListEnd.pxNext != ( const ListItem_t * ) &( pxTasksWaitingForBits->xListEnd ) );
-            xTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, eventUNBLOCKED_DUE_TO_BIT_SET );
+            vTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, eventUNBLOCKED_DUE_TO_BIT_SET );
         }
     }
     taskEXIT_CRITICAL();

+ 3 - 0
components/freertos/include/esp_additions/freertos/FreeRTOSConfig.h

@@ -304,4 +304,7 @@ extern void vPortCleanUpTCB ( void *pxTCB );
 
 #define configTASK_NOTIFICATION_ARRAY_ENTRIES           1
 
+// backward compatibility for 4.4
+#define xTaskRemoveFromUnorderedEventList vTaskRemoveFromUnorderedEventList
+
 #endif /* FREERTOS_CONFIG_H */

+ 18 - 23
components/freertos/include/freertos/task.h

@@ -430,14 +430,14 @@ typedef enum
 #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
 
     static inline IRAM_ATTR BaseType_t xTaskCreate(
-            TaskFunction_t pvTaskCode,
-            const char * const pcName,
-            const uint32_t usStackDepth,
-            void * const pvParameters,
-            UBaseType_t uxPriority,
-            TaskHandle_t * const pvCreatedTask)
+                            TaskFunction_t pvTaskCode,
+                            const char * const pcName,     /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
+                            const uint32_t usStackDepth,
+                            void * const pvParameters,
+                            UBaseType_t uxPriority,
+                            TaskHandle_t * const pxCreatedTask) PRIVILEGED_FUNCTION
     {
-        return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, tskNO_AFFINITY );
+        return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, tskNO_AFFINITY );
     }
 
 #endif
@@ -599,15 +599,15 @@ typedef enum
 
 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
     static inline IRAM_ATTR TaskHandle_t xTaskCreateStatic(
-            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)
+                                    TaskFunction_t pvTaskCode,
+                                    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
     {
-        return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, pxStackBuffer, pxTaskBuffer, tskNO_AFFINITY );
+        return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, tskNO_AFFINITY );
     }
 #endif /* configSUPPORT_STATIC_ALLOCATION */
 
@@ -690,7 +690,7 @@ typedef enum
  */
 #if ( portUSING_MPU_WRAPPERS == 1 )
     BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
-                                      TaskHandle_t * pxCreatedTask );
+                                      TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
 #endif
 
 /**
@@ -3335,8 +3335,8 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList,
  * making the call, otherwise pdFALSE.
  */
 BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION;
-BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
-                                              const TickType_t xItemValue ) PRIVILEGED_FUNCTION;
+void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
+                                        const TickType_t xItemValue ) PRIVILEGED_FUNCTION;
 
 /*
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS ONLY
@@ -3399,11 +3399,6 @@ void vTaskPriorityDisinheritAfterTimeout( TaskHandle_t const pxMutexHolder,
  */
 UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
 
-/*
- * Get the current core affinity of a task
- */
-BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
-
 /*
  * Set the uxTaskNumber of the task referenced by the xTask parameter to
  * uxHandle.

+ 1 - 1
components/freertos/linker.lf

@@ -26,7 +26,7 @@ entries:
         tasks: vTaskSuspendAll (default)
         tasks: uxTaskGetNumberOfTasks (default)
         tasks: xTaskGetIdleTaskHandle (default)
-        tasks: xTaskRemoveFromUnorderedEventList (default)
+        tasks: vTaskRemoveFromUnorderedEventList (default)
         tasks: uxTaskPriorityGet (default)
         tasks: vTaskPrioritySet (default)
         tasks: vTaskSetThreadLocalStoragePointerAndDelCallback (default)

+ 21 - 23
components/freertos/tasks.c

@@ -2347,11 +2347,13 @@ void vTaskStartScheduler( void )
         portDISABLE_INTERRUPTS();
 
         #if ( configUSE_NEWLIB_REENTRANT == 1 )
-        {
-            // /* Switch Newlib's _impure_ptr variable to point to the _reent
-            // structure specific to the task that will run first. */
+            {
+                /* Switch Newlib's _impure_ptr variable to point to the _reent
+                 * structure specific to the task that will run first.
+                 * See the third party link http://www.nadler.com/embedded/newlibAndFreeRTOS.html
+                 * for additional information. */
             // _impure_ptr = &( pxCurrentTCB[xPortGetCoreID()]->xNewLib_reent );
-        }
+            }
         #endif /* configUSE_NEWLIB_REENTRANT */
 
         xNextTaskUnblockTime = portMAX_DELAY;
@@ -3105,6 +3107,7 @@ BaseType_t xTaskIncrementTick( void )
      * 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[xPortGetCoreID()] == ( UBaseType_t ) pdFALSE )
     {
         taskENTER_CRITICAL_ISR();
@@ -3326,7 +3329,8 @@ BaseType_t xTaskIncrementTick( void )
 
 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
 
-    BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter )
+    BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask,
+                                             void * pvParameter )
     {
         TCB_t * xTCB;
         BaseType_t xReturn;
@@ -3529,7 +3533,8 @@ void vTaskSwitchContext( void )
 }
 /*-----------------------------------------------------------*/
 
-void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksToWait )
+void vTaskPlaceOnEventList( List_t * const pxEventList,
+                            const TickType_t xTicksToWait )
 {
     configASSERT( pxEventList );
     taskENTER_CRITICAL();
@@ -3548,7 +3553,9 @@ void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksT
 }
 /*-----------------------------------------------------------*/
 
-void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait )
+void vTaskPlaceOnUnorderedEventList( List_t * pxEventList,
+                                     const TickType_t xItemValue,
+                                     const TickType_t xTicksToWait )
 {
     configASSERT( pxEventList );
     taskENTER_CRITICAL();
@@ -3709,10 +3716,10 @@ BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList )
 }
 /*-----------------------------------------------------------*/
 
-BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, const TickType_t xItemValue )
+void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
+                                        const TickType_t xItemValue )
 {
     TCB_t * pxUnblockedTCB;
-    BaseType_t xReturn;
 
     taskENTER_CRITICAL();
 
@@ -3733,12 +3740,6 @@ BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, cons
 
     if ( tskCAN_RUN_HERE(pxUnblockedTCB->xCoreID) && pxUnblockedTCB->uxPriority >= pxCurrentTCB[ xPortGetCoreID() ]->uxPriority )
     {
-        /* Return true if the task removed from the event list has
-         * a higher priority than the calling task.  This allows
-         * the calling task to know if it should force a context
-         * switch now. */
-        xReturn = pdTRUE;
-
         /* Mark that a yield is pending in case the user is not using the
          * "xHigherPriorityTaskWoken" parameter to an ISR safe FreeRTOS function. */
         xYieldPending[ xPortGetCoreID() ] = pdTRUE;
@@ -3746,15 +3747,9 @@ BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, cons
     else if ( pxUnblockedTCB->xCoreID != xPortGetCoreID() )
     {
         taskYIELD_OTHER_CORE( pxUnblockedTCB->xCoreID, pxUnblockedTCB->uxPriority );
-        xReturn = pdFALSE;
-    }
-    else
-    {
-        xReturn = pdFALSE;
     }
 
     taskEXIT_CRITICAL();
-    return xReturn;
 }
 /*-----------------------------------------------------------*/
 
@@ -3778,7 +3773,8 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut )
 }
 /*-----------------------------------------------------------*/
 
-BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait )
+BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
+                                 TickType_t * const pxTicksToWait )
 {
     BaseType_t xReturn;
 
@@ -3872,7 +3868,8 @@ void vTaskMissedYield( void )
 
 #if ( configUSE_TRACE_FACILITY == 1 )
 
-    void vTaskSetTaskNumber( TaskHandle_t xTask, const UBaseType_t uxHandle )
+    void vTaskSetTaskNumber( TaskHandle_t xTask,
+                             const UBaseType_t uxHandle )
     {
         TCB_t * pxTCB;
 
@@ -5423,6 +5420,7 @@ TickType_t uxTaskResetEventItemValue( void )
         BaseType_t xReturn;
 
         configASSERT( uxIndexToWait < configTASK_NOTIFICATION_ARRAY_ENTRIES );
+
         taskENTER_CRITICAL();
         {
             /* Only block if a notification is not already pending. */