@ -1,5 +1,5 @@
/*******************************************************************************
* Trace Recorder Library for Tracealyzer v4 . 1.5
* Trace Recorder Library for Tracealyzer v4 . 3.11
* Percepio AB , www . percepio . com
*
* Terms of Use
@ -56,21 +56,29 @@ extern "C" {
/*** FreeRTOS version codes **************************************************/
# define FREERTOS_VERSION_NOT_SET 0
# define TRC_FREERTOS_VERSION_7_3 1 /* v7.3 is earliest supported.*/
# define TRC_FREERTOS_VERSION_7_4 2
# define TRC_FREERTOS_VERSION_7_5_OR_7_6 3
# define TRC_FREERTOS_VERSION_8_X 4 /* Any v8.x.x*/
# define TRC_FREERTOS_VERSION_7_3_X 1 /* v7.3 is earliest supported.*/
# define TRC_FREERTOS_VERSION_7_4_X 2
# define TRC_FREERTOS_VERSION_7_5_X 3
# define TRC_FREERTOS_VERSION_7_6_X TRC_FREERTOS_VERSION_7_5_X
# define TRC_FREERTOS_VERSION_8_X_X 4
# define TRC_FREERTOS_VERSION_9_0_0 5
# define TRC_FREERTOS_VERSION_9_0_1 6
# define TRC_FREERTOS_VERSION_9_0_2 7
# define TRC_FREERTOS_VERSION_10_0_0 8 /* If using FreeRTOS v10.0.0 or later version */
# define TRC_FREERTOS_VERSION_9_X 42 /* Not allowed anymore */
# if (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_X)
/* This setting for TRC_CFG_FREERTOS_VERSION is no longer allowed as v9.0.1 needs special handling. */
# error "Please specify your exact FreeRTOS version in trcConfig.h, from the options listed above."
# endif
# define TRC_FREERTOS_VERSION_10_0_0 8
# define TRC_FREERTOS_VERSION_10_0_1 TRC_FREERTOS_VERSION_10_0_0
# define TRC_FREERTOS_VERSION_10_1_0 TRC_FREERTOS_VERSION_10_0_0
# define TRC_FREERTOS_VERSION_10_1_1 TRC_FREERTOS_VERSION_10_0_0
# define TRC_FREERTOS_VERSION_10_2_0 TRC_FREERTOS_VERSION_10_0_0
# define TRC_FREERTOS_VERSION_10_2_1 TRC_FREERTOS_VERSION_10_0_0
# define TRC_FREERTOS_VERSION_10_3_0 9
# define TRC_FREERTOS_VERSION_10_3_1 TRC_FREERTOS_VERSION_10_3_0
# define TRC_FREERTOS_VERSION_10_4_0 10
/* Legacy FreeRTOS version codes for backwards compatibility with old trace configurations */
# define TRC_FREERTOS_VERSION_7_3 TRC_FREERTOS_VERSION_7_3_X
# define TRC_FREERTOS_VERSION_7_4 TRC_FREERTOS_VERSION_7_4_X
# define TRC_FREERTOS_VERSION_7_5_OR_7_6 TRC_FREERTOS_VERSION_7_5_X
# define TRC_FREERTOS_VERSION_8_X TRC_FREERTOS_VERSION_8_X_X
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0)
# define prvGetStreamBufferType(x) ((( StreamBuffer_t * )x )->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER)
@ -80,18 +88,28 @@ extern "C" {
/* Added mainly for our internal testing. This makes it easier to create test applications that
runs on multiple FreeRTOS versions . */
# if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_8_X )
/* FreeRTOS v7. 0 and later */
# if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_8_X _X )
/* FreeRTOS v7. x */
# define STRING_CAST(x) ( (signed char*) x )
# define TickType portTickType
# define TaskType xTaskHandle
# else
/* FreeRTOS v8.0 and later */
# define STRING_CAST(x) x
# define TickType TickType_t
# define TaskType TaskHandle_t
# endif
# if (defined(TRC_USE_TRACEALYZER_RECORDER)) && (TRC_USE_TRACEALYZER_RECORDER == 1)
# if defined(TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1) && (TRC_CFG_SCHEDULING_ONLY == 0)
/* Required for this feature */
# undef INCLUDE_uxTaskGetStackHighWaterMark
# define INCLUDE_uxTaskGetStackHighWaterMark 1
# endif /* defined(TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1) && (TRC_CFG_SCHEDULING_ONLY == 0) */
/*******************************************************************************
* INCLUDE_xTaskGetCurrentTaskHandle must be set to 1 for tracing to work properly
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@ -171,6 +189,14 @@ void vTraceSetMessageBufferName(void* object, const char* name);
# define vTraceSetMessageBufferName(object, name) /* Do nothing */
# endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */
# if defined (TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1)
void prvAddTaskToStackMonitor ( void * task ) ;
void prvRemoveTaskFromStackMonitor ( void * task ) ;
# else /* defined (TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1) */
# define prvAddTaskToStackMonitor(task)
# define prvRemoveTaskFromStackMonitor(task)
# endif /* defined (TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1) */
# else /* (TRC_CFG_SCHEDULING_ONLY == 0) */
# define vTraceSetQueueName(object, name) /* Do nothing */
@ -179,6 +205,8 @@ void vTraceSetMessageBufferName(void* object, const char* name);
# define vTraceSetEventGroupName(object, name) /* Do nothing */
# define vTraceSetStreamBufferName(object, name) /* Do nothing */
# define vTraceSetMessageBufferName(object, name) /* Do nothing */
# define prvAddTaskToStackMonitor(task) /* Do nothing */
# define prvRemoveTaskFromStackMonitor(task) /* Do nothing */
# endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */
@ -227,12 +255,39 @@ unsigned char prvTraceIsSchedulerSuspended(void);
# define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);}
# endif
# if ((TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_CORTEX_A9) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Renesas_RX600) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Altera_NiosII))
# if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_CORTEX_A9) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_XILINX_ZyncUltraScaleR5)
/**************************************************************************
* Disables " FreeRTOS-enabled " interrupts only , i . e . with priorities up to
* configMAX_API_CALL_INTERRUPT_PRIORITY . Don ' t add tracing in ISRs with
* greater priority .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern int cortex_a9_r5_enter_critical ( void ) ;
extern void cortex_a9_r5_exit_critical ( int irq_already_masked_at_enter ) ;
# define TRACE_ALLOC_CRITICAL_SECTION() uint32_t __irq_mask_status;
# define TRACE_ENTER_CRITICAL_SECTION() { __irq_mask_status = cortex_a9_r5_enter_critical(); }
# define TRACE_EXIT_CRITICAL_SECTION() { cortex_a9_r5_exit_critical(__irq_mask_status); }
# endif
# if ( (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Renesas_RX600) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32))
# define TRACE_ALLOC_CRITICAL_SECTION() int __irq_status;
# define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();}
# define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);}
# endif
# if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Altera_NiosII)
# include "system.h"
# include "sys/alt_irq.h"
# define TRACE_ALLOC_CRITICAL_SECTION() alt_irq_context __irq_status;
# define TRACE_ENTER_CRITICAL_SECTION(){__irq_status = alt_irq_disable_all();}
# define TRACE_EXIT_CRITICAL_SECTION() {alt_irq_enable_all(__irq_status);}
# endif
# if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Win32)
/* In the Win32 port, there are no real interrupts, so we can use the normal critical sections */
# define TRACE_ALLOC_CRITICAL_SECTION()
@ -241,7 +296,7 @@ unsigned char prvTraceIsSchedulerSuspended(void);
# endif
# if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_POWERPC_Z4)
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X )
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X )
/* FreeRTOS v8.0 or later */
# define TRACE_ALLOC_CRITICAL_SECTION() UBaseType_t __irq_status;
# define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();}
@ -298,7 +353,6 @@ extern uint16_t CurrentFilterMask;
extern uint16_t CurrentFilterGroup ;
uint8_t prvTraceGetQueueType ( void * handle ) ;
uint16_t prvTraceGetTaskNumberLow16 ( void * handle ) ;
uint16_t prvTraceGetTaskNumberHigh16 ( void * handle ) ;
void prvTraceSetTaskNumberLow16 ( void * handle , uint16_t value ) ;
@ -357,14 +411,37 @@ void prvTraceSetStreamBufferNumberHigh16(void* handle, uint16_t value);
# define TRACE_GET_STREAMBUFFER_FILTER(pxObject) prvTraceGetStreamBufferNumberHigh16((void*)pxObject)
# define TRACE_SET_STREAMBUFFER_FILTER(pxObject, group) prvTraceSetStreamBufferNumberHigh16((void*)pxObject, group)
/* We can only support filtering if FreeRTOS is at least v 7.4 */
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 7_4 )
/* We can only support filtering if FreeRTOS is at least v 8.0 */
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 8_X_X )
# define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) TRACE_GET_##CLASS##_FILTER(pxObject)
# define TRACE_SET_OBJECT_FILTER(CLASS, pxObject, group) TRACE_SET_##CLASS##_FILTER(pxObject, group)
# else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 7_4 ) */
# define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) 1
# else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 8_X_X ) */
# define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) 0xFFFF
# define TRACE_SET_OBJECT_FILTER(CLASS, pxObject, group)
# endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4) */
# endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) */
/* Helpers needed to correctly expand names */
# define TZ__CAT2(a,b) a ## b
# define TZ__CAT(a,b) TZ__CAT2(a, b)
/**************************************************************************/
/* Makes sure xQueueGiveFromISR also has a xCopyPosition parameter */
/**************************************************************************/
/* Expands name if this header is included... uxQueueType must be a macro that only exists in queue.c or whatever, and it must expand to nothing or to something that's valid in identifiers */
# define xQueueGiveFromISR(a,b) TZ__CAT(xQueueGiveFromISR__, uxQueueType) (a,b)
/* If in queue.c, the "uxQueueType" macro expands to "pcHead". queueSEND_TO_BACK is the value we need to send in */
# define xQueueGiveFromISR__pcHead(__a, __b) MyWrapper_xQueueGiveFromISR(__a, __b, const BaseType_t xCopyPosition); \
BaseType_t xQueueGiveFromISR ( __a , __b ) { return MyWrapper_xQueueGiveFromISR ( xQueue , pxHigherPriorityTaskWoken , queueSEND_TO_BACK ) ; } \
BaseType_t MyWrapper_xQueueGiveFromISR ( __a , __b , const BaseType_t xCopyPosition )
/* If not in queue.c, "uxQueueType" isn't expanded */
# define xQueueGiveFromISR__uxQueueType(__a, __b) xQueueGiveFromISR(__a,__b)
/**************************************************************************/
/* End of xQueueGiveFromISR fix */
/**************************************************************************/
/******************************************************************************/
/*** Definitions for Snapshot mode ********************************************/
@ -711,6 +788,10 @@ extern traceObjectClass TraceQueueClassTable[5];
# define TRACE_STREAMBUFFER_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 4UL) /*0xE6*/
# define TRACE_MESSAGEBUFFER_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 5UL) /*0xE7*/
# define EVENTGROUP_MALLOC_FAILED (EVENTGROUP_STREAMBUFFER_DIV + 6UL) /*0xE8*/
# define MEM_MALLOC_SIZE_TRCFAILED (EVENTGROUP_MALLOC_FAILED + 0UL) /*0xE8*/
# define MEM_MALLOC_ADDR_TRCFAILED (EVENTGROUP_MALLOC_FAILED + 1UL) /*0xE9*/
/* The following are using previously "lost" event codes */
# define TRACE_STREAMBUFFER_CREATE_OBJ_TRCSUCCESS (EVENTGROUP_CREATE_OBJ_TRCSUCCESS + 4UL) /*0x1C*/
# define TRACE_STREAMBUFFER_CREATE_OBJ_TRCFAILED (EVENTGROUP_CREATE_OBJ_TRCFAILED + 4UL) /*0x44*/
@ -741,7 +822,15 @@ extern traceObjectClass TraceQueueClassTable[5];
# define TRACE_MESSAGEBUFFER_RECEIVE_FROM_ISR_TRCSUCCESS (EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS + 4UL) /*0x3C*/
# define TRACE_MESSAGEBUFFER_RECEIVE_FROM_ISR_TRCFAILED (EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED + 4UL) /*0x64*/
/* LAST EVENT (0xE7) */
# define TRACE_QUEUE_SEND_TO_FRONT_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 5UL) /*0x25*/
# define TRACE_QUEUE_SEND_TO_FRONT_TRCBLOCK (EVENTGROUP_SEND_TRCBLOCK + 5UL) /*0x75*/
# define TRACE_QUEUE_SEND_TO_FRONT_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 5UL) /*0x4D*/
# define TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCSUCCESS (EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 5UL) /*0x35*/
# define TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCFAILED (EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 5UL) /*0x5D*/
# define TRACE_UNUSED_STACK (EVENTGROUP_MALLOC_FAILED + 2UL) /*0xEA*/
/* LAST EVENT (0xEA) */
/****************************
* MACROS TO GET TRACE CLASS *
@ -838,24 +927,34 @@ extern traceObjectClass TraceQueueClassTable[5];
/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */
# undef traceTASK_INCREMENT_TICK
# if (TRC_CFG_FREERTOS_VERSION <= TRC_FREERTOS_VERSION_7_4 )
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_3_0 )
# define traceTASK_INCREMENT_TICK( xTickCount ) \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | uxMissedTicks = = 0 ) { trcKERNEL_HOOKS_INCREMENT_TICK ( ) ; } \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | xPendedTicks = = 0 ) { trcKERNEL_HOOKS_INCREMENT_TICK ( ) ; } \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdFALSE ) { trcKERNEL_HOOKS_NEW_TIME ( DIV_NEW_TIME , xTickCount + 1 ) ; }
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_X)
# define traceTASK_INCREMENT_TICK( xTickCount ) \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | uxPendedTicks = = 0 ) { trcKERNEL_HOOKS_INCREMENT_TICK ( ) ; } \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdFALSE ) { trcKERNEL_HOOKS_NEW_TIME ( DIV_NEW_TIME , xTickCount + 1 ) ; }
# else
# define traceTASK_INCREMENT_TICK( xTickCount ) \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | xPendedTicks = = 0 ) { trcKERNEL_HOOKS_INCREMENT_TICK ( ) ; } \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | uxMiss edTicks = = 0 ) { trcKERNEL_HOOKS_INCREMENT_TICK ( ) ; } \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdFALSE ) { trcKERNEL_HOOKS_NEW_TIME ( DIV_NEW_TIME , xTickCount + 1 ) ; }
# endif
extern volatile uint32_t uiTraceSystemState ;
/* Called on each task-switch */
# undef traceTASK_SWITCHED_IN
# define traceTASK_SWITCHED_IN() \
trcKERNEL_HOOKS_TASK_SWITCH ( TRACE_GET_CURRENT_TASK ( ) ) ;
uiTraceSystemState = TRC_STATE_IN_TASKSWITCH ; \
trcKERNEL_HOOKS_TASK_SWITCH ( TRACE_GET_CURRENT_TASK ( ) ) ; \
uiTraceSystemState = TRC_STATE_IN_APPLICATION ;
/* Called on vTaskCreate */
# undef traceTASK_CREATE
@ -863,6 +962,7 @@ extern traceObjectClass TraceQueueClassTable[5];
if ( pxNewTCB ! = NULL ) \
{ \
trcKERNEL_HOOKS_TASK_CREATE ( TRACE_GET_OBJECT_EVENT_CODE ( CREATE_OBJ , TRCSUCCESS , TASK , pxNewTCB ) , TASK , pxNewTCB ) ; \
prvAddTaskToStackMonitor ( pxNewTCB ) ; \
}
/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */
@ -876,6 +976,7 @@ extern traceObjectClass TraceQueueClassTable[5];
{ TRACE_ALLOC_CRITICAL_SECTION ( ) ; \
TRACE_ENTER_CRITICAL_SECTION ( ) ; \
trcKERNEL_HOOKS_TASK_DELETE ( TRACE_GET_OBJECT_EVENT_CODE ( DELETE_OBJ , TRCSUCCESS , TASK , pxTaskToDelete ) , TRACE_GET_OBJECT_EVENT_CODE ( OBJCLOSE_NAME , TRCSUCCESS , TASK , pxTaskToDelete ) , TRACE_GET_OBJECT_EVENT_CODE ( OBJCLOSE_PROP , TRCSUCCESS , TASK , pxTaskToDelete ) , pxTaskToDelete ) ; \
prvRemoveTaskFromStackMonitor ( pxTaskToDelete ) ; \
TRACE_EXIT_CRITICAL_SECTION ( ) ; }
# if (TRC_CFG_SCHEDULING_ONLY == 0)
@ -970,18 +1071,24 @@ extern traceObjectClass TraceQueueClassTable[5];
/* Called when a message is sent to a queue */ /* CS IS NEW ! */
# undef traceQUEUE_SEND
# define traceQUEUE_SEND( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE ( TRACE_GET_OBJECT_EVENT_CODE ( SEND , TRCSUCCESS , QUEUE , pxQueue ) , QUEUE , pxQueue ) ; \
trcKERNEL_HOOKS_KERNEL_SERVICE ( xCopyPosition = = queueSEND_TO_BACK ? ( TRACE_GET_OBJECT_EVENT_CODE ( SEND , TRCSUCCESS , QUEUE , pxQueue ) ) : TRACE_QUEUE_SEND_TO_FRONT_TRCSUCCESS , QUEUE , pxQueue ) ; \
trcKERNEL_HOOKS_SET_OBJECT_STATE ( QUEUE , pxQueue , TRACE_GET_OBJECT_TRACE_CLASS ( QUEUE , pxQueue ) = = TRACE_CLASS_MUTEX ? ( uint8_t ) 0 : ( uint8_t ) ( pxQueue - > uxMessagesWaiting + 1 ) ) ;
/* Called when a message is sent to a queue set */
# undef traceQUEUE_SET_SEND
# define traceQUEUE_SET_SEND( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE ( TRACE_GET_OBJECT_EVENT_CODE ( SEND , TRCSUCCESS , QUEUE , pxQueue ) , QUEUE , pxQueue ) ; \
trcKERNEL_HOOKS_SET_OBJECT_STATE ( QUEUE , pxQueue , ( uint8_t ) ( pxQueue - > uxMessagesWaiting + 1 ) ) ;
/* Called when a message failed to be sent to a queue (timeout) */
# undef traceQUEUE_SEND_FAILED
# define traceQUEUE_SEND_FAILED( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE ( TRACE_GET_OBJECT_EVENT_CODE ( SEND , TRCFAILED , QUEUE , pxQueue ) , QUEUE , pxQueue ) ;
trcKERNEL_HOOKS_KERNEL_SERVICE ( xCopyPosition = = queueSEND_TO_BACK ? ( TRACE_GET_OBJECT_EVENT_CODE ( SEND , TRCFAILED , QUEUE , pxQueue ) ) : TRACE_QUEUE_SEND_TO_FRONT_TRCFAILED , QUEUE , pxQueue ) ;
/* Called when the task is blocked due to a send operation on a full queue */
# undef traceBLOCKING_ON_QUEUE_SEND
# define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE ( TRACE_GET_OBJECT_EVENT_CODE ( SEND , TRCBLOCK , QUEUE , pxQueue ) , QUEUE , pxQueue ) ;
trcKERNEL_HOOKS_KERNEL_SERVICE ( xCopyPosition = = queueSEND_TO_BACK ? ( TRACE_GET_OBJECT_EVENT_CODE ( SEND , TRCBLOCK , QUEUE , pxQueue ) ) : TRACE_QUEUE_SEND_TO_FRONT_TRCBLOCK , QUEUE , pxQueue ) ;
/* Called when a message is received from a queue */
# undef traceQUEUE_RECEIVE
@ -1046,13 +1153,13 @@ extern traceObjectClass TraceQueueClassTable[5];
/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */
# undef traceQUEUE_SEND_FROM_ISR
# define traceQUEUE_SEND_FROM_ISR( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR ( TRACE_GET_OBJECT_EVENT_CODE ( SEND_FROM_ISR , TRCSUCCESS , QUEUE , pxQueue ) , QUEUE , pxQueue ) ; \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR ( xCopyPosition = = queueSEND_TO_BACK ? ( TRACE_GET_OBJECT_EVENT_CODE ( SEND_FROM_ISR , TRCSUCCESS , QUEUE , pxQueue ) ) : TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCSUCCESS , QUEUE , pxQueue ) ; \
trcKERNEL_HOOKS_SET_OBJECT_STATE ( QUEUE , pxQueue , ( uint8_t ) ( pxQueue - > uxMessagesWaiting + 1 ) ) ;
/* Called when a message send from interrupt context fails (since the queue was full) */
# undef traceQUEUE_SEND_FROM_ISR_FAILED
# define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR ( TRACE_GET_OBJECT_EVENT_CODE ( SEND_FROM_ISR , TRCFAILED , QUEUE , pxQueue ) , QUEUE , pxQueue ) ;
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR ( xCopyPosition = = queueSEND_TO_BACK ? ( TRACE_GET_OBJECT_EVENT_CODE ( SEND_FROM_ISR , TRCFAILED , QUEUE , pxQueue ) ) : TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCFAILED , QUEUE , pxQueue ) ;
/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */
# undef traceQUEUE_RECEIVE_FROM_ISR
@ -1094,7 +1201,7 @@ extern traceObjectClass TraceQueueClassTable[5];
trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR ( TASK_RESUME_FROM_ISR , pxTaskToResume ) ;
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X )
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X )
# if (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1)
@ -1104,7 +1211,13 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si
# undef traceMALLOC
# define traceMALLOC( pvAddress, uiSize ) \
if ( pvAddress ! = 0 ) \
vTraceStoreMemMangEvent ( MEM_MALLOC_SIZE , ( uint32_t ) pvAddress , ( int32_t ) uiSize ) ;
{ \
vTraceStoreMemMangEvent ( MEM_MALLOC_SIZE , ( uint32_t ) pvAddress , ( int32_t ) uiSize ) ; \
} \
else \
{ \
vTraceStoreMemMangEvent ( MEM_MALLOC_SIZE_TRCFAILED , ( uint32_t ) pvAddress , ( int32_t ) uiSize ) ; \
}
# undef traceFREE
# define traceFREE( pvAddress, uiSize ) \
@ -1174,7 +1287,7 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si
# endif /* (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1) */
# endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X ) */
# endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X ) */
# if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1)
@ -1252,18 +1365,30 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si
else { \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM ( TRACE_TASK_NOTIFY_TAKE_TRCFAILED , TASK , pxCurrentTCB , xTicksToWait ) ; \
}
# elif (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_TAKE() \
if ( pxCurrentTCB - > ucNotifyState = = taskNOTIFICATION_RECEIVED ) { \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM ( TRACE_TASK_NOTIFY_TAKE , TASK , pxCurrentTCB , xTicksToWait ) ; \
} else { \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM ( TRACE_TASK_NOTIFY_TAKE_TRCFAILED , TASK , pxCurrentTCB , xTicksToWait ) ; }
# else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */
# define traceTASK_NOTIFY_TAKE(index) \
if ( pxCurrentTCB - > ucNotifyState [ ( index ) ] = = taskNOTIFICATION_RECEIVED ) { \
if ( pxCurrentTCB - > ucNotifyState [ index ] = = taskNOTIFICATION_RECEIVED ) { \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM ( TRACE_TASK_NOTIFY_TAKE , TASK , pxCurrentTCB , xTicksToWait ) ; \
} else { \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM ( TRACE_TASK_NOTIFY_TAKE_TRCFAILED , TASK , pxCurrentTCB , xTicksToWait ) ; }
# endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */
# undef traceTASK_NOTIFY_TAKE_BLOCK
# if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_TAKE_BLOCK() \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM ( TRACE_TASK_NOTIFY_TAKE_TRCBLOCK , TASK , pxCurrentTCB , xTicksToWait ) ; \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED ( ) ;
# else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY_TAKE_BLOCK(index) \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM ( TRACE_TASK_NOTIFY_TAKE_TRCBLOCK , TASK , pxCurrentTCB , xTicksToWait ) ; \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED ( ) ;
# endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# undef traceTASK_NOTIFY_WAIT
# if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0)
@ -1275,11 +1400,20 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si
else \
prvTraceStoreKernelCallWithParam ( TRACE_TASK_NOTIFY_WAIT_TRCFAILED , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( pxCurrentTCB ) , xTicksToWait ) ; \
}
# elif (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_WAIT() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , pxCurrentTCB ) & CurrentFilterMask ) \
{ \
if ( pxCurrentTCB - > ucNotifyState = = taskNOTIFICATION_RECEIVED ) \
prvTraceStoreKernelCallWithParam ( TRACE_TASK_NOTIFY_WAIT , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( pxCurrentTCB ) , xTicksToWait ) ; \
else \
prvTraceStoreKernelCallWithParam ( TRACE_TASK_NOTIFY_WAIT_TRCFAILED , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( pxCurrentTCB ) , xTicksToWait ) ; \
}
# else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */
# define traceTASK_NOTIFY_WAIT(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , pxCurrentTCB ) & CurrentFilterMask ) \
{ \
if ( pxCurrentTCB - > ucNotifyState [ ( index ) ] = = taskNOTIFICATION_RECEIVED ) \
if ( pxCurrentTCB - > ucNotifyState [ index ] = = taskNOTIFICATION_RECEIVED ) \
prvTraceStoreKernelCallWithParam ( TRACE_TASK_NOTIFY_WAIT , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( pxCurrentTCB ) , xTicksToWait ) ; \
else \
prvTraceStoreKernelCallWithParam ( TRACE_TASK_NOTIFY_WAIT_TRCFAILED , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( pxCurrentTCB ) , xTicksToWait ) ; \
@ -1287,26 +1421,52 @@ extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t si
# endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */
# undef traceTASK_NOTIFY_WAIT_BLOCK
# if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_WAIT_BLOCK() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , pxCurrentTCB ) & CurrentFilterMask ) \
prvTraceStoreKernelCallWithParam ( TRACE_TASK_NOTIFY_WAIT_TRCBLOCK , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( pxCurrentTCB ) , xTicksToWait ) ; \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED ( ) ;
# else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY_WAIT_BLOCK(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , pxCurrentTCB ) & CurrentFilterMask ) \
prvTraceStoreKernelCallWithParam ( TRACE_TASK_NOTIFY_WAIT_TRCBLOCK , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( pxCurrentTCB ) , xTicksToWait ) ; \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED ( ) ;
# endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# undef traceTASK_NOTIFY
# if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreKernelCall ( TRACE_TASK_NOTIFY , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( xTaskToNotify ) ) ;
# else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreKernelCall ( TRACE_TASK_NOTIFY , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( xTaskToNotify ) ) ;
# endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# undef traceTASK_NOTIFY_FROM_ISR
# if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_FROM_ISR() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreKernelCall ( TRACE_TASK_NOTIFY_FROM_ISR , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( xTaskToNotify ) ) ;
# else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY_FROM_ISR(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreKernelCall ( TRACE_TASK_NOTIFY_FROM_ISR , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( xTaskToNotify ) ) ;
# endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# undef traceTASK_NOTIFY_GIVE_FROM_ISR
# if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_GIVE_FROM_ISR() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreKernelCall ( TRACE_TASK_NOTIFY_GIVE_FROM_ISR , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( xTaskToNotify ) ) ;
# else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY_GIVE_FROM_ISR(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreKernelCall ( TRACE_TASK_NOTIFY_GIVE_FROM_ISR , TRACE_CLASS_TASK , TRACE_GET_TASK_NUMBER ( xTaskToNotify ) ) ;
# endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */
# if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1)
@ -1615,6 +1775,10 @@ uint32_t prvIsNewTCB(void* pNewTCB);
# define PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR_FAILED 0xE7
# define PSF_EVENT_MESSAGEBUFFER_RESET 0xE8
# define PSF_EVENT_MALLOC_FAILED 0xE9
# define PSF_EVENT_UNUSED_STACK 0xEA
/*** The trace macros for streaming ******************************************/
/* A macro that will update the tick count when returning from tickless idle */
@ -1630,26 +1794,40 @@ uint32_t prvIsNewTCB(void* pNewTCB);
/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */
# undef traceTASK_INCREMENT_TICK
# if TRC_CFG_FREERTOS_VERSION <= TRC_FREERTOS_VERSION_7_4
# if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_3_0
# define traceTASK_INCREMENT_TICK( xTickCount ) \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | uxMiss edTicks = = 0 ) { extern uint32_t uiTraceTickCount ; uiTraceTickCount + + ; } \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | xPend edTicks = = 0 ) { extern uint32_t uiTraceTickCount ; uiTraceTickCount + + ; } \
OS_TICK_EVENT ( uxSchedulerSuspended , xTickCount )
# else
# elif TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_X
# define traceTASK_INCREMENT_TICK( xTickCount ) \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | uxPendedTicks = = 0 ) { extern uint32_t uiTraceTickCount ; uiTraceTickCount + + ; } \
OS_TICK_EVENT ( uxSchedulerSuspended , xTickCount )
# endif /* TRC_CFG_FREERTOS_VERSION <= TRC_FREERTOS_VERSION_7_4 */
# else
# define traceTASK_INCREMENT_TICK( xTickCount ) \
if ( uxSchedulerSuspended = = ( unsigned portBASE_TYPE ) pdTRUE | | uxMissedTicks = = 0 ) { extern uint32_t uiTraceTickCount ; uiTraceTickCount + + ; } \
OS_TICK_EVENT ( uxSchedulerSuspended , xTickCount )
# endif
extern volatile uint32_t uiTraceSystemState ;
/* Called on each task-switch */
# undef traceTASK_SWITCHED_IN
# define traceTASK_SWITCHED_IN() \
uiTraceSystemState = TRC_STATE_IN_TASKSWITCH ; \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
{ \
if ( prvIsNewTCB ( pxCurrentTCB ) ) \
{ \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_ACTIVATE , ( uint32_t ) pxCurrentTCB , pxCurrentTCB - > uxPriority ) ; \
} \
}
} \
uiTraceSystemState = TRC_STATE_IN_APPLICATION ;
/* Called for each task that becomes ready */
# if (TRC_CFG_INCLUDE_READY_EVENTS == 1)
@ -1664,7 +1842,8 @@ uint32_t prvIsNewTCB(void* pNewTCB);
# define traceTASK_CREATE(pxNewTCB) \
if ( pxNewTCB ! = NULL ) \
{ \
prvTraceSaveSymbol ( pxNewTCB , pxNewTCB - > pcTaskName ) ; \
prvAddTaskToStackMonitor ( pxNewTCB ) ; \
prvTraceSaveObjectSymbol ( pxNewTCB , pxNewTCB - > pcTaskName ) ; \
prvTraceSaveObjectData ( pxNewTCB , pxNewTCB - > uxPriority ) ; \
prvTraceStoreStringEvent ( 1 , PSF_EVENT_OBJ_NAME , pxNewTCB - > pcTaskName , pxNewTCB ) ; \
TRACE_SET_OBJECT_FILTER ( TASK , pxNewTCB , CurrentFilterGroup ) ; \
@ -1676,7 +1855,8 @@ uint32_t prvIsNewTCB(void* pNewTCB);
# define traceTASK_CREATE(pxNewTCB) \
if ( pxNewTCB ! = NULL ) \
{ \
prvTraceSaveSymbol ( pxNewTCB , ( const char * ) pcName ) ; \
prvAddTaskToStackMonitor ( pxNewTCB ) ; \
prvTraceSaveObjectSymbol ( pxNewTCB , ( const char * ) pcName ) ; \
prvTraceSaveObjectData ( pxNewTCB , uxPriority ) ; \
prvTraceStoreStringEvent ( 1 , PSF_EVENT_OBJ_NAME , ( const char * ) pcName , pxNewTCB ) ; \
TRACE_SET_OBJECT_FILTER ( TASK , pxNewTCB , CurrentFilterGroup ) ; \
@ -1699,7 +1879,8 @@ uint32_t prvIsNewTCB(void* pNewTCB);
if ( TRACE_GET_OBJECT_FILTER ( TASK , pxTaskToDelete ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_DELETE , ( uint32_t ) pxTaskToDelete , ( pxTaskToDelete ! = NULL ) ? ( pxTaskToDelete - > uxPriority ) : 0 ) ; \
prvTraceDeleteSymbol ( pxTaskToDelete ) ; \
prvTraceDeleteObjectData ( pxTaskToDelete ) ;
prvTraceDeleteObjectData ( pxTaskToDelete ) ; \
prvRemoveTaskFromStackMonitor ( pxTaskToDelete ) ;
# if (TRC_CFG_SCHEDULING_ONLY == 0)
@ -1832,19 +2013,19 @@ uint32_t prvIsNewTCB(void* pNewTCB);
/* Called in xQueueCreateCountingSemaphore, if the queue creation fails */
# undef traceCREATE_COUNTING_SEMAPHORE
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X )
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X )
# define traceCREATE_COUNTING_SEMAPHORE() \
TRACE_SET_OBJECT_FILTER ( QUEUE , xHandle , CurrentFilterGroup ) ; \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( QUEUE , xHandle ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_SEMAPHORE_COUNTING_CREATE , ( uint32_t ) xHandle , uxMaxCount )
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_ OR_7_6 )
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_ X )
# define traceCREATE_COUNTING_SEMAPHORE() \
TRACE_SET_OBJECT_FILTER ( QUEUE , xHandle , CurrentFilterGroup ) ; \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( QUEUE , xHandle ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_SEMAPHORE_COUNTING_CREATE , ( uint32_t ) xHandle , uxInitialCount ) ;
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4 )
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4 _X )
# define traceCREATE_COUNTING_SEMAPHORE() \
TRACE_SET_OBJECT_FILTER ( QUEUE , xHandle , CurrentFilterGroup ) ; \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
@ -1856,18 +2037,18 @@ uint32_t prvIsNewTCB(void* pNewTCB);
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( QUEUE , pxHandle ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_SEMAPHORE_COUNTING_CREATE , ( uint32_t ) pxHandle , uxCountValue ) ;
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X */
# undef traceCREATE_COUNTING_SEMAPHORE_FAILED
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X )
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X )
# define traceCREATE_COUNTING_SEMAPHORE_FAILED() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED , 0 , uxMaxCount ) ;
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_ OR_7_6 )
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_ X )
# define traceCREATE_COUNTING_SEMAPHORE_FAILED() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED , 0 , uxInitialCount ) ;
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4 )
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4 _X )
# define traceCREATE_COUNTING_SEMAPHORE_FAILED() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED , 0 , uxCountValue ) ;
@ -1875,7 +2056,7 @@ uint32_t prvIsNewTCB(void* pNewTCB);
# define traceCREATE_COUNTING_SEMAPHORE_FAILED() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED , 0 , uxCountValue ) ;
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X */
/* This macro is not necessary as of FreeRTOS v9.0.0 */
@ -1927,6 +2108,12 @@ uint32_t prvIsNewTCB(void* pNewTCB);
break ; \
}
# undef traceQUEUE_SET_SEND
# define traceQUEUE_SET_SEND( pxQueue ) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( QUEUE , pxQueue ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_QUEUE_SEND , ( uint32_t ) pxQueue , pxQueue - > uxMessagesWaiting + 1 ) ;
/* Called when a message failed to be sent to a queue (timeout) */
# undef traceQUEUE_SEND_FAILED
# define traceQUEUE_SEND_FAILED( pxQueue ) \
@ -1967,28 +2154,6 @@ uint32_t prvIsNewTCB(void* pNewTCB);
break ; \
}
/**************************************************************************/
/* Makes sure xQueueGiveFromISR also has a xCopyPosition parameter */
/**************************************************************************/
/* Helpers needed to correctly expand names */
# define TZ__CAT2(a,b) a ## b
# define TZ__CAT(a,b) TZ__CAT2(a, b)
/* Expands name if this header is included... uxQueueType must be a macro that only exists in queue.c or whatever, and it must expand to nothing or to something that's valid in identifiers */
# define xQueueGiveFromISR(a,b) TZ__CAT(xQueueGiveFromISR__, uxQueueType) (a,b)
/* If in queue.c, the "uxQueueType" macro expands to "pcHead". queueSEND_TO_BACK is the value we need to send in */
# define xQueueGiveFromISR__pcHead(__a, __b) MyWrapper(__a, __b, const BaseType_t xCopyPosition); \
BaseType_t xQueueGiveFromISR ( __a , __b ) { return MyWrapper ( xQueue , pxHigherPriorityTaskWoken , queueSEND_TO_BACK ) ; } \
BaseType_t MyWrapper ( __a , __b , const BaseType_t xCopyPosition )
/* If not in queue.c, "uxQueueType" isn't expanded */
# define xQueueGiveFromISR__uxQueueType(__a, __b) xQueueGiveFromISR(__a,__b)
/**************************************************************************/
/* End of xQueueGiveFromISR fix */
/**************************************************************************/
/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */
# undef traceQUEUE_SEND_FROM_ISR
# define traceQUEUE_SEND_FROM_ISR( pxQueue ) \
@ -2218,13 +2383,29 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition)
# if (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1)
extern uint32_t trcHeapCounter ;
# undef traceMALLOC
# define traceMALLOC( pvAddress, uiSize ) \
if ( pvAddress ! = 0 ) \
{ \
trcHeapCounter + = uiSize ; \
} \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_MALLOC , ( uint32_t ) pvAddress , uiSize ) ;
{ \
if ( pvAddress ! = 0 ) \
{ \
prvTraceStoreEvent2 ( PSF_EVENT_MALLOC , ( uint32_t ) pvAddress , uiSize ) ; \
} \
else \
{ \
prvTraceStoreEvent2 ( PSF_EVENT_MALLOC_FAILED , ( uint32_t ) pvAddress , uiSize ) ; \
} \
}
# undef traceFREE
# define traceFREE( pvAddress, uiSize ) \
trcHeapCounter - = uiSize ; \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_FREE , ( uint32_t ) pvAddress , ( uint32_t ) ( 0 - uiSize ) ) ; /* "0 -" instead of just "-" to get rid of a warning... */
@ -2236,8 +2417,8 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition)
# undef traceTIMER_CREATE
# define traceTIMER_CREATE(tmr) \
TRACE_SET_OBJECT_FILTER ( TIMER , tmr , CurrentFilterGroup ) ; \
prvTraceSave Symbol( tmr , tmr - > pcTimerName ) ; \
prvTraceStoreStringEvent ( 1 , PSF_EVENT_OBJ_NAME , tmr - > pcTimerName , tmr ) ; \
prvTraceSave Object Symbol( tmr , ( const char * ) tmr - > pcTimerName ) ; \
prvTraceStoreStringEvent ( 1 , PSF_EVENT_OBJ_NAME , ( const char * ) tmr - > pcTimerName , tmr ) ; \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( TIMER , tmr ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_TIMER_CREATE , ( uint32_t ) tmr , tmr - > xTimerPeriodInTicks ) ;
@ -2247,7 +2428,7 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition)
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent0 ( PSF_EVENT_TIMER_CREATE_FAILED ) ;
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X )
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X )
# define traceTIMER_COMMAND_SEND_8_0_CASES(tmr) \
case tmrCOMMAND_RESET : \
prvTraceStoreEvent2 ( ( xReturn = = pdPASS ) ? PSF_EVENT_TIMER_RESET : PSF_EVENT_TIMER_RESET_FAILED , ( uint32_t ) tmr , xOptionalValue ) ; \
@ -2264,9 +2445,9 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition)
case tmrCOMMAND_CHANGE_PERIOD_FROM_ISR : \
prvTraceStoreEvent2 ( ( xReturn = = pdPASS ) ? PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR : PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR_FAILED , ( uint32_t ) tmr , xOptionalValue ) ; \
break ;
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X */
# define traceTIMER_COMMAND_SEND_8_0_CASES(tmr)
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X */
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X _X */
/* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */
# undef traceTIMER_COMMAND_SEND
@ -2381,68 +2562,113 @@ BaseType_t MyWrapper(__a, __b, const BaseType_t xCopyPosition)
# endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */
# undef traceTASK_NOTIFY_TAKE
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0)
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_TAKE(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) { \
if ( pxCurrentTCB - > ucNotifyState [ index ] = = taskNOTIFICATION_RECEIVED ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_TAKE , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; \
else \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_TAKE_FAILED , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; }
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0)
# define traceTASK_NOTIFY_TAKE() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) { \
if ( pxCurrentTCB - > ucNotifyState = = taskNOTIFICATION_RECEIVED ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_TAKE , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; \
else \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_TAKE_FAILED , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; }
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 10_4 _0 */
# define traceTASK_NOTIFY_TAKE() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) { \
if ( pxCurrentTCB - > eNotifyState = = eNotified ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_TAKE , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; \
else \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_TAKE_FAILED , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; }
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 9_0 _0 */
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 10_4 _0 */
# undef traceTASK_NOTIFY_TAKE_BLOCK
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_TAKE_BLOCK(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_TAKE_BLOCK , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ;
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY_TAKE_BLOCK() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_TAKE_BLOCK , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ;
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# undef traceTASK_NOTIFY_WAIT
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0)
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_WAIT(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) { \
if ( pxCurrentTCB - > ucNotifyState [ index ] = = taskNOTIFICATION_RECEIVED ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_WAIT , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; \
else \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_WAIT_FAILED , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; }
# elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0)
# define traceTASK_NOTIFY_WAIT() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) { \
if ( pxCurrentTCB - > ucNotifyState = = taskNOTIFICATION_RECEIVED ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_WAIT , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; \
else \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_WAIT_FAILED , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; }
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 10_4 _0 */
# define traceTASK_NOTIFY_WAIT() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) { \
if ( pxCurrentTCB - > eNotifyState = = eNotified ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_WAIT , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; \
else \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_WAIT_FAILED , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ; }
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 9_0 _0 */
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_ 10_4 _0 */
# undef traceTASK_NOTIFY_WAIT_BLOCK
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_WAIT_BLOCK(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ;
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY_WAIT_BLOCK() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
prvTraceStoreEvent2 ( PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK , ( uint32_t ) pxCurrentTCB , xTicksToWait ) ;
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# undef traceTASK_NOTIFY
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreEvent1 ( PSF_EVENT_TASK_NOTIFY , ( uint32_t ) xTaskToNotify ) ;
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , TRACE_GET_CURRENT_TASK ( ) ) & CurrentFilterMask ) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreEvent1 ( PSF_EVENT_TASK_NOTIFY , ( uint32_t ) xTaskToNotify ) ;
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# undef traceTASK_NOTIFY_FROM_ISR
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_FROM_ISR(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreEvent1 ( PSF_EVENT_TASK_NOTIFY_FROM_ISR , ( uint32_t ) xTaskToNotify ) ;
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY_FROM_ISR() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreEvent1 ( PSF_EVENT_TASK_NOTIFY_FROM_ISR , ( uint32_t ) xTaskToNotify ) ;
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# undef traceTASK_NOTIFY_GIVE_FROM_ISR
# if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0)
# define traceTASK_NOTIFY_GIVE_FROM_ISR(index) \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreEvent1 ( PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR , ( uint32_t ) xTaskToNotify ) ;
# else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# define traceTASK_NOTIFY_GIVE_FROM_ISR() \
if ( TRACE_GET_OBJECT_FILTER ( TASK , xTaskToNotify ) & CurrentFilterMask ) \
prvTraceStoreEvent1 ( PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR , ( uint32_t ) xTaskToNotify ) ;
# endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */
# undef traceQUEUE_REGISTRY_ADD
# define traceQUEUE_REGISTRY_ADD(object, name) \
prvTraceSave Symbol( object , ( const char * ) name ) ; \
prvTraceSave Object Symbol( object , ( const char * ) name ) ; \
prvTraceStoreStringEvent ( 1 , PSF_EVENT_OBJ_NAME , name , object ) ;
# if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1)