Skip to content

Commit 288d143

Browse files
chinglee-iotSkptak
andauthored
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 <[email protected]>
1 parent 5fb9b50 commit 288d143

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

include/FreeRTOS.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,10 @@
11651165
#error configUSE_TASK_PREEMPTION_DISABLE is not supported in single core FreeRTOS
11661166
#endif
11671167

1168+
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_PORT_OPTIMISED_TASK_SELECTION != 0 ) )
1169+
#error configUSE_PORT_OPTIMISED_TASK_SELECTION is not supported in SMP FreeRTOS
1170+
#endif
1171+
11681172
#ifndef configINITIAL_TICK_COUNT
11691173
#define configINITIAL_TICK_COUNT 0
11701174
#endif

tasks.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@
152152
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
153153
uxTopReadyPriority = uxTopPriority; \
154154
} while( 0 ) /* taskSELECT_HIGHEST_PRIORITY_TASK */
155+
#else /* if ( configNUMBER_OF_CORES == 1 ) */
156+
157+
#define taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID ) prvSelectHighestPriorityTask( xCoreID )
158+
155159
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
156160

157161
/*-----------------------------------------------------------*/
@@ -164,10 +168,6 @@
164168

165169
#else /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
166170

167-
#if ( configNUMBER_OF_CORES > 1 )
168-
#error configUSE_PORT_OPTIMISED_TASK_SELECTION not supported in FreeRTOS SMP.
169-
#endif
170-
171171
/* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 1 then task selection is
172172
* performed in a way that is tailored to the particular microcontroller
173173
* architecture being used. */
@@ -4701,7 +4701,7 @@ BaseType_t xTaskIncrementTick( void )
47014701
#endif
47024702

47034703
/* Select a new task to run. */
4704-
prvSelectHighestPriorityTask( xCoreID );
4704+
taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID );
47054705
traceTASK_SWITCHED_IN();
47064706

47074707
/* After the new task is switched in, update the global errno. */

0 commit comments

Comments
 (0)