Update taskSELECT_HIGHEST_PRIORITY_TASK macro for SMP (#777)

* Move the configUSE_PORT_OPTIMISED_TASK_SELECTION check to FreeRTOS.h
* SMP also use taskSELECT_HIGHEST_PRIORITY_TASK macro
---------

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
This commit is contained in:
chinglee-iot 2023-09-06 15:13:34 +08:00 committed by GitHub
parent 5fb9b50da8
commit 288d143357
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -1165,6 +1165,10 @@
#error configUSE_TASK_PREEMPTION_DISABLE is not supported in single core FreeRTOS #error configUSE_TASK_PREEMPTION_DISABLE is not supported in single core FreeRTOS
#endif #endif
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_PORT_OPTIMISED_TASK_SELECTION != 0 ) )
#error configUSE_PORT_OPTIMISED_TASK_SELECTION is not supported in SMP FreeRTOS
#endif
#ifndef configINITIAL_TICK_COUNT #ifndef configINITIAL_TICK_COUNT
#define configINITIAL_TICK_COUNT 0 #define configINITIAL_TICK_COUNT 0
#endif #endif

10
tasks.c
View file

@ -152,6 +152,10 @@
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \ listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
uxTopReadyPriority = uxTopPriority; \ uxTopReadyPriority = uxTopPriority; \
} while( 0 ) /* taskSELECT_HIGHEST_PRIORITY_TASK */ } while( 0 ) /* taskSELECT_HIGHEST_PRIORITY_TASK */
#else /* if ( configNUMBER_OF_CORES == 1 ) */
#define taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID ) prvSelectHighestPriorityTask( xCoreID )
#endif /* if ( configNUMBER_OF_CORES == 1 ) */ #endif /* if ( configNUMBER_OF_CORES == 1 ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -164,10 +168,6 @@
#else /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ #else /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
#if ( configNUMBER_OF_CORES > 1 )
#error configUSE_PORT_OPTIMISED_TASK_SELECTION not supported in FreeRTOS SMP.
#endif
/* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 1 then task selection is /* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 1 then task selection is
* performed in a way that is tailored to the particular microcontroller * performed in a way that is tailored to the particular microcontroller
* architecture being used. */ * architecture being used. */
@ -4701,7 +4701,7 @@ BaseType_t xTaskIncrementTick( void )
#endif #endif
/* Select a new task to run. */ /* Select a new task to run. */
prvSelectHighestPriorityTask( xCoreID ); taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID );
traceTASK_SWITCHED_IN(); traceTASK_SWITCHED_IN();
/* After the new task is switched in, update the global errno. */ /* After the new task is switched in, update the global errno. */