1 /* 2 * Trace Recorder for Tracealyzer v4.5.1 3 * Copyright 2021 Percepio AB 4 * www.percepio.com 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 * 8 * FreeRTOS specific definitions needed by the trace recorder 9 */ 10 11 #ifndef TRC_KERNEL_PORT_H 12 #define TRC_KERNEL_PORT_H 13 14 #include "FreeRTOS.h" /* Defines configUSE_TRACE_FACILITY */ 15 #include "trcPortDefines.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #define TRC_USE_TRACEALYZER_RECORDER configUSE_TRACE_FACILITY 22 23 /*** FreeRTOS version codes **************************************************/ 24 #define FREERTOS_VERSION_NOT_SET 0 25 #define TRC_FREERTOS_VERSION_7_3_X 1 /* v7.3 is earliest supported.*/ 26 #define TRC_FREERTOS_VERSION_7_4_X 2 27 #define TRC_FREERTOS_VERSION_7_5_X 3 28 #define TRC_FREERTOS_VERSION_7_6_X TRC_FREERTOS_VERSION_7_5_X 29 #define TRC_FREERTOS_VERSION_8_X_X 4 30 #define TRC_FREERTOS_VERSION_9_0_0 5 31 #define TRC_FREERTOS_VERSION_9_0_1 6 32 #define TRC_FREERTOS_VERSION_9_0_2 7 33 #define TRC_FREERTOS_VERSION_10_0_0 8 34 #define TRC_FREERTOS_VERSION_10_0_1 TRC_FREERTOS_VERSION_10_0_0 35 #define TRC_FREERTOS_VERSION_10_1_0 TRC_FREERTOS_VERSION_10_0_0 36 #define TRC_FREERTOS_VERSION_10_1_1 TRC_FREERTOS_VERSION_10_0_0 37 #define TRC_FREERTOS_VERSION_10_2_0 TRC_FREERTOS_VERSION_10_0_0 38 #define TRC_FREERTOS_VERSION_10_2_1 TRC_FREERTOS_VERSION_10_0_0 39 #define TRC_FREERTOS_VERSION_10_3_0 9 40 #define TRC_FREERTOS_VERSION_10_3_1 TRC_FREERTOS_VERSION_10_3_0 41 #define TRC_FREERTOS_VERSION_10_4_0 10 42 #define TRC_FREERTOS_VERSION_10_4_1 TRC_FREERTOS_VERSION_10_4_0 43 44 /* Legacy FreeRTOS version codes for backwards compatibility with old trace configurations */ 45 #define TRC_FREERTOS_VERSION_7_3 TRC_FREERTOS_VERSION_7_3_X 46 #define TRC_FREERTOS_VERSION_7_4 TRC_FREERTOS_VERSION_7_4_X 47 #define TRC_FREERTOS_VERSION_7_5_OR_7_6 TRC_FREERTOS_VERSION_7_5_X 48 #define TRC_FREERTOS_VERSION_8_X TRC_FREERTOS_VERSION_8_X_X 49 50 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) 51 #define prvGetStreamBufferType(x) ((( StreamBuffer_t * )x )->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER) 52 #else 53 #define prvGetStreamBufferType(x) 0 54 #endif 55 56 /* Added mainly for our internal testing. This makes it easier to create test applications that 57 runs on multiple FreeRTOS versions. */ 58 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_8_X_X) 59 /* FreeRTOS v7.x */ 60 #define STRING_CAST(x) ( (signed char*) x ) 61 #define TickType portTickType 62 #define TaskType xTaskHandle 63 #else 64 /* FreeRTOS v8.0 and later */ 65 #define STRING_CAST(x) x 66 #define TickType TickType_t 67 #define TaskType TaskHandle_t 68 #endif 69 70 71 72 #if (defined(TRC_USE_TRACEALYZER_RECORDER)) && (TRC_USE_TRACEALYZER_RECORDER == 1) 73 74 #define TRC_PLATFORM_CFG "" 75 #define TRC_PLATFORM_CFG_MAJOR 1 76 #define TRC_PLATFORM_CFG_MINOR 0 77 #define TRC_PLATFORM_CFG_PATCH 0 78 79 #if defined(TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1) && (TRC_CFG_SCHEDULING_ONLY == 0) 80 /* Required for this feature */ 81 #undef INCLUDE_uxTaskGetStackHighWaterMark 82 #define INCLUDE_uxTaskGetStackHighWaterMark 1 83 #endif /* defined(TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1) && (TRC_CFG_SCHEDULING_ONLY == 0) */ 84 85 /******************************************************************************* 86 * INCLUDE_xTaskGetCurrentTaskHandle must be set to 1 for tracing to work properly 87 ******************************************************************************/ 88 #undef INCLUDE_xTaskGetCurrentTaskHandle 89 #define INCLUDE_xTaskGetCurrentTaskHandle 1 90 91 #if (TRC_CFG_SCHEDULING_ONLY == 0) 92 /******************************************************************************* 93 * vTraceSetQueueName(void* object, const char* name) 94 * 95 * Parameter object: pointer to the Queue that shall be named 96 * Parameter name: the name to set (const string literal) 97 * 98 * Sets a name for Queue objects for display in Tracealyzer. 99 ******************************************************************************/ 100 void vTraceSetQueueName(void* object, const char* name); 101 102 /******************************************************************************* 103 * vTraceSetSemaphoreName(void* object, const char* name) 104 * 105 * Parameter object: pointer to the Semaphore that shall be named 106 * Parameter name: the name to set (const string literal) 107 * 108 * Sets a name for Semaphore objects for display in Tracealyzer. 109 ******************************************************************************/ 110 void vTraceSetSemaphoreName(void* object, const char* name); 111 112 /******************************************************************************* 113 * vTraceSetMutexName(void* object, const char* name) 114 * 115 * Parameter object: pointer to the Mutex that shall be named 116 * Parameter name: the name to set (const string literal) 117 * 118 * Sets a name for Semaphore objects for display in Tracealyzer. 119 ******************************************************************************/ 120 void vTraceSetMutexName(void* object, const char* name); 121 122 #if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) 123 /******************************************************************************* 124 * vTraceSetEventGroupName(void* object, const char* name) 125 * 126 * Parameter object: pointer to the EventGroup that shall be named 127 * Parameter name: the name to set (const string literal) 128 * 129 * Sets a name for EventGroup objects for display in Tracealyzer. 130 ******************************************************************************/ 131 void vTraceSetEventGroupName(void* object, const char* name); 132 #else /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */ 133 #define vTraceSetEventGroupName(object, name) /* Do nothing */ 134 #endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */ 135 136 #if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) 137 /******************************************************************************* 138 * vTraceSetStreamBufferName(void* object, const char* name) 139 * 140 * Parameter object: pointer to the StreamBuffer that shall be named 141 * Parameter name: the name to set (const string literal) 142 * 143 * Sets a name for StreamBuffer objects for display in Tracealyzer. 144 ******************************************************************************/ 145 void vTraceSetStreamBufferName(void* object, const char* name); 146 #else /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */ 147 #define vTraceSetStreamBufferName(object, name) /* Do nothing */ 148 #endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */ 149 150 #if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) 151 /******************************************************************************* 152 * vTraceSetMessageBufferName(void* object, const char* name) 153 * 154 * Parameter object: pointer to the MessageBuffer that shall be named 155 * Parameter name: the name to set (const string literal) 156 * 157 * Sets a name for MessageBuffer objects for display in Tracealyzer. 158 ******************************************************************************/ 159 void vTraceSetMessageBufferName(void* object, const char* name); 160 #else /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */ 161 #define vTraceSetMessageBufferName(object, name) /* Do nothing */ 162 #endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */ 163 164 #if defined(TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1) 165 uint32_t prvTraceGetStackHighWaterMark(void* task); 166 #endif /* defined(TRC_CFG_ENABLE_STACK_MONITOR) && (TRC_CFG_ENABLE_STACK_MONITOR == 1)*/ 167 168 #else /* (TRC_CFG_SCHEDULING_ONLY == 0) */ 169 170 #define vTraceSetQueueName(object, name) /* Do nothing */ 171 #define vTraceSetSemaphoreName(object, name) /* Do nothing */ 172 #define vTraceSetMutexName(object, name) /* Do nothing */ 173 #define vTraceSetEventGroupName(object, name) /* Do nothing */ 174 #define vTraceSetStreamBufferName(object, name) /* Do nothing */ 175 #define vTraceSetMessageBufferName(object, name) /* Do nothing */ 176 #define prvAddTaskToStackMonitor(task) /* Do nothing */ 177 #define prvRemoveTaskFromStackMonitor(task) /* Do nothing */ 178 179 #endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */ 180 181 /******************************************************************************* 182 * Note: Setting names for event groups is difficult to support, this has been 183 * excluded intentionally. This since we don't know if event_groups.c is 184 * included in the build, so referencing it from the recorder may cause errors. 185 ******************************************************************************/ 186 187 /* Gives the currently executing task (wrapper for RTOS-specific function) */ 188 void* prvTraceGetCurrentTaskHandle(void); 189 190 #if (((TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT) && (TRC_CFG_INCLUDE_ISR_TRACING == 1)) || (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)) 191 /* Tells if the scheduler currently is suspended (task-switches can't occur) */ 192 unsigned char prvTraceIsSchedulerSuspended(void); 193 194 /******************************************************************************* 195 * INCLUDE_xTaskGetSchedulerState must be set to 1 for tracing to work properly 196 ******************************************************************************/ 197 #undef INCLUDE_xTaskGetSchedulerState 198 #define INCLUDE_xTaskGetSchedulerState 1 199 200 #endif /* (((TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT) && (TRC_CFG_INCLUDE_ISR_TRACING == 1)) || (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)) */ 201 202 #define TRACE_KERNEL_VERSION 0x1AA1 203 #define TRACE_TICK_RATE_HZ configTICK_RATE_HZ /* Defined in "FreeRTOS.h" */ 204 #define TRACE_CPU_CLOCK_HZ configCPU_CLOCK_HZ /* Defined in "FreeRTOSConfig.h" */ 205 #define TRACE_GET_CURRENT_TASK() prvTraceGetCurrentTaskHandle() 206 207 #define TRACE_GET_OS_TICKS() (uiTraceTickCount) /* Streaming only */ 208 209 /* If using dynamic allocation of snapshot trace buffer... */ 210 #define TRACE_MALLOC(size) pvPortMalloc(size) 211 212 #if defined(configUSE_TIMERS) 213 #if (configUSE_TIMERS == 1) 214 #undef INCLUDE_xTimerGetTimerDaemonTaskHandle 215 #define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 216 #endif /* configUSE_TIMERS == 1*/ 217 #endif /* configUSE_TIMERS */ 218 219 /* For ARM Cortex-M devices - assumes the ARM CMSIS API is available */ 220 #if (defined (__CORTEX_M)) 221 #define TRACE_ALLOC_CRITICAL_SECTION() uint32_t __irq_status; 222 #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = __get_PRIMASK(); __set_PRIMASK(1);} /* PRIMASK disables ALL interrupts - allows for tracing in any ISR */ 223 #define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);} 224 #endif 225 226 #if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_CORTEX_A9) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_XILINX_ZyncUltraScaleR5) 227 228 /************************************************************************** 229 * Disables "FreeRTOS-enabled" interrupts only , i.e. with priorities up to 230 * configMAX_API_CALL_INTERRUPT_PRIORITY. Don't add tracing in ISRs with 231 * greater priority. 232 *************************************************************************/ 233 234 extern int cortex_a9_r5_enter_critical(void); 235 extern void cortex_a9_r5_exit_critical(int irq_already_masked_at_enter); 236 237 #define TRACE_ALLOC_CRITICAL_SECTION() uint32_t __irq_mask_status; 238 239 #define TRACE_ENTER_CRITICAL_SECTION() { __irq_mask_status = cortex_a9_r5_enter_critical(); } 240 241 #define TRACE_EXIT_CRITICAL_SECTION() { cortex_a9_r5_exit_critical(__irq_mask_status); } 242 243 #endif 244 245 #if ( (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Renesas_RX600) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32)) 246 #define TRACE_ALLOC_CRITICAL_SECTION() int __irq_status; 247 #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();} 248 #define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);} 249 #endif 250 251 #if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Altera_NiosII) 252 #include "system.h" 253 #include "sys/alt_irq.h" 254 #define TRACE_ALLOC_CRITICAL_SECTION() alt_irq_context __irq_status; 255 #define TRACE_ENTER_CRITICAL_SECTION(){__irq_status = alt_irq_disable_all();} 256 #define TRACE_EXIT_CRITICAL_SECTION() {alt_irq_enable_all(__irq_status);} 257 #endif 258 259 #if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Win32) 260 /* In the Win32 port, there are no real interrupts, so we can use the normal critical sections */ 261 #define TRACE_ALLOC_CRITICAL_SECTION() 262 #define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL() 263 #define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL() 264 #endif 265 266 #if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_POWERPC_Z4) 267 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) 268 /* FreeRTOS v8.0 or later */ 269 #define TRACE_ALLOC_CRITICAL_SECTION() UBaseType_t __irq_status; 270 #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();} 271 #define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);} 272 #else 273 /* FreeRTOS v7.x */ 274 #define TRACE_ALLOC_CRITICAL_SECTION() unsigned portBASE_TYPE __irq_status; 275 #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();} 276 #define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);} 277 #endif 278 #endif 279 280 #ifndef TRACE_ENTER_CRITICAL_SECTION 281 #error "This hardware port has no definition for critical sections! See http://percepio.com/2014/10/27/how-to-define-critical-sections-for-the-recorder/" 282 #endif 283 284 285 #if (TRC_CFG_FREERTOS_VERSION == TRC_FREERTOS_VERSION_9_0_1) 286 /****************************************************************************** 287 * Fix for FreeRTOS v9.0.1 to correctly identify xQueuePeek events. 288 * 289 * In FreeRTOS v9.0.1, the below trace hooks are incorrectly used from three 290 * different functions. This as the earlier function xQueueGenericReceive 291 * has been replaced by xQueuePeek, xQueueSemaphoreTake and xQueueReceive. 292 * 293 * xQueueGenericReceive had a parameter "xJustPeeking", used by the trace hooks 294 * to tell between xQueuePeek events and others. This is no longer present, so 295 * we need another way to correctly identify peek events. Since all three 296 * functions call the same trace macros, the context of these macro is unknown. 297 * 298 * We therefore check the __LINE__ macro inside of the trace macros. This gives 299 * the line number of queue.c, where the macros are used. This can be used to 300 * tell if the context is xQueuePeek or another function. 301 * __LINE__ is a standard compiler feature since ancient times, so it should 302 * work on all common compilers. 303 * 304 * This might seem as a quite brittle and unusual solution, but works in this 305 * particular case and is only for FreeRTOS v9.0.1. 306 * Future versions of FreeRTOS should not need this fix, as we have submitted 307 * a correction of queue.c with individual trace macros for each function. 308 ******************************************************************************/ 309 #define isQueueReceiveHookActuallyPeek (__LINE__ > 1674) /* Half way between the closes trace points */ 310 311 #elif (TRC_CFG_FREERTOS_VERSION <= TRC_FREERTOS_VERSION_9_0_0) 312 #define isQueueReceiveHookActuallyPeek xJustPeeking 313 314 #elif (TRC_CFG_FREERTOS_VERSION > TRC_FREERTOS_VERSION_9_0_1) 315 #define isQueueReceiveHookActuallyPeek (__LINE__ < 0) /* instead of pdFALSE to fix a warning of "constant condition" */ 316 317 #endif 318 319 extern uint16_t CurrentFilterMask; 320 321 extern uint16_t CurrentFilterGroup; 322 323 uint8_t prvTraceGetQueueType(void* handle); 324 uint16_t prvTraceGetTaskNumberLow16(void* handle); 325 uint16_t prvTraceGetTaskNumberHigh16(void* handle); 326 void prvTraceSetTaskNumberLow16(void* handle, uint16_t value); 327 void prvTraceSetTaskNumberHigh16(void* handle, uint16_t value); 328 329 uint16_t prvTraceGetQueueNumberLow16(void* handle); 330 uint16_t prvTraceGetQueueNumberHigh16(void* handle); 331 void prvTraceSetQueueNumberLow16(void* handle, uint16_t value); 332 void prvTraceSetQueueNumberHigh16(void* handle, uint16_t value); 333 334 #if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) 335 uint16_t prvTraceGetTimerNumberLow16(void* handle); 336 uint16_t prvTraceGetTimerNumberHigh16(void* handle); 337 void prvTraceSetTimerNumberLow16(void* handle, uint16_t value); 338 void prvTraceSetTimerNumberHigh16(void* handle, uint16_t value); 339 #endif /* (TRC_CFG_INCLUDE_TIMER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 340 341 #if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) 342 uint16_t prvTraceGetEventGroupNumberLow16(void* handle); 343 uint16_t prvTraceGetEventGroupNumberHigh16(void* handle); 344 void prvTraceSetEventGroupNumberLow16(void* handle, uint16_t value); 345 void prvTraceSetEventGroupNumberHigh16(void* handle, uint16_t value); 346 #endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 347 348 #if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) 349 uint16_t prvTraceGetStreamBufferNumberLow16(void* handle); 350 uint16_t prvTraceGetStreamBufferNumberHigh16(void* handle); 351 void prvTraceSetStreamBufferNumberLow16(void* handle, uint16_t value); 352 void prvTraceSetStreamBufferNumberHigh16(void* handle, uint16_t value); 353 #endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1 && TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 354 355 #define TRACE_GET_TASK_FILTER(pxTask) prvTraceGetTaskNumberHigh16((void*)pxTask) 356 #define TRACE_SET_TASK_FILTER(pxTask, group) prvTraceSetTaskNumberHigh16((void*)pxTask, group) 357 358 #define TRACE_GET_QUEUE_FILTER(pxObject) prvTraceGetQueueNumberHigh16((void*)pxObject) 359 #define TRACE_SET_QUEUE_FILTER(pxObject, group) prvTraceSetQueueNumberHigh16((void*)pxObject, group) 360 361 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) 362 #define TRACE_GET_EVENTGROUP_FILTER(pxObject) prvTraceGetEventGroupNumberHigh16((void*)pxObject) 363 #define TRACE_SET_EVENTGROUP_FILTER(pxObject, group) prvTraceSetEventGroupNumberHigh16((void*)pxObject, group) 364 #else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 365 /* FreeRTOS versions before v10.0 does not support filtering for event groups */ 366 #define TRACE_GET_EVENTGROUP_FILTER(pxObject) 1 367 #define TRACE_SET_EVENTGROUP_FILTER(pxObject, group) 368 #endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 369 370 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) 371 #define TRACE_GET_TIMER_FILTER(pxObject) prvTraceGetTimerNumberHigh16((void*)pxObject) 372 #define TRACE_SET_TIMER_FILTER(pxObject, group) prvTraceSetTimerNumberHigh16((void*)pxObject, group) 373 #else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 374 /* FreeRTOS versions before v10.0 does not support filtering for timers */ 375 #define TRACE_GET_TIMER_FILTER(pxObject) 1 376 #define TRACE_SET_TIMER_FILTER(pxObject, group) 377 #endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 378 379 #define TRACE_GET_STREAMBUFFER_FILTER(pxObject) prvTraceGetStreamBufferNumberHigh16((void*)pxObject) 380 #define TRACE_SET_STREAMBUFFER_FILTER(pxObject, group) prvTraceSetStreamBufferNumberHigh16((void*)pxObject, group) 381 382 /* We can only support filtering if FreeRTOS is at least v8.0 */ 383 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) 384 #define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) TRACE_GET_##CLASS##_FILTER(pxObject) 385 #define TRACE_SET_OBJECT_FILTER(CLASS, pxObject, group) TRACE_SET_##CLASS##_FILTER(pxObject, group) 386 #else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) */ 387 #define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) 0xFFFF 388 #define TRACE_SET_OBJECT_FILTER(CLASS, pxObject, group) 389 #endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) */ 390 391 /* Helpers needed to correctly expand names */ 392 #define TZ__CAT2(a,b) a ## b 393 #define TZ__CAT(a,b) TZ__CAT2(a, b) 394 395 /**************************************************************************/ 396 /* Makes sure xQueueGiveFromISR also has a xCopyPosition parameter */ 397 /**************************************************************************/ 398 399 /* 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 */ 400 #define xQueueGiveFromISR(a,b) TZ__CAT(xQueueGiveFromISR__, uxQueueType) (a,b) 401 402 /* If in queue.c, the "uxQueueType" macro expands to "pcHead". queueSEND_TO_BACK is the value we need to send in */ 403 #define xQueueGiveFromISR__pcHead(__a, __b) MyWrapper_xQueueGiveFromISR(__a, __b, const BaseType_t xCopyPosition); \ 404 BaseType_t xQueueGiveFromISR(__a, __b) { return MyWrapper_xQueueGiveFromISR(xQueue, pxHigherPriorityTaskWoken, queueSEND_TO_BACK); } \ 405 BaseType_t MyWrapper_xQueueGiveFromISR(__a, __b, const BaseType_t xCopyPosition) 406 407 /* If not in queue.c, "uxQueueType" isn't expanded */ 408 #define xQueueGiveFromISR__uxQueueType(__a, __b) xQueueGiveFromISR(__a,__b) 409 410 /**************************************************************************/ 411 /* End of xQueueGiveFromISR fix */ 412 /**************************************************************************/ 413 414 /******************************************************************************/ 415 /*** Definitions for Snapshot mode ********************************************/ 416 /******************************************************************************/ 417 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT) 418 419 /*** The object classes *******************************************************/ 420 421 #define TRACE_NCLASSES 9 422 #define TRACE_CLASS_QUEUE ((traceObjectClass)0) 423 #define TRACE_CLASS_SEMAPHORE ((traceObjectClass)1) 424 #define TRACE_CLASS_MUTEX ((traceObjectClass)2) 425 #define TRACE_CLASS_TASK ((traceObjectClass)3) 426 #define TRACE_CLASS_ISR ((traceObjectClass)4) 427 #define TRACE_CLASS_TIMER ((traceObjectClass)5) 428 #define TRACE_CLASS_EVENTGROUP ((traceObjectClass)6) 429 #define TRACE_CLASS_STREAMBUFFER ((traceObjectClass)7) 430 #define TRACE_CLASS_MESSAGEBUFFER ((traceObjectClass)8) 431 432 /*** Definitions for Object Table ********************************************/ 433 #define TRACE_KERNEL_OBJECT_COUNT ((TRC_CFG_NQUEUE) + (TRC_CFG_NSEMAPHORE) + (TRC_CFG_NMUTEX) + (TRC_CFG_NTASK) + (TRC_CFG_NISR) + (TRC_CFG_NTIMER) + (TRC_CFG_NEVENTGROUP) + (TRC_CFG_NSTREAMBUFFER) + (TRC_CFG_NMESSAGEBUFFER)) 434 435 /* Queue properties (except name): current number of message in queue */ 436 #define PropertyTableSizeQueue ((TRC_CFG_NAME_LEN_QUEUE) + 1) 437 438 /* Semaphore properties (except name): state (signaled = 1, cleared = 0) */ 439 #define PropertyTableSizeSemaphore ((TRC_CFG_NAME_LEN_SEMAPHORE) + 1) 440 441 /* Mutex properties (except name): owner (task handle, 0 = free) */ 442 #define PropertyTableSizeMutex ((TRC_CFG_NAME_LEN_MUTEX) + 1) 443 444 /* Task properties (except name): Byte 0: Current priority 445 Byte 1: state (if already active) 446 Byte 2: legacy, not used 447 Byte 3: legacy, not used */ 448 #define PropertyTableSizeTask ((TRC_CFG_NAME_LEN_TASK) + 4) 449 450 /* ISR properties: Byte 0: priority 451 Byte 1: state (if already active) */ 452 #define PropertyTableSizeISR ((TRC_CFG_NAME_LEN_ISR) + 2) 453 454 /* TRC_CFG_NTIMER properties: Byte 0: state (unused for now) */ 455 #define PropertyTableSizeTimer ((TRC_CFG_NAME_LEN_TIMER) + 1) 456 457 /* TRC_CFG_NEVENTGROUP properties: Byte 0-3: state (unused for now)*/ 458 #define PropertyTableSizeEventGroup ((TRC_CFG_NAME_LEN_EVENTGROUP) + 4) 459 460 /* TRC_CFG_NSTREAMBUFFER properties: Byte 0-3: state (unused for now)*/ 461 #define PropertyTableSizeStreamBuffer ((TRC_CFG_NAME_LEN_STREAMBUFFER) + 4) 462 463 /* TRC_CFG_NMESSAGEBUFFER properties: Byte 0-3: state (unused for now)*/ 464 #define PropertyTableSizeMessageBuffer ((TRC_CFG_NAME_LEN_MESSAGEBUFFER) + 4) 465 466 467 /* The layout of the byte array representing the Object Property Table */ 468 #define StartIndexQueue (0) 469 #define StartIndexSemaphore (StartIndexQueue + (TRC_CFG_NQUEUE) * PropertyTableSizeQueue) 470 #define StartIndexMutex (StartIndexSemaphore + (TRC_CFG_NSEMAPHORE) * PropertyTableSizeSemaphore) 471 #define StartIndexTask (StartIndexMutex + (TRC_CFG_NMUTEX) * PropertyTableSizeMutex) 472 #define StartIndexISR (StartIndexTask + (TRC_CFG_NTASK) * PropertyTableSizeTask) 473 #define StartIndexTimer (StartIndexISR + (TRC_CFG_NISR) * PropertyTableSizeISR) 474 #define StartIndexEventGroup (StartIndexTimer + (TRC_CFG_NTIMER) * PropertyTableSizeTimer) 475 #define StartIndexStreamBuffer (StartIndexEventGroup + (TRC_CFG_NEVENTGROUP) * PropertyTableSizeEventGroup) 476 #define StartIndexMessageBuffer (StartIndexStreamBuffer + (TRC_CFG_NSTREAMBUFFER) * PropertyTableSizeStreamBuffer) 477 478 /* Number of bytes used by the object table */ 479 #define TRACE_OBJECT_TABLE_SIZE (StartIndexMessageBuffer + (TRC_CFG_NMESSAGEBUFFER) * PropertyTableSizeMessageBuffer) 480 481 /* Flag to tell the context of tracePEND_FUNC_CALL_FROM_ISR */ 482 extern int uiInEventGroupSetBitsFromISR; 483 484 /* Initialization of the object property table */ 485 void vTraceInitObjectPropertyTable(void); 486 487 /* Initialization of the handle mechanism, see e.g, prvTraceGetObjectHandle */ 488 void vTraceInitObjectHandleStack(void); 489 490 /* Returns the "Not enough handles" error message for the specified object class */ 491 const char* pszTraceGetErrorNotEnoughHandles(traceObjectClass objectclass); 492 493 void* prvTraceGetCurrentTaskHandle(void); 494 495 /****************************************************************************** 496 * TraceQueueClassTable 497 * Translates a FreeRTOS QueueType into trace objects classes (TRACE_CLASS_). 498 * Has one entry for each QueueType, gives TRACE_CLASS ID. 499 ******************************************************************************/ 500 extern traceObjectClass TraceQueueClassTable[5]; 501 502 503 /*** Event codes for snapshot mode - must match Tracealyzer config files ******/ 504 505 #define NULL_EVENT (0x00UL) 506 507 /******************************************************************************* 508 * EVENTGROUP_DIV 509 * 510 * Miscellaneous events. 511 ******************************************************************************/ 512 #define EVENTGROUP_DIV (NULL_EVENT + 1UL) /*0x01*/ 513 #define DIV_XPS (EVENTGROUP_DIV + 0UL) /*0x01*/ 514 #define DIV_TASK_READY (EVENTGROUP_DIV + 1UL) /*0x02*/ 515 #define DIV_NEW_TIME (EVENTGROUP_DIV + 2UL) /*0x03*/ 516 517 /******************************************************************************* 518 * EVENTGROUP_TS 519 * 520 * Events for storing task-switches and interrupts. The RESUME events are 521 * generated if the task/interrupt is already marked active. 522 ******************************************************************************/ 523 #define EVENTGROUP_TS (EVENTGROUP_DIV + 3UL) /*0x04*/ 524 #define TS_ISR_BEGIN (EVENTGROUP_TS + 0UL) /*0x04*/ 525 #define TS_ISR_RESUME (EVENTGROUP_TS + 1UL) /*0x05*/ 526 #define TS_TASK_BEGIN (EVENTGROUP_TS + 2UL) /*0x06*/ 527 #define TS_TASK_RESUME (EVENTGROUP_TS + 3UL) /*0x07*/ 528 529 /******************************************************************************* 530 * EVENTGROUP_OBJCLOSE_NAME 531 * 532 * About Close Events 533 * When an object is evicted from the object property table (object close), two 534 * internal events are stored (EVENTGROUP_OBJCLOSE_NAME and 535 * EVENTGROUP_OBJCLOSE_PROP), containing the handle-name mapping and object 536 * properties valid up to this point. 537 ******************************************************************************/ 538 #define EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS (EVENTGROUP_TS + 4UL) /*0x08*/ 539 540 /******************************************************************************* 541 * EVENTGROUP_OBJCLOSE_PROP 542 * 543 * The internal event carrying properties of deleted objects 544 * The handle and object class of the closed object is not stored in this event, 545 * but is assumed to be the same as in the preceding CLOSE event. Thus, these 546 * two events must be generated from within a critical section. 547 * When queues are closed, arg1 is the "state" property (i.e., number of 548 * buffered messages/signals). 549 * When actors are closed, arg1 is priority, arg2 is handle of the "instance 550 * finish" event, and arg3 is event code of the "instance finish" event. 551 * In this case, the lower three bits is the object class of the instance finish 552 * handle. The lower three bits are not used (always zero) when queues are 553 * closed since the queue type is given in the previous OBJCLOSE_NAME event. 554 ******************************************************************************/ 555 #define EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + 8UL) /*0x10*/ 556 557 /******************************************************************************* 558 * EVENTGROUP_CREATE 559 * 560 * The events in this group are used to log Kernel object creations. 561 * The lower three bits in the event code gives the object class, i.e., type of 562 * create operation (task, queue, semaphore, etc). 563 ******************************************************************************/ 564 #define EVENTGROUP_CREATE_OBJ_TRCSUCCESS (EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS + 8UL) /*0x18*/ 565 566 /******************************************************************************* 567 * EVENTGROUP_SEND 568 * 569 * The events in this group are used to log Send/Give events on queues, 570 * semaphores and mutexes The lower three bits in the event code gives the 571 * object class, i.e., what type of object that is operated on (queue, semaphore 572 * or mutex). 573 ******************************************************************************/ 574 #define EVENTGROUP_SEND_TRCSUCCESS (EVENTGROUP_CREATE_OBJ_TRCSUCCESS + 8UL) /*0x20*/ 575 576 /******************************************************************************* 577 * EVENTGROUP_RECEIVE 578 * 579 * The events in this group are used to log Receive/Take events on queues, 580 * semaphores and mutexes. The lower three bits in the event code gives the 581 * object class, i.e., what type of object that is operated on (queue, semaphore 582 * or mutex). 583 ******************************************************************************/ 584 #define EVENTGROUP_RECEIVE_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 8UL) /*0x28*/ 585 586 /* Send/Give operations, from ISR */ 587 #define EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS \ 588 (EVENTGROUP_RECEIVE_TRCSUCCESS + 8UL) /*0x30*/ 589 590 /* Receive/Take operations, from ISR */ 591 #define EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS \ 592 (EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 8UL) /*0x38*/ 593 594 /* "Failed" event type versions of above (timeout, failed allocation, etc) */ 595 #define EVENTGROUP_KSE_TRCFAILED \ 596 (EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS + 8UL) /*0x40*/ 597 598 /* Failed create calls - memory allocation failed */ 599 #define EVENTGROUP_CREATE_OBJ_TRCFAILED (EVENTGROUP_KSE_TRCFAILED) /*0x40*/ 600 601 /* Failed send/give - timeout! */ 602 #define EVENTGROUP_SEND_TRCFAILED (EVENTGROUP_CREATE_OBJ_TRCFAILED + 8UL) /*0x48*/ 603 604 /* Failed receive/take - timeout! */ 605 #define EVENTGROUP_RECEIVE_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 8UL) /*0x50*/ 606 607 /* Failed non-blocking send/give - queue full */ 608 #define EVENTGROUP_SEND_FROM_ISR_TRCFAILED (EVENTGROUP_RECEIVE_TRCFAILED + 8UL) /*0x58*/ 609 610 /* Failed non-blocking receive/take - queue empty */ 611 #define EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED \ 612 (EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 8UL) /*0x60*/ 613 614 /* Events when blocking on receive/take */ 615 #define EVENTGROUP_RECEIVE_TRCBLOCK \ 616 (EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED + 8UL) /*0x68*/ 617 618 /* Events when blocking on send/give */ 619 #define EVENTGROUP_SEND_TRCBLOCK (EVENTGROUP_RECEIVE_TRCBLOCK + 8UL) /*0x70*/ 620 621 /* Events on queue peek (receive) */ 622 #define EVENTGROUP_PEEK_TRCSUCCESS (EVENTGROUP_SEND_TRCBLOCK + 8UL) /*0x78*/ 623 624 /* Events on object delete (vTaskDelete or vQueueDelete) */ 625 #define EVENTGROUP_DELETE_OBJ_TRCSUCCESS (EVENTGROUP_PEEK_TRCSUCCESS + 8UL) /*0x80*/ 626 627 /* Other events - object class is implied: TASK */ 628 #define EVENTGROUP_OTHERS (EVENTGROUP_DELETE_OBJ_TRCSUCCESS + 8UL) /*0x88*/ 629 #define TASK_DELAY_UNTIL (EVENTGROUP_OTHERS + 0UL) /*0x88*/ 630 #define TASK_DELAY (EVENTGROUP_OTHERS + 1UL) /*0x89*/ 631 #define TASK_SUSPEND (EVENTGROUP_OTHERS + 2UL) /*0x8A*/ 632 #define TASK_RESUME (EVENTGROUP_OTHERS + 3UL) /*0x8B*/ 633 #define TASK_RESUME_FROM_ISR (EVENTGROUP_OTHERS + 4UL) /*0x8C*/ 634 #define TASK_PRIORITY_SET (EVENTGROUP_OTHERS + 5UL) /*0x8D*/ 635 #define TASK_PRIORITY_INHERIT (EVENTGROUP_OTHERS + 6UL) /*0x8E*/ 636 #define TASK_PRIORITY_DISINHERIT (EVENTGROUP_OTHERS + 7UL) /*0x8F*/ 637 638 #define EVENTGROUP_MISC_PLACEHOLDER (EVENTGROUP_OTHERS + 8UL) /*0x90*/ 639 #define PEND_FUNC_CALL (EVENTGROUP_MISC_PLACEHOLDER+0UL) /*0x90*/ 640 #define PEND_FUNC_CALL_FROM_ISR (EVENTGROUP_MISC_PLACEHOLDER+1UL) /*0x91*/ 641 #define PEND_FUNC_CALL_TRCFAILED (EVENTGROUP_MISC_PLACEHOLDER+2UL) /*0x92*/ 642 #define PEND_FUNC_CALL_FROM_ISR_TRCFAILED (EVENTGROUP_MISC_PLACEHOLDER+3UL) /*0x93*/ 643 #define MEM_MALLOC_SIZE (EVENTGROUP_MISC_PLACEHOLDER+4UL) /*0x94*/ 644 #define MEM_MALLOC_ADDR (EVENTGROUP_MISC_PLACEHOLDER+5UL) /*0x95*/ 645 #define MEM_FREE_SIZE (EVENTGROUP_MISC_PLACEHOLDER+6UL) /*0x96*/ 646 #define MEM_FREE_ADDR (EVENTGROUP_MISC_PLACEHOLDER+7UL) /*0x97*/ 647 648 /* User events */ 649 #define EVENTGROUP_USEREVENT (EVENTGROUP_MISC_PLACEHOLDER + 8UL) /*0x98*/ 650 #define USER_EVENT (EVENTGROUP_USEREVENT + 0UL) 651 652 /* Allow for 0-15 arguments (the number of args is added to event code) */ 653 #define USER_EVENT_LAST (EVENTGROUP_USEREVENT + 15UL) /*0xA7*/ 654 655 /******************************************************************************* 656 * XTS Event - eXtended TimeStamp events 657 * The timestamps used in the recorder are "differential timestamps" (DTS), i.e. 658 * the time since the last stored event. The DTS fields are either 1 or 2 bytes 659 * in the other events, depending on the bytes available in the event struct. 660 * If the time since the last event (the DTS) is larger than allowed for by 661 * the DTS field of the current event, an XTS event is inserted immediately 662 * before the original event. The XTS event contains up to 3 additional bytes 663 * of the DTS value - the higher bytes of the true DTS value. The lower 1-2 664 * bytes are stored in the normal DTS field. 665 * There are two types of XTS events, XTS8 and XTS16. An XTS8 event is stored 666 * when there is only room for 1 byte (8 bit) DTS data in the original event, 667 * which means a limit of 0xFF (255UL). The XTS16 is used when the original event 668 * has a 16 bit DTS field and thereby can handle values up to 0xFFFF (65535UL). 669 * 670 * Using a very high frequency time base can result in many XTS events. 671 * Preferably, the time between two OS ticks should fit in 16 bits, i.e., 672 * at most 65535. If your time base has a higher frequency, you can define 673 * the TRACE 674 ******************************************************************************/ 675 676 #define EVENTGROUP_SYS (EVENTGROUP_USEREVENT + 16UL) /*0xA8*/ 677 #define XTS8 (EVENTGROUP_SYS + 0UL) /*0xA8*/ 678 #define XTS16 (EVENTGROUP_SYS + 1UL) /*0xA9*/ 679 #define EVENT_BEING_WRITTEN (EVENTGROUP_SYS + 2UL) /*0xAA*/ 680 #define RESERVED_DUMMY_CODE (EVENTGROUP_SYS + 3UL) /*0xAB*/ 681 #define LOW_POWER_BEGIN (EVENTGROUP_SYS + 4UL) /*0xAC*/ 682 #define LOW_POWER_END (EVENTGROUP_SYS + 5UL) /*0xAD*/ 683 #define XID (EVENTGROUP_SYS + 6UL) /*0xAE*/ 684 #define XTS16L (EVENTGROUP_SYS + 7UL) /*0xAF*/ 685 686 #define EVENTGROUP_TIMER (EVENTGROUP_SYS + 8UL) /*0xB0*/ 687 #define TIMER_CREATE (EVENTGROUP_TIMER + 0UL) /*0xB0*/ 688 #define TIMER_START (EVENTGROUP_TIMER + 1UL) /*0xB1*/ 689 #define TIMER_RST (EVENTGROUP_TIMER + 2UL) /*0xB2*/ 690 #define TIMER_STOP (EVENTGROUP_TIMER + 3UL) /*0xB3*/ 691 #define TIMER_CHANGE_PERIOD (EVENTGROUP_TIMER + 4UL) /*0xB4*/ 692 #define TIMER_DELETE_OBJ (EVENTGROUP_TIMER + 5UL) /*0xB5*/ 693 #define TIMER_START_FROM_ISR (EVENTGROUP_TIMER + 6UL) /*0xB6*/ 694 #define TIMER_RESET_FROM_ISR (EVENTGROUP_TIMER + 7UL) /*0xB7*/ 695 #define TIMER_STOP_FROM_ISR (EVENTGROUP_TIMER + 8UL) /*0xB8*/ 696 697 #define TIMER_CREATE_TRCFAILED (EVENTGROUP_TIMER + 9UL) /*0xB9*/ 698 #define TIMER_START_TRCFAILED (EVENTGROUP_TIMER + 10UL) /*0xBA*/ 699 #define TIMER_RESET_TRCFAILED (EVENTGROUP_TIMER + 11UL) /*0xBB*/ 700 #define TIMER_STOP_TRCFAILED (EVENTGROUP_TIMER + 12UL) /*0xBC*/ 701 #define TIMER_CHANGE_PERIOD_TRCFAILED (EVENTGROUP_TIMER + 13UL) /*0xBD*/ 702 #define TIMER_DELETE_TRCFAILED (EVENTGROUP_TIMER + 14UL) /*0xBE*/ 703 #define TIMER_START_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 15UL) /*0xBF*/ 704 #define TIMER_RESET_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 16UL) /*0xC0*/ 705 #define TIMER_STOP_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 17UL) /*0xC1*/ 706 707 #define EVENTGROUP_EG (EVENTGROUP_TIMER + 18UL) /*0xC2*/ 708 #define EVENT_GROUP_CREATE (EVENTGROUP_EG + 0UL) /*0xC2*/ 709 #define EVENT_GROUP_CREATE_TRCFAILED (EVENTGROUP_EG + 1UL) /*0xC3*/ 710 #define EVENT_GROUP_SYNC_TRCBLOCK (EVENTGROUP_EG + 2UL) /*0xC4*/ 711 #define EVENT_GROUP_SYNC_END (EVENTGROUP_EG + 3UL) /*0xC5*/ 712 #define EVENT_GROUP_WAIT_BITS_TRCBLOCK (EVENTGROUP_EG + 4UL) /*0xC6*/ 713 #define EVENT_GROUP_WAIT_BITS_END (EVENTGROUP_EG + 5UL) /*0xC7*/ 714 #define EVENT_GROUP_CLEAR_BITS (EVENTGROUP_EG + 6UL) /*0xC8*/ 715 #define EVENT_GROUP_CLEAR_BITS_FROM_ISR (EVENTGROUP_EG + 7UL) /*0xC9*/ 716 #define EVENT_GROUP_SET_BITS (EVENTGROUP_EG + 8UL) /*0xCA*/ 717 #define EVENT_GROUP_DELETE_OBJ (EVENTGROUP_EG + 9UL) /*0xCB*/ 718 #define EVENT_GROUP_SYNC_END_TRCFAILED (EVENTGROUP_EG + 10UL) /*0xCC*/ 719 #define EVENT_GROUP_WAIT_BITS_END_TRCFAILED (EVENTGROUP_EG + 11UL) /*0xCD*/ 720 #define EVENT_GROUP_SET_BITS_FROM_ISR (EVENTGROUP_EG + 12UL) /*0xCE*/ 721 #define EVENT_GROUP_SET_BITS_FROM_ISR_TRCFAILED (EVENTGROUP_EG + 13UL) /*0xCF*/ 722 723 #define TASK_INSTANCE_FINISHED_NEXT_KSE (EVENTGROUP_EG + 14UL) /*0xD0*/ 724 #define TASK_INSTANCE_FINISHED_DIRECT (EVENTGROUP_EG + 15UL) /*0xD1*/ 725 726 #define TRACE_TASK_NOTIFY_GROUP (EVENTGROUP_EG + 16UL) /*0xD2*/ 727 #define TRACE_TASK_NOTIFY (TRACE_TASK_NOTIFY_GROUP + 0UL) /*0xD2*/ 728 #define TRACE_TASK_NOTIFY_TAKE (TRACE_TASK_NOTIFY_GROUP + 1UL) /*0xD3*/ 729 #define TRACE_TASK_NOTIFY_TAKE_TRCBLOCK (TRACE_TASK_NOTIFY_GROUP + 2UL) /*0xD4*/ 730 #define TRACE_TASK_NOTIFY_TAKE_TRCFAILED (TRACE_TASK_NOTIFY_GROUP + 3UL) /*0xD5*/ 731 #define TRACE_TASK_NOTIFY_WAIT (TRACE_TASK_NOTIFY_GROUP + 4UL) /*0xD6*/ 732 #define TRACE_TASK_NOTIFY_WAIT_TRCBLOCK (TRACE_TASK_NOTIFY_GROUP + 5UL) /*0xD7*/ 733 #define TRACE_TASK_NOTIFY_WAIT_TRCFAILED (TRACE_TASK_NOTIFY_GROUP + 6UL) /*0xD8*/ 734 #define TRACE_TASK_NOTIFY_FROM_ISR (TRACE_TASK_NOTIFY_GROUP + 7UL) /*0xD9*/ 735 #define TRACE_TASK_NOTIFY_GIVE_FROM_ISR (TRACE_TASK_NOTIFY_GROUP + 8UL) /*0xDA*/ 736 737 #define TIMER_EXPIRED (TRACE_TASK_NOTIFY_GROUP + 9UL) /*0xDB*/ 738 739 /* Events on queue peek (receive) */ 740 #define EVENTGROUP_PEEK_TRCBLOCK (TRACE_TASK_NOTIFY_GROUP + 10UL) /*0xDC*/ 741 /* peek block on queue: 0xDC */ 742 /* peek block on semaphore: 0xDD */ 743 /* peek block on mutex: 0xDE */ 744 745 /* Events on queue peek (receive) */ 746 #define EVENTGROUP_PEEK_TRCFAILED (EVENTGROUP_PEEK_TRCBLOCK + 3UL) /*0xDF*/ 747 /* peek failed on queue: 0xDF */ 748 /* peek failed on semaphore: 0xE0 */ 749 /* peek failed on mutex: 0xE1 */ 750 751 #define EVENTGROUP_STREAMBUFFER_DIV (EVENTGROUP_PEEK_TRCFAILED + 3UL) /*0xE2*/ 752 #define TRACE_STREAMBUFFER_RESET (EVENTGROUP_STREAMBUFFER_DIV + 0) /*0xE2*/ 753 #define TRACE_MESSAGEBUFFER_RESET (EVENTGROUP_STREAMBUFFER_DIV + 1UL) /*0xE3*/ 754 #define TRACE_STREAMBUFFER_OBJCLOSE_NAME_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 2UL) /*0xE4*/ 755 #define TRACE_MESSAGEBUFFER_OBJCLOSE_NAME_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 3UL) /*0xE5*/ 756 #define TRACE_STREAMBUFFER_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 4UL) /*0xE6*/ 757 #define TRACE_MESSAGEBUFFER_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_STREAMBUFFER_DIV + 5UL) /*0xE7*/ 758 759 #define EVENTGROUP_MALLOC_FAILED (EVENTGROUP_STREAMBUFFER_DIV + 6UL) /*0xE8*/ 760 #define MEM_MALLOC_SIZE_TRCFAILED (EVENTGROUP_MALLOC_FAILED + 0UL) /*0xE8*/ 761 #define MEM_MALLOC_ADDR_TRCFAILED (EVENTGROUP_MALLOC_FAILED + 1UL) /*0xE9*/ 762 763 /* The following are using previously "lost" event codes */ 764 #define TRACE_STREAMBUFFER_CREATE_OBJ_TRCSUCCESS (EVENTGROUP_CREATE_OBJ_TRCSUCCESS + 4UL) /*0x1C*/ 765 #define TRACE_STREAMBUFFER_CREATE_OBJ_TRCFAILED (EVENTGROUP_CREATE_OBJ_TRCFAILED + 4UL) /*0x44*/ 766 #define TRACE_STREAMBUFFER_DELETE_OBJ_TRCSUCCESS (EVENTGROUP_DELETE_OBJ_TRCSUCCESS + 4UL) /*0x84*/ 767 #define TRACE_STREAMBUFFER_SEND_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 3UL) /*0x23*/ 768 #define TRACE_STREAMBUFFER_SEND_TRCBLOCK (EVENTGROUP_SEND_TRCBLOCK + 3UL) /*0x73*/ 769 #define TRACE_STREAMBUFFER_SEND_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 3UL) /*0x4B*/ 770 #define TRACE_STREAMBUFFER_RECEIVE_TRCSUCCESS (EVENTGROUP_RECEIVE_TRCSUCCESS + 3UL) /*0x2B*/ 771 #define TRACE_STREAMBUFFER_RECEIVE_TRCBLOCK (EVENTGROUP_RECEIVE_TRCBLOCK + 3UL) /*0x6B*/ 772 #define TRACE_STREAMBUFFER_RECEIVE_TRCFAILED (EVENTGROUP_RECEIVE_TRCFAILED + 3UL) /*0x53*/ 773 #define TRACE_STREAMBUFFER_SEND_FROM_ISR_TRCSUCCESS (EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 3UL) /*0x33*/ 774 #define TRACE_STREAMBUFFER_SEND_FROM_ISR_TRCFAILED (EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 3UL) /*0x5B*/ 775 #define TRACE_STREAMBUFFER_RECEIVE_FROM_ISR_TRCSUCCESS (EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS + 3UL) /*0x3B*/ 776 #define TRACE_STREAMBUFFER_RECEIVE_FROM_ISR_TRCFAILED (EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED + 3UL) /*0x63*/ 777 778 /* The following are using previously "lost" event codes. These macros aren't even directly referenced, instead we do (equivalent STREAMBUFFER code) + 1. */ 779 #define TRACE_MESSAGEBUFFER_CREATE_OBJ_TRCSUCCESS (EVENTGROUP_CREATE_OBJ_TRCSUCCESS + 5UL) /*0x1D*/ 780 #define TRACE_MESSAGEBUFFER_CREATE_OBJ_TRCFAILED (EVENTGROUP_CREATE_OBJ_TRCFAILED + 5UL) /*0x45*/ 781 #define TRACE_MESSAGEBUFFER_DELETE_OBJ_TRCSUCCESS (EVENTGROUP_DELETE_OBJ_TRCSUCCESS + 5UL) /*0x85*/ 782 #define TRACE_MESSAGEBUFFER_SEND_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 4UL) /*0x24*/ 783 #define TRACE_MESSAGEBUFFER_SEND_TRCBLOCK (EVENTGROUP_SEND_TRCBLOCK + 4UL) /*0x74*/ 784 #define TRACE_MESSAGEBUFFER_SEND_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 4UL) /*0x4C*/ 785 #define TRACE_MESSAGEBUFFER_RECEIVE_TRCSUCCESS (EVENTGROUP_RECEIVE_TRCSUCCESS + 4UL) /*0x2C*/ 786 #define TRACE_MESSAGEBUFFER_RECEIVE_TRCBLOCK (EVENTGROUP_RECEIVE_TRCBLOCK + 4UL) /*0x6C*/ 787 #define TRACE_MESSAGEBUFFER_RECEIVE_TRCFAILED (EVENTGROUP_RECEIVE_TRCFAILED + 4UL) /*0x54*/ 788 #define TRACE_MESSAGEBUFFER_SEND_FROM_ISR_TRCSUCCESS (EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 4UL) /*0x34*/ 789 #define TRACE_MESSAGEBUFFER_SEND_FROM_ISR_TRCFAILED (EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 4UL) /*0x5C*/ 790 #define TRACE_MESSAGEBUFFER_RECEIVE_FROM_ISR_TRCSUCCESS (EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS + 4UL) /*0x3C*/ 791 #define TRACE_MESSAGEBUFFER_RECEIVE_FROM_ISR_TRCFAILED (EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED + 4UL) /*0x64*/ 792 793 #define TRACE_QUEUE_SEND_TO_FRONT_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 5UL) /*0x25*/ 794 #define TRACE_QUEUE_SEND_TO_FRONT_TRCBLOCK (EVENTGROUP_SEND_TRCBLOCK + 5UL) /*0x75*/ 795 #define TRACE_QUEUE_SEND_TO_FRONT_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 5UL) /*0x4D*/ 796 #define TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCSUCCESS (EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 5UL) /*0x35*/ 797 #define TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCFAILED (EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 5UL) /*0x5D*/ 798 799 #define TRACE_UNUSED_STACK (EVENTGROUP_MALLOC_FAILED + 2UL) /*0xEA*/ 800 801 /* LAST EVENT (0xEA) */ 802 803 /**************************** 804 * MACROS TO GET TRACE CLASS * 805 ****************************/ 806 #define TRACE_GET_TRACE_CLASS_FROM_TASK_CLASS(kernelClass) (TRACE_CLASS_TASK) 807 #define TRACE_GET_TRACE_CLASS_FROM_TASK_OBJECT(pxObject) (TRACE_CLASS_TASK) 808 809 #define TRACE_GET_TRACE_CLASS_FROM_QUEUE_CLASS(kernelClass) TraceQueueClassTable[kernelClass] 810 #define TRACE_GET_TRACE_CLASS_FROM_QUEUE_OBJECT(pxObject) TRACE_GET_TRACE_CLASS_FROM_QUEUE_CLASS(prvTraceGetQueueType(pxObject)) 811 812 #define TRACE_GET_TRACE_CLASS_FROM_TIMER_CLASS(kernelClass) (TRACE_CLASS_TIMER) 813 #define TRACE_GET_TRACE_CLASS_FROM_TIMER_OBJECT(pxObject) (TRACE_CLASS_TIMER) 814 815 #define TRACE_GET_TRACE_CLASS_FROM_EVENTGROUP_CLASS(kernelClass) (TRACE_CLASS_EVENTGROUP) 816 #define TRACE_GET_TRACE_CLASS_FROM_EVENTGROUP_OBJECT(pxObject) (TRACE_CLASS_EVENTGROUP) 817 818 /* TRACE_GET_TRACE_CLASS_FROM_STREAMBUFFER_CLASS can only be accessed with a parameter indicating if it is a MessageBuffer */ 819 #define TRACE_GET_TRACE_CLASS_FROM_STREAMBUFFER_CLASS(xIsMessageBuffer) (xIsMessageBuffer == 1 ? TRACE_CLASS_MESSAGEBUFFER : TRACE_CLASS_STREAMBUFFER) 820 #define TRACE_GET_TRACE_CLASS_FROM_STREAMBUFFER_OBJECT(pxObject) (prvGetStreamBufferType(pxObject) == 1 ? TRACE_CLASS_MESSAGEBUFFER : TRACE_CLASS_STREAMBUFFER) 821 822 /* Generic versions */ 823 #define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TRACE_GET_TRACE_CLASS_FROM_##CLASS##_CLASS(kernelClass) 824 #define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_TRACE_CLASS_FROM_##CLASS##_OBJECT(pxObject) 825 826 /****************************** 827 * MACROS TO GET OBJECT NUMBER * 828 ******************************/ 829 #define TRACE_GET_TASK_NUMBER(pxTCB) (traceHandle)(prvTraceGetTaskNumberLow16(pxTCB)) 830 #define TRACE_SET_TASK_NUMBER(pxTCB) prvTraceSetTaskNumberLow16(pxTCB, prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(TASK, pxTCB))); 831 832 #define TRACE_GET_QUEUE_NUMBER(queue) ( ( traceHandle ) prvTraceGetQueueNumberLow16(queue) ) 833 #define TRACE_SET_QUEUE_NUMBER(queue) prvTraceSetQueueNumberLow16(queue, (uint16_t)prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, queue))); 834 835 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) 836 #define TRACE_GET_TIMER_NUMBER(tmr) ( ( traceHandle ) prvTraceGetTimerNumberLow16(tmr) ) 837 #define TRACE_SET_TIMER_NUMBER(tmr) prvTraceSetTimerNumberLow16(tmr, (uint16_t)prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr))); 838 #else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 839 #define TRACE_GET_TIMER_NUMBER(tmr) ( ( traceHandle ) ((Timer_t*)tmr)->uxTimerNumber ) 840 #define TRACE_SET_TIMER_NUMBER(tmr) ((Timer_t*)tmr)->uxTimerNumber = prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr)); 841 #endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 842 843 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) 844 #define TRACE_GET_EVENTGROUP_NUMBER(eg) ( ( traceHandle ) prvTraceGetEventGroupNumberLow16(eg) ) 845 #define TRACE_SET_EVENTGROUP_NUMBER(eg) prvTraceSetEventGroupNumberLow16(eg, (uint16_t)prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg))); 846 #else /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 847 #define TRACE_GET_EVENTGROUP_NUMBER(eg) ( ( traceHandle ) uxEventGroupGetNumber(eg) ) 848 #define TRACE_SET_EVENTGROUP_NUMBER(eg) ((EventGroup_t*)eg)->uxEventGroupNumber = prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg)); 849 #endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_0_0) */ 850 851 852 #define TRACE_GET_STREAMBUFFER_NUMBER(sb) ( ( traceHandle ) prvTraceGetStreamBufferNumberLow16(sb) ) 853 #define TRACE_SET_STREAMBUFFER_NUMBER(sb) prvTraceSetStreamBufferNumberLow16(sb, (uint16_t)prvTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(STREAMBUFFER, sb))); 854 855 /* Generic versions */ 856 #define TRACE_GET_OBJECT_NUMBER(CLASS, pxObject) TRACE_GET_##CLASS##_NUMBER(pxObject) 857 #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) TRACE_SET_##CLASS##_NUMBER(pxObject) 858 859 /****************************** 860 * MACROS TO GET EVENT CODES * 861 ******************************/ 862 #define TRACE_GET_TASK_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(TASK, kernelClass)) 863 #define TRACE_GET_QUEUE_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(QUEUE, kernelClass)) 864 #define TRACE_GET_TIMER_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) -- THIS IS NOT USED -- 865 #define TRACE_GET_EVENTGROUP_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) -- THIS IS NOT USED -- 866 #define TRACE_GET_STREAMBUFFER_CLASS_EVENT_CODE(SERVICE, RESULT, isMessageBuffer) (uint8_t)(TRACE_STREAMBUFFER_##SERVICE##_##RESULT + (uint8_t)isMessageBuffer) 867 868 #define TRACE_GET_TASK_OBJECT_EVENT_CODE(SERVICE, RESULT, pxTCB) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_CLASS_TASK) 869 #define TRACE_GET_QUEUE_OBJECT_EVENT_CODE(SERVICE, RESULT, pxObject) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxObject)) 870 #define TRACE_GET_TIMER_OBJECT_EVENT_CODE(SERVICE, RESULT, UNUSED) -- THIS IS NOT USED -- 871 #define TRACE_GET_EVENTGROUP_OBJECT_EVENT_CODE(SERVICE, RESULT, UNUSED) -- THIS IS NOT USED -- 872 #define TRACE_GET_STREAMBUFFER_OBJECT_EVENT_CODE(SERVICE, RESULT, pxObject) (uint8_t)(TRACE_STREAMBUFFER_##SERVICE##_##RESULT + prvGetStreamBufferType(pxObject)) 873 874 /* Generic versions */ 875 #define TRACE_GET_CLASS_EVENT_CODE(SERVICE, RESULT, CLASS, kernelClass) TRACE_GET_##CLASS##_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) 876 #define TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject) TRACE_GET_##CLASS##_OBJECT_EVENT_CODE(SERVICE, RESULT, pxObject) 877 878 /****************************** 879 * SPECIAL MACROS FOR TASKS * 880 ******************************/ 881 #define TRACE_GET_TASK_PRIORITY(pxTCB) ((uint8_t)pxTCB->uxPriority) 882 #define TRACE_GET_TASK_NAME(pxTCB) ((char*)pxTCB->pcTaskName) 883 884 /*** The trace macros for snapshot mode **************************************/ 885 886 /* A macro that will update the tick count when returning from tickless idle */ 887 #undef traceINCREASE_TICK_COUNT 888 #define traceINCREASE_TICK_COUNT( xCount ) 889 890 /* Called for each task that becomes ready */ 891 #undef traceMOVED_TASK_TO_READY_STATE 892 #define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \ 893 trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB); 894 895 /* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */ 896 #undef traceTASK_INCREMENT_TICK 897 898 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_3_0) 899 900 #define traceTASK_INCREMENT_TICK( xTickCount ) \ 901 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || xPendedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \ 902 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); } 903 904 #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_X) 905 906 #define traceTASK_INCREMENT_TICK( xTickCount ) \ 907 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxPendedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \ 908 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); } 909 910 #else 911 912 #define traceTASK_INCREMENT_TICK( xTickCount ) \ 913 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxMissedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \ 914 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); } 915 916 #endif 917 918 extern volatile uint32_t uiTraceSystemState; 919 920 /* Called on each task-switch */ 921 #undef traceTASK_SWITCHED_IN 922 #define traceTASK_SWITCHED_IN() \ 923 uiTraceSystemState = TRC_STATE_IN_TASKSWITCH; \ 924 trcKERNEL_HOOKS_TASK_SWITCH(TRACE_GET_CURRENT_TASK()); \ 925 uiTraceSystemState = TRC_STATE_IN_APPLICATION; 926 927 /* Called on vTaskCreate */ 928 #undef traceTASK_CREATE 929 #define traceTASK_CREATE(pxNewTCB) \ 930 if (pxNewTCB != NULL) \ 931 { \ 932 trcKERNEL_HOOKS_TASK_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, TASK, pxNewTCB), TASK, pxNewTCB); \ 933 prvAddTaskToStackMonitor(pxNewTCB); \ 934 } 935 936 /* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */ 937 #undef traceTASK_CREATE_FAILED 938 #define traceTASK_CREATE_FAILED() \ 939 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, TASK, NOT_USED), 0); 940 941 /* Called on vTaskDelete */ 942 #undef traceTASK_DELETE 943 #define traceTASK_DELETE( pxTaskToDelete ) \ 944 { TRACE_ALLOC_CRITICAL_SECTION(); \ 945 TRACE_ENTER_CRITICAL_SECTION(); \ 946 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); \ 947 prvRemoveTaskFromStackMonitor(pxTaskToDelete); \ 948 TRACE_EXIT_CRITICAL_SECTION(); } 949 950 #if (TRC_CFG_SCHEDULING_ONLY == 0) 951 952 #if defined(configUSE_TICKLESS_IDLE) 953 #if (configUSE_TICKLESS_IDLE != 0) 954 955 #undef traceLOW_POWER_IDLE_BEGIN 956 #define traceLOW_POWER_IDLE_BEGIN() \ 957 { \ 958 extern uint32_t trace_disable_timestamp; \ 959 prvTraceStoreLowPower(0); \ 960 trace_disable_timestamp = 1; \ 961 } 962 963 #undef traceLOW_POWER_IDLE_END 964 #define traceLOW_POWER_IDLE_END() \ 965 { \ 966 extern uint32_t trace_disable_timestamp; \ 967 trace_disable_timestamp = 0; \ 968 prvTraceStoreLowPower(1); \ 969 } 970 971 #endif /* (configUSE_TICKLESS_IDLE != 0) */ 972 #endif /* defined(configUSE_TICKLESS_IDLE) */ 973 974 /* Called on vTaskSuspend */ 975 #undef traceTASK_SUSPEND 976 #define traceTASK_SUSPEND( pxTaskToSuspend ) \ 977 trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend); 978 979 /* Called from special case with timer only */ 980 #undef traceTASK_DELAY_SUSPEND 981 #define traceTASK_DELAY_SUSPEND( pxTaskToSuspend ) \ 982 trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend); \ 983 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 984 985 /* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */ 986 #undef traceTASK_DELAY 987 #define traceTASK_DELAY() \ 988 trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY, pxCurrentTCB, xTicksToDelay); \ 989 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 990 991 /* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */ 992 #undef traceTASK_DELAY_UNTIL 993 #if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 994 #define traceTASK_DELAY_UNTIL(xTimeToWake) \ 995 trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, xTimeToWake); \ 996 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 997 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ 998 #define traceTASK_DELAY_UNTIL() \ 999 trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, xTimeToWake); \ 1000 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 1001 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ 1002 1003 /* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */ 1004 #undef traceQUEUE_CREATE 1005 #define traceQUEUE_CREATE( pxNewQueue ) \ 1006 trcKERNEL_HOOKS_OBJECT_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, QUEUE, pxNewQueue), QUEUE, pxNewQueue); 1007 1008 /* Called in xQueueCreate, if the queue creation fails */ 1009 #undef traceQUEUE_CREATE_FAILED 1010 #define traceQUEUE_CREATE_FAILED( queueType ) \ 1011 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, QUEUE, queueType), 0); 1012 1013 /* Called on vQueueDelete */ 1014 #undef traceQUEUE_DELETE 1015 #define traceQUEUE_DELETE( pxQueue ) \ 1016 { TRACE_ALLOC_CRITICAL_SECTION(); \ 1017 TRACE_ENTER_CRITICAL_SECTION(); \ 1018 trcKERNEL_HOOKS_OBJECT_DELETE(TRACE_GET_OBJECT_EVENT_CODE(DELETE_OBJ, TRCSUCCESS, QUEUE, pxQueue), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_NAME, TRCSUCCESS, QUEUE, pxQueue), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_PROP, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \ 1019 TRACE_EXIT_CRITICAL_SECTION(); } 1020 1021 /* This macro is not necessary as of FreeRTOS v9.0.0 */ 1022 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) 1023 /* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */ 1024 #undef traceCREATE_MUTEX 1025 #define traceCREATE_MUTEX( pxNewQueue ) \ 1026 trcKERNEL_HOOKS_OBJECT_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, QUEUE, pxNewQueue), QUEUE, pxNewQueue); 1027 1028 /* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */ 1029 #undef traceCREATE_MUTEX_FAILED 1030 #define traceCREATE_MUTEX_FAILED() \ 1031 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, QUEUE, queueQUEUE_TYPE_MUTEX), 0); 1032 #endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */ 1033 1034 /* Called when the Mutex can not be given, since not holder */ 1035 #undef traceGIVE_MUTEX_RECURSIVE_FAILED 1036 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ) \ 1037 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCFAILED, QUEUE, pxMutex), QUEUE, pxMutex); 1038 1039 /* Called when a message is sent to a queue */ /* CS IS NEW ! */ 1040 #undef traceQUEUE_SEND 1041 #define traceQUEUE_SEND( pxQueue ) \ 1042 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); \ 1043 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)); 1044 1045 /* Called when a message is sent to a queue set */ 1046 #undef traceQUEUE_SET_SEND 1047 #define traceQUEUE_SET_SEND( pxQueue ) \ 1048 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \ 1049 trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting + 1)); 1050 1051 /* Called when a message failed to be sent to a queue (timeout) */ 1052 #undef traceQUEUE_SEND_FAILED 1053 #define traceQUEUE_SEND_FAILED( pxQueue ) \ 1054 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); 1055 1056 /* Called when the task is blocked due to a send operation on a full queue */ 1057 #undef traceBLOCKING_ON_QUEUE_SEND 1058 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \ 1059 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); 1060 1061 /* Called when a message is received from a queue */ 1062 #undef traceQUEUE_RECEIVE 1063 #define traceQUEUE_RECEIVE( pxQueue ) \ 1064 if (isQueueReceiveHookActuallyPeek) \ 1065 { \ 1066 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \ 1067 } \ 1068 else \ 1069 { \ 1070 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \ 1071 } \ 1072 trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxQueue) == TRACE_CLASS_MUTEX ? (uint8_t)TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()) : (uint8_t)(pxQueue->uxMessagesWaiting - 1)); 1073 1074 /* Called when a receive operation on a queue fails (timeout) */ 1075 #undef traceQUEUE_RECEIVE_FAILED 1076 #define traceQUEUE_RECEIVE_FAILED( pxQueue ) \ 1077 if (isQueueReceiveHookActuallyPeek) \ 1078 { \ 1079 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue); \ 1080 } \ 1081 else \ 1082 { \ 1083 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue); \ 1084 } 1085 1086 /* Called when the task is blocked due to a receive operation on an empty queue */ 1087 #undef traceBLOCKING_ON_QUEUE_RECEIVE 1088 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \ 1089 if (isQueueReceiveHookActuallyPeek) \ 1090 { \ 1091 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCBLOCK, QUEUE, pxQueue), QUEUE, pxQueue); \ 1092 } \ 1093 else \ 1094 { \ 1095 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCBLOCK, QUEUE, pxQueue), QUEUE, pxQueue); \ 1096 } \ 1097 if (TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxQueue) != TRACE_CLASS_MUTEX) \ 1098 { \ 1099 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); \ 1100 } 1101 1102 /* Called on xQueuePeek */ 1103 #undef traceQUEUE_PEEK 1104 #define traceQUEUE_PEEK( pxQueue ) \ 1105 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); 1106 1107 /* Called on xQueuePeek fail/timeout (added in FreeRTOS v9.0.2) */ 1108 #undef traceQUEUE_PEEK_FAILED 1109 #define traceQUEUE_PEEK_FAILED( pxQueue ) \ 1110 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue); 1111 1112 /* Called on xQueuePeek blocking (added in FreeRTOS v9.0.2) */ 1113 #undef traceBLOCKING_ON_QUEUE_PEEK 1114 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue ) \ 1115 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCBLOCK, QUEUE, pxQueue), QUEUE, pxQueue); \ 1116 if (TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxQueue) != TRACE_CLASS_MUTEX) \ 1117 { \ 1118 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); \ 1119 } 1120 1121 /* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */ 1122 #undef traceQUEUE_SEND_FROM_ISR 1123 #define traceQUEUE_SEND_FROM_ISR( pxQueue ) \ 1124 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); \ 1125 trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting + 1)); 1126 1127 /* Called when a message send from interrupt context fails (since the queue was full) */ 1128 #undef traceQUEUE_SEND_FROM_ISR_FAILED 1129 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \ 1130 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); 1131 1132 /* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */ 1133 #undef traceQUEUE_RECEIVE_FROM_ISR 1134 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \ 1135 trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \ 1136 trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting - 1)); 1137 1138 /* Called when a message receive from interrupt context fails (since the queue was empty) */ 1139 #undef traceQUEUE_RECEIVE_FROM_ISR_FAILED 1140 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \ 1141 trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue); 1142 1143 #undef traceQUEUE_REGISTRY_ADD 1144 #define traceQUEUE_REGISTRY_ADD(object, name) prvTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, object), TRACE_GET_OBJECT_NUMBER(QUEUE, object), name); 1145 1146 /* Called in vTaskPrioritySet */ 1147 #undef traceTASK_PRIORITY_SET 1148 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \ 1149 trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_SET, pxTask, uxNewPriority); 1150 1151 /* Called in vTaskPriorityInherit, which is called by Mutex operations */ 1152 #undef traceTASK_PRIORITY_INHERIT 1153 #define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \ 1154 trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_INHERIT, pxTask, uxNewPriority); 1155 1156 /* Called in vTaskPriorityDisinherit, which is called by Mutex operations */ 1157 #undef traceTASK_PRIORITY_DISINHERIT 1158 #define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \ 1159 trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_DISINHERIT, pxTask, uxNewPriority); 1160 1161 /* Called in vTaskResume */ 1162 #undef traceTASK_RESUME 1163 #define traceTASK_RESUME( pxTaskToResume ) \ 1164 trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME, pxTaskToResume); 1165 1166 /* Called in vTaskResumeFromISR */ 1167 #undef traceTASK_RESUME_FROM_ISR 1168 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \ 1169 trcKERNEL_HOOKS_TASK_RESUME_FROM_ISR(TASK_RESUME_FROM_ISR, pxTaskToResume); 1170 1171 1172 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) 1173 1174 #if (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) 1175 1176 extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t size); 1177 1178 /* MALLOC and FREE are always stored, no matter if they happen inside filtered task */ 1179 #undef traceMALLOC 1180 #define traceMALLOC( pvAddress, uiSize ) \ 1181 if (pvAddress != 0) \ 1182 { \ 1183 vTraceStoreMemMangEvent(MEM_MALLOC_SIZE, ( uint32_t ) pvAddress, (int32_t)uiSize); \ 1184 } \ 1185 else \ 1186 { \ 1187 vTraceStoreMemMangEvent(MEM_MALLOC_SIZE_TRCFAILED, ( uint32_t ) pvAddress, (int32_t)uiSize); \ 1188 } 1189 1190 #undef traceFREE 1191 #define traceFREE( pvAddress, uiSize ) \ 1192 vTraceStoreMemMangEvent(MEM_FREE_SIZE, ( uint32_t ) pvAddress, -((int32_t)uiSize)); 1193 1194 #endif /* (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) */ 1195 1196 #if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1) 1197 1198 /* Called in timer.c - xTimerCreate */ 1199 #undef traceTIMER_CREATE 1200 #define traceTIMER_CREATE(tmr) \ 1201 trcKERNEL_HOOKS_OBJECT_CREATE(TIMER_CREATE, TIMER, tmr); 1202 1203 #undef traceTIMER_CREATE_FAILED 1204 #define traceTIMER_CREATE_FAILED() \ 1205 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TIMER_CREATE_TRCFAILED, 0); 1206 1207 /* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */ 1208 #undef traceTIMER_COMMAND_SEND 1209 #define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \ 1210 if (xCommandID > tmrCOMMAND_START_DONT_TRACE) \ 1211 { \ 1212 if (xCommandID == tmrCOMMAND_CHANGE_PERIOD) \ 1213 { \ 1214 if (xReturn == pdPASS) { \ 1215 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TIMER_CHANGE_PERIOD, TIMER, tmr, xOptionalValue); \ 1216 } \ 1217 else \ 1218 { \ 1219 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TIMER_CHANGE_PERIOD_TRCFAILED, TIMER, tmr, xOptionalValue); \ 1220 } \ 1221 } \ 1222 else if ((xCommandID == tmrCOMMAND_DELETE) && (xReturn == pdPASS)) \ 1223 { \ 1224 trcKERNEL_HOOKS_OBJECT_DELETE(TIMER_DELETE_OBJ, EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr), EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr), TIMER, tmr); \ 1225 } \ 1226 else \ 1227 { \ 1228 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENTGROUP_TIMER + (uint32_t)xCommandID + ((xReturn == pdPASS) ? 0 : (TIMER_CREATE_TRCFAILED - TIMER_CREATE)), TIMER, tmr, xOptionalValue); \ 1229 }\ 1230 } 1231 1232 #undef traceTIMER_EXPIRED 1233 #define traceTIMER_EXPIRED(tmr) \ 1234 trcKERNEL_HOOKS_KERNEL_SERVICE(TIMER_EXPIRED, TIMER, tmr); 1235 1236 #endif /* (TRC_CFG_INCLUDE_TIMER_EVENTS == 1) */ 1237 1238 #if (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1) 1239 1240 #undef tracePEND_FUNC_CALL 1241 #define tracePEND_FUNC_CALL(func, arg1, arg2, ret) \ 1242 if (ret == pdPASS){ \ 1243 trcKERNEL_HOOKS_KERNEL_SERVICE(PEND_FUNC_CALL, TASK, xTimerGetTimerDaemonTaskHandle() ); \ 1244 } \ 1245 else \ 1246 { \ 1247 trcKERNEL_HOOKS_KERNEL_SERVICE(PEND_FUNC_CALL_TRCFAILED, TASK, xTimerGetTimerDaemonTaskHandle() ); \ 1248 } 1249 1250 #undef tracePEND_FUNC_CALL_FROM_ISR 1251 #define tracePEND_FUNC_CALL_FROM_ISR(func, arg1, arg2, ret) \ 1252 if (! uiInEventGroupSetBitsFromISR) \ 1253 prvTraceStoreKernelCall(PEND_FUNC_CALL_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTimerGetTimerDaemonTaskHandle()) ); \ 1254 uiInEventGroupSetBitsFromISR = 0; 1255 1256 #endif /* (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1) */ 1257 1258 #endif /* (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) */ 1259 1260 #if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) 1261 1262 #undef traceEVENT_GROUP_CREATE 1263 #define traceEVENT_GROUP_CREATE(eg) \ 1264 trcKERNEL_HOOKS_OBJECT_CREATE(EVENT_GROUP_CREATE, EVENTGROUP, eg); 1265 1266 #undef traceEVENT_GROUP_CREATE_FAILED 1267 #define traceEVENT_GROUP_CREATE_FAILED() \ 1268 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(EVENT_GROUP_CREATE_TRCFAILED, 0); 1269 1270 #undef traceEVENT_GROUP_DELETE 1271 #define traceEVENT_GROUP_DELETE(eg) \ 1272 { TRACE_ALLOC_CRITICAL_SECTION(); \ 1273 TRACE_ENTER_CRITICAL_SECTION(); \ 1274 trcKERNEL_HOOKS_OBJECT_DELETE(EVENT_GROUP_DELETE_OBJ, EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg), EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg), EVENTGROUP, eg); \ 1275 TRACE_EXIT_CRITICAL_SECTION(); } 1276 1277 #undef traceEVENT_GROUP_SYNC_BLOCK 1278 #define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \ 1279 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_SYNC_TRCBLOCK, EVENTGROUP, eg, bitsToWaitFor); 1280 1281 #undef traceEVENT_GROUP_SYNC_END 1282 #define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \ 1283 if (wasTimeout) \ 1284 { \ 1285 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_SYNC_END_TRCFAILED, EVENTGROUP, eg, bitsToWaitFor); \ 1286 } \ 1287 else \ 1288 { \ 1289 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_SYNC_END, EVENTGROUP, eg, bitsToWaitFor); \ 1290 } 1291 1292 #undef traceEVENT_GROUP_WAIT_BITS_BLOCK 1293 #define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \ 1294 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_WAIT_BITS_TRCBLOCK, EVENTGROUP, eg, bitsToWaitFor); \ 1295 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 1296 1297 #undef traceEVENT_GROUP_WAIT_BITS_END 1298 #define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \ 1299 if (wasTimeout) \ 1300 { \ 1301 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_WAIT_BITS_END_TRCFAILED, EVENTGROUP, eg, bitsToWaitFor); \ 1302 } \ 1303 else \ 1304 { \ 1305 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_WAIT_BITS_END, EVENTGROUP, eg, bitsToWaitFor); \ 1306 } 1307 1308 #undef traceEVENT_GROUP_CLEAR_BITS 1309 #define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \ 1310 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_CLEAR_BITS, EVENTGROUP, eg, bitsToClear); 1311 1312 #undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR 1313 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \ 1314 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM_FROM_ISR(EVENT_GROUP_CLEAR_BITS_FROM_ISR, EVENTGROUP, eg, bitsToClear); 1315 1316 #undef traceEVENT_GROUP_SET_BITS 1317 #define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \ 1318 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(EVENT_GROUP_SET_BITS, EVENTGROUP, eg, bitsToSet); 1319 1320 #undef traceEVENT_GROUP_SET_BITS_FROM_ISR 1321 #define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \ 1322 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM_FROM_ISR(EVENT_GROUP_SET_BITS_FROM_ISR, EVENTGROUP, eg, bitsToSet); \ 1323 uiInEventGroupSetBitsFromISR = 1; 1324 1325 #endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */ 1326 1327 #undef traceTASK_NOTIFY_TAKE 1328 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) 1329 #define traceTASK_NOTIFY_TAKE() \ 1330 if (pxCurrentTCB->eNotifyState == eNotified){ \ 1331 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE, TASK, pxCurrentTCB, xTicksToWait); \ 1332 } \ 1333 else{ \ 1334 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE_TRCFAILED, TASK, pxCurrentTCB, xTicksToWait); \ 1335 } 1336 #elif (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0) 1337 #define traceTASK_NOTIFY_TAKE() \ 1338 if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED){ \ 1339 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE, TASK, pxCurrentTCB, xTicksToWait); \ 1340 }else{ \ 1341 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE_TRCFAILED, TASK, pxCurrentTCB, xTicksToWait);} 1342 #else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */ 1343 #define traceTASK_NOTIFY_TAKE(index) \ 1344 if (pxCurrentTCB->ucNotifyState[index] == taskNOTIFICATION_RECEIVED){ \ 1345 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE, TASK, pxCurrentTCB, xTicksToWait); \ 1346 }else{ \ 1347 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE_TRCFAILED, TASK, pxCurrentTCB, xTicksToWait);} 1348 #endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */ 1349 1350 #undef traceTASK_NOTIFY_TAKE_BLOCK 1351 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0) 1352 #define traceTASK_NOTIFY_TAKE_BLOCK() \ 1353 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE_TRCBLOCK, TASK, pxCurrentTCB, xTicksToWait); \ 1354 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 1355 #else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1356 #define traceTASK_NOTIFY_TAKE_BLOCK(index) \ 1357 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_TAKE_TRCBLOCK, TASK, pxCurrentTCB, xTicksToWait); \ 1358 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 1359 #endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1360 1361 #undef traceTASK_NOTIFY_WAIT 1362 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) 1363 #define traceTASK_NOTIFY_WAIT() \ 1364 if (TRACE_GET_OBJECT_FILTER(TASK, pxCurrentTCB) & CurrentFilterMask) \ 1365 { \ 1366 if (pxCurrentTCB->eNotifyState == eNotified) \ 1367 prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ 1368 else \ 1369 prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCFAILED, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ 1370 } 1371 #elif (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0) 1372 #define traceTASK_NOTIFY_WAIT() \ 1373 if (TRACE_GET_OBJECT_FILTER(TASK, pxCurrentTCB) & CurrentFilterMask) \ 1374 { \ 1375 if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \ 1376 prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ 1377 else \ 1378 prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCFAILED, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ 1379 } 1380 #else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */ 1381 #define traceTASK_NOTIFY_WAIT(index) \ 1382 if (TRACE_GET_OBJECT_FILTER(TASK, pxCurrentTCB) & CurrentFilterMask) \ 1383 { \ 1384 if (pxCurrentTCB->ucNotifyState[index] == taskNOTIFICATION_RECEIVED) \ 1385 prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ 1386 else \ 1387 prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCFAILED, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ 1388 } 1389 #endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0 */ 1390 1391 #undef traceTASK_NOTIFY_WAIT_BLOCK 1392 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0) 1393 #define traceTASK_NOTIFY_WAIT_BLOCK() \ 1394 if (TRACE_GET_OBJECT_FILTER(TASK, pxCurrentTCB) & CurrentFilterMask) \ 1395 prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCBLOCK, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ 1396 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 1397 #else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1398 #define traceTASK_NOTIFY_WAIT_BLOCK(index) \ 1399 if (TRACE_GET_OBJECT_FILTER(TASK, pxCurrentTCB) & CurrentFilterMask) \ 1400 prvTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_TRCBLOCK, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(pxCurrentTCB), xTicksToWait); \ 1401 trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); 1402 #endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1403 1404 #undef traceTASK_NOTIFY 1405 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0) 1406 #define traceTASK_NOTIFY() \ 1407 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1408 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 1409 prvTraceStoreKernelCall(TRACE_TASK_NOTIFY, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); 1410 #else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1411 #define traceTASK_NOTIFY(index) \ 1412 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1413 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 1414 prvTraceStoreKernelCall(TRACE_TASK_NOTIFY, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); 1415 #endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1416 1417 #undef traceTASK_NOTIFY_FROM_ISR 1418 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0) 1419 #define traceTASK_NOTIFY_FROM_ISR() \ 1420 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 1421 prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); 1422 #else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1423 #define traceTASK_NOTIFY_FROM_ISR(index) \ 1424 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 1425 prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); 1426 #endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1427 1428 #undef traceTASK_NOTIFY_GIVE_FROM_ISR 1429 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0) 1430 #define traceTASK_NOTIFY_GIVE_FROM_ISR() \ 1431 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 1432 prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_GIVE_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); 1433 #else /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1434 #define traceTASK_NOTIFY_GIVE_FROM_ISR(index) \ 1435 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 1436 prvTraceStoreKernelCall(TRACE_TASK_NOTIFY_GIVE_FROM_ISR, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(xTaskToNotify)); 1437 #endif /* TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_10_4_0 */ 1438 1439 #if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) 1440 1441 #undef traceSTREAM_BUFFER_CREATE 1442 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ) \ 1443 trcKERNEL_HOOKS_OBJECT_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, STREAMBUFFER, pxStreamBuffer), STREAMBUFFER, pxStreamBuffer); 1444 1445 #undef traceSTREAM_BUFFER_CREATE_FAILED 1446 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) \ 1447 trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_NUMERIC_PARAM_ONLY(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, STREAMBUFFER, xIsMessageBuffer), 0); 1448 1449 #undef traceSTREAM_BUFFER_CREATE_STATIC_FAILED 1450 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer ) \ 1451 traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) 1452 1453 #undef traceSTREAM_BUFFER_DELETE 1454 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) \ 1455 trcKERNEL_HOOKS_OBJECT_DELETE(TRACE_GET_OBJECT_EVENT_CODE(DELETE_OBJ, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_NAME, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_PROP, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); 1456 1457 #undef traceSTREAM_BUFFER_RESET 1458 #define traceSTREAM_BUFFER_RESET( xStreamBuffer ) \ 1459 trcKERNEL_HOOKS_KERNEL_SERVICE(prvGetStreamBufferType(xStreamBuffer) > 0 ? TRACE_MESSAGEBUFFER_RESET : TRACE_STREAMBUFFER_RESET, STREAMBUFFER, xStreamBuffer); \ 1460 trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, 0); 1461 1462 #undef traceSTREAM_BUFFER_SEND 1463 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xReturn ) \ 1464 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \ 1465 trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); 1466 1467 #undef traceBLOCKING_ON_STREAM_BUFFER_SEND 1468 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer ) \ 1469 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCBLOCK, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); 1470 1471 #undef traceSTREAM_BUFFER_SEND_FAILED 1472 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ) \ 1473 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCFAILED, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); 1474 1475 #undef traceSTREAM_BUFFER_RECEIVE 1476 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength ) \ 1477 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \ 1478 trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); 1479 1480 1481 #undef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE 1482 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer ) \ 1483 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCBLOCK, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); 1484 1485 #undef traceSTREAM_BUFFER_RECEIVE_FAILED 1486 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer ) \ 1487 trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCFAILED, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); 1488 1489 #undef traceSTREAM_BUFFER_SEND_FROM_ISR 1490 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xReturn ) \ 1491 if( xReturn > ( size_t ) 0 ) \ 1492 { \ 1493 trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(SEND_FROM_ISR, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \ 1494 trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \ 1495 } \ 1496 else \ 1497 { \ 1498 trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(SEND_FROM_ISR, TRCFAILED, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \ 1499 } 1500 1501 #undef traceSTREAM_BUFFER_RECEIVE_FROM_ISR 1502 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ) \ 1503 if( xReceivedLength > ( size_t ) 0 ) \ 1504 { \ 1505 trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCSUCCESS, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \ 1506 trcKERNEL_HOOKS_SET_OBJECT_STATE(STREAMBUFFER, xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \ 1507 } \ 1508 else \ 1509 { \ 1510 trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCFAILED, STREAMBUFFER, xStreamBuffer), STREAMBUFFER, xStreamBuffer); \ 1511 } 1512 1513 #endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */ 1514 1515 #endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */ 1516 1517 #endif /*#if TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT */ 1518 1519 /******************************************************************************/ 1520 /*** Definitions for Streaming mode *******************************************/ 1521 /******************************************************************************/ 1522 #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) 1523 1524 /******************************************************************************* 1525 * vTraceStoreKernelObjectName 1526 * 1527 * Set the name for a kernel object (defined by its address). 1528 ******************************************************************************/ 1529 void vTraceStoreKernelObjectName(void* object, const char* name); 1530 1531 #define TRACE_GET_CURRENT_TASK() prvTraceGetCurrentTaskHandle() 1532 1533 /*************************************************************************/ 1534 /* KERNEL SPECIFIC OBJECT CONFIGURATION */ 1535 /*************************************************************************/ 1536 1537 /******************************************************************************* 1538 * The event codes - should match the offline config file. 1539 ******************************************************************************/ 1540 1541 /*** Event codes for streaming - should match the Tracealyzer config file *****/ 1542 #define PSF_EVENT_NULL_EVENT 0x00 1543 1544 #define PSF_EVENT_TRACE_START 0x01 1545 #define PSF_EVENT_TS_CONFIG 0x02 1546 #define PSF_EVENT_OBJ_NAME 0x03 1547 #define PSF_EVENT_TASK_PRIORITY 0x04 1548 #define PSF_EVENT_TASK_PRIO_INHERIT 0x05 1549 #define PSF_EVENT_TASK_PRIO_DISINHERIT 0x06 1550 #define PSF_EVENT_DEFINE_ISR 0x07 1551 1552 #define PSF_EVENT_TASK_CREATE 0x10 1553 #define PSF_EVENT_QUEUE_CREATE 0x11 1554 #define PSF_EVENT_SEMAPHORE_BINARY_CREATE 0x12 1555 #define PSF_EVENT_MUTEX_CREATE 0x13 1556 #define PSF_EVENT_TIMER_CREATE 0x14 1557 #define PSF_EVENT_EVENTGROUP_CREATE 0x15 1558 #define PSF_EVENT_SEMAPHORE_COUNTING_CREATE 0x16 1559 #define PSF_EVENT_MUTEX_RECURSIVE_CREATE 0x17 1560 #define PSF_EVENT_STREAMBUFFER_CREATE 0x18 1561 #define PSF_EVENT_MESSAGEBUFFER_CREATE 0x19 1562 1563 #define PSF_EVENT_TASK_DELETE 0x20 1564 #define PSF_EVENT_QUEUE_DELETE 0x21 1565 #define PSF_EVENT_SEMAPHORE_DELETE 0x22 1566 #define PSF_EVENT_MUTEX_DELETE 0x23 1567 #define PSF_EVENT_TIMER_DELETE 0x24 1568 #define PSF_EVENT_EVENTGROUP_DELETE 0x25 1569 #define PSF_EVENT_STREAMBUFFER_DELETE 0x28 1570 #define PSF_EVENT_MESSAGEBUFFER_DELETE 0x29 1571 1572 #define PSF_EVENT_TASK_READY 0x30 1573 #define PSF_EVENT_NEW_TIME 0x31 1574 #define PSF_EVENT_NEW_TIME_SCHEDULER_SUSPENDED 0x32 1575 #define PSF_EVENT_ISR_BEGIN 0x33 1576 #define PSF_EVENT_ISR_RESUME 0x34 1577 #define PSF_EVENT_TS_BEGIN 0x35 1578 #define PSF_EVENT_TS_RESUME 0x36 1579 #define PSF_EVENT_TASK_ACTIVATE 0x37 1580 1581 #define PSF_EVENT_MALLOC 0x38 1582 #define PSF_EVENT_FREE 0x39 1583 1584 #define PSF_EVENT_LOWPOWER_BEGIN 0x3A 1585 #define PSF_EVENT_LOWPOWER_END 0x3B 1586 1587 #define PSF_EVENT_IFE_NEXT 0x3C 1588 #define PSF_EVENT_IFE_DIRECT 0x3D 1589 1590 #define PSF_EVENT_TASK_CREATE_FAILED 0x40 1591 #define PSF_EVENT_QUEUE_CREATE_FAILED 0x41 1592 #define PSF_EVENT_SEMAPHORE_BINARY_CREATE_FAILED 0x42 1593 #define PSF_EVENT_MUTEX_CREATE_FAILED 0x43 1594 #define PSF_EVENT_TIMER_CREATE_FAILED 0x44 1595 #define PSF_EVENT_EVENTGROUP_CREATE_FAILED 0x45 1596 #define PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED 0x46 1597 #define PSF_EVENT_MUTEX_RECURSIVE_CREATE_FAILED 0x47 1598 #define PSF_EVENT_STREAMBUFFER_CREATE_FAILED 0x49 1599 #define PSF_EVENT_MESSAGEBUFFER_CREATE_FAILED 0x4A 1600 1601 #define PSF_EVENT_TIMER_DELETE_FAILED 0x48 1602 1603 #define PSF_EVENT_QUEUE_SEND 0x50 1604 #define PSF_EVENT_SEMAPHORE_GIVE 0x51 1605 #define PSF_EVENT_MUTEX_GIVE 0x52 1606 1607 #define PSF_EVENT_QUEUE_SEND_FAILED 0x53 1608 #define PSF_EVENT_SEMAPHORE_GIVE_FAILED 0x54 1609 #define PSF_EVENT_MUTEX_GIVE_FAILED 0x55 1610 1611 #define PSF_EVENT_QUEUE_SEND_BLOCK 0x56 1612 #define PSF_EVENT_SEMAPHORE_GIVE_BLOCK 0x57 1613 #define PSF_EVENT_MUTEX_GIVE_BLOCK 0x58 1614 1615 #define PSF_EVENT_QUEUE_SEND_FROMISR 0x59 1616 #define PSF_EVENT_SEMAPHORE_GIVE_FROMISR 0x5A 1617 1618 #define PSF_EVENT_QUEUE_SEND_FROMISR_FAILED 0x5C 1619 #define PSF_EVENT_SEMAPHORE_GIVE_FROMISR_FAILED 0x5D 1620 1621 #define PSF_EVENT_QUEUE_RECEIVE 0x60 1622 #define PSF_EVENT_SEMAPHORE_TAKE 0x61 1623 #define PSF_EVENT_MUTEX_TAKE 0x62 1624 1625 #define PSF_EVENT_QUEUE_RECEIVE_FAILED 0x63 1626 #define PSF_EVENT_SEMAPHORE_TAKE_FAILED 0x64 1627 #define PSF_EVENT_MUTEX_TAKE_FAILED 0x65 1628 1629 #define PSF_EVENT_QUEUE_RECEIVE_BLOCK 0x66 1630 #define PSF_EVENT_SEMAPHORE_TAKE_BLOCK 0x67 1631 #define PSF_EVENT_MUTEX_TAKE_BLOCK 0x68 1632 1633 #define PSF_EVENT_QUEUE_RECEIVE_FROMISR 0x69 1634 #define PSF_EVENT_SEMAPHORE_TAKE_FROMISR 0x6A 1635 1636 #define PSF_EVENT_QUEUE_RECEIVE_FROMISR_FAILED 0x6C 1637 #define PSF_EVENT_SEMAPHORE_TAKE_FROMISR_FAILED 0x6D 1638 1639 #define PSF_EVENT_QUEUE_PEEK 0x70 1640 #define PSF_EVENT_SEMAPHORE_PEEK 0x71 1641 #define PSF_EVENT_MUTEX_PEEK 0x72 1642 1643 #define PSF_EVENT_QUEUE_PEEK_FAILED 0x73 1644 #define PSF_EVENT_SEMAPHORE_PEEK_FAILED 0x74 1645 #define PSF_EVENT_MUTEX_PEEK_FAILED 0x75 1646 1647 #define PSF_EVENT_QUEUE_PEEK_BLOCK 0x76 1648 #define PSF_EVENT_SEMAPHORE_PEEK_BLOCK 0x77 1649 #define PSF_EVENT_MUTEX_PEEK_BLOCK 0x78 1650 1651 #define PSF_EVENT_TASK_DELAY_UNTIL 0x79 1652 #define PSF_EVENT_TASK_DELAY 0x7A 1653 #define PSF_EVENT_TASK_SUSPEND 0x7B 1654 #define PSF_EVENT_TASK_RESUME 0x7C 1655 #define PSF_EVENT_TASK_RESUME_FROMISR 0x7D 1656 1657 #define PSF_EVENT_TIMER_PENDFUNCCALL 0x80 1658 #define PSF_EVENT_TIMER_PENDFUNCCALL_FROMISR 0x81 1659 #define PSF_EVENT_TIMER_PENDFUNCCALL_FAILED 0x82 1660 #define PSF_EVENT_TIMER_PENDFUNCCALL_FROMISR_FAILED 0x83 1661 1662 #define PSF_EVENT_USER_EVENT 0x90 1663 1664 #define PSF_EVENT_TIMER_START 0xA0 1665 #define PSF_EVENT_TIMER_RESET 0xA1 1666 #define PSF_EVENT_TIMER_STOP 0xA2 1667 #define PSF_EVENT_TIMER_CHANGEPERIOD 0xA3 1668 #define PSF_EVENT_TIMER_START_FROMISR 0xA4 1669 #define PSF_EVENT_TIMER_RESET_FROMISR 0xA5 1670 #define PSF_EVENT_TIMER_STOP_FROMISR 0xA6 1671 #define PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR 0xA7 1672 #define PSF_EVENT_TIMER_START_FAILED 0xA8 1673 #define PSF_EVENT_TIMER_RESET_FAILED 0xA9 1674 #define PSF_EVENT_TIMER_STOP_FAILED 0xAA 1675 #define PSF_EVENT_TIMER_CHANGEPERIOD_FAILED 0xAB 1676 #define PSF_EVENT_TIMER_START_FROMISR_FAILED 0xAC 1677 #define PSF_EVENT_TIMER_RESET_FROMISR_FAILED 0xAD 1678 #define PSF_EVENT_TIMER_STOP_FROMISR_FAILED 0xAE 1679 #define PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR_FAILED 0xAF 1680 1681 #define PSF_EVENT_EVENTGROUP_SYNC 0xB0 1682 #define PSF_EVENT_EVENTGROUP_WAITBITS 0xB1 1683 #define PSF_EVENT_EVENTGROUP_CLEARBITS 0xB2 1684 #define PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR 0xB3 1685 #define PSF_EVENT_EVENTGROUP_SETBITS 0xB4 1686 #define PSF_EVENT_EVENTGROUP_SETBITS_FROMISR 0xB5 1687 #define PSF_EVENT_EVENTGROUP_SYNC_BLOCK 0xB6 1688 #define PSF_EVENT_EVENTGROUP_WAITBITS_BLOCK 0xB7 1689 #define PSF_EVENT_EVENTGROUP_SYNC_FAILED 0xB8 1690 #define PSF_EVENT_EVENTGROUP_WAITBITS_FAILED 0xB9 1691 1692 #define PSF_EVENT_QUEUE_SEND_FRONT 0xC0 1693 #define PSF_EVENT_QUEUE_SEND_FRONT_FAILED 0xC1 1694 #define PSF_EVENT_QUEUE_SEND_FRONT_BLOCK 0xC2 1695 #define PSF_EVENT_QUEUE_SEND_FRONT_FROMISR 0xC3 1696 #define PSF_EVENT_QUEUE_SEND_FRONT_FROMISR_FAILED 0xC4 1697 #define PSF_EVENT_MUTEX_GIVE_RECURSIVE 0xC5 1698 #define PSF_EVENT_MUTEX_GIVE_RECURSIVE_FAILED 0xC6 1699 #define PSF_EVENT_MUTEX_TAKE_RECURSIVE 0xC7 1700 #define PSF_EVENT_MUTEX_TAKE_RECURSIVE_FAILED 0xC8 1701 1702 #define PSF_EVENT_TASK_NOTIFY 0xC9 1703 #define PSF_EVENT_TASK_NOTIFY_TAKE 0xCA 1704 #define PSF_EVENT_TASK_NOTIFY_TAKE_BLOCK 0xCB 1705 #define PSF_EVENT_TASK_NOTIFY_TAKE_FAILED 0xCC 1706 #define PSF_EVENT_TASK_NOTIFY_WAIT 0xCD 1707 #define PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK 0xCE 1708 #define PSF_EVENT_TASK_NOTIFY_WAIT_FAILED 0xCF 1709 #define PSF_EVENT_TASK_NOTIFY_FROM_ISR 0xD0 1710 #define PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR 0xD1 1711 1712 #define PSF_EVENT_TIMER_EXPIRED 0xD2 1713 1714 #define PSF_EVENT_STREAMBUFFER_SEND 0xD3 1715 #define PSF_EVENT_STREAMBUFFER_SEND_BLOCK 0xD4 1716 #define PSF_EVENT_STREAMBUFFER_SEND_FAILED 0xD5 1717 #define PSF_EVENT_STREAMBUFFER_RECEIVE 0xD6 1718 #define PSF_EVENT_STREAMBUFFER_RECEIVE_BLOCK 0xD7 1719 #define PSF_EVENT_STREAMBUFFER_RECEIVE_FAILED 0xD8 1720 #define PSF_EVENT_STREAMBUFFER_SEND_FROM_ISR 0xD9 1721 #define PSF_EVENT_STREAMBUFFER_SEND_FROM_ISR_FAILED 0xDA 1722 #define PSF_EVENT_STREAMBUFFER_RECEIVE_FROM_ISR 0xDB 1723 #define PSF_EVENT_STREAMBUFFER_RECEIVE_FROM_ISR_FAILED 0xDC 1724 #define PSF_EVENT_STREAMBUFFER_RESET 0xDD 1725 1726 #define PSF_EVENT_MESSAGEBUFFER_SEND 0xDE 1727 #define PSF_EVENT_MESSAGEBUFFER_SEND_BLOCK 0xDF 1728 #define PSF_EVENT_MESSAGEBUFFER_SEND_FAILED 0xE0 1729 #define PSF_EVENT_MESSAGEBUFFER_RECEIVE 0xE1 1730 #define PSF_EVENT_MESSAGEBUFFER_RECEIVE_BLOCK 0xE2 1731 #define PSF_EVENT_MESSAGEBUFFER_RECEIVE_FAILED 0xE3 1732 #define PSF_EVENT_MESSAGEBUFFER_SEND_FROM_ISR 0xE4 1733 #define PSF_EVENT_MESSAGEBUFFER_SEND_FROM_ISR_FAILED 0xE5 1734 #define PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR 0xE6 1735 #define PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR_FAILED 0xE7 1736 #define PSF_EVENT_MESSAGEBUFFER_RESET 0xE8 1737 1738 #define PSF_EVENT_MALLOC_FAILED 0xE9 1739 1740 #define PSF_EVENT_UNUSED_STACK 0xEA 1741 1742 /*** The trace macros for streaming ******************************************/ 1743 1744 /* A macro that will update the tick count when returning from tickless idle */ 1745 #undef traceINCREASE_TICK_COUNT 1746 /* Note: This can handle time adjustments of max 2^32 ticks, i.e., 35 seconds at 120 MHz. Thus, tick-less idle periods longer than 2^32 ticks will appear "compressed" on the time line.*/ 1747 #define traceINCREASE_TICK_COUNT( xCount ) { extern uint32_t uiTraceTickCount; uiTraceTickCount += xCount; } 1748 1749 #if (TRC_CFG_INCLUDE_OSTICK_EVENTS == 1) 1750 #define OS_TICK_EVENT(uxSchedulerSuspended, xTickCount) if (uxSchedulerSuspended == (unsigned portBASE_TYPE) pdFALSE) { prvTraceStoreEvent1(PSF_EVENT_NEW_TIME, (uint32_t)(xTickCount + 1)); } 1751 #else 1752 #define OS_TICK_EVENT(uxSchedulerSuspended, xTickCount) 1753 #endif 1754 1755 /* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */ 1756 #undef traceTASK_INCREMENT_TICK 1757 #if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_3_0 1758 1759 #define traceTASK_INCREMENT_TICK( xTickCount ) \ 1760 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || xPendedTicks == 0) { extern uint32_t uiTraceTickCount; uiTraceTickCount++; } \ 1761 OS_TICK_EVENT(uxSchedulerSuspended, xTickCount) 1762 1763 #elif TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_X 1764 1765 #define traceTASK_INCREMENT_TICK( xTickCount ) \ 1766 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxPendedTicks == 0) { extern uint32_t uiTraceTickCount; uiTraceTickCount++; } \ 1767 OS_TICK_EVENT(uxSchedulerSuspended, xTickCount) 1768 1769 #else 1770 1771 #define traceTASK_INCREMENT_TICK( xTickCount ) \ 1772 if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxMissedTicks == 0) { extern uint32_t uiTraceTickCount; uiTraceTickCount++; } \ 1773 OS_TICK_EVENT(uxSchedulerSuspended, xTickCount) 1774 1775 #endif 1776 1777 extern volatile uint32_t uiTraceSystemState; 1778 1779 /* Called on each task-switch */ 1780 #undef traceTASK_SWITCHED_IN 1781 #define traceTASK_SWITCHED_IN() \ 1782 uiTraceSystemState = TRC_STATE_IN_TASKSWITCH; \ 1783 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1784 { \ 1785 if (prvTraceGetCurrentTask() != (uint32_t)pxCurrentTCB) \ 1786 { \ 1787 prvTraceSetCurrentTask((uint32_t)pxCurrentTCB); \ 1788 prvTraceStoreEvent2(PSF_EVENT_TASK_ACTIVATE, (uint32_t)pxCurrentTCB, pxCurrentTCB->uxPriority); \ 1789 } \ 1790 } \ 1791 uiTraceSystemState = TRC_STATE_IN_APPLICATION; 1792 1793 /* Called for each task that becomes ready */ 1794 #if (TRC_CFG_INCLUDE_READY_EVENTS == 1) 1795 #undef traceMOVED_TASK_TO_READY_STATE 1796 #define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \ 1797 if (TRACE_GET_OBJECT_FILTER(TASK, pxTCB) & CurrentFilterMask) \ 1798 prvTraceStoreEvent1(PSF_EVENT_TASK_READY, (uint32_t)pxTCB); 1799 #endif 1800 1801 #undef traceTASK_CREATE 1802 #if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 1803 #define traceTASK_CREATE(pxNewTCB) \ 1804 if (pxNewTCB != NULL) \ 1805 { \ 1806 prvAddTaskToStackMonitor(pxNewTCB); \ 1807 prvTraceSaveObjectSymbol(pxNewTCB, pxNewTCB->pcTaskName); \ 1808 prvTraceSaveObjectData(pxNewTCB, pxNewTCB->uxPriority); \ 1809 prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, pxNewTCB->pcTaskName, pxNewTCB); \ 1810 TRACE_SET_OBJECT_FILTER(TASK, pxNewTCB, CurrentFilterGroup); \ 1811 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1812 if (TRACE_GET_OBJECT_FILTER(TASK, pxNewTCB) & CurrentFilterMask) \ 1813 prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, pxNewTCB->uxPriority); \ 1814 } 1815 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ 1816 #define traceTASK_CREATE(pxNewTCB) \ 1817 if (pxNewTCB != NULL) \ 1818 { \ 1819 prvAddTaskToStackMonitor(pxNewTCB); \ 1820 prvTraceSaveObjectSymbol(pxNewTCB, (const char*)pcName); \ 1821 prvTraceSaveObjectData(pxNewTCB, uxPriority); \ 1822 prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, (const char*)pcName, pxNewTCB); \ 1823 TRACE_SET_OBJECT_FILTER(TASK, pxNewTCB, CurrentFilterGroup); \ 1824 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1825 if (TRACE_GET_OBJECT_FILTER(TASK, pxNewTCB) & CurrentFilterMask) \ 1826 prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, uxPriority); \ 1827 } 1828 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ 1829 1830 /* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */ 1831 #undef traceTASK_CREATE_FAILED 1832 #define traceTASK_CREATE_FAILED() \ 1833 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1834 prvTraceStoreEvent0(PSF_EVENT_TASK_CREATE_FAILED); 1835 1836 /* Called on vTaskDelete */ 1837 #undef traceTASK_DELETE // We don't allow for filtering out "delete" events. They are important and not very frequent. Moreover, we can't exclude create events, so this should be symmetrical. 1838 #define traceTASK_DELETE( pxTaskToDelete ) \ 1839 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1840 if (TRACE_GET_OBJECT_FILTER(TASK, pxTaskToDelete) & CurrentFilterMask) \ 1841 prvTraceStoreEvent2(PSF_EVENT_TASK_DELETE, (uint32_t)pxTaskToDelete, (pxTaskToDelete != NULL) ? (pxTaskToDelete->uxPriority) : 0); \ 1842 prvTraceDeleteSymbol(pxTaskToDelete); \ 1843 prvTraceDeleteObjectData(pxTaskToDelete); \ 1844 prvRemoveTaskFromStackMonitor(pxTaskToDelete); 1845 1846 #if (TRC_CFG_SCHEDULING_ONLY == 0) 1847 1848 #if (defined(configUSE_TICKLESS_IDLE) && configUSE_TICKLESS_IDLE != 0) 1849 1850 #undef traceLOW_POWER_IDLE_BEGIN 1851 #define traceLOW_POWER_IDLE_BEGIN() \ 1852 { \ 1853 prvTraceStoreEvent1(PSF_EVENT_LOWPOWER_BEGIN, xExpectedIdleTime); \ 1854 } 1855 1856 #undef traceLOW_POWER_IDLE_END 1857 #define traceLOW_POWER_IDLE_END() \ 1858 { \ 1859 prvTraceStoreEvent0(PSF_EVENT_LOWPOWER_END); \ 1860 } 1861 1862 #endif /* (defined(configUSE_TICKLESS_IDLE) && configUSE_TICKLESS_IDLE != 0) */ 1863 1864 /* Called on vTaskSuspend */ 1865 #undef traceTASK_SUSPEND 1866 #define traceTASK_SUSPEND( pxTaskToSuspend ) \ 1867 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1868 if (TRACE_GET_OBJECT_FILTER(TASK, pxTaskToSuspend) & CurrentFilterMask) \ 1869 prvTraceStoreEvent1(PSF_EVENT_TASK_SUSPEND, (uint32_t)pxTaskToSuspend); 1870 1871 /* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */ 1872 #undef traceTASK_DELAY 1873 #define traceTASK_DELAY() \ 1874 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1875 prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY, xTicksToDelay); 1876 1877 /* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */ 1878 #undef traceTASK_DELAY_UNTIL 1879 #if TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 1880 #define traceTASK_DELAY_UNTIL(xTimeToWake) \ 1881 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1882 prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, (uint32_t)xTimeToWake); 1883 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ 1884 #define traceTASK_DELAY_UNTIL() \ 1885 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1886 prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, (uint32_t)xTimeToWake); 1887 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0 */ 1888 1889 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0) 1890 #define traceQUEUE_CREATE_HELPER() \ 1891 case queueQUEUE_TYPE_MUTEX: \ 1892 prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE, (uint32_t)pxNewQueue); \ 1893 break; \ 1894 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 1895 prvTraceStoreEvent1(PSF_EVENT_MUTEX_RECURSIVE_CREATE, (uint32_t)pxNewQueue); \ 1896 break; 1897 #else 1898 #define traceQUEUE_CREATE_HELPER() 1899 #endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */ 1900 1901 /* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */ 1902 #undef traceQUEUE_CREATE 1903 #define traceQUEUE_CREATE( pxNewQueue )\ 1904 TRACE_SET_OBJECT_FILTER(QUEUE, pxNewQueue, CurrentFilterGroup); \ 1905 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1906 { \ 1907 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxNewQueue) & CurrentFilterMask) \ 1908 { \ 1909 switch (pxNewQueue->ucQueueType) \ 1910 { \ 1911 case queueQUEUE_TYPE_BASE: \ 1912 prvTraceStoreEvent2(PSF_EVENT_QUEUE_CREATE, (uint32_t)pxNewQueue, uxQueueLength); \ 1913 break; \ 1914 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 1915 prvTraceStoreEvent1(PSF_EVENT_SEMAPHORE_BINARY_CREATE, (uint32_t)pxNewQueue); \ 1916 break; \ 1917 traceQUEUE_CREATE_HELPER() \ 1918 } \ 1919 } \ 1920 } 1921 1922 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0) 1923 #define traceQUEUE_CREATE_FAILED_HELPER() \ 1924 case queueQUEUE_TYPE_MUTEX: \ 1925 prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE_FAILED, 0); \ 1926 break; \ 1927 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 1928 prvTraceStoreEvent1(PSF_EVENT_MUTEX_RECURSIVE_CREATE_FAILED, 0); \ 1929 break; 1930 #else 1931 #define traceQUEUE_CREATE_FAILED_HELPER() 1932 #endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */ 1933 1934 /* Called in xQueueCreate, if the queue creation fails */ 1935 #undef traceQUEUE_CREATE_FAILED 1936 #define traceQUEUE_CREATE_FAILED( queueType ) \ 1937 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1938 { \ 1939 switch (queueType) \ 1940 { \ 1941 case queueQUEUE_TYPE_BASE: \ 1942 prvTraceStoreEvent2(PSF_EVENT_QUEUE_CREATE_FAILED, 0, uxQueueLength); \ 1943 break; \ 1944 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 1945 prvTraceStoreEvent1(PSF_EVENT_SEMAPHORE_BINARY_CREATE_FAILED, 0); \ 1946 break; \ 1947 traceQUEUE_CREATE_FAILED_HELPER() \ 1948 } \ 1949 } 1950 1951 #undef traceQUEUE_DELETE // We don't allow for filtering out "delete" events. They are important and not very frequent. Moreover, we can't exclude create events, so this should be symmetrical. 1952 #define traceQUEUE_DELETE( pxQueue ) \ 1953 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1954 { \ 1955 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 1956 { \ 1957 switch (pxQueue->ucQueueType) \ 1958 { \ 1959 case queueQUEUE_TYPE_BASE: \ 1960 prvTraceStoreEvent2(PSF_EVENT_QUEUE_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \ 1961 break; \ 1962 case queueQUEUE_TYPE_MUTEX: \ 1963 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 1964 prvTraceStoreEvent2(PSF_EVENT_MUTEX_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \ 1965 break; \ 1966 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 1967 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 1968 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_DELETE, (uint32_t)pxQueue, (pxQueue != NULL) ? (pxQueue->uxMessagesWaiting) : 0); \ 1969 break; \ 1970 } \ 1971 } \ 1972 } \ 1973 prvTraceDeleteSymbol(pxQueue); 1974 1975 /* Called in xQueueCreateCountingSemaphore, if the queue creation fails */ 1976 #undef traceCREATE_COUNTING_SEMAPHORE 1977 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) 1978 #define traceCREATE_COUNTING_SEMAPHORE() \ 1979 TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \ 1980 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1981 if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \ 1982 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxMaxCount) 1983 #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_X) 1984 #define traceCREATE_COUNTING_SEMAPHORE() \ 1985 TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \ 1986 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1987 if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \ 1988 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxInitialCount); 1989 #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4_X) 1990 #define traceCREATE_COUNTING_SEMAPHORE() \ 1991 TRACE_SET_OBJECT_FILTER(QUEUE, xHandle, CurrentFilterGroup); \ 1992 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1993 if (TRACE_GET_OBJECT_FILTER(QUEUE, xHandle) & CurrentFilterMask) \ 1994 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)xHandle, uxCountValue); 1995 #else 1996 #define traceCREATE_COUNTING_SEMAPHORE() \ 1997 TRACE_SET_OBJECT_FILTER(QUEUE, pxHandle, CurrentFilterGroup); \ 1998 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 1999 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxHandle) & CurrentFilterMask) \ 2000 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE, (uint32_t)pxHandle, uxCountValue); 2001 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X */ 2002 2003 #undef traceCREATE_COUNTING_SEMAPHORE_FAILED 2004 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) 2005 #define traceCREATE_COUNTING_SEMAPHORE_FAILED() \ 2006 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2007 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxMaxCount); 2008 #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_5_X) 2009 #define traceCREATE_COUNTING_SEMAPHORE_FAILED() \ 2010 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2011 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxInitialCount); 2012 #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_7_4_X) 2013 #define traceCREATE_COUNTING_SEMAPHORE_FAILED() \ 2014 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2015 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxCountValue); 2016 #else 2017 #define traceCREATE_COUNTING_SEMAPHORE_FAILED() \ 2018 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2019 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED, 0, uxCountValue); 2020 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X */ 2021 2022 2023 /* This macro is not necessary as of FreeRTOS v9.0.0 */ 2024 #if (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) 2025 /* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */ 2026 #undef traceCREATE_MUTEX 2027 #define traceCREATE_MUTEX( pxNewQueue ) \ 2028 TRACE_SET_OBJECT_FILTER(QUEUE, pxNewQueue, CurrentFilterGroup); \ 2029 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2030 { \ 2031 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxNewQueue) & CurrentFilterMask) \ 2032 { \ 2033 switch (pxNewQueue->ucQueueType) \ 2034 { \ 2035 case queueQUEUE_TYPE_MUTEX: \ 2036 prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE, (uint32_t)pxNewQueue); \ 2037 break; \ 2038 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2039 prvTraceStoreEvent1(PSF_EVENT_MUTEX_RECURSIVE_CREATE, (uint32_t)pxNewQueue); \ 2040 break; \ 2041 } \ 2042 }\ 2043 } 2044 2045 /* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */ 2046 #undef traceCREATE_MUTEX_FAILED 2047 #define traceCREATE_MUTEX_FAILED() \ 2048 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2049 prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE_FAILED, 0); 2050 #endif /* (TRC_CFG_FREERTOS_VERSION < TRC_FREERTOS_VERSION_9_0_0) */ 2051 2052 /* Called when a message is sent to a queue */ /* CS IS NEW ! */ 2053 #undef traceQUEUE_SEND 2054 #define traceQUEUE_SEND( pxQueue ) \ 2055 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2056 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2057 switch (pxQueue->ucQueueType) \ 2058 { \ 2059 case queueQUEUE_TYPE_BASE: \ 2060 prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND : PSF_EVENT_QUEUE_SEND_FRONT, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \ 2061 break; \ 2062 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2063 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2064 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \ 2065 break; \ 2066 case queueQUEUE_TYPE_MUTEX: \ 2067 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2068 prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE, (uint32_t)pxQueue); \ 2069 break; \ 2070 } 2071 2072 #undef traceQUEUE_SET_SEND 2073 #define traceQUEUE_SET_SEND( pxQueue ) \ 2074 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2075 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2076 prvTraceStoreEvent2(PSF_EVENT_QUEUE_SEND, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); 2077 2078 /* Called when a message failed to be sent to a queue (timeout) */ 2079 #undef traceQUEUE_SEND_FAILED 2080 #define traceQUEUE_SEND_FAILED( pxQueue ) \ 2081 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2082 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2083 switch (pxQueue->ucQueueType) \ 2084 { \ 2085 case queueQUEUE_TYPE_BASE: \ 2086 prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FAILED : PSF_EVENT_QUEUE_SEND_FRONT_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \ 2087 break; \ 2088 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2089 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2090 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \ 2091 break; \ 2092 case queueQUEUE_TYPE_MUTEX: \ 2093 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2094 prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE_FAILED, (uint32_t)pxQueue); \ 2095 break; \ 2096 } 2097 2098 /* Called when the task is blocked due to a send operation on a full queue */ 2099 #undef traceBLOCKING_ON_QUEUE_SEND 2100 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \ 2101 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2102 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2103 switch (pxQueue->ucQueueType) \ 2104 { \ 2105 case queueQUEUE_TYPE_BASE: \ 2106 prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_BLOCK : PSF_EVENT_QUEUE_SEND_FRONT_BLOCK, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \ 2107 break; \ 2108 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2109 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2110 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_BLOCK, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \ 2111 break; \ 2112 case queueQUEUE_TYPE_MUTEX: \ 2113 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2114 prvTraceStoreEvent1(PSF_EVENT_MUTEX_GIVE_BLOCK, (uint32_t)pxQueue); \ 2115 break; \ 2116 } 2117 2118 /* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */ 2119 #undef traceQUEUE_SEND_FROM_ISR 2120 #define traceQUEUE_SEND_FROM_ISR( pxQueue ) \ 2121 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2122 switch (pxQueue->ucQueueType) \ 2123 { \ 2124 case queueQUEUE_TYPE_BASE: \ 2125 prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR : PSF_EVENT_QUEUE_SEND_FRONT_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \ 2126 break; \ 2127 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2128 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2129 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting + 1); \ 2130 break; \ 2131 } 2132 2133 /* Called when a message send from interrupt context fails (since the queue was full) */ 2134 #undef traceQUEUE_SEND_FROM_ISR_FAILED 2135 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \ 2136 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2137 switch (pxQueue->ucQueueType) \ 2138 { \ 2139 case queueQUEUE_TYPE_BASE: \ 2140 prvTraceStoreEvent2(xCopyPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR_FAILED : PSF_EVENT_QUEUE_SEND_FRONT_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \ 2141 break; \ 2142 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2143 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2144 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_GIVE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \ 2145 break; \ 2146 } 2147 2148 /* Called when a message is received from a queue */ 2149 #undef traceQUEUE_RECEIVE 2150 #define traceQUEUE_RECEIVE( pxQueue ) \ 2151 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2152 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2153 switch (pxQueue->ucQueueType) \ 2154 { \ 2155 case queueQUEUE_TYPE_BASE: \ 2156 if (isQueueReceiveHookActuallyPeek) \ 2157 prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \ 2158 else\ 2159 prvTraceStoreEvent3(PSF_EVENT_QUEUE_RECEIVE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \ 2160 break; \ 2161 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2162 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2163 if (isQueueReceiveHookActuallyPeek) \ 2164 prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \ 2165 else \ 2166 prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_TAKE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting - 1); \ 2167 break; \ 2168 case queueQUEUE_TYPE_MUTEX: \ 2169 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2170 if (isQueueReceiveHookActuallyPeek) \ 2171 prvTraceStoreEvent2(PSF_EVENT_MUTEX_PEEK, (uint32_t)pxQueue, xTicksToWait); \ 2172 else \ 2173 prvTraceStoreEvent2(PSF_EVENT_MUTEX_TAKE, (uint32_t)pxQueue, xTicksToWait); \ 2174 break; \ 2175 } 2176 2177 /* Called when a receive operation on a queue fails (timeout) */ 2178 #undef traceQUEUE_RECEIVE_FAILED 2179 #define traceQUEUE_RECEIVE_FAILED( pxQueue ) \ 2180 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2181 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2182 switch (pxQueue->ucQueueType) \ 2183 { \ 2184 case queueQUEUE_TYPE_BASE: \ 2185 prvTraceStoreEvent3(isQueueReceiveHookActuallyPeek ? PSF_EVENT_QUEUE_PEEK_FAILED : PSF_EVENT_QUEUE_RECEIVE_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2186 break; \ 2187 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2188 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2189 prvTraceStoreEvent3(isQueueReceiveHookActuallyPeek ? PSF_EVENT_SEMAPHORE_PEEK_FAILED : PSF_EVENT_SEMAPHORE_TAKE_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2190 break; \ 2191 case queueQUEUE_TYPE_MUTEX: \ 2192 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2193 prvTraceStoreEvent2(isQueueReceiveHookActuallyPeek ? PSF_EVENT_MUTEX_PEEK_FAILED : PSF_EVENT_MUTEX_TAKE_FAILED, (uint32_t)pxQueue, xTicksToWait); \ 2194 break; \ 2195 } 2196 2197 /* Called when the task is blocked due to a receive operation on an empty queue */ 2198 #undef traceBLOCKING_ON_QUEUE_RECEIVE 2199 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \ 2200 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2201 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2202 switch (pxQueue->ucQueueType) \ 2203 { \ 2204 case queueQUEUE_TYPE_BASE: \ 2205 prvTraceStoreEvent3(isQueueReceiveHookActuallyPeek ? PSF_EVENT_QUEUE_PEEK_BLOCK : PSF_EVENT_QUEUE_RECEIVE_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2206 break; \ 2207 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2208 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2209 prvTraceStoreEvent3(isQueueReceiveHookActuallyPeek ? PSF_EVENT_SEMAPHORE_PEEK_BLOCK : PSF_EVENT_SEMAPHORE_TAKE_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2210 break; \ 2211 case queueQUEUE_TYPE_MUTEX: \ 2212 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2213 prvTraceStoreEvent2(isQueueReceiveHookActuallyPeek ? PSF_EVENT_MUTEX_PEEK_BLOCK : PSF_EVENT_MUTEX_TAKE_BLOCK, (uint32_t)pxQueue, xTicksToWait); \ 2214 break; \ 2215 } 2216 2217 #if (TRC_CFG_FREERTOS_VERSION > TRC_FREERTOS_VERSION_9_0_1) 2218 /* Called when a peek operation on a queue fails (timeout) */ 2219 #undef traceQUEUE_PEEK_FAILED 2220 #define traceQUEUE_PEEK_FAILED( pxQueue ) \ 2221 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2222 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2223 switch (pxQueue->ucQueueType) \ 2224 { \ 2225 case queueQUEUE_TYPE_BASE: \ 2226 prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2227 break; \ 2228 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2229 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2230 prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2231 break; \ 2232 case queueQUEUE_TYPE_MUTEX: \ 2233 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2234 prvTraceStoreEvent2(PSF_EVENT_MUTEX_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait); \ 2235 break; \ 2236 } 2237 2238 /* Called when the task is blocked due to a peek operation on an empty queue */ 2239 #undef traceBLOCKING_ON_QUEUE_PEEK 2240 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue ) \ 2241 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2242 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2243 switch (pxQueue->ucQueueType) \ 2244 { \ 2245 case queueQUEUE_TYPE_BASE: \ 2246 prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2247 break; \ 2248 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2249 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2250 prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2251 break; \ 2252 case queueQUEUE_TYPE_MUTEX: \ 2253 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2254 prvTraceStoreEvent2(PSF_EVENT_MUTEX_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait); \ 2255 break; \ 2256 } 2257 2258 #endif /* (TRC_CFG_FREERTOS_VERSION > TRC_FREERTOS_VERSION_9_0_1) */ 2259 2260 /* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */ 2261 #undef traceQUEUE_RECEIVE_FROM_ISR 2262 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \ 2263 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2264 switch (pxQueue->ucQueueType) \ 2265 { \ 2266 case queueQUEUE_TYPE_BASE: \ 2267 prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting - 1); \ 2268 break; \ 2269 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2270 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2271 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_TAKE_FROMISR, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting - 1); \ 2272 break; \ 2273 } 2274 2275 /* Called when a message receive from interrupt context fails (since the queue was empty) */ 2276 #undef traceQUEUE_RECEIVE_FROM_ISR_FAILED 2277 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \ 2278 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2279 switch (pxQueue->ucQueueType) \ 2280 { \ 2281 case queueQUEUE_TYPE_BASE: \ 2282 prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \ 2283 break; \ 2284 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2285 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2286 prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_TAKE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxMessagesWaiting); \ 2287 break; \ 2288 } 2289 2290 /* Called on xQueuePeek */ 2291 #undef traceQUEUE_PEEK 2292 #define traceQUEUE_PEEK( pxQueue ) \ 2293 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2294 if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \ 2295 switch (pxQueue->ucQueueType) \ 2296 { \ 2297 case queueQUEUE_TYPE_BASE: \ 2298 prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2299 break; \ 2300 case queueQUEUE_TYPE_BINARY_SEMAPHORE: \ 2301 case queueQUEUE_TYPE_COUNTING_SEMAPHORE: \ 2302 prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxMessagesWaiting); \ 2303 break; \ 2304 case queueQUEUE_TYPE_MUTEX: \ 2305 case queueQUEUE_TYPE_RECURSIVE_MUTEX: \ 2306 prvTraceStoreEvent1(PSF_EVENT_MUTEX_PEEK, (uint32_t)pxQueue); \ 2307 break; \ 2308 } 2309 2310 /* Called in vTaskPrioritySet */ 2311 #undef traceTASK_PRIORITY_SET 2312 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \ 2313 prvTraceSaveObjectData(pxTask, uxNewPriority); \ 2314 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2315 if (TRACE_GET_OBJECT_FILTER(TASK, pxTask) & CurrentFilterMask) \ 2316 prvTraceStoreEvent2(PSF_EVENT_TASK_PRIORITY, (uint32_t)pxTask, uxNewPriority); 2317 2318 /* Called in vTaskPriorityInherit, which is called by Mutex operations */ 2319 #undef traceTASK_PRIORITY_INHERIT 2320 #define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \ 2321 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2322 if (TRACE_GET_OBJECT_FILTER(TASK, pxTask) & CurrentFilterMask) \ 2323 prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_INHERIT, (uint32_t)pxTask, uxNewPriority); 2324 2325 /* Called in vTaskPriorityDisinherit, which is called by Mutex operations */ 2326 #undef traceTASK_PRIORITY_DISINHERIT 2327 #define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \ 2328 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2329 if (TRACE_GET_OBJECT_FILTER(TASK, pxTask) & CurrentFilterMask) \ 2330 prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_DISINHERIT, (uint32_t)pxTask, uxNewPriority); 2331 2332 /* Called in vTaskResume */ 2333 #undef traceTASK_RESUME 2334 #define traceTASK_RESUME( pxTaskToResume ) \ 2335 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2336 if (TRACE_GET_OBJECT_FILTER(TASK, pxTaskToResume) & CurrentFilterMask) \ 2337 prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME, (uint32_t)pxTaskToResume); 2338 2339 /* Called in vTaskResumeFromISR */ 2340 #undef traceTASK_RESUME_FROM_ISR 2341 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \ 2342 if (TRACE_GET_OBJECT_FILTER(TASK, pxTaskToResume) & CurrentFilterMask) \ 2343 prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME_FROMISR, (uint32_t)pxTaskToResume); 2344 2345 #if (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) 2346 2347 extern uint32_t trcHeapCounter; 2348 extern uint32_t trcHeapMax; 2349 2350 #undef traceMALLOC 2351 #define traceMALLOC( pvAddress, uiSize ) \ 2352 if (pvAddress != 0) \ 2353 { \ 2354 trcHeapCounter += uiSize; \ 2355 if (trcHeapCounter > trcHeapMax) \ 2356 { \ 2357 trcHeapMax = trcHeapCounter; \ 2358 } \ 2359 } \ 2360 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2361 { \ 2362 if (pvAddress != 0) \ 2363 { \ 2364 prvTraceStoreEvent2(PSF_EVENT_MALLOC, (uint32_t)pvAddress, uiSize); \ 2365 } \ 2366 else \ 2367 { \ 2368 prvTraceStoreEvent2(PSF_EVENT_MALLOC_FAILED, (uint32_t)pvAddress, uiSize); \ 2369 } \ 2370 } 2371 2372 #undef traceFREE 2373 #define traceFREE( pvAddress, uiSize ) \ 2374 trcHeapCounter -= uiSize; \ 2375 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2376 prvTraceStoreEvent2(PSF_EVENT_FREE, (uint32_t)pvAddress, (uint32_t)(0 - uiSize)); /* "0 -" instead of just "-" to get rid of a warning... */ 2377 2378 #endif /* (TRC_CFG_INCLUDE_MEMMANG_EVENTS == 1) */ 2379 2380 #if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1) 2381 2382 /* Called in timer.c - xTimerCreate */ 2383 #undef traceTIMER_CREATE 2384 #define traceTIMER_CREATE(tmr) \ 2385 TRACE_SET_OBJECT_FILTER(TIMER, tmr, CurrentFilterGroup); \ 2386 prvTraceSaveObjectSymbol(tmr, (const char*)tmr->pcTimerName); \ 2387 prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, (const char*)tmr->pcTimerName, tmr); \ 2388 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2389 if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \ 2390 prvTraceStoreEvent2(PSF_EVENT_TIMER_CREATE, (uint32_t)tmr, tmr->xTimerPeriodInTicks); 2391 2392 #undef traceTIMER_CREATE_FAILED 2393 #define traceTIMER_CREATE_FAILED() \ 2394 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2395 prvTraceStoreEvent0(PSF_EVENT_TIMER_CREATE_FAILED); 2396 2397 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X) 2398 #define traceTIMER_COMMAND_SEND_8_0_CASES(tmr) \ 2399 case tmrCOMMAND_RESET: \ 2400 prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_RESET : PSF_EVENT_TIMER_RESET_FAILED, (uint32_t)tmr, xOptionalValue); \ 2401 break; \ 2402 case tmrCOMMAND_START_FROM_ISR: \ 2403 prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_START_FROMISR : PSF_EVENT_TIMER_START_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \ 2404 break; \ 2405 case tmrCOMMAND_RESET_FROM_ISR: \ 2406 prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_RESET_FROMISR : PSF_EVENT_TIMER_RESET_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \ 2407 break; \ 2408 case tmrCOMMAND_STOP_FROM_ISR: \ 2409 prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP_FROMISR : PSF_EVENT_TIMER_STOP_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \ 2410 break; \ 2411 case tmrCOMMAND_CHANGE_PERIOD_FROM_ISR: \ 2412 prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR : PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \ 2413 break; 2414 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X */ 2415 #define traceTIMER_COMMAND_SEND_8_0_CASES(tmr) 2416 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_8_X_X */ 2417 2418 /* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */ 2419 #undef traceTIMER_COMMAND_SEND 2420 #define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \ 2421 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2422 if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \ 2423 switch(xCommandID) \ 2424 { \ 2425 case tmrCOMMAND_START: \ 2426 prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_START : PSF_EVENT_TIMER_START_FAILED, (uint32_t)tmr); \ 2427 break; \ 2428 case tmrCOMMAND_STOP: \ 2429 prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP : PSF_EVENT_TIMER_STOP_FAILED, (uint32_t)tmr); \ 2430 break; \ 2431 case tmrCOMMAND_CHANGE_PERIOD: \ 2432 prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD : PSF_EVENT_TIMER_CHANGEPERIOD_FAILED, (uint32_t)tmr, xOptionalValue); \ 2433 break; \ 2434 case tmrCOMMAND_DELETE: \ 2435 prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_DELETE : PSF_EVENT_TIMER_DELETE_FAILED, (uint32_t)tmr); \ 2436 break; \ 2437 traceTIMER_COMMAND_SEND_8_0_CASES(tmr) \ 2438 } 2439 2440 #undef traceTIMER_EXPIRED 2441 #define traceTIMER_EXPIRED(tmr) \ 2442 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2443 if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \ 2444 prvTraceStoreEvent2(PSF_EVENT_TIMER_EXPIRED, (uint32_t)tmr->pxCallbackFunction, (uint32_t)tmr->pvTimerID); 2445 2446 #endif /* #if (TRC_CFG_INCLUDE_TIMER_EVENTS == 1) */ 2447 2448 2449 #if (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1) 2450 2451 #undef tracePEND_FUNC_CALL 2452 #define tracePEND_FUNC_CALL(func, arg1, arg2, ret) \ 2453 prvTraceStoreEvent1((ret == pdPASS) ? PSF_EVENT_TIMER_PENDFUNCCALL : PSF_EVENT_TIMER_PENDFUNCCALL_FAILED, (uint32_t)func); 2454 2455 #undef tracePEND_FUNC_CALL_FROM_ISR 2456 #define tracePEND_FUNC_CALL_FROM_ISR(func, arg1, arg2, ret) \ 2457 prvTraceStoreEvent1((ret == pdPASS) ? PSF_EVENT_TIMER_PENDFUNCCALL_FROMISR : PSF_EVENT_TIMER_PENDFUNCCALL_FROMISR_FAILED, (uint32_t)func); 2458 2459 #endif /* (TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS == 1) */ 2460 2461 #if (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) 2462 2463 #undef traceEVENT_GROUP_CREATE 2464 #define traceEVENT_GROUP_CREATE(eg) \ 2465 TRACE_SET_OBJECT_FILTER(EVENTGROUP, eg, CurrentFilterGroup); \ 2466 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2467 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2468 prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_CREATE, (uint32_t)eg); 2469 2470 #undef traceEVENT_GROUP_DELETE 2471 #define traceEVENT_GROUP_DELETE(eg) \ 2472 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2473 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2474 prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_DELETE, (uint32_t)eg); \ 2475 prvTraceDeleteSymbol(eg); 2476 2477 #undef traceEVENT_GROUP_CREATE_FAILED 2478 #define traceEVENT_GROUP_CREATE_FAILED() \ 2479 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2480 prvTraceStoreEvent0(PSF_EVENT_EVENTGROUP_CREATE_FAILED); 2481 2482 #undef traceEVENT_GROUP_SYNC_BLOCK 2483 #define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \ 2484 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2485 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2486 prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SYNC_BLOCK, (uint32_t)eg, bitsToWaitFor); 2487 2488 #undef traceEVENT_GROUP_SYNC_END 2489 #define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \ 2490 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2491 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2492 prvTraceStoreEvent2((wasTimeout != pdTRUE) ? PSF_EVENT_EVENTGROUP_SYNC : PSF_EVENT_EVENTGROUP_SYNC_FAILED, (uint32_t)eg, bitsToWaitFor); 2493 2494 #undef traceEVENT_GROUP_WAIT_BITS_BLOCK 2495 #define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \ 2496 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2497 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2498 prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_WAITBITS_BLOCK, (uint32_t)eg, bitsToWaitFor); 2499 2500 #undef traceEVENT_GROUP_WAIT_BITS_END 2501 #define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \ 2502 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2503 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2504 prvTraceStoreEvent2((wasTimeout != pdTRUE) ? PSF_EVENT_EVENTGROUP_WAITBITS : PSF_EVENT_EVENTGROUP_WAITBITS_FAILED, (uint32_t)eg, bitsToWaitFor); 2505 2506 #undef traceEVENT_GROUP_CLEAR_BITS 2507 #define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \ 2508 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2509 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2510 prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS, (uint32_t)eg, bitsToClear); 2511 2512 #undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR 2513 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \ 2514 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2515 prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR, (uint32_t)eg, bitsToClear); 2516 2517 #undef traceEVENT_GROUP_SET_BITS 2518 #define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \ 2519 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2520 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2521 prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS, (uint32_t)eg, bitsToSet); 2522 2523 #undef traceEVENT_GROUP_SET_BITS_FROM_ISR 2524 #define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \ 2525 if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \ 2526 prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS_FROMISR, (uint32_t)eg, bitsToSet); 2527 2528 #endif /* (TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS == 1) */ 2529 2530 #undef traceTASK_NOTIFY_TAKE 2531 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0) 2532 #define traceTASK_NOTIFY_TAKE(index) \ 2533 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ 2534 if (pxCurrentTCB->ucNotifyState[index] == taskNOTIFICATION_RECEIVED) \ 2535 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \ 2536 else \ 2537 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);} 2538 #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0) 2539 #define traceTASK_NOTIFY_TAKE() \ 2540 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ 2541 if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \ 2542 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \ 2543 else \ 2544 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);} 2545 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2546 #define traceTASK_NOTIFY_TAKE() \ 2547 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ 2548 if (pxCurrentTCB->eNotifyState == eNotified) \ 2549 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE, (uint32_t)pxCurrentTCB, xTicksToWait); \ 2550 else \ 2551 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);} 2552 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2553 2554 #undef traceTASK_NOTIFY_TAKE_BLOCK 2555 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0) 2556 #define traceTASK_NOTIFY_TAKE_BLOCK(index) \ 2557 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2558 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait); 2559 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2560 #define traceTASK_NOTIFY_TAKE_BLOCK() \ 2561 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2562 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_TAKE_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait); 2563 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2564 2565 #undef traceTASK_NOTIFY_WAIT 2566 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0) 2567 #define traceTASK_NOTIFY_WAIT(index) \ 2568 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ 2569 if (pxCurrentTCB->ucNotifyState[index] == taskNOTIFICATION_RECEIVED) \ 2570 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \ 2571 else \ 2572 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);} 2573 #elif (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_9_0_0) 2574 #define traceTASK_NOTIFY_WAIT() \ 2575 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ 2576 if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \ 2577 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \ 2578 else \ 2579 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);} 2580 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2581 #define traceTASK_NOTIFY_WAIT() \ 2582 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask){ \ 2583 if (pxCurrentTCB->eNotifyState == eNotified) \ 2584 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \ 2585 else \ 2586 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait);} 2587 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2588 2589 #undef traceTASK_NOTIFY_WAIT_BLOCK 2590 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0) 2591 #define traceTASK_NOTIFY_WAIT_BLOCK(index) \ 2592 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2593 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait); 2594 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2595 #define traceTASK_NOTIFY_WAIT_BLOCK() \ 2596 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2597 prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait); 2598 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2599 2600 #undef traceTASK_NOTIFY 2601 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0) 2602 #define traceTASK_NOTIFY(index) \ 2603 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2604 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 2605 prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY, (uint32_t)xTaskToNotify); 2606 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2607 #define traceTASK_NOTIFY() \ 2608 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2609 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 2610 prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY, (uint32_t)xTaskToNotify); 2611 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2612 2613 #undef traceTASK_NOTIFY_FROM_ISR 2614 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0) 2615 #define traceTASK_NOTIFY_FROM_ISR(index) \ 2616 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 2617 prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_FROM_ISR, (uint32_t)xTaskToNotify); 2618 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2619 #define traceTASK_NOTIFY_FROM_ISR() \ 2620 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 2621 prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_FROM_ISR, (uint32_t)xTaskToNotify); 2622 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2623 2624 #undef traceTASK_NOTIFY_GIVE_FROM_ISR 2625 #if (TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0) 2626 #define traceTASK_NOTIFY_GIVE_FROM_ISR(index) \ 2627 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 2628 prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR, (uint32_t)xTaskToNotify); 2629 #else /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2630 #define traceTASK_NOTIFY_GIVE_FROM_ISR() \ 2631 if (TRACE_GET_OBJECT_FILTER(TASK, xTaskToNotify) & CurrentFilterMask) \ 2632 prvTraceStoreEvent1(PSF_EVENT_TASK_NOTIFY_GIVE_FROM_ISR, (uint32_t)xTaskToNotify); 2633 #endif /* TRC_CFG_FREERTOS_VERSION >= TRC_FREERTOS_VERSION_10_4_0 */ 2634 2635 #undef traceQUEUE_REGISTRY_ADD 2636 #define traceQUEUE_REGISTRY_ADD(object, name) \ 2637 prvTraceSaveObjectSymbol(object, (const char*)name); \ 2638 prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, name, object); 2639 2640 #if (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) 2641 2642 #undef traceSTREAM_BUFFER_CREATE 2643 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ) \ 2644 TRACE_SET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer, CurrentFilterGroup); \ 2645 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2646 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer) & CurrentFilterMask) \ 2647 prvTraceStoreEvent2(xIsMessageBuffer == 1 ? PSF_EVENT_MESSAGEBUFFER_CREATE : PSF_EVENT_STREAMBUFFER_CREATE, (uint32_t)pxStreamBuffer, xBufferSizeBytes); 2648 2649 #undef traceSTREAM_BUFFER_CREATE_FAILED 2650 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) \ 2651 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2652 prvTraceStoreEvent2(xIsMessageBuffer == 1 ? PSF_EVENT_MESSAGEBUFFER_CREATE_FAILED : PSF_EVENT_STREAMBUFFER_CREATE_FAILED, 0 , xBufferSizeBytes); 2653 2654 #undef traceSTREAM_BUFFER_CREATE_STATIC_FAILED 2655 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer ) \ 2656 traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) 2657 2658 #undef traceSTREAM_BUFFER_DELETE 2659 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) \ 2660 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2661 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, pxStreamBuffer) & CurrentFilterMask) \ 2662 prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_DELETE : PSF_EVENT_STREAMBUFFER_DELETE, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \ 2663 prvTraceDeleteSymbol(xStreamBuffer); 2664 2665 #undef traceSTREAM_BUFFER_RESET 2666 #define traceSTREAM_BUFFER_RESET( xStreamBuffer ) \ 2667 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2668 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2669 prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RESET : PSF_EVENT_STREAMBUFFER_RESET, (uint32_t)xStreamBuffer, 0); 2670 2671 #undef traceSTREAM_BUFFER_SEND 2672 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xReturn ) \ 2673 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2674 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2675 prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND : PSF_EVENT_STREAMBUFFER_SEND, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); 2676 2677 #undef traceBLOCKING_ON_STREAM_BUFFER_SEND 2678 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer ) \ 2679 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2680 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2681 prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_BLOCK : PSF_EVENT_STREAMBUFFER_SEND_BLOCK, (uint32_t)xStreamBuffer); 2682 2683 #undef traceSTREAM_BUFFER_SEND_FAILED 2684 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ) \ 2685 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2686 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2687 prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_FAILED : PSF_EVENT_STREAMBUFFER_SEND_FAILED, (uint32_t)xStreamBuffer); 2688 2689 #undef traceSTREAM_BUFFER_RECEIVE 2690 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength ) \ 2691 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2692 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2693 prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE: PSF_EVENT_STREAMBUFFER_RECEIVE, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); 2694 2695 #undef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE 2696 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer ) \ 2697 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2698 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2699 prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_BLOCK: PSF_EVENT_STREAMBUFFER_RECEIVE_BLOCK, (uint32_t)xStreamBuffer); 2700 2701 #undef traceSTREAM_BUFFER_RECEIVE_FAILED 2702 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer ) \ 2703 if (TRACE_GET_OBJECT_FILTER(TASK, TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \ 2704 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2705 prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_FAILED: PSF_EVENT_STREAMBUFFER_RECEIVE_FAILED, (uint32_t)xStreamBuffer); 2706 2707 #undef traceSTREAM_BUFFER_SEND_FROM_ISR 2708 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xReturn ) \ 2709 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2710 { \ 2711 if ( xReturn > ( size_t ) 0 ) \ 2712 { \ 2713 prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_FROM_ISR : PSF_EVENT_STREAMBUFFER_SEND_FROM_ISR, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \ 2714 } \ 2715 else \ 2716 { \ 2717 prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_SEND_FROM_ISR_FAILED : PSF_EVENT_STREAMBUFFER_SEND_FROM_ISR_FAILED, (uint32_t)xStreamBuffer); \ 2718 } \ 2719 } 2720 2721 #undef traceSTREAM_BUFFER_RECEIVE_FROM_ISR 2722 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ) \ 2723 if (TRACE_GET_OBJECT_FILTER(STREAMBUFFER, xStreamBuffer) & CurrentFilterMask) \ 2724 { \ 2725 if ( xReceivedLength > ( size_t ) 0 ) \ 2726 { \ 2727 prvTraceStoreEvent2(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR : PSF_EVENT_STREAMBUFFER_RECEIVE_FROM_ISR, (uint32_t)xStreamBuffer, prvBytesInBuffer(xStreamBuffer)); \ 2728 } \ 2729 else \ 2730 { \ 2731 prvTraceStoreEvent1(prvGetStreamBufferType(xStreamBuffer) > 0 ? PSF_EVENT_MESSAGEBUFFER_RECEIVE_FROM_ISR_FAILED : PSF_EVENT_STREAMBUFFER_RECEIVE_FROM_ISR_FAILED, (uint32_t)xStreamBuffer); \ 2732 } \ 2733 } 2734 2735 #endif /* (TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS == 1) */ 2736 2737 #endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */ 2738 2739 #endif /* (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING) */ 2740 2741 #else /* (TRC_USE_TRACEALYZER_RECORDER == 1) */ 2742 2743 /* When recorder is disabled */ 2744 #define vTraceSetQueueName(object, name) 2745 #define vTraceSetSemaphoreName(object, name) 2746 #define vTraceSetMutexName(object, name) 2747 #define vTraceSetEventGroupName(object, name) 2748 #define vTraceSetStreamBufferName(object, name) 2749 #define vTraceSetMessageBufferName(object, name) 2750 2751 #endif /* (TRC_USE_TRACEALYZER_RECORDER == 1) */ 2752 2753 #ifdef __cplusplus 2754 } 2755 #endif 2756 2757 #endif /* TRC_KERNEL_PORT_H */ 2758