Go to the documentation of this file.
1 /*******************************************************************************
2  * Tracealyzer v3.0.2 Recorder Library
3  * Percepio AB, www.percepio.com
4  *
5  * trcKernelPort.h
6  *
7  * Kernel-specific functionality for FreeRTOS, used by the recorder library.
8  *
9  * Terms of Use
10  * This software is copyright Percepio AB. The recorder library is free for
11  * use together with Percepio products. You may distribute the recorder library
12  * in its original form, including modifications in trcHardwarePort.c/.h
13  * given that these modification are clearly marked as your own modifications
14  * and documented in the initial comment section of these source files.
15  * This software is the intellectual property of Percepio AB and may not be
16  * sold or in other ways commercially redistributed without explicit written
17  * permission by Percepio AB.
18  *
19  * Disclaimer
20  * The trace tool and recorder library is being delivered to you AS IS and
21  * Percepio AB makes no warranty as to its use or performance. Percepio AB does
22  * not and cannot warrant the performance or results you may obtain by using the
23  * software or documentation. Percepio AB make no warranties, express or
24  * implied, as to noninfringement of third party rights, merchantability, or
25  * fitness for any particular purpose. In no event will Percepio AB, its
26  * technology partners, or distributors be liable to you for any consequential,
27  * incidental or special damages, including any lost profits or lost savings,
28  * even if a representative of Percepio AB has been advised of the possibility
29  * of such damages, or for any claim by any third party. Some jurisdictions do
30  * not allow the exclusion or limitation of incidental, consequential or special
31  * damages, or the exclusion of implied warranties or limitations on how long an
32  * implied warranty may last, so the above limitations may not apply to you.
33  *
34  * Tabs are used for indent in this file (1 tab = 4 spaces)
35  *
36  * Copyright Percepio AB, 2014.
37  * www.percepio.com
38  ******************************************************************************/
39 
40 
41 #ifndef TRCKERNELPORTFREERTOS_H
42 #define TRCKERNELPORTFREERTOS_H
43 
44 #include "FreeRTOS.h" /* Defines configUSE_TRACE_FACILITY */
45 #include "trcHardwarePort.h"
46 
48 
49 #define USE_TRACEALYZER_RECORDER configUSE_TRACE_FACILITY
50 
51 #if (USE_TRACEALYZER_RECORDER == 1)
52 
53 /* Defines that must be set for the recorder to work properly */
54 #define TRACE_KERNEL_VERSION 0x1AA1
55 #define TRACE_TICK_RATE_HZ configTICK_RATE_HZ /* Defined in "FreeRTOS.h" */
56 #define TRACE_CPU_CLOCK_HZ configCPU_CLOCK_HZ /* Defined in "FreeRTOSConfig.h" */
57 
58 #if (SELECTED_PORT == PORT_ARM_CortexM)
59 
60  /* Uses CMSIS API */
61 
62  #define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;
63  #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = __get_PRIMASK(); __set_PRIMASK(1);}
64  #define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);}
65 
66 #endif
67 
68 #if (SELECTED_PORT == PORT_ARM_CORTEX_M0)
69 
70 #define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;
71 #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = __get_PRIMASK(); __set_PRIMASK(1);}
72 #define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);}
73 
74 #endif
75 
76 #if ((SELECTED_PORT == PORT_ARM_CORTEX_A9) || (SELECTED_PORT == PORT_Renesas_RX600) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MX) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MZ))
77  #define TRACE_SR_ALLOC_CRITICAL_SECTION() int __irq_status;
78  #define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();}
79  #define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);}
80 #endif
81 
82 #if (SELECTED_PORT == PORT_Win32)
83  /* In the Win32 port, there are no real interrupts, so we can use the normal critical sections */
84  #define TRACE_SR_ALLOC_CRITICAL_SECTION()
85  #define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()
86  #define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()
87 #endif
88 
89 #ifndef TRACE_ENTER_CRITICAL_SECTION
90  #error "This port has no valid definition for critical sections! See http://percepio.com/2014/10/27/how-to-define-critical-sections-for-the-recorder/"
91 #endif
92 
93 #if (SELECTED_PORT == PORT_ARM_CortexM)
94  #define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_BEGIN
95  #define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY trcCRITICAL_SECTION_END
96 #else
97  #define trcCRITICAL_SECTION_BEGIN_ON_CORTEX_M_ONLY() recorder_busy++;
98  #define trcCRITICAL_SECTION_END_ON_CORTEX_M_ONLY() recorder_busy--;
99 #endif
100 
101 /*************************************************************************/
102 /* KERNEL SPECIFIC OBJECT CONFIGURATION */
103 /*************************************************************************/
104 #define TRACE_NCLASSES 7
105 #define TRACE_CLASS_QUEUE ((traceObjectClass)0)
106 #define TRACE_CLASS_SEMAPHORE ((traceObjectClass)1)
107 #define TRACE_CLASS_MUTEX ((traceObjectClass)2)
108 #define TRACE_CLASS_TASK ((traceObjectClass)3)
109 #define TRACE_CLASS_ISR ((traceObjectClass)4)
110 #define TRACE_CLASS_TIMER ((traceObjectClass)5)
111 #define TRACE_CLASS_EVENTGROUP ((traceObjectClass)6)
112 
113 #define TRACE_KERNEL_OBJECT_COUNT (NQueue + NSemaphore + NMutex + NTask + NISR + NTimer + NEventGroup)
114 
115 /* The size of the Object Property Table entries, in bytes, per object */
116 
117 /* Queue properties (except name): current number of message in queue */
118 #define PropertyTableSizeQueue (NameLenQueue + 1)
119 
120 /* Semaphore properties (except name): state (signaled = 1, cleared = 0) */
121 #define PropertyTableSizeSemaphore (NameLenSemaphore + 1)
122 
123 /* Mutex properties (except name): owner (task handle, 0 = free) */
124 #define PropertyTableSizeMutex (NameLenMutex + 1)
125 
126 /* Task properties (except name): Byte 0: Current priority
127  Byte 1: state (if already active)
128  Byte 2: legacy, not used
129  Byte 3: legacy, not used */
130 #define PropertyTableSizeTask (NameLenTask + 4)
131 
132 /* ISR properties: Byte 0: priority
133  Byte 1: state (if already active) */
134 #define PropertyTableSizeISR (NameLenISR + 2)
135 
136 /* NTimer properties: Byte 0: state (unused for now) */
137 #define PropertyTableSizeTimer (NameLenTimer + 1)
138 
139 /* NEventGroup properties: Byte 0-3: state (unused for now)*/
140 #define PropertyTableSizeEventGroup (NameLenEventGroup + 4)
141 
142 
143 /* The layout of the byte array representing the Object Property Table */
144 #define StartIndexQueue 0
145 #define StartIndexSemaphore StartIndexQueue + NQueue * PropertyTableSizeQueue
146 #define StartIndexMutex StartIndexSemaphore + NSemaphore * PropertyTableSizeSemaphore
147 #define StartIndexTask StartIndexMutex + NMutex * PropertyTableSizeMutex
148 #define StartIndexISR StartIndexTask + NTask * PropertyTableSizeTask
149 #define StartIndexTimer StartIndexISR + NISR * PropertyTableSizeISR
150 #define StartIndexEventGroup StartIndexTimer + NTimer * PropertyTableSizeTimer
151 
152 /* Number of bytes used by the object table */
153 #define TRACE_OBJECT_TABLE_SIZE StartIndexEventGroup + NEventGroup * PropertyTableSizeEventGroup
154 
155 #define FREERTOS_VERSION_NOT_SET 0
156 #define FREERTOS_VERSION_7_3_OR_7_4 1
157 #define FREERTOS_VERSION_7_5_OR_7_6 2
158 #define FREERTOS_VERSION_8_0_OR_LATER 3
159 
160 /* Includes */
161 #include "trcConfig.h" /* Must be first, even before trcTypes.h */
162 #include "trcHardwarePort.h"
163 #include "trcTypes.h"
164 #include "trcKernelHooks.h"
165 #include "trcBase.h"
166 #include "trcKernel.h"
167 #include "trcUser.h"
168 
169 #if (INCLUDE_NEW_TIME_EVENTS == 1 && configUSE_TICKLESS_IDLE != 0)
170  #error "NewTime events can not be used in combination with tickless idle!"
171 #endif
172 
173 /* Initialization of the object property table */
174 void vTraceInitObjectPropertyTable(void);
175 
176 /* Initialization of the handle mechanism, see e.g, xTraceGetObjectHandle */
177 void vTraceInitObjectHandleStack(void);
178 
179 /* Returns the "Not enough handles" error message for the specified object class */
180 const char* pszTraceGetErrorNotEnoughHandles(traceObjectClass objectclass);
181 
182 /*******************************************************************************
183  * The event codes - should match the offline config file.
184  *
185  * Some sections below are encoded to allow for constructions like:
186  *
187  * vTraceStoreKernelCall(EVENTGROUP_CREATE + objectclass, ...
188  *
189  * The object class ID is given by the three LSB bits, in such cases. Since each
190  * object class has a separate object property table, the class ID is needed to
191  * know what section in the object table to use for getting an object name from
192  * an object handle.
193  ******************************************************************************/
194 
195 #define NULL_EVENT (0x00) /* Ignored in the analysis*/
196 
197 /*******************************************************************************
198  * EVENTGROUP_DIV
199  *
200  * Miscellaneous events.
201  ******************************************************************************/
202 #define EVENTGROUP_DIV (NULL_EVENT + 1) /*0x01*/
203 #define DIV_XPS (EVENTGROUP_DIV + 0) /*0x01*/
204 #define DIV_TASK_READY (EVENTGROUP_DIV + 1) /*0x02*/
205 #define DIV_NEW_TIME (EVENTGROUP_DIV + 2) /*0x03*/
206 
207 /*******************************************************************************
208  * EVENTGROUP_TS
209  *
210  * Events for storing task-switches and interrupts. The RESUME events are
211  * generated if the task/interrupt is already marked active.
212  ******************************************************************************/
213 #define EVENTGROUP_TS (EVENTGROUP_DIV + 3) /*0x04*/
214 #define TS_ISR_BEGIN (EVENTGROUP_TS + 0) /*0x04*/
215 #define TS_ISR_RESUME (EVENTGROUP_TS + 1) /*0x05*/
216 #define TS_TASK_BEGIN (EVENTGROUP_TS + 2) /*0x06*/
217 #define TS_TASK_RESUME (EVENTGROUP_TS + 3) /*0x07*/
218 
219 /*******************************************************************************
220  * EVENTGROUP_OBJCLOSE_NAME
221  *
222  * About Close Events
223  * When an object is evicted from the object property table (object close), two
224  * internal events are stored (EVENTGROUP_OBJCLOSE_NAME and
225  * EVENTGROUP_OBJCLOSE_PROP), containing the handle-name mapping and object
226  * properties valid up to this point.
227  ******************************************************************************/
228 #define EVENTGROUP_OBJCLOSE_NAME (EVENTGROUP_TS + 4) /*0x08*/
229 
230 /*******************************************************************************
231  * EVENTGROUP_OBJCLOSE_PROP
232  *
233  * The internal event carrying properties of deleted objects
234  * The handle and object class of the closed object is not stored in this event,
235  * but is assumed to be the same as in the preceding CLOSE event. Thus, these
236  * two events must be generated from within a critical section.
237  * When queues are closed, arg1 is the "state" property (i.e., number of
238  * buffered messages/signals).
239  * When actors are closed, arg1 is priority, arg2 is handle of the "instance
240  * finish" event, and arg3 is event code of the "instance finish" event.
241  * In this case, the lower three bits is the object class of the instance finish
242  * handle. The lower three bits are not used (always zero) when queues are
243  * closed since the queue type is given in the previous OBJCLOSE_NAME event.
244  ******************************************************************************/
245 #define EVENTGROUP_OBJCLOSE_PROP (EVENTGROUP_OBJCLOSE_NAME + 8) /*0x10*/
246 
247 /*******************************************************************************
248  * EVENTGROUP_CREATE
249  *
250  * The events in this group are used to log Kernel object creations.
251  * The lower three bits in the event code gives the object class, i.e., type of
252  * create operation (task, queue, semaphore, etc).
253  ******************************************************************************/
254 #define EVENTGROUP_CREATE_OBJ_SUCCESS (EVENTGROUP_OBJCLOSE_PROP + 8) /*0x18*/
255 
256 /*******************************************************************************
257  * EVENTGROUP_SEND
258  *
259  * The events in this group are used to log Send/Give events on queues,
260  * semaphores and mutexes The lower three bits in the event code gives the
261  * object class, i.e., what type of object that is operated on (queue, semaphore
262  * or mutex).
263  ******************************************************************************/
264 #define EVENTGROUP_SEND_SUCCESS (EVENTGROUP_CREATE_OBJ_SUCCESS + 8) /*0x20*/
265 
266 /*******************************************************************************
267  * EVENTGROUP_RECEIVE
268  *
269  * The events in this group are used to log Receive/Take events on queues,
270  * semaphores and mutexes. The lower three bits in the event code gives the
271  * object class, i.e., what type of object that is operated on (queue, semaphore
272  * or mutex).
273  ******************************************************************************/
274 #define EVENTGROUP_RECEIVE_SUCCESS (EVENTGROUP_SEND_SUCCESS + 8) /*0x28*/
275 
276 /* Send/Give operations, from ISR */
277 #define EVENTGROUP_SEND_FROM_ISR_SUCCESS \
278  (EVENTGROUP_RECEIVE_SUCCESS + 8) /*0x30*/
279 
280 /* Receive/Take operations, from ISR */
281 #define EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS \
282  (EVENTGROUP_SEND_FROM_ISR_SUCCESS + 8) /*0x38*/
283 
284 /* "Failed" event type versions of above (timeout, failed allocation, etc) */
285 #define EVENTGROUP_KSE_FAILED \
286  (EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + 8) /*0x40*/
287 
288 /* Failed create calls - memory allocation failed */
289 #define EVENTGROUP_CREATE_OBJ_FAILED (EVENTGROUP_KSE_FAILED) /*0x40*/
290 
291 /* Failed send/give - timeout! */
292 #define EVENTGROUP_SEND_FAILED (EVENTGROUP_CREATE_OBJ_FAILED + 8) /*0x48*/
293 
294 /* Failed receive/take - timeout! */
295 #define EVENTGROUP_RECEIVE_FAILED (EVENTGROUP_SEND_FAILED + 8) /*0x50*/
296 
297 /* Failed non-blocking send/give - queue full */
298 #define EVENTGROUP_SEND_FROM_ISR_FAILED (EVENTGROUP_RECEIVE_FAILED + 8) /*0x58*/
299 
300 /* Failed non-blocking receive/take - queue empty */
301 #define EVENTGROUP_RECEIVE_FROM_ISR_FAILED \
302  (EVENTGROUP_SEND_FROM_ISR_FAILED + 8) /*0x60*/
303 
304 /* Events when blocking on receive/take */
305 #define EVENTGROUP_RECEIVE_BLOCK \
306  (EVENTGROUP_RECEIVE_FROM_ISR_FAILED + 8) /*0x68*/
307 
308 /* Events when blocking on send/give */
309 #define EVENTGROUP_SEND_BLOCK (EVENTGROUP_RECEIVE_BLOCK + 8) /*0x70*/
310 
311 /* Events on queue peek (receive) */
312 #define EVENTGROUP_PEEK_SUCCESS (EVENTGROUP_SEND_BLOCK + 8) /*0x78*/
313 
314 /* Events on object delete (vTaskDelete or vQueueDelete) */
315 #define EVENTGROUP_DELETE_OBJ_SUCCESS (EVENTGROUP_PEEK_SUCCESS + 8) /*0x80*/
316 
317 /* Other events - object class is implied: TASK */
318 #define EVENTGROUP_OTHERS (EVENTGROUP_DELETE_OBJ_SUCCESS + 8) /*0x88*/
319 #define TASK_DELAY_UNTIL (EVENTGROUP_OTHERS + 0) /*0x88*/
320 #define TASK_DELAY (EVENTGROUP_OTHERS + 1) /*0x89*/
321 #define TASK_SUSPEND (EVENTGROUP_OTHERS + 2) /*0x8A*/
322 #define TASK_RESUME (EVENTGROUP_OTHERS + 3) /*0x8B*/
323 #define TASK_RESUME_FROM_ISR (EVENTGROUP_OTHERS + 4) /*0x8C*/
324 #define TASK_PRIORITY_SET (EVENTGROUP_OTHERS + 5) /*0x8D*/
325 #define TASK_PRIORITY_INHERIT (EVENTGROUP_OTHERS + 6) /*0x8E*/
326 #define TASK_PRIORITY_DISINHERIT (EVENTGROUP_OTHERS + 7) /*0x8F*/
327 
328 #define EVENTGROUP_MISC_PLACEHOLDER (EVENTGROUP_OTHERS + 8) /*0x90*/
329 #define PEND_FUNC_CALL (EVENTGROUP_MISC_PLACEHOLDER+0) /*0x90*/
330 #define PEND_FUNC_CALL_FROM_ISR (EVENTGROUP_MISC_PLACEHOLDER+1) /*0x91*/
331 #define PEND_FUNC_CALL_FAILED (EVENTGROUP_MISC_PLACEHOLDER+2) /*0x92*/
332 #define PEND_FUNC_CALL_FROM_ISR_FAILED (EVENTGROUP_MISC_PLACEHOLDER+3) /*0x93*/
333 #define MEM_MALLOC_SIZE (EVENTGROUP_MISC_PLACEHOLDER+4) /*0x94*/
334 #define MEM_MALLOC_ADDR (EVENTGROUP_MISC_PLACEHOLDER+5) /*0x95*/
335 #define MEM_FREE_SIZE (EVENTGROUP_MISC_PLACEHOLDER+6) /*0x96*/
336 #define MEM_FREE_ADDR (EVENTGROUP_MISC_PLACEHOLDER+7) /*0x97*/
337 
338 /* User events */
339 #define EVENTGROUP_USEREVENT (EVENTGROUP_MISC_PLACEHOLDER + 8) /*0x98*/
340 #define USER_EVENT (EVENTGROUP_USEREVENT + 0)
341 
342 /* Allow for 0-15 arguments (the number of args is added to event code) */
343 #define USER_EVENT_LAST (EVENTGROUP_USEREVENT + 15) /*0xA7*/
344 
345 /*******************************************************************************
346  * XTS Event - eXtended TimeStamp events
347  * The timestamps used in the recorder are "differential timestamps" (DTS), i.e.
348  * the time since the last stored event. The DTS fields are either 1 or 2 bytes
349  * in the other events, depending on the bytes available in the event struct.
350  * If the time since the last event (the DTS) is larger than allowed for by
351  * the DTS field of the current event, an XTS event is inserted immediately
352  * before the original event. The XTS event contains up to 3 additional bytes
353  * of the DTS value - the higher bytes of the true DTS value. The lower 1-2
354  * bytes are stored in the normal DTS field.
355  * There are two types of XTS events, XTS8 and XTS16. An XTS8 event is stored
356  * when there is only room for 1 byte (8 bit) DTS data in the original event,
357  * which means a limit of 0xFF (255). The XTS16 is used when the original event
358  * has a 16 bit DTS field and thereby can handle values up to 0xFFFF (65535).
359  *
360  * Using a very high frequency time base can result in many XTS events.
361  * Preferably, the time between two OS ticks should fit in 16 bits, i.e.,
362  * at most 65535. If your time base has a higher frequency, you can define
363  * the TRACE
364  ******************************************************************************/
365 
366 #define EVENTGROUP_SYS (EVENTGROUP_USEREVENT + 16) /*0xA8*/
367 #define XTS8 (EVENTGROUP_SYS + 0) /*0xA8*/
368 #define XTS16 (EVENTGROUP_SYS + 1) /*0xA9*/
369 #define EVENT_BEING_WRITTEN (EVENTGROUP_SYS + 2) /*0xAA*/
370 #define RESERVED_DUMMY_CODE (EVENTGROUP_SYS + 3) /*0xAB*/
371 #define LOW_POWER_BEGIN (EVENTGROUP_SYS + 4) /*0xAC*/
372 #define LOW_POWER_END (EVENTGROUP_SYS + 5) /*0xAD*/
373 #define XID (EVENTGROUP_SYS + 6) /*0xAE*/
374 #define XTS16L (EVENTGROUP_SYS + 7) /*0xAF*/
375 
376 #define EVENTGROUP_TIMER (EVENTGROUP_SYS + 8) /*0xB0*/
377 #define TIMER_CREATE (EVENTGROUP_TIMER + 0) /*0xB0*/
378 #define TIMER_START (EVENTGROUP_TIMER + 1) /*0xB1*/
379 #define TIMER_RST (EVENTGROUP_TIMER + 2) /*0xB2*/
380 #define TIMER_STOP (EVENTGROUP_TIMER + 3) /*0xB3*/
381 #define TIMER_CHANGE_PERIOD (EVENTGROUP_TIMER + 4) /*0xB4*/
382 #define TIMER_DELETE (EVENTGROUP_TIMER + 5) /*0xB5*/
383 #define TIMER_START_FROM_ISR (EVENTGROUP_TIMER + 6) /*0xB6*/
384 #define TIMER_RESET_FROM_ISR (EVENTGROUP_TIMER + 7) /*0xB7*/
385 #define TIMER_STOP_FROM_ISR (EVENTGROUP_TIMER + 8) /*0xB8*/
386 
387 #define TIMER_CREATE_FAILED (EVENTGROUP_TIMER + 9) /*0xB9*/
388 #define TIMER_START_FAILED (EVENTGROUP_TIMER + 10) /*0xBA*/
389 #define TIMER_RESET_FAILED (EVENTGROUP_TIMER + 11) /*0xBB*/
390 #define TIMER_STOP_FAILED (EVENTGROUP_TIMER + 12) /*0xBC*/
391 #define TIMER_CHANGE_PERIOD_FAILED (EVENTGROUP_TIMER + 13) /*0xBD*/
392 #define TIMER_DELETE_FAILED (EVENTGROUP_TIMER + 14) /*0xBE*/
393 #define TIMER_START_FROM_ISR_FAILED (EVENTGROUP_TIMER + 15) /*0xBF*/
394 #define TIMER_RESET_FROM_ISR_FAILED (EVENTGROUP_TIMER + 16) /*0xC0*/
395 #define TIMER_STOP_FROM_ISR_FAILED (EVENTGROUP_TIMER + 17) /*0xC1*/
396 
397 #define EVENTGROUP_EG (EVENTGROUP_TIMER + 18) /*0xC2*/
398 #define EVENT_GROUP_CREATE (EVENTGROUP_EG + 0) /*0xC2*/
399 #define EVENT_GROUP_CREATE_FAILED (EVENTGROUP_EG + 1) /*0xC3*/
400 #define EVENT_GROUP_SYNC_BLOCK (EVENTGROUP_EG + 2) /*0xC4*/
401 #define EVENT_GROUP_SYNC_END (EVENTGROUP_EG + 3) /*0xC5*/
402 #define EVENT_GROUP_WAIT_BITS_BLOCK (EVENTGROUP_EG + 4) /*0xC6*/
403 #define EVENT_GROUP_WAIT_BITS_END (EVENTGROUP_EG + 5) /*0xC7*/
404 #define EVENT_GROUP_CLEAR_BITS (EVENTGROUP_EG + 6) /*0xC8*/
405 #define EVENT_GROUP_CLEAR_BITS_FROM_ISR (EVENTGROUP_EG + 7) /*0xC9*/
406 #define EVENT_GROUP_SET_BITS (EVENTGROUP_EG + 8) /*0xCA*/
407 #define EVENT_GROUP_DELETE (EVENTGROUP_EG + 9) /*0xCB*/
408 #define EVENT_GROUP_SYNC_END_FAILED (EVENTGROUP_EG + 10) /*0xCC*/
409 #define EVENT_GROUP_WAIT_BITS_END_FAILED (EVENTGROUP_EG + 11) /*0xCD*/
410 #define EVENT_GROUP_SET_BITS_FROM_ISR (EVENTGROUP_EG + 12) /*0xCE*/
411 #define EVENT_GROUP_SET_BITS_FROM_ISR_FAILED (EVENTGROUP_EG + 13) /*0xCF*/
412 
413 #define TASK_INSTANCE_FINISHED_NEXT_KSE (EVENTGROUP_EG + 14) /*0xD0*/
414 #define TASK_INSTANCE_FINISHED_DIRECT (EVENTGROUP_EG + 15) /*0xD1*/
415 
416 #define TRACE_TASK_NOTIFY_GROUP (EVENTGROUP_EG + 16) /*0xD2*/
417 #define TRACE_TASK_NOTIFY (TRACE_TASK_NOTIFY_GROUP + 0) /*0xD2*/
418 #define TRACE_TASK_NOTIFY_TAKE (TRACE_TASK_NOTIFY_GROUP + 1) /*0xD3*/
419 #define TRACE_TASK_NOTIFY_TAKE_BLOCK (TRACE_TASK_NOTIFY_GROUP + 2) /*0xD4*/
420 #define TRACE_TASK_NOTIFY_TAKE_FAILED (TRACE_TASK_NOTIFY_GROUP + 3) /*0xD5*/
421 #define TRACE_TASK_NOTIFY_WAIT (TRACE_TASK_NOTIFY_GROUP + 4) /*0xD6*/
422 #define TRACE_TASK_NOTIFY_WAIT_BLOCK (TRACE_TASK_NOTIFY_GROUP + 5) /*0xD7*/
423 #define TRACE_TASK_NOTIFY_WAIT_FAILED (TRACE_TASK_NOTIFY_GROUP + 6) /*0xD8*/
424 #define TRACE_TASK_NOTIFY_FROM_ISR (TRACE_TASK_NOTIFY_GROUP + 7) /*0xD9*/
425 #define TRACE_TASK_NOTIFY_GIVE_FROM_ISR (TRACE_TASK_NOTIFY_GROUP + 8) /*0xDA*/
426 
427 /************************************************************************/
428 /* KERNEL SPECIFIC DATA AND FUNCTIONS NEEDED TO PROVIDE THE */
429 /* FUNCTIONALITY REQUESTED BY THE TRACE RECORDER */
430 /************************************************************************/
431 
432 /******************************************************************************
433  * TraceObjectClassTable
434  * Translates a FreeRTOS QueueType into trace objects classes (TRACE_CLASS_).
435  * This was added since we want to map both types of Mutex and both types of
436  * Semaphores on common classes for all Mutexes and all Semaphores respectively.
437  *
438  * FreeRTOS Queue types
439  * #define queueQUEUE_TYPE_BASE (0U) => TRACE_CLASS_QUEUE
440  * #define queueQUEUE_TYPE_MUTEX (1U) => TRACE_CLASS_MUTEX
441  * #define queueQUEUE_TYPE_COUNTING_SEMAPHORE (2U) => TRACE_CLASS_SEMAPHORE
442  * #define queueQUEUE_TYPE_BINARY_SEMAPHORE (3U) => TRACE_CLASS_SEMAPHORE
443  * #define queueQUEUE_TYPE_RECURSIVE_MUTEX (4U) => TRACE_CLASS_MUTEX
444  ******************************************************************************/
445 
446 extern traceObjectClass TraceObjectClassTable[5];
447 
448 /* These functions are implemented in the .c file since certain header files
449 must not be included in this one */
450 objectHandleType prvTraceGetObjectNumber(void* handle);
451 unsigned char prvTraceGetObjectType(void* handle);
452 objectHandleType prvTraceGetTaskNumber(void* handle);
453 unsigned char prvTraceIsSchedulerActive(void);
454 unsigned char prvTraceIsSchedulerSuspended(void);
455 unsigned char prvTraceIsSchedulerStarted(void);
456 void* prvTraceGetCurrentTaskHandle(void);
457 
458 #if (configUSE_TIMERS == 1)
459 #undef INCLUDE_xTimerGetTimerDaemonTaskHandle
460 #define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
461 #endif
462 
463 /************************************************************************/
464 /* KERNEL SPECIFIC MACROS USED BY THE TRACE RECORDER */
465 /************************************************************************/
466 
467 #define TRACE_MALLOC(size) pvPortMalloc(size)
468 #define TRACE_IS_SCHEDULER_ACTIVE() prvTraceIsSchedulerActive()
469 #define TRACE_IS_SCHEDULER_STARTED() prvTraceIsSchedulerStarted()
470 #define TRACE_IS_SCHEDULER_SUSPENDED() prvTraceIsSchedulerSuspended()
471 #define TRACE_GET_CURRENT_TASK() prvTraceGetCurrentTaskHandle()
472 
473 #define TRACE_GET_TASK_PRIORITY(pxTCB) ((uint8_t)pxTCB->uxPriority)
474 #define TRACE_GET_TASK_NAME(pxTCB) ((char*)pxTCB->pcTaskName)
475 #define TRACE_GET_TASK_NUMBER(pxTCB) (prvTraceGetTaskNumber(pxTCB))
476 #define TRACE_SET_TASK_NUMBER(pxTCB) pxTCB->uxTaskNumber = xTraceGetObjectHandle(TRACE_CLASS_TASK);
477 
478 #define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TraceObjectClassTable[kernelClass]
479 #define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_CLASS_TRACE_CLASS(CLASS, prvTraceGetObjectType(pxObject))
480 
481 #define TRACE_GET_TIMER_NUMBER(tmr) ( ( objectHandleType ) ((Timer_t*)tmr)->uxTimerNumber )
482 #define TRACE_SET_TIMER_NUMBER(tmr) ((Timer_t*)tmr)->uxTimerNumber = xTraceGetObjectHandle(TRACE_CLASS_TIMER);
483 #define TRACE_GET_TIMER_NAME(pxTimer) pxTimer->pcTimerName
484 #define TRACE_GET_TIMER_PERIOD(pxTimer) pxTimer->xTimerPeriodInTicks
485 
486 #define TRACE_GET_EVENTGROUP_NUMBER(eg) ( ( objectHandleType ) uxEventGroupGetNumber(eg) )
487 #define TRACE_SET_EVENTGROUP_NUMBER(eg) ((EventGroup_t*)eg)->uxEventGroupNumber = xTraceGetObjectHandle(TRACE_CLASS_EVENTGROUP);
488 
489 #define TRACE_GET_OBJECT_NUMBER(CLASS, pxObject) (prvTraceGetObjectNumber(pxObject))
490 
491 #if (FREERTOS_VERSION < FREERTOS_VERSION_8_0_OR_LATER)
492  #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->ucQueueNumber = xTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject));
493 #else
494  #define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) pxObject->uxQueueNumber = xTraceGetObjectHandle(TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject));
495 #endif
496 
497 #define TRACE_GET_CLASS_EVENT_CODE(SERVICE, RESULT, CLASS, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass))
498 #define TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject))
499 #define TRACE_GET_TASK_EVENT_CODE(SERVICE, RESULT, CLASS, pxTCB) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_CLASS_TASK)
500 
501 /************************************************************************/
502 /* KERNEL SPECIFIC WRAPPERS THAT SHOULD BE CALLED BY THE KERNEL */
503 /************************************************************************/
504 
505 #if (configUSE_TICKLESS_IDLE != 0)
506 
507 #undef traceLOW_POWER_IDLE_BEGIN
508 #define traceLOW_POWER_IDLE_BEGIN() \
509  { \
510  extern uint32_t trace_disable_timestamp; \
511  vTraceStoreLowPower(0); \
512  trace_disable_timestamp = 1; \
513  }
514 
515 #undef traceLOW_POWER_IDLE_END
516 #define traceLOW_POWER_IDLE_END() \
517  { \
518  extern uint32_t trace_disable_timestamp; \
519  trace_disable_timestamp = 0; \
520  vTraceStoreLowPower(1); \
521  }
522 
523 #endif
524 
525 /* A macro that will update the tick count when returning from tickless idle */
526 #undef traceINCREASE_TICK_COUNT
527 /* 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.*/
528 #define traceINCREASE_TICK_COUNT( xCount ) { DWT_CYCLES_ADDED += (xCount * (TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ)); }
529 
530 /* Called for each task that becomes ready */
531 #undef traceMOVED_TASK_TO_READY_STATE
532 #define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \
533  trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB);
534 
535 /* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */
536 #undef traceTASK_INCREMENT_TICK
537 
538 #if (FREERTOS_VERSION == FREERTOS_VERSION_7_3_OR_7_4)
539 
540 #define traceTASK_INCREMENT_TICK( xTickCount ) \
541  if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxMissedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \
542  if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); }
543 
544 #else
545 
546 #define traceTASK_INCREMENT_TICK( xTickCount ) \
547  if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdTRUE || uxPendedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \
548  if (uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); }
549 
550 #endif
551 
552 /* Called on each task-switch */
553 #undef traceTASK_SWITCHED_IN
554 #define traceTASK_SWITCHED_IN() \
555  trcKERNEL_HOOKS_TASK_SWITCH(TRACE_GET_CURRENT_TASK());
556 
557 /* Called on vTaskSuspend */
558 #undef traceTASK_SUSPEND
559 #define traceTASK_SUSPEND( pxTaskToSuspend ) \
560  trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend);
561 
562 /* Called from special case with timer only */
563 #undef traceTASK_DELAY_SUSPEND
564 #define traceTASK_DELAY_SUSPEND( pxTaskToSuspend ) \
565  trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend); \
566  trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
567 
568 /* Called on vTaskDelay - note the use of FreeRTOS variable xTicksToDelay */
569 #undef traceTASK_DELAY
570 #define traceTASK_DELAY() \
571  trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY, pxCurrentTCB, xTicksToDelay); \
572  trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
573 
574 /* Called on vTaskDelayUntil - note the use of FreeRTOS variable xTimeToWake */
575 #undef traceTASK_DELAY_UNTIL
576 #define traceTASK_DELAY_UNTIL( xTickTimeToWake ) \
577  trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, ( xTickTimeToWake)); \
578  trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
579 
580 #if (INCLUDE_OBJECT_DELETE == 1)
581 /* Called on vTaskDelete */
582 #undef traceTASK_DELETE
583 #define traceTASK_DELETE( pxTaskToDelete ) \
584  { TRACE_SR_ALLOC_CRITICAL_SECTION(); \
585  TRACE_ENTER_CRITICAL_SECTION(); \
586  trcKERNEL_HOOKS_TASK_DELETE(DELETE_OBJ, pxTaskToDelete); \
587  TRACE_EXIT_CRITICAL_SECTION(); }
588 #endif
589 
590 #if (INCLUDE_OBJECT_DELETE == 1)
591 /* Called on vQueueDelete */
592 #undef traceQUEUE_DELETE
593 #define traceQUEUE_DELETE( pxQueue ) \
594  { TRACE_SR_ALLOC_CRITICAL_SECTION(); \
595  TRACE_ENTER_CRITICAL_SECTION(); \
596  trcKERNEL_HOOKS_OBJECT_DELETE(DELETE_OBJ, UNUSED, pxQueue); \
597  TRACE_EXIT_CRITICAL_SECTION(); }
598 #endif
599 
600 /* Called on vTaskCreate */
601 #undef traceTASK_CREATE
602 #define traceTASK_CREATE(pxNewTCB) \
603  if (pxNewTCB != NULL) \
604  { \
605  trcKERNEL_HOOKS_TASK_CREATE(CREATE_OBJ, UNUSED, pxNewTCB); \
606  }
607 
608 /* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */
609 #undef traceTASK_CREATE_FAILED
610 #define traceTASK_CREATE_FAILED() \
611  trcKERNEL_HOOKS_TASK_CREATE_FAILED(CREATE_OBJ, UNUSED);
612 
613 /* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */
614 #undef traceQUEUE_CREATE
615 #define traceQUEUE_CREATE( pxNewQueue )\
616  trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, UNUSED, pxNewQueue);
617 
618 /* Called in xQueueCreate, if the queue creation fails */
619 #undef traceQUEUE_CREATE_FAILED
620 #define traceQUEUE_CREATE_FAILED( queueType ) \
621  trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, UNUSED, queueType);
622 
623 /* Called in xQueueCreateMutex, and thereby also from xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex */
624 #undef traceCREATE_MUTEX
625 #define traceCREATE_MUTEX( pxNewQueue ) \
626  trcKERNEL_HOOKS_OBJECT_CREATE(CREATE_OBJ, UNUSED, pxNewQueue);
627 
628 /* Called in xQueueCreateMutex when the operation fails (when memory allocation fails) */
629 #undef traceCREATE_MUTEX_FAILED
630 #define traceCREATE_MUTEX_FAILED() \
631  trcKERNEL_HOOKS_OBJECT_CREATE_FAILED(CREATE_OBJ, UNUSED, queueQUEUE_TYPE_MUTEX);
632 
633 /* Called when the Mutex can not be given, since not holder */
634 #undef traceGIVE_MUTEX_RECURSIVE_FAILED
635 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ) \
636  trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, UNUSED, pxMutex);
637 
638 /* Called when a message is sent to a queue */ /* CS IS NEW ! */
639 #undef traceQUEUE_SEND
640 #define traceQUEUE_SEND( pxQueue ) \
641  trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, SUCCESS, UNUSED, pxQueue); \
642  trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, pxQueue) == TRACE_CLASS_MUTEX ? (uint8_t)0 : (uint8_t)(pxQueue->uxMessagesWaiting + 1));
643 
644 /* Called when a message failed to be sent to a queue (timeout) */
645 #undef traceQUEUE_SEND_FAILED
646 #define traceQUEUE_SEND_FAILED( pxQueue ) \
647  trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, FAILED, UNUSED, pxQueue);
648 
649 /* Called when the task is blocked due to a send operation on a full queue */
650 #undef traceBLOCKING_ON_QUEUE_SEND
651 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \
652  trcKERNEL_HOOKS_KERNEL_SERVICE(SEND, BLOCK, UNUSED, pxQueue);
653 
654 /* Called when a message is received from a queue */
655 #undef traceQUEUE_RECEIVE
656 #define traceQUEUE_RECEIVE( pxQueue ) \
657  trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, SUCCESS, UNUSED, pxQueue); \
658  trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, pxQueue) == TRACE_CLASS_MUTEX ? TRACE_GET_TASK_NUMBER(TRACE_GET_CURRENT_TASK()) : (uint8_t)(pxQueue->uxMessagesWaiting - 1));
659 
660 /* Called when a receive operation on a queue fails (timeout) */
661 #undef traceQUEUE_RECEIVE_FAILED
662 #define traceQUEUE_RECEIVE_FAILED( pxQueue ) \
663  trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, FAILED, UNUSED, pxQueue);
664 
665 /* Called when the task is blocked due to a receive operation on an empty queue */
666 #undef traceBLOCKING_ON_QUEUE_RECEIVE
667 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \
668  trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE, BLOCK, UNUSED, pxQueue); \
669  if (TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, pxQueue) != TRACE_CLASS_MUTEX) \
670  {trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();}
671 
672 /* Called on xQueuePeek */
673 #undef traceQUEUE_PEEK
674 #define traceQUEUE_PEEK( pxQueue ) \
675  trcKERNEL_HOOKS_KERNEL_SERVICE(PEEK, SUCCESS, UNUSED, pxQueue);
676 
677 /* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */
678 #undef traceQUEUE_SEND_FROM_ISR
679 #define traceQUEUE_SEND_FROM_ISR( pxQueue ) \
680  trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, SUCCESS, UNUSED, pxQueue); \
681  trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting + 1));
682 
683 /* Called when a message send from interrupt context fails (since the queue was full) */
684 #undef traceQUEUE_SEND_FROM_ISR_FAILED
685 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \
686  trcKERNEL_HOOKS_KERNEL_SERVICE(SEND_FROM_ISR, FAILED, UNUSED, pxQueue);
687 
688 /* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */
689 #undef traceQUEUE_RECEIVE_FROM_ISR
690 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \
691  trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, SUCCESS, UNUSED, pxQueue); \
692  trcKERNEL_HOOKS_SET_OBJECT_STATE(UNUSED, pxQueue, (uint8_t)(pxQueue->uxMessagesWaiting - 1));
693 
694 /* Called when a message receive from interrupt context fails (since the queue was empty) */
695 #undef traceQUEUE_RECEIVE_FROM_ISR_FAILED
696 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \
697  trcKERNEL_HOOKS_KERNEL_SERVICE(RECEIVE_FROM_ISR, FAILED, UNUSED, pxQueue);
698 
699 /* Called in vTaskPrioritySet */
700 #undef traceTASK_PRIORITY_SET
701 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \
702  trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_SET, pxTask, uxNewPriority);
703 
704 /* Called in vTaskPriorityInherit, which is called by Mutex operations */
705 #undef traceTASK_PRIORITY_INHERIT
706 #define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \
707  trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_INHERIT, pxTask, uxNewPriority);
708 
709 /* Called in vTaskPriorityDisinherit, which is called by Mutex operations */
710 #undef traceTASK_PRIORITY_DISINHERIT
711 #define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \
712  trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_DISINHERIT, pxTask, uxNewPriority);
713 
714 /* Called in vTaskResume */
715 #undef traceTASK_RESUME
716 #define traceTASK_RESUME( pxTaskToResume ) \
717  trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME, pxTaskToResume);
718 
719 /* Called in vTaskResumeFromISR */
720 #undef traceTASK_RESUME_FROM_ISR
721 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \
722  trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME_FROM_ISR, pxTaskToResume);
723 
724 
725 #if (FREERTOS_VERSION >= FREERTOS_VERSION_8_0_OR_LATER)
726 
727 #if (INCLUDE_MEMMANG_EVENTS == 1)
728 
729 extern void vTraceStoreMemMangEvent(uint32_t ecode, uint32_t address, int32_t size);
730 
731 #undef traceMALLOC
732 #define traceMALLOC( pvAddress, uiSize ) {if (pvAddress != 0) vTraceStoreMemMangEvent(MEM_MALLOC_SIZE, ( uint32_t ) pvAddress, (int32_t)uiSize); }
733 
734 #undef traceFREE
735 #define traceFREE( pvAddress, uiSize ) {vTraceStoreMemMangEvent(MEM_FREE_SIZE, ( uint32_t ) pvAddress, (int32_t)(-uiSize)); }
736 
737 #endif
738 
739 /* Called in timer.c - xTimerCreate */
740 #undef traceTIMER_CREATE
741 #define traceTIMER_CREATE(tmr) \
742  trcKERNEL_HOOKS_TIMER_CREATE(TIMER_CREATE, tmr);
743 
744 #undef traceTIMER_CREATE_FAILED
745 #define traceTIMER_CREATE_FAILED() \
746  trcKERNEL_HOOKS_TIMER_EVENT(TIMER_CREATE_FAILED, 0);
747 
748 /* Note that xCommandID can never be tmrCOMMAND_EXECUTE_CALLBACK (-1) since the trace macro is not called in that case */
749 #undef traceTIMER_COMMAND_SEND
750 #define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \
751 if (xCommandID > tmrCOMMAND_START_DONT_TRACE){\
752  if (xCommandID == tmrCOMMAND_CHANGE_PERIOD) vTraceStoreKernelCallWithParam((xReturn == pdPASS) ? TIMER_CHANGE_PERIOD : TIMER_CHANGE_PERIOD_FAILED, TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(tmr), xOptionalValue);\
753  else if ((xCommandID == tmrCOMMAND_DELETE) && (xReturn == pdPASS)){ trcKERNEL_HOOKS_TIMER_DELETE(TIMER_DELETE, tmr); } \
754  else {trcKERNEL_HOOKS_TIMER_EVENT(EVENTGROUP_TIMER + xCommandID + ((xReturn == pdPASS)?0:(TIMER_CREATE_FAILED - TIMER_CREATE)), tmr); }\
755 }
756 
757 #undef tracePEND_FUNC_CALL
758 #define tracePEND_FUNC_CALL(func, arg1, arg2, ret) \
759 if (ret == pdPASS) \
760  vTraceStoreKernelCall(PEND_FUNC_CALL, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \
761 else \
762  vTraceStoreKernelCall(PEND_FUNC_CALL_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) );
763 
764 #undef tracePEND_FUNC_CALL_FROM_ISR
765 #define tracePEND_FUNC_CALL_FROM_ISR(func, arg1, arg2, ret) \
766  if (! uiInEventGroupSetBitsFromISR) vTraceStoreKernelCall(PEND_FUNC_CALL_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTimerGetTimerDaemonTaskHandle()) ); \
767  uiInEventGroupSetBitsFromISR = 0;
768 #endif
769 
770 #undef traceEVENT_GROUP_CREATE
771 #define traceEVENT_GROUP_CREATE(eg) \
772  TRACE_SET_EVENTGROUP_NUMBER(eg); \
773  vTraceStoreKernelCall(EVENT_GROUP_CREATE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg));
774 
775 #undef traceEVENT_GROUP_DELETE
776 #define traceEVENT_GROUP_DELETE(eg) \
777  vTraceStoreKernelCall(EVENT_GROUP_DELETE, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg)); \
778  vTraceStoreObjectNameOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \
779  vTraceStoreObjectPropertiesOnCloseEvent(TRACE_GET_EVENTGROUP_NUMBER(eg), TRACE_CLASS_EVENTGROUP); \
780  vTraceFreeObjectHandle(TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg));
781 
782 #undef traceEVENT_GROUP_CREATE_FAILED
783 #define traceEVENT_GROUP_CREATE_FAILED() \
784  vTraceStoreKernelCall(EVENT_GROUP_CREATE_FAILED, TRACE_CLASS_EVENTGROUP, 0);
785 
786 #undef traceEVENT_GROUP_SYNC_BLOCK
787 #define traceEVENT_GROUP_SYNC_BLOCK(eg, bitsToSet, bitsToWaitFor) \
788  vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor);
789 
790 #undef traceEVENT_GROUP_SYNC_END
791 #define traceEVENT_GROUP_SYNC_END(eg, bitsToSet, bitsToWaitFor, wasTimeout) \
792  if (wasTimeout){ vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor);} \
793  else{ vTraceStoreKernelCallWithParam(EVENT_GROUP_SYNC_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); }
794 
795 #undef traceEVENT_GROUP_WAIT_BITS_BLOCK
796 #define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor) \
797  vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_BLOCK, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); \
798  trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
799 
800 #undef traceEVENT_GROUP_WAIT_BITS_END
801 #define traceEVENT_GROUP_WAIT_BITS_END(eg, bitsToWaitFor, wasTimeout) \
802  if (wasTimeout){ vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END_FAILED, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); } \
803  else{ vTraceStoreKernelCallWithParam(EVENT_GROUP_WAIT_BITS_END, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToWaitFor); }
804 
805 #undef traceEVENT_GROUP_CLEAR_BITS
806 #define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \
807  if (bitsToClear) vTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear);
808 
809 #undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
810 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \
811  if (bitsToClear) vTraceStoreKernelCallWithParam(EVENT_GROUP_CLEAR_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToClear);
812 
813 #undef traceEVENT_GROUP_SET_BITS
814 #define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \
815  vTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet);
816 
817 #undef traceEVENT_GROUP_SET_BITS_FROM_ISR
818 #define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \
819  vTraceStoreKernelCallWithParam(EVENT_GROUP_SET_BITS_FROM_ISR, TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(eg), bitsToSet); \
820  uiInEventGroupSetBitsFromISR = 1;
821 
822 #undef traceTASK_NOTIFY_TAKE
823 #define traceTASK_NOTIFY_TAKE() \
824  if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \
825  vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \
826  else \
827  vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait);
828 
829 #undef traceTASK_NOTIFY_TAKE_BLOCK
830 #define traceTASK_NOTIFY_TAKE_BLOCK() \
831  vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_TAKE_BLOCK, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \
832  trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
833 
834 #undef traceTASK_NOTIFY_WAIT
835 #define traceTASK_NOTIFY_WAIT() \
836  if (pxCurrentTCB->ucNotifyState == taskNOTIFICATION_RECEIVED) \
837  vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \
838  else \
839  vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_FAILED, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait);
840 
841 #undef traceTASK_NOTIFY_WAIT_BLOCK
842 #define traceTASK_NOTIFY_WAIT_BLOCK() \
843  vTraceStoreKernelCallWithParam(TRACE_TASK_NOTIFY_WAIT_BLOCK, TRACE_CLASS_TASK, uxTaskGetTaskNumber(pxCurrentTCB), xTicksToWait); \
844  trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
845 
846 #undef traceTASK_NOTIFY
847 #define traceTASK_NOTIFY() \
848  vTraceStoreKernelCall(TRACE_TASK_NOTIFY, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify));
849 
850 #undef traceTASK_NOTIFY_FROM_ISR
851 #define traceTASK_NOTIFY_FROM_ISR() \
852  vTraceStoreKernelCall(TRACE_TASK_NOTIFY_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify));
853 
854 #undef traceTASK_NOTIFY_GIVE_FROM_ISR
855 #define traceTASK_NOTIFY_GIVE_FROM_ISR() \
856  vTraceStoreKernelCall(TRACE_TASK_NOTIFY_GIVE_FROM_ISR, TRACE_CLASS_TASK, uxTaskGetTaskNumber(xTaskToNotify));
857 
858 /************************************************************************/
859 /* KERNEL SPECIFIC MACROS TO EXCLUDE OR INCLUDE THINGS IN TRACE */
860 /************************************************************************/
861 
862 /* Returns the exclude state of the object */
863 uint8_t uiTraceIsObjectExcluded(traceObjectClass objectclass, objectHandleType handle);
864 
865 #define TRACE_SET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, queueIndex)
866 #define TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, queueIndex)
867 #define TRACE_GET_QUEUE_FLAG_ISEXCLUDED(queueIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, queueIndex)
868 
869 #define TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex)
870 #define TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex)
871 #define TRACE_GET_SEMAPHORE_FLAG_ISEXCLUDED(semaphoreIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+semaphoreIndex)
872 
873 #define TRACE_SET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex)
874 #define TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex)
875 #define TRACE_GET_MUTEX_FLAG_ISEXCLUDED(mutexIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+mutexIndex)
876 
877 #define TRACE_SET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex)
878 #define TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex)
879 #define TRACE_GET_TASK_FLAG_ISEXCLUDED(taskIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+taskIndex)
880 
881 #define TRACE_SET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex)
882 #define TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex)
883 #define TRACE_GET_TIMER_FLAG_ISEXCLUDED(timerIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+timerIndex)
884 
885 #define TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_SET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex)
886 #define TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_CLEAR_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex)
887 #define TRACE_GET_EVENTGROUP_FLAG_ISEXCLUDED(egIndex) TRACE_GET_FLAG_ISEXCLUDED(excludedObjects, NQueue+1+NSemaphore+1+NMutex+1+NTask+1+NTimer+1+egIndex)
888 
889 
890 #define TRACE_CLEAR_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \
891 switch (objectclass) \
892 { \
893 case TRACE_CLASS_QUEUE: \
894  TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(handle); \
895  break; \
896 case TRACE_CLASS_SEMAPHORE: \
897  TRACE_CLEAR_SEMAPHORE_FLAG_ISEXCLUDED(handle); \
898  break; \
899 case TRACE_CLASS_MUTEX: \
900  TRACE_CLEAR_MUTEX_FLAG_ISEXCLUDED(handle); \
901  break; \
902 case TRACE_CLASS_TASK: \
903  TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(handle); \
904  break; \
905 case TRACE_CLASS_TIMER: \
906  TRACE_CLEAR_TIMER_FLAG_ISEXCLUDED(handle); \
907  break; \
908 case TRACE_CLASS_EVENTGROUP: \
909  TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(handle); \
910  break; \
911 }
912 
913 #define TRACE_SET_OBJECT_FLAG_ISEXCLUDED(objectclass, handle) \
914 switch (objectclass) \
915 { \
916 case TRACE_CLASS_QUEUE: \
917  TRACE_SET_QUEUE_FLAG_ISEXCLUDED(handle); \
918  break; \
919 case TRACE_CLASS_SEMAPHORE: \
920  TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(handle); \
921  break; \
922 case TRACE_CLASS_MUTEX: \
923  TRACE_SET_MUTEX_FLAG_ISEXCLUDED(handle); \
924  break; \
925 case TRACE_CLASS_TASK: \
926  TRACE_SET_TASK_FLAG_ISEXCLUDED(handle); \
927  break; \
928 case TRACE_CLASS_TIMER: \
929  TRACE_SET_TIMER_FLAG_ISEXCLUDED(handle); \
930  break; \
931 case TRACE_CLASS_EVENTGROUP: \
932  TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(handle); \
933  break; \
934 }
935 
936 /* Task */
937 #define vTraceExcludeTaskFromTrace(handle) \
938 TRACE_SET_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(handle));
939 
940 #define vTraceIncludeTaskInTrace(handle) \
941 TRACE_CLEAR_TASK_FLAG_ISEXCLUDED(TRACE_GET_TASK_NUMBER(handle));
942 
943 
944 /* Queue */
945 #define vTraceExcludeQueueFromTrace(handle) \
946 TRACE_SET_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));
947 
948 #define vTraceIncludeQueueInTrace(handle) \
949 TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));
950 
951 
952 /* Semaphore */
953 #define vTraceExcludeSemaphoreFromTrace(handle) \
954 TRACE_SET_SEMAPHORE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));
955 
956 #define vTraceIncludeSemaphoreInTrace(handle) \
957 TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));
958 
959 
960 /* Mutex */
961 #define vTraceExcludeMutexFromTrace(handle) \
962 TRACE_SET_MUTEX_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));
963 
964 #define vTraceIncludeMutexInTrace(handle) \
965 TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_OBJECT_NUMBER(UNUSED, handle));
966 
967 /* Timer */
968 #define vTraceExcludeTimerFromTrace(handle) \
969 TRACE_SET_TIMER_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(handle));
970 
971 #define vTraceIncludeTimerInTrace(handle) \
972 TRACE_CLEAR_QUEUE_FLAG_ISEXCLUDED(TRACE_GET_TIMER_NUMBER(handle));
973 
974 /* Event Group */
975 #define vTraceExcludeEventGroupFromTrace(handle) \
976 TRACE_SET_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(handle));
977 
978 #define vTraceIncludeEventGroupInTrace(handle) \
979 TRACE_CLEAR_EVENTGROUP_FLAG_ISEXCLUDED(TRACE_GET_EVENTGROUP_NUMBER(handle));
980 
981 
982 /* Kernel Services */
983 #define vTraceExcludeKernelServiceDelayFromTrace() \
984 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \
985 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL);
986 
987 #define vTraceIncludeKernelServiceDelayInTrace() \
988 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY); \
989 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(TASK_DELAY_UNTIL);
990 
991 /* HELPER MACROS FOR KERNEL SERVICES FOR OBJECTS */
992 #define vTraceExcludeKernelServiceSendFromTrace_HELPER(class) \
993 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_SUCCESS + class); \
994 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_BLOCK + class); \
995 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FAILED + class); \
996 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_SUCCESS + class); \
997 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_FAILED + class);
998 
999 #define vTraceIncludeKernelServiceSendInTrace_HELPER(class) \
1000 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_SUCCESS + class); \
1001 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_BLOCK + class); \
1002 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FAILED + class); \
1003 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_SUCCESS + class); \
1004 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_SEND_FROM_ISR_FAILED + class);
1005 
1006 #define vTraceExcludeKernelServiceReceiveFromTrace_HELPER(class) \
1007 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_SUCCESS + class); \
1008 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_BLOCK + class); \
1009 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FAILED + class); \
1010 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + class); \
1011 TRACE_SET_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_FAILED + class);
1012 
1013 #define vTraceIncludeKernelServiceReceiveInTrace_HELPER(class) \
1014 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_SUCCESS + class); \
1015 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_BLOCK + class); \
1016 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FAILED + class); \
1017 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_SUCCESS + class); \
1018 TRACE_CLEAR_EVENT_CODE_FLAG_ISEXCLUDED(EVENTGROUP_RECEIVE_FROM_ISR_FAILED + class);
1019 
1020 /* EXCLUDE AND INCLUDE FOR QUEUE */
1021 #define vTraceExcludeKernelServiceQueueSendFromTrace() \
1022 vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_QUEUE);
1023 
1024 #define vTraceIncludeKernelServiceQueueSendInTrace() \
1025 vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_QUEUE);
1026 
1027 #define vTraceExcludeKernelServiceQueueReceiveFromTrace() \
1028 vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_QUEUE);
1029 
1030 #define vTraceIncludeKernelServiceQueueReceiveInTrace() \
1031 vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_QUEUE);
1032 
1033 /* EXCLUDE AND INCLUDE FOR SEMAPHORE */
1034 #define vTraceExcludeKernelServiceSemaphoreSendFromTrace() \
1035 vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_SEMAPHORE);
1036 
1037 #define vTraceIncludeKernelServicSemaphoreSendInTrace() \
1038 vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_SEMAPHORE);
1039 
1040 #define vTraceExcludeKernelServiceSemaphoreReceiveFromTrace() \
1041 vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_SEMAPHORE);
1042 
1043 #define vTraceIncludeKernelServiceSemaphoreReceiveInTrace() \
1044 vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_SEMAPHORE);
1045 
1046 /* EXCLUDE AND INCLUDE FOR MUTEX */
1047 #define vTraceExcludeKernelServiceMutexSendFromTrace() \
1048 vTraceExcludeKernelServiceSendFromTrace_HELPER(TRACE_CLASS_MUTEX);
1049 
1050 #define vTraceIncludeKernelServiceMutexSendInTrace() \
1051 vTraceIncludeKernelServiceSendInTrace_HELPER(TRACE_CLASS_MUTEX);
1052 
1053 #define vTraceExcludeKernelServiceMutexReceiveFromTrace() \
1054 vTraceExcludeKernelServiceReceiveFromTrace_HELPER(TRACE_CLASS_MUTEX);
1055 
1056 #define vTraceIncludeKernelServiceMutexReceiveInTrace() \
1057 vTraceIncludeKernelServiceReceiveInTrace_HELPER(TRACE_CLASS_MUTEX);
1058 
1059 /************************************************************************/
1060 /* KERNEL SPECIFIC MACROS TO NAME OBJECTS, IF NECESSARY */
1061 /************************************************************************/
1062 #define vTraceSetQueueName(object, name) \
1063 vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name);
1064 
1065 #define vTraceSetSemaphoreName(object, name) \
1066 vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name);
1067 
1068 #define vTraceSetMutexName(object, name) \
1069 vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name);
1070 
1071 #define vTraceSetEventGroupName(object, name) \
1072 vTraceSetObjectName(TRACE_CLASS_EVENTGROUP, (objectHandleType)uxEventGroupGetNumber(object), name);
1073 
1074 #undef traceQUEUE_REGISTRY_ADD
1075 #define traceQUEUE_REGISTRY_ADD(object, name) vTraceSetObjectName(TRACE_GET_OBJECT_TRACE_CLASS(UNUSED, object), TRACE_GET_OBJECT_NUMBER(UNUSED, object), name);
1076 #endif
1077 
1078 #endif /* TRCKERNELPORTFREERTOS_H_ */
int uiInEventGroupSetBitsFromISR
uint8_t objectHandleType
Definition: trcTypes.h:53
uint8_t traceObjectClass
Definition: trcTypes.h:56
To use the FreeRTOS so play with it a little *uses roughly of and uses roughly of RAM *The larger the size
Definition: readme.txt:4