1 /*
2  * Trace Recorder for Tracealyzer v4.8.1
3  * Copyright 2023 Percepio AB
4  * www.percepio.com
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * The Zephyr specific parts needed by the trace recorder
9  */
10 
11 #ifndef TRC_KERNEL_PORT_H
12 #define TRC_KERNEL_PORT_H
13 
14 #include <zephyr/kernel.h>
15 #include <version.h>
16 #include <trcRecorder.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 
23 /**
24  * @def TRACE_KERNEL_VERSION
25  * @brief This defines the kernel version/identity.
26  */
27 #define TRACE_KERNEL_VERSION 0x9AA9
28 
29 /**
30  * @def TRC_PLATFORM_CFG
31  * @brief This defines the basis for version specific lookup of
32  * platform configuration files. If left empty the default
33  * RTOS XML files are used.
34  */
35 #define TRC_PLATFORM_CFG "Zephyr"
36 
37 /**
38  * @def TRC_PLATFORM_CFG_MAJOR
39  * @brief Major release version for recorder.
40  */
41 #define TRC_PLATFORM_CFG_MAJOR 3
42 
43 /**
44  * @def TRC_PLATFORM_CFG_MINOR
45  * @brief Minor release version for recorder.
46  */
47 #define TRC_PLATFORM_CFG_MINOR 3
48 
49 /**
50  * @def TRC_PLATFORM_CFG_PATCH
51  * @brief Patchlevel release version for recorder.
52  */
53 #define TRC_PLATFORM_CFG_PATCH 0
54 
55 /**
56  * @def TRC_TICK_RATE_HZ
57  * @brief Trace RTOS tick rate in Hz.
58  */
59 #define TRC_TICK_RATE_HZ CONFIG_SYS_CLOCK_TICKS_PER_SEC
60 
61 /**
62  * @def TraceKernelPortTaskHandle_t
63  * @brief RTOS data type for tasks/threads.
64  */
65 #define TraceKernelPortTaskHandle_t struct k_thread
66 
67 extern TraceHeapHandle_t xSystemHeapHandle;
68 
69 /**
70  * @brief A structure representing the kernel port buffer.
71  */
72 typedef struct TraceKernelPortDataBuffer	/* Aligned */
73 {
74 	uint8_t buffer[sizeof(TraceHeapHandle_t) + sizeof(TraceKernelPortTaskHandle_t) + sizeof(TraceExtensionHandle_t) + 8];
75 } TraceKernelPortDataBuffer_t;
76 
77 /**
78  * @internal Kernel port initialize callback.
79  *
80  * This function is called by the recorder as part of its initialization phase.
81  *
82  * @param[in] pxBuffer Buffer
83  *
84  * @retval TRC_FAIL Initialization failed
85  * @retval TRC_SUCCESS Success
86  */
87 traceResult xTraceKernelPortInitialize(TraceKernelPortDataBuffer_t* pxBuffer);
88 
89 /**
90  * @brief Kernel port begin callback.
91  *
92  * This function is called by the recorder as part of its begin phase.
93  *
94  * @retval TRC_FAIL Enabling failed
95  * @retval TRC_SUCCESS Success
96  */
97 traceResult xTraceKernelPortEnable(void);
98 
99 /**
100  * @brief Get unused stack size for kernel port thread.
101  *
102  * @param[in] pvThread Thread
103  * @param[out] puxUnusedStack Unused stack
104  *
105  * @retval TRC_FAIL Failed to get size
106  * @retval TRC_SUCCESS Success
107  */
108 traceResult xTraceKernelPortGetUnusedStack(void* pvThread, TraceUnsignedBaseType_t* puxUnusedStack);
109 
110 /**
111  * @brief Get kernel port system heap handle.
112  *
113  * @return TraceHeapHandle_t
114  */
115 TraceHeapHandle_t xTraceKernelPortGetSystemHeapHandle(void);
116 
117 /**
118  * @brief Get kernel port scheduler suspended state
119  *
120  * @retval 0 Scheduler not suspended
121  * @retval 1 Scheduler suspended
122  */
123 unsigned char xTraceKernelPortIsSchedulerSuspended(void);
124 
125 /**
126  * @brief Sets kernel object name for display in Tracealyzer.
127  *
128  * @param[in] object Kernel object
129  * @param[in] name name
130  */
131 void vTraceSetKernelObjectName(void* object, const char* name);
132 
133 /**
134  * @brief Sets Work Queue name for display in Tracealyzer.
135  *
136  * @param[in] object Work queue object
137  * @param[in] name name
138  */
139 void vTraceSetWorkQueueName(void* object, const char* name);
140 
141 /**
142  * @brief Sets Heap name for display in Tracealyzer.
143  *
144  * @param[in] object Heap object
145  * @param[in] name name
146  */
147 void vTraceSetHeapName(void* object, const char* name);
148 
149 /**
150  * @brief Sets Semaphore name for display in Tracealyzer.
151  *
152  * @param[in] object Semaphore object
153  * @param[in] name name
154  */
155 void vTraceSetSemaphoreName(void* object, const char* name);
156 
157 /**
158  * @brief Sets Mutex name for display in Tracealyzer.
159  *
160  * @param[in] object Mutex object
161  * @param[in] name name
162  */
163 void vTraceSetMutexName(void* object, const char* name);
164 
165 /**
166  * @brief Sets Condvar name for display in Tracealyzer.
167  *
168  * @param[in] object Condvar object
169  * @param[in] name name
170  */
171 void vTraceSetCondvarName(void* object, const char* name);
172 
173 /**
174  * @brief Sets Queue name for display in Tracealyzer.
175  *
176  * @param[in] object Queue object
177  * @param[in] name name
178  */
179 void vTraceSetQueueName(void* object, const char* name);
180 
181 /**
182  * @brief Sets FIFO Queue name for display in Tracealyzer.
183  *
184  * @param[in] object FIFO Queue object
185  * @param[in] name name
186  */
187 void vTraceSetFIFOQueueName(void* object, const char* name);
188 
189 /**
190  * @brief Sets LIFO Queue name for display in Tracealyzer.
191  *
192  * @param[in] object LIFO Queue object
193  * @param[in] name name
194  */
195 void vTraceSetLIFOQueueName(void* object, const char* name);
196 
197 /**
198  * @brief Sets Stack name for display in Tracealyzer.
199  *
200  * @param[in] object Stack object
201  * @param[in] name name
202  */
203 void vTraceSetStackName(void* object, const char* name);
204 
205 /**
206  * @brief Sets Message Queue name for display in Tracealyzer.
207  *
208  * @param[in] object Message Queue object
209  * @param[in] name name
210  */
211 void vTraceSetMessageQueueName(void* object, const char* name);
212 
213 /**
214  * @brief Sets Mailbox name for display in Tracealyzer.
215  *
216  * @param[in] object Mailbox object
217  * @param[in] name name
218  */
219 void vTraceSetMailboxName(void* object, const char* name);
220 
221 /**
222  * @brief Sets Pipe name for display in Tracealyzer.
223  *
224  * @param[in] object Pipe object
225  * @param[in] name name
226  */
227 void vTraceSetPipeName(void* object, const char* name);
228 
229 /**
230  * @brief Sets Memory Heap name for display in Tracealyzer.
231  *
232  * @param[in] object Memory Heap object
233  * @param[in] name name
234  */
235 void vTraceSetMemoryHeapName(void* object, const char* name);
236 
237 /**
238  * @brief Sets Memory Slab name for display in Tracealyzer.
239  *
240  * @param[in] object Memory Slab object
241  * @param[in] name name
242  */
243 void vTraceSetMemorySlabName(void* object, const char* name);
244 
245 /**
246  * @brief Sets Timer name for display in Tracealyzer.
247  *
248  * @param[in] object Timer object
249  * @param[in] name name
250  */
251 void vTraceSetTimerName(void* object, const char* name);
252 
253 
254 /* Flag an error if the user is trying to use the tracerecorder in a version of
255  * Zephyr that predates the new tracing system on which the recorder relies
256  * (Zephyr 2.6.0).
257  */
258 #if ((KERNEL_VERSION_MAJOR) < 2)
259 	#error "Tracerecorder is not compatible with Zephyr versions older than v2.6.0"
260 #elif (((KERNEL_VERSION_MAJOR) == 2) && ((KERNEL_VERSION_MINOR) < 6))
261 	#error "Tracerecorder is not compatible with Zephyr versions lower than v2.6.0"
262 #endif
263 
264 /* Ensure that CONFIG_MEM_POOL has been set when the user selects dynamic
265  * allocation of the recorder buffer.
266  */
267 #if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)
268     /* While we could add CONFIG_KERNEL_MEM_POOL as a dependency for the
269 	 * dynamic allocation option, we have opted to output and error if
270 	 * the user have forgotten this since they also have to specify an
271 	 * appropriate size for the kernel memory pool.
272 	 */
273     #ifndef CONFIG_KERNEL_MEM_POOL
274         #error "Tracerecorder: You have choosen the TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC option without enabling KERNEL_MEM_POOL in Zephyr. Enable this option and allocate an appropriate size."
275     #endif
276 
277 	/**
278 	 * @internal Kernel port specific heap initialization
279 	 */
280 	#define TRC_KERNEL_PORT_HEAP_INIT(size)
281 
282 	/**
283 	 * @internal Kernel port specific heap malloc definition
284 	 */
285 	#define TRC_KERNEL_PORT_HEAP_MALLOC(size) k_malloc(size)
286 #endif
287 
288 
289 /**
290  * Define streaming event codes - should match the Tracealyzer config file
291  */
292 #define PSF_EVENT_NULL_EVENT								0x00
293 
294 #define PSF_EVENT_TRACE_START								0x01
295 #define PSF_EVENT_TS_CONFIG									0x02
296 #define PSF_EVENT_OBJ_NAME									0x03
297 
298 #define PSF_EVENT_TASK_PRIO_INHERIT							0x05
299 #define PSF_EVENT_TASK_PRIO_DISINHERIT						0x06
300 #define PSF_EVENT_DEFINE_ISR								0x07
301 
302 #define PSF_EVENT_THREAD_SCHED_WAKEUP						0xB6
303 #define PSF_EVENT_THREAD_SCHED_ABORT						0x20
304 #define PSF_EVENT_THREAD_SCHED_PRIORITY_SET					0x04
305 #define PSF_EVENT_THREAD_SCHED_READY						0x30
306 #define PSF_EVENT_THREAD_SCHED_PEND
307 #define PSF_EVENT_THREAD_SCHED_RESUME						0x7C
308 #define PSF_EVENT_THREAD_SCHED_SUSPEND						0x7B
309 
310 #define PSF_EVENT_THREAD_FOREACH_ENTER						0x09
311 #define PSF_EVENT_THREAD_FOREACH_EXIT						0x0B
312 #define PSF_EVENT_THREAD_FOREACH_UNLOCKED_ENTER				0x0A
313 #define PSF_EVENT_THREAD_FOREACH_UNLOCKED_EXIT				0xF2
314 #define PSF_EVENT_THREAD_INIT								0x10
315 #define PSF_EVENT_THREAD_USER_MODE_ENTER					0x0C
316 #define PSF_EVENT_THREAD_HEAP_ASSIGN						0xFC
317 #define PSF_EVENT_THREAD_JOIN_SUCCESS						0xB0
318 #define PSF_EVENT_THREAD_JOIN_BLOCKING						0xB2
319 #define PSF_EVENT_THREAD_JOIN_TIMEOUT						0xB1
320 #define PSF_EVENT_THREAD_SLEEP_ENTER						0x2A
321 #define PSF_EVENT_THREAD_SLEEP_EXIT							0x2B
322 #define PSF_EVENT_THREAD_MSLEEP_ENTER						0x2C
323 #define PSF_EVENT_THREAD_MSLEEP_EXIT						0x2D
324 #define PSF_EVENT_THREAD_USLEEP_ENTER						0x2E
325 #define PSF_EVENT_THREAD_USLEEP_EXIT						0x2F
326 #define PSF_EVENT_THREAD_BUSY_WAIT_ENTER					0xB4
327 #define PSF_EVENT_THREAD_BUSY_WAIT_EXIT						0xF3
328 #define PSF_EVENT_THREAD_YIELD								0xB5
329 #define PSF_EVENT_THREAD_WAKEUP								0x15D
330 #define PSF_EVENT_THREAD_ABORT								0x15E
331 #define PSF_EVENT_THREAD_START								0xB3
332 #define PSF_EVENT_THREAD_SET_PRIORITY						0x15F
333 #define PSF_EVENT_THREAD_SUSPEND							0x161
334 #define PSF_EVENT_THREAD_RESUME								0x160
335 #define PSF_EVENT_THREAD_SCHED_LOCK							0xB7
336 #define PSF_EVENT_THREAD_SCHED_UNLOCK						0xB8
337 
338 #define PSF_EVENT_WORK_INIT									0x11E
339 #define PSF_EVENT_WORK_SUBMIT_TO_QUEUE_SUCCESS				0x11F
340 #define PSF_EVENT_WORK_SUBMIT_TO_QUEUE_BLOCKING				0x120
341 #define PSF_EVENT_WORK_SUBMIT_TO_QUEUE_FAILURE				0x121
342 #define PSF_EVENT_WORK_SUBMIT_SUCCESS						0x122
343 #define PSF_EVENT_WORK_SUBMIT_BLOCKING						0x123
344 #define PSF_EVENT_WORK_SUBMIT_FAILURE						0x124
345 #define PSF_EVENT_WORK_FLUSH_SUCCESS						0x125
346 #define PSF_EVENT_WORK_FLUSH_BLOCKING						0x126
347 #define PSF_EVENT_WORK_FLUSH_FAILURE						0x127
348 #define PSF_EVENT_WORK_CANCEL_SUCCESS						0x128
349 #define PSF_EVENT_WORK_CANCEL_BLOCKING						0x129
350 #define PSF_EVENT_WORK_CANCEL_FAILURE						0x12A
351 #define PSF_EVENT_WORK_CANCEL_SYNC_SUCCESS					0x12B
352 #define PSF_EVENT_WORK_CANCEL_SYNC_BLOCKING					0x12C
353 #define PSF_EVENT_WORK_CANCEL_SYNC_FAILURE					0x12D
354 
355 #define PSF_EVENT_WORK_QUEUE_START_SUCCESS					0x12E
356 #define PSF_EVENT_WORK_QUEUE_START_BLOCKING					0x12F
357 #define PSF_EVENT_WORK_QUEUE_START_FAILURE					0x130
358 #define PSF_EVENT_WORK_QUEUE_DRAIN_SUCCESS					0x131
359 #define PSF_EVENT_WORK_QUEUE_DRAIN_BLOCKING					0x132
360 #define PSF_EVENT_WORK_QUEUE_DRAIN_FAILURE					0x133
361 #define PSF_EVENT_WORK_QUEUE_UNPLUG_SUCCESS					0x134
362 #define PSF_EVENT_WORK_QUEUE_UNPLUG_BLOCKING				0x135
363 #define PSF_EVENT_WORK_QUEUE_UNPLUG_FAILURE					0x136
364 
365 #define PSF_EVENT_DWORK_INIT								0x137
366 #define PSF_EVENT_DWORK_SCHEDULE_FOR_QUEUE_SUCCESS 			0x138
367 #define PSF_EVENT_DWORK_SCHEDULE_FOR_QUEUE_BLOCKING 		0x139
368 #define PSF_EVENT_DWORK_SCHEDULE_FOR_QUEUE_FAILURE			0x13A
369 #define PSF_EVENT_DWORK_SCHEDULE_SUCCESS					0x13B
370 #define PSF_EVENT_DWORK_SCHEDULE_BLOCKING					0x13C
371 #define PSF_EVENT_DWORK_SCHEDULE_FAILURE					0x13D
372 #define PSF_EVENT_DWORK_RESCHEDULE_FOR_QUEUE_SUCCESS		0x13E
373 #define PSF_EVENT_DWORK_RESCHEDULE_FOR_QUEUE_BLOCKING		0x13F
374 #define PSF_EVENT_DWORK_RESCHEDULE_FOR_QUEUE_FAILURE		0x140
375 #define PSF_EVENT_DWORK_RESCHEDULE_SUCCESS					0x141
376 #define PSF_EVENT_DWORK_RESCHEDULE_BLOCKING					0x142
377 #define PSF_EVENT_DWORK_RESCHEDULE_FAILURE					0x143
378 #define PSF_EVENT_DWORK_FLUSH_SUCCESS						0x144
379 #define PSF_EVENT_DWORK_FLUSH_BLOCKING						0x145
380 #define PSF_EVENT_DWORK_FLUSH_FAILURE						0x146
381 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_SUCCESS			0x147
382 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_BLOCKING			0x148
383 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_FAILURE			0x149
384 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_SYNC_SUCCESS		0x14A
385 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_SYNC_BLOCKING		0x14B
386 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_SYNC_FAILURE		0x14C
387 
388 #define PSF_EVENT_UWORK_INIT								0x14D
389 #define PSF_EVENT_UWORK_SUBMIT_TO_QUEUE_SUCCESS				0x14E
390 #define PSF_EVENT_UWORK_SUBMIT_TO_QUEUE_BLOCKING			0x14F
391 #define PSF_EVENT_UWORK_SUBMIT_TO_QUEUE_FAILURE				0x150
392 
393 #define PSF_EVENT_UWORK_QUEUE_START_ENTER					0x151
394 #define PSF_EVENT_UWORK_QUEUE_START_EXIT					0x152
395 
396 #define PSF_EVENT_PWORK_INIT_ENTER							0x153
397 #define PSF_EVENT_PWORK_INIT_EXIT							0x166
398 #define PSF_EVENT_PWORK_SUBMIT_TO_QUEUE_SUCCESS				0x154
399 #define PSF_EVENT_PWORK_SUBMIT_TO_QUEUE_BLOCKING			0x155
400 #define PSF_EVENT_PWORK_SUBMIT_TO_QUEUE_FAILURE				0x156
401 #define PSF_EVENT_PWORK_SUBMIT_SUCCESS						0x157
402 #define PSF_EVENT_PWORK_SUBMIT_BLOCKING						0x158
403 #define PSF_EVENT_PWORK_SUBMIT_FAILURE						0x159
404 #define PSF_EVENT_PWORK_CANCEL_SUCCESS						0x15A
405 #define PSF_EVENT_PWORK_CANCEL_BLOCKING						0x15B
406 #define PSF_EVENT_PWORK_CANCEL_FAILURE						0x15C
407 
408 #define PSF_EVENT_ISR_ENTER									0x162
409 #define PSF_EVENT_ISR_EXIT									0x163
410 #define PSF_EVENT_ISR_EXIT_TO_SCHEDULER						0x164
411 
412 #define PSF_EVENT_POLL_EVENT_INIT							0x82
413 #define PSF_EVENT_POLL_POLL_SUCCESS							0x8F
414 #define PSF_EVENT_POLL_POLL_BLOCKING						0x11
415 #define PSF_EVENT_POLL_POLL_FAILURE							0x0D
416 #define PSF_EVENT_POLL_SIGNAL_INIT							0x83
417 #define PSF_EVENT_POLL_SIGNAL_RESET							0x8D
418 #define PSF_EVENT_POLL_SIGNAL_CHECK							0xF0
419 #define PSF_EVENT_POLL_SIGNAL_RAISE_SUCCESS					0x8E
420 #define PSF_EVENT_POLL_SIGNAL_RAISE_FAILURE					0xEF
421 
422 #define PSF_EVENT_QUEUE_INIT								0xC0
423 #define PSF_EVENT_QUEUE_CANCEL_WAIT							0xC1
424 #define PSF_EVENT_QUEUE_QUEUE_INSERT_SUCCESS				0xBC		// Only tracked when there is a queue allocation event
425 #define PSF_EVENT_QUEUE_QUEUE_INSERT_BLOCKING				0xBD		// Only tracked when there is a queue allocation event
426 #define PSF_EVENT_QUEUE_QUEUE_INSERT_FAILURE				0xBE		// Only tracked when there is a queue allocation event
427 #define PSF_EVENT_QUEUE_APPEND								0xC2
428 #define PSF_EVENT_QUEUE_ALLOC_APPEND_SUCCESS				0xC3
429 #define PSF_EVENT_QUEUE_ALLOC_APPEND_BLOCKING				0xF1
430 #define PSF_EVENT_QUEUE_ALLOC_APPEND_FAILURE				0xC4
431 #define PSF_EVENT_QUEUE_PREPEND								0xC5
432 #define PSF_EVENT_QUEUE_ALLOC_PREPEND_SUCCESS				0xC6
433 #define PSF_EVENT_QUEUE_ALLOC_PREPEND_BLOCKING				0xBF
434 #define PSF_EVENT_QUEUE_ALLOC_PREPEND_FAILURE				0xC7
435 #define PSF_EVENT_QUEUE_INSERT								0xC8
436 #define PSF_EVENT_QUEUE_APPEND_LIST_SUCCESS					0xC9
437 #define PSF_EVENT_QUEUE_APPEND_LIST_BLOCKING				0x165
438 #define PSF_EVENT_QUEUE_APPEND_LIST_FAILURE					0xCA
439 #define PSF_EVENT_QUEUE_MERGE_SLIST_SUCCESS					0xCB
440 #define PSF_EVENT_QUEUE_MERGE_SLIST_BLOCKING				0x6E
441 #define PSF_EVENT_QUEUE_MERGE_SLIST_FAILURE					0xCC
442 #define PSF_EVENT_QUEUE_GET_SUCCESS							0xCD
443 #define PSF_EVENT_QUEUE_GET_BLOCKING						0xCE
444 #define PSF_EVENT_QUEUE_GET_TIMEOUT							0xCF
445 #define PSF_EVENT_QUEUE_REMOVE_SUCCESS						0xD0
446 #define PSF_EVENT_QUEUE_REMOVE_BLOCKING						0xDB
447 #define PSF_EVENT_QUEUE_REMOVE_FAILURE						0xD1
448 #define PSF_EVENT_QUEUE_UNIQUE_APPEND_SUCCESS				0xD2
449 #define PSF_EVENT_QUEUE_UNIQUE_APPEND_BLOCKING				0xEE
450 #define PSF_EVENT_QUEUE_UNIQUE_APPEND_FAILURE				0xB9
451 #define PSF_EVENT_QUEUE_PEEK_HEAD							0xBA
452 #define PSF_EVENT_QUEUE_PEEK_TAIL							0xBB
453 
454 #define PSF_EVENT_FIFO_INIT_ENTER							0x100
455 #define PSF_EVENT_FIFO_INIT_EXIT							0x101
456 #define PSF_EVENT_FIFO_CANCEL_WAIT_ENTER					0x102
457 #define PSF_EVENT_FIFO_CANCEL_WAIT_EXIT						0x103
458 #define PSF_EVENT_FIFO_PUT_ENTER							0x104
459 #define PSF_EVENT_FIFO_PUT_EXIT								0x105
460 #define PSF_EVENT_FIFO_ALLOC_PUT_SUCCESS					0x106
461 #define PSF_EVENT_FIFO_ALLOC_PUT_BLOCKING					0x107
462 #define PSF_EVENT_FIFO_ALLOC_PUT_FAILURE					0x108
463 #define PSF_EVENT_FIFO_PUT_LIST_ENTER						0x109
464 #define PSF_EVENT_FIFO_PUT_LIST_EXIT						0x10A
465 #define PSF_EVENT_FIFO_PUT_SLIST_ENTER						0x10B
466 #define PSF_EVENT_FIFO_PUT_SLIST_EXIT						0x10C
467 #define PSF_EVENT_FIFO_GET_SUCCESS							0x10D
468 #define PSF_EVENT_FIFO_GET_BLOCKING							0x10E
469 #define PSF_EVENT_FIFO_GET_FAILURE							0x10F
470 #define PSF_EVENT_FIFO_PEEK_HEAD_ENTER						0x110
471 #define PSF_EVENT_FIFO_PEEK_HEAD_EXIT						0x111
472 #define PSF_EVENT_FIFO_PEEK_TAIL_ENTER						0x112
473 #define PSF_EVENT_FIFO_PEEK_TAIL_EXIT						0x113
474 
475 #define PSF_EVENT_LIFO_INIT_ENTER							0x114
476 #define PSF_EVENT_LIFO_INIT_EXIT							0x115
477 #define PSF_EVENT_LIFO_PUT_ENTER							0x116
478 #define PSF_EVENT_LIFO_PUT_EXIT								0x117
479 #define PSF_EVENT_LIFO_ALLOC_PUT_SUCCESS					0x118
480 #define PSF_EVENT_LIFO_ALLOC_PUT_BLOCKING					0x119
481 #define PSF_EVENT_LIFO_ALLOC_PUT_FAILURE					0x11A
482 #define PSF_EVENT_LIFO_GET_SUCCESS							0x11B
483 #define PSF_EVENT_LIFO_GET_BLOCKING							0x11C
484 #define PSF_EVENT_LIFO_GET_FAILURE							0x11D
485 
486 #define PSF_EVENT_STACK_INIT								0x4A
487 #define PSF_EVENT_STACK_ALLOC_INIT_SUCCESS					0x4B
488 #define PSF_EVENT_STACK_ALLOC_INIT_BLOCKING					0x4C
489 #define PSF_EVENT_STACK_ALLOC_INIT_FAILURE					0x4D
490 #define PSF_EVENT_STACK_CLEANUP_SUCCESS						0x4E
491 #define PSF_EVENT_STACK_CLEANUP_BLOCKING					0x4F
492 #define PSF_EVENT_STACK_CLEANUP_FAILURE						0x26
493 #define PSF_EVENT_STACK_PUSH_SUCCESS						0x27
494 #define PSF_EVENT_STACK_PUSH_BLOCKING						0x3E
495 #define PSF_EVENT_STACK_PUSH_FAILURE						0x3F
496 #define PSF_EVENT_STACK_POP_SUCCESS							0x5B
497 #define PSF_EVENT_STACK_POP_BLOCKING						0x5E
498 #define PSF_EVENT_STACK_POP_FAILURE							0x5F
499 
500 #define PSF_EVENT_QUEUE_CREATE								0x11
501 #define PSF_EVENT_MUTEX_CREATE								0x13
502 #define PSF_EVENT_TIMER_CREATE								0x14
503 #define PSF_EVENT_EVENTGROUP_CREATE							0x15
504 #define PSF_EVENT_SEMAPHORE_CREATE_SUCCESS					0x16
505 #define PSF_EVENT_SEMAPHORE_CREATE_TIMEOUT					0x12
506 #define PSF_EVENT_MUTEX_RECURSIVE_CREATE					0x17
507 #define PSF_EVENT_STREAMBUFFER_CREATE						0x18
508 #define PSF_EVENT_MEMORY_SLAB_INIT_SUCCESS                  0x1C
509 #define PSF_EVENT_MEMORY_SLAB_INIT_FAILURE					0x29
510 #define PSF_EVENT_KHEAP_INIT                                0x1D
511 
512 #define PSF_EVENT_QUEUE_DELETE								0x21
513 #define PSF_EVENT_SEMAPHORE_DELETE							0x22
514 #define PSF_EVENT_MUTEX_DELETE								0x23
515 #define PSF_EVENT_TIMER_DELETE								0x24
516 #define PSF_EVENT_EVENTGROUP_DELETE							0x25
517 #define PSF_EVENT_STREAMBUFFER_DELETE						0x28
518 
519 #define PSF_EVENT_NEW_TIME									0x31
520 #define PSF_EVENT_NEW_TIME_SCHEDULER_SUSPENDED				0x32
521 #define PSF_EVENT_ISR_BEGIN									0x33
522 #define PSF_EVENT_ISR_RESUME								0x34
523 #define PSF_EVENT_TS_BEGIN									0x35
524 #define PSF_EVENT_TS_RESUME									0x36
525 #define PSF_EVENT_TASK_ACTIVATE								0x37
526 
527 #define PSF_EVENT_MALLOC									0x38
528 #define PSF_EVENT_FREE										0x39
529 
530 #define PSF_EVENT_LOWPOWER_BEGIN							0x3A
531 #define PSF_EVENT_LOWPOWER_END								0x3B
532 
533 #define PSF_EVENT_IFE_NEXT									0x3C
534 #define PSF_EVENT_IFE_DIRECT								0x3D
535 
536 #define PSF_EVENT_TASK_CREATE_FAILED						0x40
537 #define PSF_EVENT_QUEUE_CREATE_FAILED						0x41
538 #define PSF_EVENT_SEMAPHORE_BINARY_CREATE_FAILED			0x42
539 #define PSF_EVENT_MUTEX_CREATE_FAILED						0x43
540 #define PSF_EVENT_TIMER_CREATE_FAILED						0x44
541 #define PSF_EVENT_EVENTGROUP_CREATE_FAILED					0x45
542 #define PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED			0x46
543 #define PSF_EVENT_MUTEX_RECURSIVE_CREATE_FAILED				0x47
544 #define PSF_EVENT_STREAMBUFFER_CREATE_FAILED				0x49
545 
546 #define PSF_EVENT_TIMER_DELETE_FAILED						0x48
547 
548 #define PSF_EVENT_SEMAPHORE_RESET							0x6A
549 #define PSF_EVENT_SEMAPHORE_GIVE_SUCCESS					0x51
550 #define PSF_EVENT_SEMAPHORE_GIVE_FAILED						0x54
551 #define PSF_EVENT_SEMAPHORE_GIVE_BLOCKING					0x57
552 #define PSF_EVENT_SEMAPHORE_GIVE_FROMISR					0x5A
553 #define PSF_EVENT_SEMAPHORE_GIVE_FROMISR_FAILED				0x5D
554 #define PSF_EVENT_SEMAPHORE_TAKE_SUCCESS					0x61
555 #define PSF_EVENT_SEMAPHORE_TAKE_BLOCKING					0x67
556 #define PSF_EVENT_SEMAPHORE_TAKE_FAILED						0x64
557 #define PSF_EVENT_SEMAPHORE_TAKE_FROMISR_FAILED				0x6D
558 #define PSF_EVENT_SEMAPHORE_PEEK_SUCCESS					0x71
559 #define PSF_EVENT_SEMAPHORE_PEEK_FAILED						0x74
560 #define PSF_EVENT_SEMAPHORE_PEEK_BLOCKING					0x77
561 
562 #define PSF_EVENT_MUTEX_GIVE_SUCCESS						0x52
563 #define PSF_EVENT_MUTEX_GIVE_FAILED							0x55
564 #define PSF_EVENT_MUTEX_GIVE_BLOCKING						0x58
565 #define PSF_EVENT_MUTEX_TAKE_SUCCESS						0x62
566 #define PSF_EVENT_MUTEX_TAKE_FAILED							0x65
567 #define PSF_EVENT_MUTEX_TAKE_BLOCKING						0x68
568 #define PSF_EVENT_MUTEX_PEEK_SUCCESS						0x72
569 #define PSF_EVENT_MUTEX_PEEK_FAILED							0x75
570 #define PSF_EVENT_MUTEX_PEEK_BLOCKING						0x78
571 
572 #define PSF_EVENT_CONDVAR_INIT								0x6F
573 #define PSF_EVENT_CONDVAR_SIGNAL_SUCCESS					0x76
574 #define PSF_EVENT_CONDVAR_SIGNAL_BLOCKING					0x79
575 #define PSF_EVENT_CONDVAR_SIGNAL_FAILURE					0x7A
576 #define PSF_EVENT_CONDVAR_BROADCAST_ENTER					0x7D
577 #define PSF_EVENT_CONDVAR_BROADCAST_EXIT					0x7E
578 #define PSF_EVENT_CONDVAR_WAIT_SUCCESS						0x7F
579 #define PSF_EVENT_CONDVAR_WAIT_BLOCKING						0x80
580 #define PSF_EVENT_CONDVAR_WAIT_FAILURE						0x81
581 
582 #define PSF_EVENT_USER_EVENT								0x90
583 #define PSF_EVENT_USER_EVENT_FIXED							0x98
584 
585 #define PSF_EVENT_TIMER_INIT								0xA0
586 #define PSF_EVENT_TIMER_START								0xA1
587 #define PSF_EVENT_TIMER_STOP								0xA2
588 #define PSF_EVENT_TIMER_STATUS_SYNC_AWAIT					0xA3
589 #define PSF_EVENT_TIMER_STATUS_SYNC_EXIT					0xA4
590 
591 #define PSF_EVENT_MAILBOX_INIT                              0x1B
592 #define PSF_EVENT_MAILBOX_MESSAGE_PUT_SUCCESS				0xF7
593 #define PSF_EVENT_MAILBOX_MESSAGE_PUT_BLOCKING				0xF8
594 #define PSF_EVENT_MAILBOX_MESSAGE_PUT_FAILURE				0xF9
595 #define PSF_EVENT_MAILBOX_PUT_SUCCESS                      	0xD3
596 #define PSF_EVENT_MAILBOX_PUT_BLOCKING                     	0xD5
597 #define PSF_EVENT_MAILBOX_PUT_FAILURE                      	0xD4
598 #define PSF_EVENT_MAILBOX_ASYNC_PUT_ENTER                   0xD6
599 #define PSF_EVENT_MAILBOX_ASYNC_PUT_EXIT					0xF6
600 #define PSF_EVENT_MAILBOX_GET_SUCCESS                       0xD7
601 #define PSF_EVENT_MAILBOX_GET_BLOCKING                      0xD9
602 #define PSF_EVENT_MAILBOX_GET_TIMEOUT                       0xD8
603 #define PSF_EVENT_MAILBOX_DATA_GET							0x89
604 
605 #define PSF_EVENT_PIPE_INIT									0xA5
606 #define PSF_EVENT_PIPE_CLEANUP_SUCCESS						0xA6
607 #define PSF_EVENT_PIPE_CLEANUP_BLOCKING						0xF5
608 #define PSF_EVENT_PIPE_CLEANUP_FAILURE						0xA7
609 #define PSF_EVENT_PIPE_ALLOC_INIT_SUCCESS					0xA8
610 #define PSF_EVENT_PIPE_ALLOC_INIT_BLOCKING					0xF4
611 #define PSF_EVENT_PIPE_ALLOC_INIT_FAILURE					0xA9
612 #define PSF_EVENT_PIPE_PUT_SUCCESS							0xAA
613 #define PSF_EVENT_PIPE_PUT_BLOCKING							0xAB
614 #define PSF_EVENT_PIPE_PUT_TIMEOUT							0xAC
615 #define PSF_EVENT_PIPE_GET_SUCCESS							0xAD
616 #define PSF_EVENT_PIPE_GET_BLOCKING							0xAE
617 #define PSF_EVENT_PIPE_GET_TIMEOUT							0xAF
618 #define PSF_EVENT_PIPE_BLOCK_PUT_ENTER_DEPRECATED				0xDA
619 #define PSF_EVENT_PIPE_BLOCK_PUT_EXIT_DEPRECATED				0xED
620 
621 #define PSF_EVENT_MESSAGEQUEUE_INIT                 		0x1A
622 #define PSF_EVENT_MESSAGEQUEUE_ALLOC_INIT_SUCCESS			0x1E
623 #define PSF_EVENT_MESSAGEQUEUE_ALLOC_INIT_BLOCKING			0x6B
624 #define PSF_EVENT_MESSAGEQUEUE_ALLOC_INIT_TIMEOUT			0x1F
625 #define PSF_EVENT_MESSAGEQUEUE_CLEANUP_SUCCESS				0xDC
626 #define PSF_EVENT_MESSAGEQUEUE_CLEANUP_BLOCKING				0x6C
627 #define PSF_EVENT_MESSAGEQUEUE_CLEANUP_TIMEOUT				0xDD
628 #define PSF_EVENT_MESSAGEQUEUE_PUT_SUCCESS                  0xDE
629 #define PSF_EVENT_MESSAGEQUEUE_PUT_TIMEOUT                  0xDF
630 #define PSF_EVENT_MESSAGEQUEUE_PUT_BLOCKING                 0xE0
631 #define PSF_EVENT_MESSAGEQUEUE_GET_SUCCESS                  0xE1
632 #define PSF_EVENT_MESSAGEQUEUE_GET_TIMEOUT                  0xE2
633 #define PSF_EVENT_MESSAGEQUEUE_GET_BLOCKING                 0xE3
634 #define PSF_EVENT_MESSAGEQUEUE_PEEK_SUCCESS					0xE4
635 #define PSF_EVENT_MESSAGEQUEUE_PEEK_FAILED					0xE5
636 #define PSF_EVENT_MESSAGEQUEUE_PURGE                        0xE6
637 
638 #define PSF_EVENT_MEMORY_SLAB_ALLOC_SUCCESS                 0xE7
639 #define PSF_EVENT_MEMORY_SLAB_ALLOC_TIMEOUT                 0xE8
640 #define PSF_EVENT_MEMORY_SLAB_ALLOC_BLOCKING                0xE9
641 #define PSF_EVENT_MEMORY_SLAB_ALLOC_ERROR                   0xEB
642 #define PSF_EVENT_MEMORY_SLAB_FREE                          0xEC
643 
644 #define PSF_EVENT_KHEAP_ALIGNED_ALLOC_SUCCESS               0x84
645 #define PSF_EVENT_KHEAP_ALIGNED_ALLOC_BLOCKING              0x86
646 #define PSF_EVENT_KHEAP_ALIGNED_ALLOC_FAILURE               0x85
647 #define PSF_EVENT_KHEAP_ALLOC_SUCCESS						0x87
648 #define PSF_EVENT_KHEAP_ALLOC_BLOCKING						0xFA
649 #define PSF_EVENT_KHEAP_ALLOC_FAILURE						0xFB
650 #define PSF_EVENT_KHEAP_FREE                                0x88
651 #define PSF_EVENT_KHEAP_SYS_ALIGNED_ALLOC_SUCCESS			0x50
652 #define PSF_EVENT_KHEAP_SYS_ALIGNED_ALLOC_BLOCKING			0x53
653 #define PSF_EVENT_KHEAP_SYS_ALIGNED_ALLOC_FAILURE			0x56
654 #define PSF_EVENT_KHEAP_SYS_MALLOC_SUCCESS					0x59
655 #define PSF_EVENT_KHEAP_SYS_MALLOC_BLOCKING					0x5C
656 #define PSF_EVENT_KHEAP_SYS_MALLOC_FAILURE					0x60
657 #define PSF_EVENT_KHEAP_SYS_FREE_ENTER						0x63
658 #define PSF_EVENT_KHEAP_SYS_FREE_EXIT						0x66
659 #define PSF_EVENT_KHEAP_SYS_CALLOC_SUCCESS					0x69
660 #define PSF_EVENT_KHEAP_SYS_CALLOC_BLOCKING					0x73
661 #define PSF_EVENT_KHEAP_SYS_CALLOC_FAILURE					0x70
662 
663 #define PSF_EVENT_HEAP_MALLOC								0x8A
664 #define PSF_EVENT_HEAP_FREE									0x8B
665 #define PSF_EVENT_HEAP_CALLOC								0x8C
666 
667 #define PSF_EVENT_UNUSED_STACK								0xEA
668 
669 #define PSF_EVENT_SYSTEM_SYSCALL_ENTER						0xFE
670 #define PSF_EVENT_SYSTEM_SYSCALL_EXIT						0xFF
671 
672 /* Forced compliance due to task API implementation */
673 #define PSF_EVENT_TASK_CREATE								0x0
674 #define PSF_EVENT_TASK_READY								PSF_EVENT_THREAD_SCHED_READY
675 #define PSF_EVENT_TASK_PRIORITY								PSF_EVENT_THREAD_SET_PRIORITY
676 #define PSF_EVENT_TASK_DELETE								PSF_EVENT_THREAD_ABORT
677 
678 #define PSF_EVENT_RUNNABLE_REGISTER							0x167
679 #define PSF_EVENT_RUNNABLE_START							0x168
680 #define PSF_EVENT_RUNNABLE_STOP								0x169
681 
682 #define PSF_EVENT_DEPENDENCY_REGISTER						0x16A
683 
684 #define PSF_EVENT_STATEMACHINE_STATE_CREATE					0x170
685 #define PSF_EVENT_STATEMACHINE_CREATE						0x171
686 #define PSF_EVENT_STATEMACHINE_STATECHANGE					0x172
687 #define PSF_EVENT_INTERVAL_CREATE							0x173
688 #define PSF_EVENT_INTERVAL_CHANNEL_CREATE					0x174
689 #define PSF_EVENT_INTERVAL_CHANNEL_SET_CREATE				0x175
690 #define PSF_EVENT_INTERVAL_STATECHANGE						0x176
691 #define PSF_EVENT_INTERVAL_START							0x177
692 #define PSF_EVENT_INTERVAL_STOP								0x178
693 #define PSF_EVENT_COUNTER_CREATE							0x179
694 #define PSF_EVENT_COUNTER_CHANGE							0x17A
695 #define PSF_EVENT_COUNTER_LIMIT_EXCEEDED					0x17B
696 
697 #define PSF_EVENT_MALLOC_FAILED 							0x17C
698 #define PSF_EVENT_FREE_FAILED 								0x17D
699 #define PSF_EVENT_EXTENSION_CREATE							0x17E
700 #define PSF_EVENT_HEAP_CREATE								0x17F
701 
702 #define TRC_EVENT_LAST_ID									(PSF_EVENT_HEAP_CREATE)
703 
704 
705 #ifdef __cplusplus
706 }
707 #endif
708 
709 #endif /* TRC_KERNEL_PORT_H */
710