mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 01:58:32 -04:00
Add SMP template port and example (#900)
* Add SMP template port and example * Add readme file for smp configuration * Update SMP build flow and add CI build --------- Co-authored-by: Soren Ptak <ptaksoren@gmail.com> Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
This commit is contained in:
parent
f8ef5f605b
commit
c0ce725293
6 changed files with 194 additions and 24 deletions
|
@ -25,8 +25,18 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
|||
void vPortYield( void )
|
||||
{
|
||||
/* Save the current Context */
|
||||
|
||||
/* Switch to the highest priority task that is ready to run. */
|
||||
vTaskSwitchContext();
|
||||
#if ( configNUMBER_OF_CORES == 1 )
|
||||
{
|
||||
vTaskSwitchContext();
|
||||
}
|
||||
#else
|
||||
{
|
||||
vTaskSwitchContext( portGET_CORE_ID() );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Start executing the task we have just switched to. */
|
||||
}
|
||||
|
||||
|
@ -35,12 +45,34 @@ static void prvTickISR( void )
|
|||
/* Interrupts must have been enabled for the ISR to fire, so we have to
|
||||
* save the context with interrupts enabled. */
|
||||
|
||||
/* Maintain the tick count. */
|
||||
if( xTaskIncrementTick() != pdFALSE )
|
||||
#if ( configNUMBER_OF_CORES == 1 )
|
||||
{
|
||||
/* Switch to the highest priority task that is ready to run. */
|
||||
vTaskSwitchContext();
|
||||
/* Maintain the tick count. */
|
||||
if( xTaskIncrementTick() != pdFALSE )
|
||||
{
|
||||
/* Switch to the highest priority task that is ready to run. */
|
||||
vTaskSwitchContext();
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
UBaseType_t ulPreviousMask;
|
||||
|
||||
/* Tasks or ISRs running on other cores may still in critical section in
|
||||
* multiple cores environment. Incrementing tick needs to performed in
|
||||
* critical section. */
|
||||
ulPreviousMask = taskENTER_CRITICAL_FROM_ISR();
|
||||
|
||||
/* Maintain the tick count. */
|
||||
if( xTaskIncrementTick() != pdFALSE )
|
||||
{
|
||||
/* Switch to the highest priority task that is ready to run. */
|
||||
vTaskSwitchContext( portGET_CORE_ID() );
|
||||
}
|
||||
|
||||
taskEXIT_CRITICAL_FROM_ISR( ulPreviousMask );
|
||||
}
|
||||
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
|
||||
|
||||
/* start executing the new task */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue