diff --git a/event_groups.c b/event_groups.c index 6b68c087a..556637b4c 100644 --- a/event_groups.c +++ b/event_groups.c @@ -253,15 +253,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, { if( xAlreadyYielded == pdFALSE ) { - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else /* #if ( configNUMBER_OF_CORES == 1 ) */ - { - vTaskYieldWithinAPI(); - } - #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + taskYIELD_WITHIN_API(); } else { @@ -417,15 +409,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, { if( xAlreadyYielded == pdFALSE ) { - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else /* #if ( configNUMBER_OF_CORES == 1 ) */ - { - vTaskYieldWithinAPI(); - } - #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + taskYIELD_WITHIN_API(); } else { diff --git a/include/task.h b/include/task.h index 8d6742c7f..448351876 100644 --- a/include/task.h +++ b/include/task.h @@ -3330,6 +3330,12 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) PRIVILEGED_FUNCTION; * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES *----------------------------------------------------------*/ +#if ( configNUMBER_OF_CORES == 1 ) + #define taskYIELD_WITHIN_API() portYIELD_WITHIN_API() +#else /* #if ( configNUMBER_OF_CORES == 1 ) */ + #define taskYIELD_WITHIN_API() vTaskYieldWithinAPI() +#endif /* #if ( configNUMBER_OF_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 diff --git a/queue.c b/queue.c index 91b9a0d67..3bc959721 100644 --- a/queue.c +++ b/queue.c @@ -1129,15 +1129,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, * is also a higher priority task in the pending ready list. */ if( xTaskResumeAll() == pdFALSE ) { - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else /* #if ( configNUMBER_OF_CORES == 1 ) */ - { - vTaskYieldWithinAPI(); - } - #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + taskYIELD_WITHIN_API(); } } else @@ -1616,15 +1608,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, if( xTaskResumeAll() == pdFALSE ) { - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else /* #if ( configNUMBER_OF_CORES == 1 ) */ - { - vTaskYieldWithinAPI(); - } - #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + taskYIELD_WITHIN_API(); } else { @@ -1817,15 +1801,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue, if( xTaskResumeAll() == pdFALSE ) { - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else /* #if ( configNUMBER_OF_CORES == 1 ) */ - { - vTaskYieldWithinAPI(); - } - #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + taskYIELD_WITHIN_API(); } else { @@ -2013,15 +1989,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, if( xTaskResumeAll() == pdFALSE ) { - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else /* #if ( configNUMBER_OF_CORES == 1 ) */ - { - vTaskYieldWithinAPI(); - } - #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + taskYIELD_WITHIN_API(); } else { diff --git a/tasks.c b/tasks.c index 84bc87bf2..000767bb5 100644 --- a/tasks.c +++ b/tasks.c @@ -2195,11 +2195,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, * have put ourselves to sleep. */ if( xAlreadyYielded == pdFALSE ) { - #if ( configNUMBER_OF_CORES == 1 ) - portYIELD_WITHIN_API(); - #else - vTaskYieldWithinAPI(); - #endif + taskYIELD_WITHIN_API(); } else { @@ -2251,11 +2247,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, * have put ourselves to sleep. */ if( xAlreadyYielded == pdFALSE ) { - #if ( configNUMBER_OF_CORES == 1 ) - portYIELD_WITHIN_API(); - #else - vTaskYieldWithinAPI(); - #endif + taskYIELD_WITHIN_API(); } else { @@ -7253,15 +7245,7 @@ TickType_t uxTaskResetEventItemValue( void ) * section (some will yield immediately, others wait until the * critical section exits) - but it is not something that * application code should ever do. */ - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else - { - vTaskYieldWithinAPI(); - } - #endif + taskYIELD_WITHIN_API(); } else { @@ -7344,15 +7328,7 @@ TickType_t uxTaskResetEventItemValue( void ) * section (some will yield immediately, others wait until the * critical section exits) - but it is not something that * application code should ever do. */ - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else - { - vTaskYieldWithinAPI(); - } - #endif + taskYIELD_WITHIN_API(); } else { diff --git a/timers.c b/timers.c index 0d7a0c0fe..f27caba3f 100644 --- a/timers.c +++ b/timers.c @@ -771,15 +771,7 @@ * block time to expire. If a command arrived between the * critical section being exited and this yield then the yield * will not cause the task to block. */ - #if ( configNUMBER_OF_CORES == 1 ) - { - portYIELD_WITHIN_API(); - } - #else /* #if ( configNUMBER_OF_CORES == 1 ) */ - { - vTaskYieldWithinAPI(); - } - #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + taskYIELD_WITHIN_API(); } else {