Skip to content

Commit

Permalink
Update soak test for SMP
Browse files Browse the repository at this point in the history
* Use configNUMBER_OF_CORES to separate the changes
  • Loading branch information
chinglee-iot committed Feb 9, 2023
1 parent 8f863ae commit 1bf0f01
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
21 changes: 19 additions & 2 deletions FreeRTOS/Demo/Common/Minimal/BlockQ.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#define blckqSTACK_SIZE configMINIMAL_STACK_SIZE
#define blckqNUM_TASK_SETS ( 3 )

#define blckqSHORT_DELAY ( 5 )
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 0 )
#error This example cannot be used if dynamic allocation is not allowed.
#endif
Expand Down Expand Up @@ -200,8 +201,17 @@ static portTASK_FUNCTION( vBlockingQueueProducer, pvParameters )
* consumer will expect the numbers to follow in numerical order. */
++usValue;

#if configUSE_PREEMPTION == 0
#if ( configNUMBER_OF_CORES > 1 )
{
if( pxQueueParameters->xBlockTime == 0 )
{
vTaskDelay( blckqSHORT_DELAY );
}
}
#elif configUSE_PREEMPTION == 0
{
taskYIELD();
}
#endif
}
}
Expand Down Expand Up @@ -241,7 +251,14 @@ static portTASK_FUNCTION( vBlockingQueueConsumer, pvParameters )
++usExpectedValue;
}

#if configUSE_PREEMPTION == 0
#if ( configNUMBER_OF_CORES > 1 )
{
if( pxQueueParameters->xBlockTime == 0 )
{
vTaskDelay( blckqSHORT_DELAY );
}
}
#elif configUSE_PREEMPTION == 0
{
if( pxQueueParameters->xBlockTime == 0 )
{
Expand Down
8 changes: 4 additions & 4 deletions FreeRTOS/Demo/Common/Minimal/IntQueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@
if( xQueueIsQueueFullFromISR( xNormallyEmptyQueue ) != pdTRUE ) \
{ \
UBaseType_t uxSavedInterruptStatus; \
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR(); \
{ \
uxValueForNormallyEmptyQueue++; \
if( xQueueSendFromISR( xNormallyEmptyQueue, ( void * ) &uxValueForNormallyEmptyQueue, &xHigherPriorityTaskWoken ) != pdPASS ) \
{ \
uxValueForNormallyEmptyQueue--; \
} \
} \
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); \
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); \
} \


Expand All @@ -115,15 +115,15 @@
if( xQueueIsQueueFullFromISR( xNormallyFullQueue ) != pdTRUE ) \
{ \
UBaseType_t uxSavedInterruptStatus; \
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR(); \
{ \
uxValueForNormallyFullQueue++; \
if( xQueueSendFromISR( xNormallyFullQueue, ( void * ) &uxValueForNormallyFullQueue, &xHigherPriorityTaskWoken ) != pdPASS ) \
{ \
uxValueForNormallyFullQueue--; \
} \
} \
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); \
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); \
} \


Expand Down
11 changes: 10 additions & 1 deletion FreeRTOS/Demo/Common/Minimal/dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,16 @@ static portTASK_FUNCTION( vCounterControlTask, pvParameters )

#if ( INCLUDE_eTaskGetState == 1 )
{
configASSERT( eTaskGetState( xContinuousIncrementHandle ) == eReady );
#if( configNUMBER_OF_CORES > 1 )
{
eTaskState eState = eTaskGetState( xContinuousIncrementHandle );
configASSERT( ( eState == eReady ) || ( eState == eRunning ) );
}
#else
{
configASSERT( eTaskGetState( xContinuousIncrementHandle ) == eReady );
}
#endif
}
#endif /* INCLUDE_eTaskGetState */

Expand Down

0 comments on commit 1bf0f01

Please sign in to comment.