1 /*
2  * Trace Recorder for Tracealyzer v4.6.6
3  * Copyright 2021 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 1
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
73 {
74 	uint8_t buffer[sizeof(TraceHeapHandle_t) + sizeof(TraceKernelPortTaskHandle_t) + 4];
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_STATEMACHINE_STATE_CREATE					0x0
303 #define PSF_EVENT_STATEMACHINE_CREATE						0x0
304 #define PSF_EVENT_STATEMACHINE_STATECHANGE					0x0
305 #define PSF_EVENT_INTERVAL_CREATE							0x0
306 #define PSF_EVENT_INTERVAL_CHANNEL_CREATE					0x0
307 #define PSF_EVENT_INTERVAL_CHANNEL_SET_CREATE				0x0
308 #define PSF_EVENT_INTERVAL_STATECHANGE						0x0
309 #define PSF_EVENT_INTERVAL_START							0x0
310 #define PSF_EVENT_INTERVAL_STOP								0x0
311 #define PSF_EVENT_COUNTER_CREATE							0x0
312 #define PSF_EVENT_COUNTER_CHANGE							0x0
313 #define PSF_EVENT_COUNTER_LIMIT_EXCEEDED					0x0
314 
315 #define PSF_EVENT_MALLOC_FAILED 							0x0
316 #define PSF_EVENT_FREE_FAILED 								0x0
317 #define PSF_EVENT_EXTENSION_CREATE							0x0
318 #define PSF_EVENT_HEAP_CREATE								0x0
319 
320 #define PSF_EVENT_THREAD_SCHED_WAKEUP						0xB6
321 #define PSF_EVENT_THREAD_SCHED_ABORT						0x20
322 #define PSF_EVENT_THREAD_SCHED_PRIORITY_SET					0x04
323 #define PSF_EVENT_THREAD_SCHED_READY						0x30
324 #define PSF_EVENT_THREAD_SCHED_PEND
325 #define PSF_EVENT_THREAD_SCHED_RESUME						0x7C
326 #define PSF_EVENT_THREAD_SCHED_SUSPEND						0x7B
327 
328 #define PSF_EVENT_THREAD_FOREACH_ENTER						0x09
329 #define PSF_EVENT_THREAD_FOREACH_EXIT						0x0B
330 #define PSF_EVENT_THREAD_FOREACH_UNLOCKED_ENTER				0x0A
331 #define PSF_EVENT_THREAD_FOREACH_UNLOCKED_EXIT				0xF2
332 #define PSF_EVENT_THREAD_INIT								0x10
333 #define PSF_EVENT_THREAD_USER_MODE_ENTER					0x0C
334 #define PSF_EVENT_THREAD_HEAP_ASSIGN						0xFC
335 #define PSF_EVENT_THREAD_JOIN_SUCCESS						0xB0
336 #define PSF_EVENT_THREAD_JOIN_BLOCKING						0xB2
337 #define PSF_EVENT_THREAD_JOIN_TIMEOUT						0xB1
338 #define PSF_EVENT_THREAD_SLEEP_ENTER						0x2A
339 #define PSF_EVENT_THREAD_SLEEP_EXIT							0x2B
340 #define PSF_EVENT_THREAD_MSLEEP_ENTER						0x2C
341 #define PSF_EVENT_THREAD_MSLEEP_EXIT						0x2D
342 #define PSF_EVENT_THREAD_USLEEP_ENTER						0x2E
343 #define PSF_EVENT_THREAD_USLEEP_EXIT						0x2F
344 #define PSF_EVENT_THREAD_BUSY_WAIT_ENTER					0xB4
345 #define PSF_EVENT_THREAD_BUSY_WAIT_EXIT						0xF3
346 #define PSF_EVENT_THREAD_YIELD								0xB5
347 #define PSF_EVENT_THREAD_WAKEUP								0x15D
348 #define PSF_EVENT_THREAD_ABORT								0x15E
349 #define PSF_EVENT_THREAD_START								0xB3
350 #define PSF_EVENT_THREAD_SET_PRIORITY						0x15F
351 #define PSF_EVENT_THREAD_SUSPEND							0x161
352 #define PSF_EVENT_THREAD_RESUME								0x160
353 #define PSF_EVENT_THREAD_SCHED_LOCK							0xB7
354 #define PSF_EVENT_THREAD_SCHED_UNLOCK						0xB8
355 
356 #define PSF_EVENT_WORK_INIT									0x11E
357 #define PSF_EVENT_WORK_SUBMIT_TO_QUEUE_SUCCESS				0x11F
358 #define PSF_EVENT_WORK_SUBMIT_TO_QUEUE_BLOCKING				0x120
359 #define PSF_EVENT_WORK_SUBMIT_TO_QUEUE_FAILURE				0x121
360 #define PSF_EVENT_WORK_SUBMIT_SUCCESS						0x122
361 #define PSF_EVENT_WORK_SUBMIT_BLOCKING						0x123
362 #define PSF_EVENT_WORK_SUBMIT_FAILURE						0x124
363 #define PSF_EVENT_WORK_FLUSH_SUCCESS						0x125
364 #define PSF_EVENT_WORK_FLUSH_BLOCKING						0x126
365 #define PSF_EVENT_WORK_FLUSH_FAILURE						0x127
366 #define PSF_EVENT_WORK_CANCEL_SUCCESS						0x128
367 #define PSF_EVENT_WORK_CANCEL_BLOCKING						0x129
368 #define PSF_EVENT_WORK_CANCEL_FAILURE						0x12A
369 #define PSF_EVENT_WORK_CANCEL_SYNC_SUCCESS					0x12B
370 #define PSF_EVENT_WORK_CANCEL_SYNC_BLOCKING					0x12C
371 #define PSF_EVENT_WORK_CANCEL_SYNC_FAILURE					0x12D
372 
373 #define PSF_EVENT_WORK_QUEUE_START_SUCCESS					0x12E
374 #define PSF_EVENT_WORK_QUEUE_START_BLOCKING					0x12F
375 #define PSF_EVENT_WORK_QUEUE_START_FAILURE					0x130
376 #define PSF_EVENT_WORK_QUEUE_DRAIN_SUCCESS					0x131
377 #define PSF_EVENT_WORK_QUEUE_DRAIN_BLOCKING					0x132
378 #define PSF_EVENT_WORK_QUEUE_DRAIN_FAILURE					0x133
379 #define PSF_EVENT_WORK_QUEUE_UNPLUG_SUCCESS					0x134
380 #define PSF_EVENT_WORK_QUEUE_UNPLUG_BLOCKING				0x135
381 #define PSF_EVENT_WORK_QUEUE_UNPLUG_FAILURE					0x136
382 
383 #define PSF_EVENT_DWORK_INIT								0x137
384 #define PSF_EVENT_DWORK_SCHEDULE_FOR_QUEUE_SUCCESS 			0x138
385 #define PSF_EVENT_DWORK_SCHEDULE_FOR_QUEUE_BLOCKING 		0x139
386 #define PSF_EVENT_DWORK_SCHEDULE_FOR_QUEUE_FAILURE			0x13A
387 #define PSF_EVENT_DWORK_SCHEDULE_SUCCESS					0x13B
388 #define PSF_EVENT_DWORK_SCHEDULE_BLOCKING					0x13C
389 #define PSF_EVENT_DWORK_SCHEDULE_FAILURE					0x13D
390 #define PSF_EVENT_DWORK_RESCHEDULE_FOR_QUEUE_SUCCESS		0x13E
391 #define PSF_EVENT_DWORK_RESCHEDULE_FOR_QUEUE_BLOCKING		0x13F
392 #define PSF_EVENT_DWORK_RESCHEDULE_FOR_QUEUE_FAILURE		0x140
393 #define PSF_EVENT_DWORK_RESCHEDULE_SUCCESS					0x141
394 #define PSF_EVENT_DWORK_RESCHEDULE_BLOCKING					0x142
395 #define PSF_EVENT_DWORK_RESCHEDULE_FAILURE					0x143
396 #define PSF_EVENT_DWORK_FLUSH_SUCCESS						0x144
397 #define PSF_EVENT_DWORK_FLUSH_BLOCKING						0x145
398 #define PSF_EVENT_DWORK_FLUSH_FAILURE						0x146
399 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_SUCCESS			0x147
400 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_BLOCKING			0x148
401 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_FAILURE			0x149
402 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_SYNC_SUCCESS		0x14A
403 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_SYNC_BLOCKING		0x14B
404 #define PSF_EVENT_DWORK_CANCEL_DELAYABLE_SYNC_FAILURE		0x14C
405 
406 #define PSF_EVENT_UWORK_INIT								0x14D
407 #define PSF_EVENT_UWORK_SUBMIT_TO_QUEUE_SUCCESS				0x14E
408 #define PSF_EVENT_UWORK_SUBMIT_TO_QUEUE_BLOCKING			0x14F
409 #define PSF_EVENT_UWORK_SUBMIT_TO_QUEUE_FAILURE				0x150
410 
411 #define PSF_EVENT_UWORK_QUEUE_START_ENTER					0x151
412 #define PSF_EVENT_UWORK_QUEUE_START_EXIT					0x152
413 
414 #define PSF_EVENT_PWORK_INIT_ENTER							0x153
415 #define PSF_EVENT_PWORK_INIT_EXIT							0x166
416 #define PSF_EVENT_PWORK_SUBMIT_TO_QUEUE_SUCCESS				0x154
417 #define PSF_EVENT_PWORK_SUBMIT_TO_QUEUE_BLOCKING			0x155
418 #define PSF_EVENT_PWORK_SUBMIT_TO_QUEUE_FAILURE				0x156
419 #define PSF_EVENT_PWORK_SUBMIT_SUCCESS						0x157
420 #define PSF_EVENT_PWORK_SUBMIT_BLOCKING						0x158
421 #define PSF_EVENT_PWORK_SUBMIT_FAILURE						0x159
422 #define PSF_EVENT_PWORK_CANCEL_SUCCESS						0x15A
423 #define PSF_EVENT_PWORK_CANCEL_BLOCKING						0x15B
424 #define PSF_EVENT_PWORK_CANCEL_FAILURE						0x15C
425 
426 #define PSF_EVENT_ISR_ENTER									0x162
427 #define PSF_EVENT_ISR_EXIT									0x163
428 #define PSF_EVENT_ISR_EXIT_TO_SCHEDULER						0x164
429 
430 #define PSF_EVENT_POLL_EVENT_INIT							0x82
431 #define PSF_EVENT_POLL_POLL_SUCCESS							0x8F
432 #define PSF_EVENT_POLL_POLL_BLOCKING						0x11
433 #define PSF_EVENT_POLL_POLL_FAILURE							0x0D
434 #define PSF_EVENT_POLL_SIGNAL_INIT							0x83
435 #define PSF_EVENT_POLL_SIGNAL_RESET							0x8D
436 #define PSF_EVENT_POLL_SIGNAL_CHECK							0xF0
437 #define PSF_EVENT_POLL_SIGNAL_RAISE_SUCCESS					0x8E
438 #define PSF_EVENT_POLL_SIGNAL_RAISE_FAILURE					0xEF
439 
440 #define PSF_EVENT_QUEUE_INIT								0xC0
441 #define PSF_EVENT_QUEUE_CANCEL_WAIT							0xC1
442 #define PSF_EVENT_QUEUE_QUEUE_INSERT_SUCCESS				0xBC		// Only tracked when there is a queue allocation event
443 #define PSF_EVENT_QUEUE_QUEUE_INSERT_BLOCKING				0xBD		// Only tracked when there is a queue allocation event
444 #define PSF_EVENT_QUEUE_QUEUE_INSERT_FAILURE				0xBE		// Only tracked when there is a queue allocation event
445 #define PSF_EVENT_QUEUE_APPEND								0xC2
446 #define PSF_EVENT_QUEUE_ALLOC_APPEND_SUCCESS				0xC3
447 #define PSF_EVENT_QUEUE_ALLOC_APPEND_BLOCKING				0xF1
448 #define PSF_EVENT_QUEUE_ALLOC_APPEND_FAILURE				0xC4
449 #define PSF_EVENT_QUEUE_PREPEND								0xC5
450 #define PSF_EVENT_QUEUE_ALLOC_PREPEND_SUCCESS				0xC6
451 #define PSF_EVENT_QUEUE_ALLOC_PREPEND_BLOCKING				0xBF
452 #define PSF_EVENT_QUEUE_ALLOC_PREPEND_FAILURE				0xC7
453 #define PSF_EVENT_QUEUE_INSERT								0xC8
454 #define PSF_EVENT_QUEUE_APPEND_LIST_SUCCESS					0xC9
455 #define PSF_EVENT_QUEUE_APPEND_LIST_BLOCKING				0x165
456 #define PSF_EVENT_QUEUE_APPEND_LIST_FAILURE					0xCA
457 #define PSF_EVENT_QUEUE_MERGE_SLIST_SUCCESS					0xCB
458 #define PSF_EVENT_QUEUE_MERGE_SLIST_BLOCKING				0x6E
459 #define PSF_EVENT_QUEUE_MERGE_SLIST_FAILURE					0xCC
460 #define PSF_EVENT_QUEUE_GET_SUCCESS							0xCD
461 #define PSF_EVENT_QUEUE_GET_BLOCKING						0xCE
462 #define PSF_EVENT_QUEUE_GET_TIMEOUT							0xCF
463 #define PSF_EVENT_QUEUE_REMOVE_SUCCESS						0xD0
464 #define PSF_EVENT_QUEUE_REMOVE_BLOCKING						0xDB
465 #define PSF_EVENT_QUEUE_REMOVE_FAILURE						0xD1
466 #define PSF_EVENT_QUEUE_UNIQUE_APPEND_SUCCESS				0xD2
467 #define PSF_EVENT_QUEUE_UNIQUE_APPEND_BLOCKING				0xEE
468 #define PSF_EVENT_QUEUE_UNIQUE_APPEND_FAILURE				0xB9
469 #define PSF_EVENT_QUEUE_PEEK_HEAD							0xBA
470 #define PSF_EVENT_QUEUE_PEEK_TAIL							0xBB
471 
472 #define PSF_EVENT_FIFO_INIT_ENTER							0x100
473 #define PSF_EVENT_FIFO_INIT_EXIT							0x101
474 #define PSF_EVENT_FIFO_CANCEL_WAIT_ENTER					0x102
475 #define PSF_EVENT_FIFO_CANCEL_WAIT_EXIT						0x103
476 #define PSF_EVENT_FIFO_PUT_ENTER							0x104
477 #define PSF_EVENT_FIFO_PUT_EXIT								0x105
478 #define PSF_EVENT_FIFO_ALLOC_PUT_SUCCESS					0x106
479 #define PSF_EVENT_FIFO_ALLOC_PUT_BLOCKING					0x107
480 #define PSF_EVENT_FIFO_ALLOC_PUT_FAILURE					0x108
481 #define PSF_EVENT_FIFO_PUT_LIST_ENTER						0x109
482 #define PSF_EVENT_FIFO_PUT_LIST_EXIT						0x10A
483 #define PSF_EVENT_FIFO_PUT_SLIST_ENTER						0x10B
484 #define PSF_EVENT_FIFO_PUT_SLIST_EXIT						0x10C
485 #define PSF_EVENT_FIFO_GET_SUCCESS							0x10D
486 #define PSF_EVENT_FIFO_GET_BLOCKING							0x10E
487 #define PSF_EVENT_FIFO_GET_FAILURE							0x10F
488 #define PSF_EVENT_FIFO_PEEK_HEAD_ENTER						0x110
489 #define PSF_EVENT_FIFO_PEEK_HEAD_EXIT						0x111
490 #define PSF_EVENT_FIFO_PEEK_TAIL_ENTER						0x112
491 #define PSF_EVENT_FIFO_PEEK_TAIL_EXIT						0x113
492 
493 #define PSF_EVENT_LIFO_INIT_ENTER							0x114
494 #define PSF_EVENT_LIFO_INIT_EXIT							0x115
495 #define PSF_EVENT_LIFO_PUT_ENTER							0x116
496 #define PSF_EVENT_LIFO_PUT_EXIT								0x117
497 #define PSF_EVENT_LIFO_ALLOC_PUT_SUCCESS					0x118
498 #define PSF_EVENT_LIFO_ALLOC_PUT_BLOCKING					0x119
499 #define PSF_EVENT_LIFO_ALLOC_PUT_FAILURE					0x11A
500 #define PSF_EVENT_LIFO_GET_SUCCESS							0x11B
501 #define PSF_EVENT_LIFO_GET_BLOCKING							0x11C
502 #define PSF_EVENT_LIFO_GET_FAILURE							0x11D
503 
504 #define PSF_EVENT_STACK_INIT								0x4A
505 #define PSF_EVENT_STACK_ALLOC_INIT_SUCCESS					0x4B
506 #define PSF_EVENT_STACK_ALLOC_INIT_BLOCKING					0x4C
507 #define PSF_EVENT_STACK_ALLOC_INIT_FAILURE					0x4D
508 #define PSF_EVENT_STACK_CLEANUP_SUCCESS						0x4E
509 #define PSF_EVENT_STACK_CLEANUP_BLOCKING					0x4F
510 #define PSF_EVENT_STACK_CLEANUP_FAILURE						0x26
511 #define PSF_EVENT_STACK_PUSH_SUCCESS						0x27
512 #define PSF_EVENT_STACK_PUSH_BLOCKING						0x3E
513 #define PSF_EVENT_STACK_PUSH_FAILURE						0x3F
514 #define PSF_EVENT_STACK_POP_SUCCESS							0x5B
515 #define PSF_EVENT_STACK_POP_BLOCKING						0x5E
516 #define PSF_EVENT_STACK_POP_FAILURE							0x5F
517 
518 #define PSF_EVENT_QUEUE_CREATE								0x11
519 #define PSF_EVENT_MUTEX_CREATE								0x13
520 #define PSF_EVENT_TIMER_CREATE								0x14
521 #define PSF_EVENT_EVENTGROUP_CREATE							0x15
522 #define PSF_EVENT_SEMAPHORE_CREATE_SUCCESS					0x16
523 #define PSF_EVENT_SEMAPHORE_CREATE_TIMEOUT					0x12
524 #define PSF_EVENT_MUTEX_RECURSIVE_CREATE					0x17
525 #define PSF_EVENT_STREAMBUFFER_CREATE						0x18
526 #define PSF_EVENT_MEMORY_SLAB_INIT_SUCCESS                  0x1C
527 #define PSF_EVENT_MEMORY_SLAB_INIT_FAILURE					0x29
528 #define PSF_EVENT_KHEAP_INIT                                0x1D
529 
530 #define PSF_EVENT_QUEUE_DELETE								0x21
531 #define PSF_EVENT_SEMAPHORE_DELETE							0x22
532 #define PSF_EVENT_MUTEX_DELETE								0x23
533 #define PSF_EVENT_TIMER_DELETE								0x24
534 #define PSF_EVENT_EVENTGROUP_DELETE							0x25
535 #define PSF_EVENT_STREAMBUFFER_DELETE						0x28
536 
537 #define PSF_EVENT_NEW_TIME									0x31
538 #define PSF_EVENT_NEW_TIME_SCHEDULER_SUSPENDED				0x32
539 #define PSF_EVENT_ISR_BEGIN									0x33
540 #define PSF_EVENT_ISR_RESUME								0x34
541 #define PSF_EVENT_TS_BEGIN									0x35
542 #define PSF_EVENT_TS_RESUME									0x36
543 #define PSF_EVENT_TASK_ACTIVATE								0x37
544 
545 #define PSF_EVENT_MALLOC									0x38
546 #define PSF_EVENT_FREE										0x39
547 
548 #define PSF_EVENT_LOWPOWER_BEGIN							0x3A
549 #define PSF_EVENT_LOWPOWER_END								0x3B
550 
551 #define PSF_EVENT_IFE_NEXT									0x3C
552 #define PSF_EVENT_IFE_DIRECT								0x3D
553 
554 #define PSF_EVENT_TASK_CREATE_FAILED						0x40
555 #define PSF_EVENT_QUEUE_CREATE_FAILED						0x41
556 #define PSF_EVENT_SEMAPHORE_BINARY_CREATE_FAILED			0x42
557 #define PSF_EVENT_MUTEX_CREATE_FAILED						0x43
558 #define PSF_EVENT_TIMER_CREATE_FAILED						0x44
559 #define PSF_EVENT_EVENTGROUP_CREATE_FAILED					0x45
560 #define PSF_EVENT_SEMAPHORE_COUNTING_CREATE_FAILED			0x46
561 #define PSF_EVENT_MUTEX_RECURSIVE_CREATE_FAILED				0x47
562 #define PSF_EVENT_STREAMBUFFER_CREATE_FAILED				0x49
563 
564 #define PSF_EVENT_TIMER_DELETE_FAILED						0x48
565 
566 #define PSF_EVENT_SEMAPHORE_RESET							0x6A
567 #define PSF_EVENT_SEMAPHORE_GIVE_SUCCESS					0x51
568 #define PSF_EVENT_SEMAPHORE_GIVE_FAILED						0x54
569 #define PSF_EVENT_SEMAPHORE_GIVE_BLOCKING					0x57
570 #define PSF_EVENT_SEMAPHORE_GIVE_FROMISR					0x5A
571 #define PSF_EVENT_SEMAPHORE_GIVE_FROMISR_FAILED				0x5D
572 #define PSF_EVENT_SEMAPHORE_TAKE_SUCCESS					0x61
573 #define PSF_EVENT_SEMAPHORE_TAKE_BLOCKING					0x67
574 #define PSF_EVENT_SEMAPHORE_TAKE_FAILED						0x64
575 #define PSF_EVENT_SEMAPHORE_TAKE_FROMISR_FAILED				0x6D
576 #define PSF_EVENT_SEMAPHORE_PEEK_SUCCESS					0x71
577 #define PSF_EVENT_SEMAPHORE_PEEK_FAILED						0x74
578 #define PSF_EVENT_SEMAPHORE_PEEK_BLOCKING					0x77
579 
580 #define PSF_EVENT_MUTEX_GIVE_SUCCESS						0x52
581 #define PSF_EVENT_MUTEX_GIVE_FAILED							0x55
582 #define PSF_EVENT_MUTEX_GIVE_BLOCKING						0x58
583 #define PSF_EVENT_MUTEX_TAKE_SUCCESS						0x62
584 #define PSF_EVENT_MUTEX_TAKE_FAILED							0x65
585 #define PSF_EVENT_MUTEX_TAKE_BLOCKING						0x68
586 #define PSF_EVENT_MUTEX_PEEK_SUCCESS						0x72
587 #define PSF_EVENT_MUTEX_PEEK_FAILED							0x75
588 #define PSF_EVENT_MUTEX_PEEK_BLOCKING						0x78
589 
590 #define PSF_EVENT_CONDVAR_INIT								0x6F
591 #define PSF_EVENT_CONDVAR_SIGNAL_SUCCESS					0x76
592 #define PSF_EVENT_CONDVAR_SIGNAL_BLOCKING					0x79
593 #define PSF_EVENT_CONDVAR_SIGNAL_FAILURE					0x7A
594 #define PSF_EVENT_CONDVAR_BROADCAST_ENTER					0x7D
595 #define PSF_EVENT_CONDVAR_BROADCAST_EXIT					0x7E
596 #define PSF_EVENT_CONDVAR_WAIT_SUCCESS						0x7F
597 #define PSF_EVENT_CONDVAR_WAIT_BLOCKING						0x80
598 #define PSF_EVENT_CONDVAR_WAIT_FAILURE						0x81
599 
600 #define PSF_EVENT_USER_EVENT								0x90
601 
602 #define PSF_EVENT_TIMER_INIT								0xA0
603 #define PSF_EVENT_TIMER_START								0xA1
604 #define PSF_EVENT_TIMER_STOP								0xA2
605 #define PSF_EVENT_TIMER_STATUS_SYNC_AWAIT					0xA3
606 #define PSF_EVENT_TIMER_STATUS_SYNC_EXIT					0xA4
607 
608 #define PSF_EVENT_MAILBOX_INIT                              0x1B
609 #define PSF_EVENT_MAILBOX_MESSAGE_PUT_SUCCESS				0xF7
610 #define PSF_EVENT_MAILBOX_MESSAGE_PUT_BLOCKING				0xF8
611 #define PSF_EVENT_MAILBOX_MESSAGE_PUT_FAILURE				0xF9
612 #define PSF_EVENT_MAILBOX_PUT_SUCCESS                      	0xD3
613 #define PSF_EVENT_MAILBOX_PUT_BLOCKING                     	0xD5
614 #define PSF_EVENT_MAILBOX_PUT_FAILURE                      	0xD4
615 #define PSF_EVENT_MAILBOX_ASYNC_PUT_ENTER                   0xD6
616 #define PSF_EVENT_MAILBOX_ASYNC_PUT_EXIT					0xF6
617 #define PSF_EVENT_MAILBOX_GET_SUCCESS                       0xD7
618 #define PSF_EVENT_MAILBOX_GET_BLOCKING                      0xD9
619 #define PSF_EVENT_MAILBOX_GET_TIMEOUT                       0xD8
620 #define PSF_EVENT_MAILBOX_DATA_GET							0x89
621 
622 #define PSF_EVENT_PIPE_INIT									0xA5
623 #define PSF_EVENT_PIPE_CLEANUP_SUCCESS						0xA6
624 #define PSF_EVENT_PIPE_CLEANUP_BLOCKING						0xF5
625 #define PSF_EVENT_PIPE_CLEANUP_FAILURE						0xA7
626 #define PSF_EVENT_PIPE_ALLOC_INIT_SUCCESS					0xA8
627 #define PSF_EVENT_PIPE_ALLOC_INIT_BLOCKING					0xF4
628 #define PSF_EVENT_PIPE_ALLOC_INIT_FAILURE					0xA9
629 #define PSF_EVENT_PIPE_PUT_SUCCESS							0xAA
630 #define PSF_EVENT_PIPE_PUT_BLOCKING							0xAB
631 #define PSF_EVENT_PIPE_PUT_TIMEOUT							0xAC
632 #define PSF_EVENT_PIPE_GET_SUCCESS							0xAD
633 #define PSF_EVENT_PIPE_GET_BLOCKING							0xAE
634 #define PSF_EVENT_PIPE_GET_TIMEOUT							0xAF
635 #define PSF_EVENT_PIPE_BLOCK_PUT_ENTER						0xDA
636 #define PSF_EVENT_PIPE_BLOCK_PUT_EXIT						0xED
637 
638 #define PSF_EVENT_MESSAGEQUEUE_INIT                 		0x1A
639 #define PSF_EVENT_MESSAGEQUEUE_ALLOC_INIT_SUCCESS			0x1E
640 #define PSF_EVENT_MESSAGEQUEUE_ALLOC_INIT_BLOCKING			0x6B
641 #define PSF_EVENT_MESSAGEQUEUE_ALLOC_INIT_TIMEOUT			0x1F
642 #define PSF_EVENT_MESSAGEQUEUE_CLEANUP_SUCCESS				0xDC
643 #define PSF_EVENT_MESSAGEQUEUE_CLEANUP_BLOCKING				0x6C
644 #define PSF_EVENT_MESSAGEQUEUE_CLEANUP_TIMEOUT				0xDD
645 #define PSF_EVENT_MESSAGEQUEUE_PUT_SUCCESS                  0xDE
646 #define PSF_EVENT_MESSAGEQUEUE_PUT_TIMEOUT                  0xDF
647 #define PSF_EVENT_MESSAGEQUEUE_PUT_BLOCKING                 0xE0
648 #define PSF_EVENT_MESSAGEQUEUE_GET_SUCCESS                  0xE1
649 #define PSF_EVENT_MESSAGEQUEUE_GET_TIMEOUT                  0xE2
650 #define PSF_EVENT_MESSAGEQUEUE_GET_BLOCKING                 0xE3
651 #define PSF_EVENT_MESSAGEQUEUE_PEEK_SUCCESS					0xE4
652 #define PSF_EVENT_MESSAGEQUEUE_PEEK_FAILED					0xE5
653 #define PSF_EVENT_MESSAGEQUEUE_PURGE                        0xE6
654 
655 #define PSF_EVENT_MEMORY_SLAB_ALLOC_SUCCESS                 0xE7
656 #define PSF_EVENT_MEMORY_SLAB_ALLOC_TIMEOUT                 0xE8
657 #define PSF_EVENT_MEMORY_SLAB_ALLOC_BLOCKING                0xE9
658 #define PSF_EVENT_MEMORY_SLAB_ALLOC_ERROR                   0xEB
659 #define PSF_EVENT_MEMORY_SLAB_FREE                          0xEC
660 
661 #define PSF_EVENT_KHEAP_ALIGNED_ALLOC_SUCCESS               0x84
662 #define PSF_EVENT_KHEAP_ALIGNED_ALLOC_BLOCKING              0x86
663 #define PSF_EVENT_KHEAP_ALIGNED_ALLOC_FAILURE               0x85
664 #define PSF_EVENT_KHEAP_ALLOC_SUCCESS						0x87
665 #define PSF_EVENT_KHEAP_ALLOC_BLOCKING						0xFA
666 #define PSF_EVENT_KHEAP_ALLOC_FAILURE						0xFB
667 #define PSF_EVENT_KHEAP_FREE                                0x88
668 #define PSF_EVENT_KHEAP_SYS_ALIGNED_ALLOC_SUCCESS			0x50
669 #define PSF_EVENT_KHEAP_SYS_ALIGNED_ALLOC_BLOCKING			0x53
670 #define PSF_EVENT_KHEAP_SYS_ALIGNED_ALLOC_FAILURE			0x56
671 #define PSF_EVENT_KHEAP_SYS_MALLOC_SUCCESS					0x59
672 #define PSF_EVENT_KHEAP_SYS_MALLOC_BLOCKING					0x5C
673 #define PSF_EVENT_KHEAP_SYS_MALLOC_FAILURE					0x60
674 #define PSF_EVENT_KHEAP_SYS_FREE_ENTER						0x63
675 #define PSF_EVENT_KHEAP_SYS_FREE_EXIT						0x66
676 #define PSF_EVENT_KHEAP_SYS_CALLOC_SUCCESS					0x69
677 #define PSF_EVENT_KHEAP_SYS_CALLOC_BLOCKING					0x73
678 #define PSF_EVENT_KHEAP_SYS_CALLOC_FAILURE					0x70
679 
680 #define PSF_EVENT_HEAP_MALLOC								0x8A
681 #define PSF_EVENT_HEAP_FREE									0x8B
682 #define PSF_EVENT_HEAP_CALLOC								0x8C
683 
684 #define PSF_EVENT_UNUSED_STACK								0xEA
685 
686 #define PSF_EVENT_SYSTEM_SYSCALL_ENTER						0xFE
687 #define PSF_EVENT_SYSTEM_SYSCALL_EXIT						0xFF
688 
689 /* Forced compliance due to task API implementation */
690 #define PSF_EVENT_TASK_CREATE								0x0
691 #define PSF_EVENT_TASK_READY								PSF_EVENT_THREAD_SCHED_READY
692 #define PSF_EVENT_TASK_PRIORITY								PSF_EVENT_THREAD_SET_PRIORITY
693 #define PSF_EVENT_TASK_DELETE								PSF_EVENT_THREAD_ABORT
694 
695 #define TRC_EVENT_LAST_ID 									0x167
696 
697 
698 #ifdef __cplusplus
699 }
700 #endif
701 
702 #endif /* TRC_KERNEL_PORT_H */
703