mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-11-04 02:32:42 -05:00 
			
		
		
		
	adding a minimal idle hook to the SMP port (#329)
* adjusting the kernel checks repo * Added a minimal idle hook for all idle tasks
This commit is contained in:
		
							parent
							
								
									0c1381311b
								
							
						
					
					
						commit
						b515641e0a
					
				
					 2 changed files with 174 additions and 139 deletions
				
			
		
							
								
								
									
										2
									
								
								.github/workflows/kernel-checks.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/kernel-checks.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -21,7 +21,7 @@ jobs:
 | 
			
		|||
        uses: actions/checkout@v2
 | 
			
		||||
        with:
 | 
			
		||||
          repository: FreeRTOS/FreeRTOS
 | 
			
		||||
          ref:  master
 | 
			
		||||
          ref:  smp
 | 
			
		||||
          path: tools
 | 
			
		||||
 | 
			
		||||
      # Checkout user pull request changes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										41
									
								
								tasks.c
									
										
									
									
									
								
							
							
						
						
									
										41
									
								
								tasks.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1000,8 +1000,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
 | 
			
		|||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                    /* The ready task that was removed from this core is excluded from it.
 | 
			
		||||
                         * @todo See if we can schedule it on any of the cores where it is not excluded from. */
 | 
			
		||||
                        /* The ready task that was removed from this core is excluded from it. */
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    uxCoreMap &= ( ( 1 << configNUM_CORES ) - 1 );
 | 
			
		||||
| 
						 | 
				
			
			@ -2242,7 +2241,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
 | 
			
		|||
                    {
 | 
			
		||||
                        xCoreID = ( BaseType_t ) pxTCB->xTaskRunState;
 | 
			
		||||
 | 
			
		||||
                        if( ( uxCoreAffinityMask & ( 1 << xCoreID ) ) != 0 )
 | 
			
		||||
                        if( ( uxCoreAffinityMask & ( 1 << xCoreID ) ) == 0 )
 | 
			
		||||
                        {
 | 
			
		||||
                            prvYieldCore( xCoreID );
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -2695,6 +2694,7 @@ static BaseType_t prvCreateIdleTasks( void )
 | 
			
		|||
                                                                    pxIdleTaskStackBuffer,
 | 
			
		||||
                                                                    pxIdleTaskTCBBuffer ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                #if ( configNUM_CORES > 1 )
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			@ -2747,6 +2747,7 @@ static BaseType_t prvCreateIdleTasks( void )
 | 
			
		|||
            }
 | 
			
		||||
        #endif /* configSUPPORT_STATIC_ALLOCATION */
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return xReturn;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -4222,6 +4223,7 @@ void vTaskMissedYield( void )
 | 
			
		|||
    static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
 | 
			
		||||
    {
 | 
			
		||||
        taskYIELD();
 | 
			
		||||
 | 
			
		||||
        for( ; ; )
 | 
			
		||||
        {
 | 
			
		||||
            #if ( configUSE_PREEMPTION == 0 )
 | 
			
		||||
| 
						 | 
				
			
			@ -4256,6 +4258,22 @@ static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
 | 
			
		|||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            #endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) ) */
 | 
			
		||||
 | 
			
		||||
            #if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
 | 
			
		||||
                {
 | 
			
		||||
                    extern void vApplicationMinimalIdleHook( void );
 | 
			
		||||
 | 
			
		||||
                    /* Call the user defined function from within the idle task.  This
 | 
			
		||||
                     * allows the application designer to add background functionality
 | 
			
		||||
                     * without the overhead of a separate task.
 | 
			
		||||
                     *
 | 
			
		||||
                     * This hook is intended to manage core activity such as disabling cores that go idle.
 | 
			
		||||
                     *
 | 
			
		||||
                     * NOTE: vApplicationMinimalIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
 | 
			
		||||
                     * CALL A FUNCTION THAT MIGHT BLOCK. */
 | 
			
		||||
                    vApplicationMinimalIdleHook();
 | 
			
		||||
                }
 | 
			
		||||
            #endif /* configUSE_MINIMAL_IDLE_HOOK */
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
#endif /* if ( configNUM_CORES > 1 ) */
 | 
			
		||||
| 
						 | 
				
			
			@ -4330,6 +4348,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
 | 
			
		|||
                /* Call the user defined function from within the idle task.  This
 | 
			
		||||
                 * allows the application designer to add background functionality
 | 
			
		||||
                 * without the overhead of a separate task.
 | 
			
		||||
                 *
 | 
			
		||||
                 * NOTE: vApplicationIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
 | 
			
		||||
                 * CALL A FUNCTION THAT MIGHT BLOCK. */
 | 
			
		||||
                vApplicationIdleHook();
 | 
			
		||||
| 
						 | 
				
			
			@ -4385,6 +4404,22 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
 | 
			
		|||
                }
 | 
			
		||||
            }
 | 
			
		||||
        #endif /* configUSE_TICKLESS_IDLE */
 | 
			
		||||
 | 
			
		||||
        #if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
 | 
			
		||||
            {
 | 
			
		||||
                extern void vApplicationMinimalIdleHook( void );
 | 
			
		||||
 | 
			
		||||
                /* Call the user defined function from within the idle task.  This
 | 
			
		||||
                 * allows the application designer to add background functionality
 | 
			
		||||
                 * without the overhead of a separate task.
 | 
			
		||||
                 *
 | 
			
		||||
                 * This hook is intended to manage core activity such as disabling cores that go idle.
 | 
			
		||||
                 *
 | 
			
		||||
                 * NOTE: vApplicationMinimalIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
 | 
			
		||||
                 * CALL A FUNCTION THAT MIGHT BLOCK. */
 | 
			
		||||
                vApplicationMinimalIdleHook();
 | 
			
		||||
            }
 | 
			
		||||
        #endif /* configUSE_MINIMAL_IDLE_HOOK */
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue