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