Add trace hook macro for most ports (#794)

Add trace hook macro for most ports

In pull request #659 we introduced better support for tracing
tools like systemview. This patchset adds support for more
ports as requested in the original pull request.
This commit is contained in:
Boris van der Meer 2023-09-20 12:49:42 +02:00 committed by GitHub
parent 83861f5b1d
commit d43062ba78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 1005 additions and 134 deletions

View file

@ -125,11 +125,17 @@ void vPortExitCritical( void )
portLONG ulDummy;
ulDummy = portSET_INTERRUPT_MASK_FROM_ISR();
traceISR_ENTER();
{
if( xTaskIncrementTick() != pdFALSE )
{
traceISR_EXIT_TO_SCHEDULER();
portYIELD_FROM_ISR( pdTRUE );
}
else
{
traceISR_EXIT();
}
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy );
}

View file

@ -152,8 +152,13 @@ extern portLONG pendsvflag;
do { \
if( xSwitchRequired != pdFALSE ) \
{ \
traceISR_EXIT_TO_SCHEDULER(); \
portYIELD(); \
} \
else \
{ \
traceISR_EXIT(); \
} \
} while( 0 )
#define portYIELD_FROM_ISR( a ) vTaskSwitchContext()

View file

@ -81,10 +81,22 @@ typedef unsigned long TickType_t;
/* Scheduler utilities. */
extern void vPortYield( void );
#define portYIELD() vPortYield()
#define portYIELD() vPortYield()
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) vPortYield( )
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
do \
{ \
if( xSwitchRequired != pdFALSE ) \
{ \
traceISR_EXIT_TO_SCHEDULER(); \
vPortYield(); \
} \
else \
{ \
traceISR_EXIT(); \
} \
} while( 0 )
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
/* Critical section management. */

View file

@ -97,9 +97,21 @@ typedef uint32_t UBaseType_t;
extern void vPortYield( void );
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
#define portYIELD() vPortYield()
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
#define portYIELD() vPortYield()
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
do \
{ \
if( xSwitchRequired ) \
{ \
traceISR_EXIT_TO_SCHEDULER(); \
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
} \
else \
{ \
traceISR_EXIT(); \
} \
} while( 0 )
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/

View file

@ -741,13 +741,19 @@ void xPortSysTickHandler( void )
uint32_t ulPreviousMask;
ulPreviousMask = taskENTER_CRITICAL_FROM_ISR();
traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
traceISR_EXIT_TO_SCHEDULER();
/* Pend a context switch. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
else
{
traceISR_EXIT();
}
}
taskEXIT_CRITICAL_FROM_ISR( ulPreviousMask );
}

View file

@ -185,6 +185,7 @@ BaseType_t xPortSysTickHandler( void )
if( ret != pdFALSE )
{
traceISR_EXIT_TO_SCHEDULER();
portYIELD_FROM_ISR();
}
else