1 /*
2  * Copyright (c) 2018 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ZEPHYR_TRACE_SYSVIEW_H
7 #define ZEPHYR_TRACE_SYSVIEW_H
8 #include <string.h>
9 #include <zephyr/kernel.h>
10 #include <zephyr/init.h>
11 #include <tracing_sysview_ids.h>
12 
13 #include <SEGGER_SYSVIEW.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 void sys_trace_thread_info(struct k_thread *thread);
20 
21 #define sys_port_trace_k_thread_foreach_enter() SEGGER_SYSVIEW_RecordVoid(TID_THREAD_FOREACH)
22 
23 #define sys_port_trace_k_thread_foreach_exit() SEGGER_SYSVIEW_RecordEndCall(TID_THREAD_FOREACH)
24 
25 #define sys_port_trace_k_thread_foreach_unlocked_enter()                                           \
26 	SEGGER_SYSVIEW_RecordVoid(TID_THREAD_FOREACH_UNLOCKED)
27 
28 #define sys_port_trace_k_thread_foreach_unlocked_exit()                                            \
29 	SEGGER_SYSVIEW_RecordEndCall(TID_THREAD_FOREACH_UNLOCKED)
30 
31 #define sys_port_trace_k_thread_create(new_thread)                                                 \
32 	do {                                                                                       \
33 		SEGGER_SYSVIEW_OnTaskCreate((uint32_t)(uintptr_t)new_thread);                      \
34 		sys_trace_thread_info(new_thread);                                                 \
35 	} while (false)
36 
37 #define sys_port_trace_k_thread_user_mode_enter()                                                  \
38 	SEGGER_SYSVIEW_RecordVoid(TID_THREAD_USERMODE_ENTER)
39 
40 #define sys_port_trace_k_thread_heap_assign(thread, heap)
41 #define sys_port_trace_k_thread_join_enter(thread, timeout)                                        \
42 	SEGGER_SYSVIEW_RecordU32x2(TID_THREAD_JOIN, (uint32_t)(uintptr_t)thread,                   \
43 				   (uint32_t)timeout.ticks)
44 #define sys_port_trace_k_thread_join_blocking(thread, timeout)
45 #define sys_port_trace_k_thread_join_exit(thread, timeout, ret)                                    \
46 	SEGGER_SYSVIEW_RecordEndCallU32(TID_THREAD_JOIN, (int32_t)ret)
47 
48 #define sys_port_trace_k_thread_sleep_enter(timeout)                                               \
49 	SEGGER_SYSVIEW_RecordU32(TID_SLEEP, (uint32_t)k_ticks_to_ms_floor32(timeout.ticks))
50 
51 #define sys_port_trace_k_thread_sleep_exit(timeout, ret)                                           \
52 	SEGGER_SYSVIEW_RecordEndCallU32(TID_SLEEP, (int32_t)ret)
53 
54 #define sys_port_trace_k_thread_msleep_enter(ms) SEGGER_SYSVIEW_RecordU32(TID_MSLEEP, (uint32_t)ms)
55 
56 #define sys_port_trace_k_thread_msleep_exit(ms, ret)                                               \
57 	SEGGER_SYSVIEW_RecordEndCallU32(TID_MSLEEP, (int32_t)ret)
58 
59 #define sys_port_trace_k_thread_usleep_enter(us) SEGGER_SYSVIEW_RecordU32(TID_USLEEP, (uint32_t)us)
60 
61 #define sys_port_trace_k_thread_usleep_exit(us, ret)                                               \
62 	SEGGER_SYSVIEW_RecordEndCallU32(TID_USLEEP, (int32_t)ret)
63 
64 #define sys_port_trace_k_thread_busy_wait_enter(usec_to_wait)                                      \
65 	SEGGER_SYSVIEW_RecordU32(TID_BUSYWAIT, (uint32_t)usec_to_wait)
66 
67 #define sys_port_trace_k_thread_busy_wait_exit(usec_to_wait)                                       \
68 	SEGGER_SYSVIEW_RecordEndCall(TID_BUSYWAIT)
69 
70 #define sys_port_trace_k_thread_yield() SEGGER_SYSVIEW_RecordVoid(TID_THREAD_YIELD)
71 
72 #define sys_port_trace_k_thread_wakeup(thread)                                                     \
73 	SEGGER_SYSVIEW_RecordU32(TID_THREAD_WAKEUP, (uint32_t)(uintptr_t)thread)
74 
75 #define sys_port_trace_k_thread_start(thread)                                                      \
76 	SEGGER_SYSVIEW_RecordU32(TID_THREAD_START, (uint32_t)(uintptr_t)thread)
77 
78 #define sys_port_trace_k_thread_abort(thread)                                                      \
79 	SEGGER_SYSVIEW_RecordU32(TID_THREAD_ABORT, (uint32_t)(uintptr_t)thread)
80 
81 #define sys_port_trace_k_thread_abort_enter(thread)                                                \
82 	SEGGER_SYSVIEW_RecordU32(TID_THREAD_ABORT, (uint32_t)(uintptr_t)thread)
83 
84 #define sys_port_trace_k_thread_abort_exit(thread)                                                 \
85 	SEGGER_SYSVIEW_RecordEndCall(TID_THREAD_ABORT)
86 
87 #define sys_port_trace_k_thread_suspend_enter(thread)                                              \
88 	SEGGER_SYSVIEW_RecordU32(TID_THREAD_SUSPEND, (uint32_t)(uintptr_t)thread)
89 
90 #define sys_port_trace_k_thread_suspend_exit(thread)                                               \
91 	SEGGER_SYSVIEW_RecordEndCall(TID_THREAD_SUSPEND)
92 
93 #define sys_port_trace_k_thread_resume_enter(thread)                                               \
94 	SEGGER_SYSVIEW_RecordU32(TID_THREAD_RESUME, (uint32_t)(uintptr_t)thread)
95 
96 #define sys_port_trace_k_thread_resume_exit(thread) SEGGER_SYSVIEW_RecordEndCall(TID_THREAD_RESUME)
97 
98 #define sys_port_trace_k_thread_sched_lock()
99 
100 #define sys_port_trace_k_thread_sched_unlock()
101 
102 #define sys_port_trace_k_thread_name_set(thread, ret) do { \
103 		SEGGER_SYSVIEW_RecordU32(TID_THREAD_NAME_SET, (uint32_t)(uintptr_t)thread); \
104 		sys_trace_thread_info(thread);	\
105 	} while (false)
106 
107 #define sys_port_trace_k_thread_switched_out() sys_trace_k_thread_switched_out()
108 
109 #define sys_port_trace_k_thread_switched_in() sys_trace_k_thread_switched_in()
110 
111 #define sys_port_trace_k_thread_info(thread) sys_trace_k_thread_info(thread)
112 
113 #define sys_port_trace_k_thread_sched_wakeup(thread)                                               \
114 	SEGGER_SYSVIEW_RecordU32(TID_THREAD_WAKEUP, (uint32_t)(uintptr_t)thread)
115 
116 #define sys_port_trace_k_thread_sched_abort(thread)                                                \
117 	SEGGER_SYSVIEW_RecordU32(TID_THREAD_ABORT, (uint32_t)(uintptr_t)thread)
118 
119 #define sys_port_trace_k_thread_sched_priority_set(thread, prio)                                   \
120 	SEGGER_SYSVIEW_RecordU32x2(TID_THREAD_PRIORITY_SET,                                        \
121 				   SEGGER_SYSVIEW_ShrinkId((uint32_t)thread), prio);
122 
123 #define sys_port_trace_k_thread_sched_ready(thread)                                                \
124 	SEGGER_SYSVIEW_OnTaskStartReady((uint32_t)(uintptr_t)thread)
125 
126 #define sys_port_trace_k_thread_sched_pend(thread)                                                 \
127 	SEGGER_SYSVIEW_OnTaskStopReady((uint32_t)(uintptr_t)thread, 3 << 3)
128 
129 #define sys_port_trace_k_thread_sched_resume(thread)
130 
131 #define sys_port_trace_k_thread_sched_suspend(thread)                                              \
132 	SEGGER_SYSVIEW_OnTaskStopReady((uint32_t)(uintptr_t)thread, 3 << 3)
133 
134 #define sys_port_trace_k_work_init(work)                                                           \
135 	SEGGER_SYSVIEW_RecordU32(TID_WORK_INIT, (uint32_t)(uintptr_t)work)
136 
137 #define sys_port_trace_k_work_submit_to_queue_enter(queue, work)                                   \
138 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_SUBMIT_TO_QUEUE, (uint32_t)(uintptr_t)queue,           \
139 				   (uint32_t)(uintptr_t)work)
140 
141 #define sys_port_trace_k_work_submit_to_queue_exit(queue, work, ret)                               \
142 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_SUBMIT_TO_QUEUE, (uint32_t)ret)
143 
144 #define sys_port_trace_k_work_submit_enter(work)                                                   \
145 	SEGGER_SYSVIEW_RecordU32(TID_WORK_SUBMIT, (uint32_t)(uintptr_t)work)
146 
147 #define sys_port_trace_k_work_submit_exit(work, ret)                                               \
148 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_SUBMIT, (uint32_t)ret)
149 
150 #define sys_port_trace_k_work_flush_enter(work)                                                    \
151 	SEGGER_SYSVIEW_RecordU32(TID_WORK_FLUSH, (uint32_t)(uintptr_t)work)
152 
153 #define sys_port_trace_k_work_flush_blocking(work, timeout)
154 
155 #define sys_port_trace_k_work_flush_exit(work, ret)                                                \
156 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_FLUSH, (uint32_t)ret)
157 
158 #define sys_port_trace_k_work_cancel_enter(work)                                                   \
159 	SEGGER_SYSVIEW_RecordU32(TID_WORK_CANCEL, (uint32_t)(uintptr_t)work)
160 
161 #define sys_port_trace_k_work_cancel_exit(work, ret)                                               \
162 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_CANCEL, (uint32_t)ret)
163 
164 #define sys_port_trace_k_work_cancel_sync_enter(work, sync)                                        \
165 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_CANCEL_SYNC, (uint32_t)(uintptr_t)work,                \
166 				   (uint32_t)(uintptr_t)sync)
167 
168 #define sys_port_trace_k_work_cancel_sync_blocking(work, sync)
169 
170 #define sys_port_trace_k_work_cancel_sync_exit(work, sync, ret)                                    \
171 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_CANCEL_SYNC, (uint32_t)ret)
172 
173 #define sys_port_trace_k_work_queue_init(queue)             \
174 	SEGGER_SYSVIEW_RecordU32(TID_WORK_QUEUE_INIT,       \
175 				 (uint32_t)(uintptr_t)queue)
176 
177 #define sys_port_trace_k_work_queue_start_enter(queue)                                             \
178 	SEGGER_SYSVIEW_RecordU32(TID_WORK_QUEUE_START, (uint32_t)(uintptr_t)queue)
179 
180 #define sys_port_trace_k_work_queue_start_exit(queue)                                              \
181 	SEGGER_SYSVIEW_RecordEndCall(TID_WORK_QUEUE_START)
182 
183 #define sys_port_trace_k_work_queue_stop_enter(queue, timeout)                                     \
184 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_QUEUE_STOP, (uint32_t)(uintptr_t)queue,                \
185 				   (uint32_t)timeout.ticks)
186 
187 #define sys_port_trace_k_work_queue_stop_blocking(queue, timeout)                                  \
188 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_QUEUE_STOP, (uint32_t)(uintptr_t)queue,                \
189 				   (uint32_t)timeout.ticks)
190 
191 #define sys_port_trace_k_work_queue_stop_exit(queue, timeout, ret)                                 \
192 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_QUEUE_STOP, (uint32_t)ret)
193 
194 #define sys_port_trace_k_work_queue_drain_enter(queue)                                             \
195 	SEGGER_SYSVIEW_RecordU32(TID_WORK_QUEUE_DRAIN, (uint32_t)(uintptr_t)queue)
196 
197 #define sys_port_trace_k_work_queue_drain_exit(queue, ret)                                         \
198 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_QUEUE_DRAIN, (uint32_t)ret)
199 
200 #define sys_port_trace_k_work_queue_unplug_enter(queue)                                            \
201 	SEGGER_SYSVIEW_RecordU32(TID_WORK_QUEUE_UNPLUG, (uint32_t)(uintptr_t)queue)
202 
203 #define sys_port_trace_k_work_queue_unplug_exit(queue, ret)                                        \
204 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_QUEUE_UNPLUG, (uint32_t)ret)
205 
206 #define sys_port_trace_k_work_delayable_init(dwork)                                                \
207 	SEGGER_SYSVIEW_RecordU32(TID_WORK_DELAYABLE_INIT, (uint32_t)(uintptr_t)dwork)
208 
209 #define sys_port_trace_k_work_schedule_for_queue_enter(queue, dwork, delay)                        \
210 	SEGGER_SYSVIEW_RecordU32x3(TID_WORK_SCHEDULE_FOR_QUEUE, (uint32_t)(uintptr_t)queue,        \
211 				   (uint32_t)(uintptr_t)dwork, (uint32_t)delay.ticks)
212 
213 #define sys_port_trace_k_work_schedule_for_queue_exit(queue, dwork, delay, ret)                    \
214 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_SCHEDULE_FOR_QUEUE, (uint32_t)ret)
215 
216 #define sys_port_trace_k_work_schedule_enter(dwork, delay)                                         \
217 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_SCHEDULE, (uint32_t)(uintptr_t)dwork,                  \
218 				   (uint32_t)delay.ticks)
219 
220 #define sys_port_trace_k_work_schedule_exit(dwork, delay, ret)                                     \
221 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_SCHEDULE, (uint32_t)ret)
222 
223 #define sys_port_trace_k_work_reschedule_for_queue_enter(queue, dwork, delay)                      \
224 	SEGGER_SYSVIEW_RecordU32x3(TID_WORK_RESCHEDULE_FOR_QUEUE, (uint32_t)(uintptr_t)queue,      \
225 				   (uint32_t)(uintptr_t)dwork, (uint32_t)delay.ticks)
226 
227 #define sys_port_trace_k_work_reschedule_for_queue_exit(queue, dwork, delay, ret)                  \
228 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_RESCHEDULE_FOR_QUEUE, (uint32_t)ret)
229 
230 #define sys_port_trace_k_work_reschedule_enter(dwork, delay)                                       \
231 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_RESCHEDULE, (uint32_t)(uintptr_t)dwork,                \
232 				   (uint32_t)delay.ticks)
233 
234 #define sys_port_trace_k_work_reschedule_exit(dwork, delay, ret)                                   \
235 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_RESCHEDULE, (uint32_t)ret)
236 
237 #define sys_port_trace_k_work_flush_delayable_enter(dwork, sync)                                   \
238 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_FLUSH_DELAYABLE, (uint32_t)(uintptr_t)dwork,           \
239 				   (uint32_t)(uintptr_t)sync)
240 
241 #define sys_port_trace_k_work_flush_delayable_exit(dwork, sync, ret)                               \
242 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_FLUSH_DELAYABLE, (uint32_t)ret)
243 
244 #define sys_port_trace_k_work_cancel_delayable_enter(dwork)                                        \
245 	SEGGER_SYSVIEW_RecordU32(TID_WORK_CANCEL_DELAYABLE, (uint32_t)(uintptr_t)dwork)
246 
247 #define sys_port_trace_k_work_cancel_delayable_exit(dwork, ret)                                    \
248 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_CANCEL_DELAYABLE, (uint32_t)ret)
249 
250 #define sys_port_trace_k_work_cancel_delayable_sync_enter(dwork, sync)                             \
251 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_CANCEL_DELAYABLE_SYNC, (uint32_t)(uintptr_t)dwork,     \
252 				   (uint32_t)(uintptr_t)sync)
253 
254 #define sys_port_trace_k_work_cancel_delayable_sync_exit(dwork, sync, ret)                         \
255 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_CANCEL_DELAYABLE_SYNC, (uint32_t)ret)
256 
257 #define sys_port_trace_k_work_poll_init_enter(work)                                                \
258 	SEGGER_SYSVIEW_RecordU32(TID_WORK_POLL_INIT, (uint32_t)(uintptr_t)work)
259 
260 #define sys_port_trace_k_work_poll_init_exit(work) SEGGER_SYSVIEW_RecordEndCall(TID_WORK_POLL_INIT)
261 
262 #define sys_port_trace_k_work_poll_submit_to_queue_enter(work_q, work, timeout)                    \
263 	SEGGER_SYSVIEW_RecordU32x3(TID_WORK_POLL_SUBMIT_TO_QUEUE, (uint32_t)(uintptr_t)work_q,     \
264 				   (uint32_t)(uintptr_t)work, (uint32_t)timeout.ticks)
265 
266 #define sys_port_trace_k_work_poll_submit_to_queue_blocking(work_q, work, timeout)
267 
268 #define sys_port_trace_k_work_poll_submit_to_queue_exit(work_q, work, timeout, ret)                \
269 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_POLL_SUBMIT_TO_QUEUE, (uint32_t)ret)
270 
271 #define sys_port_trace_k_work_poll_submit_enter(work, timeout)                                     \
272 	SEGGER_SYSVIEW_RecordU32x2(TID_WORK_POLL_SUBMIT, (uint32_t)(uintptr_t)work,                \
273 				   (uint32_t)timeout.ticks)
274 
275 #define sys_port_trace_k_work_poll_submit_exit(work, timeout, ret)                                 \
276 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_POLL_SUBMIT, (uint32_t)ret)
277 
278 #define sys_port_trace_k_work_poll_cancel_enter(work)                                              \
279 	SEGGER_SYSVIEW_RecordU32(TID_WORK_POLL_CANCEL, (uint32_t)(uintptr_t)work)
280 
281 #define sys_port_trace_k_work_poll_cancel_exit(work, ret)                                          \
282 	SEGGER_SYSVIEW_RecordEndCallU32(TID_WORK_POLL_CANCEL, (uint32_t)ret)
283 
284 #define sys_port_trace_k_poll_api_event_init(event)
285 #define sys_port_trace_k_poll_api_poll_enter(events)
286 #define sys_port_trace_k_poll_api_poll_exit(events, ret)
287 #define sys_port_trace_k_poll_api_signal_init(signal)
288 #define sys_port_trace_k_poll_api_signal_reset(signal)
289 #define sys_port_trace_k_poll_api_signal_check(signal)
290 #define sys_port_trace_k_poll_api_signal_raise(signal, ret)
291 
292 #define sys_port_trace_k_sem_init(sem, ret)                                                        \
293 	SEGGER_SYSVIEW_RecordU32x2(TID_SEMA_INIT, (uint32_t)(uintptr_t)sem, (int32_t)ret)
294 
295 #define sys_port_trace_k_sem_give_enter(sem)                                                       \
296 	SEGGER_SYSVIEW_RecordU32(TID_SEMA_GIVE, (uint32_t)(uintptr_t)sem)
297 
298 #define sys_port_trace_k_sem_give_exit(sem) SEGGER_SYSVIEW_RecordEndCall(TID_SEMA_GIVE)
299 
300 #define sys_port_trace_k_sem_take_enter(sem, timeout)                                              \
301 	SEGGER_SYSVIEW_RecordU32x2(TID_SEMA_TAKE, (uint32_t)(uintptr_t)sem, (uint32_t)timeout.ticks)
302 
303 #define sys_port_trace_k_sem_take_blocking(sem, timeout)
304 
305 #define sys_port_trace_k_sem_take_exit(sem, timeout, ret)                                          \
306 	SEGGER_SYSVIEW_RecordEndCallU32(TID_SEMA_TAKE, (int32_t)ret)
307 
308 #define sys_port_trace_k_sem_reset(sem)                                                            \
309 	SEGGER_SYSVIEW_RecordU32(TID_SEMA_RESET, (uint32_t)(uintptr_t)sem)
310 
311 #define sys_port_trace_k_mutex_init(mutex, ret)                                                    \
312 	SEGGER_SYSVIEW_RecordU32x2(TID_MUTEX_INIT, (uint32_t)(uintptr_t)mutex, (int32_t)ret)
313 
314 #define sys_port_trace_k_mutex_lock_enter(mutex, timeout)                                          \
315 	SEGGER_SYSVIEW_RecordU32x2(TID_MUTEX_LOCK, (uint32_t)(uintptr_t)mutex,                     \
316 				   (uint32_t)timeout.ticks)
317 
318 #define sys_port_trace_k_mutex_lock_blocking(mutex, timeout)
319 
320 #define sys_port_trace_k_mutex_lock_exit(mutex, timeout, ret)                                      \
321 	SEGGER_SYSVIEW_RecordEndCallU32(TID_MUTEX_LOCK, (int32_t)ret)
322 
323 #define sys_port_trace_k_mutex_unlock_enter(mutex)                                                 \
324 	SEGGER_SYSVIEW_RecordU32(TID_MUTEX_UNLOCK, (uint32_t)(uintptr_t)mutex)
325 
326 #define sys_port_trace_k_mutex_unlock_exit(mutex, ret)                                             \
327 	SEGGER_SYSVIEW_RecordEndCallU32(TID_MUTEX_UNLOCK, (uint32_t)ret)
328 
329 #define sys_port_trace_k_condvar_init(condvar, ret)                                                \
330 	SEGGER_SYSVIEW_RecordU32(TID_CONDVAR_INIT, (uint32_t)(uintptr_t)condvar)
331 
332 #define sys_port_trace_k_condvar_signal_enter(condvar)                                             \
333 	SEGGER_SYSVIEW_RecordU32(TID_CONDVAR_SIGNAL, (uint32_t)(uintptr_t)condvar)
334 
335 #define sys_port_trace_k_condvar_signal_blocking(condvar, timeout)
336 
337 #define sys_port_trace_k_condvar_signal_exit(condvar, ret)                                         \
338 	SEGGER_SYSVIEW_RecordEndCallU32(TID_CONDVAR_SIGNAL, (uint32_t)ret)
339 
340 #define sys_port_trace_k_condvar_broadcast_enter(condvar)                                          \
341 	SEGGER_SYSVIEW_RecordU32(TID_CONDVAR_BROADCAST, (uint32_t)(uintptr_t)condvar)
342 
343 #define sys_port_trace_k_condvar_broadcast_exit(condvar, ret)                                      \
344 	SEGGER_SYSVIEW_RecordEndCallU32(TID_CONDVAR_BROADCAST, (uint32_t)ret)
345 
346 #define sys_port_trace_k_condvar_wait_enter(condvar)                                               \
347 	SEGGER_SYSVIEW_RecordU32(TID_CONDVAR_WAIT, (uint32_t)(uintptr_t)condvar)
348 
349 #define sys_port_trace_k_condvar_wait_exit(condvar, ret)                                           \
350 	SEGGER_SYSVIEW_RecordEndCallU32(TID_CONDVAR_WAIT, (uint32_t)ret)
351 
352 #define sys_port_trace_k_queue_init(queue)                                                         \
353 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_INIT, (uint32_t)(uintptr_t)queue)
354 
355 #define sys_port_trace_k_queue_cancel_wait(queue)                                                  \
356 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_CANCEL_WAIT, (uint32_t)(uintptr_t)queue)
357 
358 #define sys_port_trace_k_queue_queue_insert_enter(queue, alloc)
359 #define sys_port_trace_k_queue_queue_insert_blocking(queue, alloc, timeout)
360 #define sys_port_trace_k_queue_queue_insert_exit(queue, alloc, ret)
361 
362 #define sys_port_trace_k_queue_append_enter(queue)                                                 \
363 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_APPEND, (uint32_t)(uintptr_t)queue)
364 
365 #define sys_port_trace_k_queue_append_exit(queue) SEGGER_SYSVIEW_RecordEndCall(TID_QUEUE_APPEND)
366 
367 #define sys_port_trace_k_queue_alloc_append_enter(queue)                                           \
368 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_ALLOC_APPEND, (uint32_t)(uintptr_t)queue)
369 
370 #define sys_port_trace_k_queue_alloc_append_exit(queue, ret)                                       \
371 	SEGGER_SYSVIEW_RecordEndCallU32(TID_QUEUE_ALLOC_APPEND, (uint32_t)ret)
372 
373 #define sys_port_trace_k_queue_prepend_enter(queue)                                                \
374 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_PREPEND, (uint32_t)(uintptr_t)queue)
375 
376 #define sys_port_trace_k_queue_prepend_exit(queue) SEGGER_SYSVIEW_RecordEndCall(TID_QUEUE_PREPEND)
377 
378 #define sys_port_trace_k_queue_alloc_prepend_enter(queue)                                          \
379 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_ALLOC_PREPEND, (uint32_t)(uintptr_t)queue)
380 
381 #define sys_port_trace_k_queue_alloc_prepend_exit(queue, ret)                                      \
382 	SEGGER_SYSVIEW_RecordEndCallU32(TID_QUEUE_ALLOC_PREPEND, (uint32_t)ret)
383 
384 #define sys_port_trace_k_queue_insert_enter(queue)                                                 \
385 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_INSERT, (uint32_t)(uintptr_t)queue)
386 
387 #define sys_port_trace_k_queue_insert_blocking(queue, timeout)
388 
389 #define sys_port_trace_k_queue_insert_exit(queue) SEGGER_SYSVIEW_RecordEndCall(TID_QUEUE_INSERT)
390 
391 #define sys_port_trace_k_queue_append_list_enter(queue)                                            \
392 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_APPEND_LIST, (uint32_t)(uintptr_t)queue)
393 
394 #define sys_port_trace_k_queue_append_list_exit(queue, ret)                                        \
395 	SEGGER_SYSVIEW_RecordEndCallU32(TID_QUEUE_APPEND_LIST, (uint32_t)ret)
396 
397 #define sys_port_trace_k_queue_merge_slist_enter(queue)
398 #define sys_port_trace_k_queue_merge_slist_exit(queue, ret)
399 
400 #define sys_port_trace_k_queue_get_enter(queue, timeout)                                           \
401 	SEGGER_SYSVIEW_RecordU32x2(TID_QUEUE_GET, (uint32_t)(uintptr_t)queue,                      \
402 				   (uint32_t)timeout.ticks)
403 
404 #define sys_port_trace_k_queue_get_blocking(queue, timeout)
405 
406 #define sys_port_trace_k_queue_get_exit(queue, timeout, data)                                      \
407 	SEGGER_SYSVIEW_RecordEndCall(TID_QUEUE_GET)
408 
409 #define sys_port_trace_k_queue_remove_enter(queue)                                                 \
410 	SEGGER_SYSVIEW_RecordU32(TID_QUEUE_REMOVE, (uint32_t)(uintptr_t)queue)
411 
412 #define sys_port_trace_k_queue_remove_exit(queue, ret)                                             \
413 	SEGGER_SYSVIEW_RecordEndCallU32(TID_QUEUE_REMOVE, (uint32_t)ret)
414 
415 #define sys_port_trace_k_queue_unique_append_enter(queue)
416 #define sys_port_trace_k_queue_unique_append_exit(queue, ret)
417 
418 #define sys_port_trace_k_queue_peek_head(queue, ret)                                               \
419 	SEGGER_SYSVIEW_RecordU32x2(TID_QUEUE_PEAK_HEAD, (uint32_t)(uintptr_t)queue, (int32_t)ret)
420 
421 #define sys_port_trace_k_queue_peek_tail(queue, ret)                                               \
422 	SEGGER_SYSVIEW_RecordU32x2(TID_QUEUE_PEAK_TAIL, (uint32_t)(uintptr_t)queue, (int32_t)ret)
423 
424 #define sys_port_trace_k_fifo_init_enter(fifo)                                                     \
425 	SEGGER_SYSVIEW_RecordU32(TID_FIFO_INIT, (uint32_t)(uintptr_t)fifo)
426 #define sys_port_trace_k_fifo_init_exit(fifo) SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_INIT)
427 
428 #define sys_port_trace_k_fifo_cancel_wait_enter(fifo)                                              \
429 	SEGGER_SYSVIEW_RecordU32(TID_FIFO_CANCEL_WAIT, (uint32_t)(uintptr_t)fifo)
430 #define sys_port_trace_k_fifo_cancel_wait_exit(fifo)                                               \
431 	SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_CANCEL_WAIT)
432 
433 #define sys_port_trace_k_fifo_put_enter(fifo, data)                                                \
434 	SEGGER_SYSVIEW_RecordU32x2(TID_FIFO_PUT, (uint32_t)(uintptr_t)fifo,                        \
435 				   (uint32_t)(uintptr_t)data)
436 
437 #define sys_port_trace_k_fifo_put_exit(fifo, data) SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_PUT)
438 
439 #define sys_port_trace_k_fifo_alloc_put_enter(fifo, data)                                          \
440 	SEGGER_SYSVIEW_RecordU32x2(TID_FIFO_ALLOC_PUT, (uint32_t)(uintptr_t)fifo,                  \
441 				   (uint32_t)(uintptr_t)data)
442 #define sys_port_trace_k_fifo_alloc_put_exit(fifo, data, ret)                                      \
443 	SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_ALLOC_PUT)
444 
445 #define sys_port_trace_k_fifo_put_list_enter(fifo, head, tail)                                     \
446 	SEGGER_SYSVIEW_RecordU32x3(TID_FIFO_PUT_LIST, (uint32_t)(uintptr_t)fifo,                   \
447 				   (uint32_t)(uintptr_t)head, (uint32_t)(uintptr_t)tail)
448 
449 #define sys_port_trace_k_fifo_put_list_exit(fifo, head, tail)                                      \
450 	SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_PUT_LIST)
451 
452 #define sys_port_trace_k_fifo_put_slist_enter(fifo, list)                                          \
453 	SEGGER_SYSVIEW_RecordU32x2(TID_FIFO_PUT_SLIST, (uint32_t)(uintptr_t)fifo,                  \
454 				   (uint32_t)(uintptr_t)list)
455 #define sys_port_trace_k_fifo_put_slist_exit(fifo, list)                                           \
456 	SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_PUT_SLIST)
457 
458 #define sys_port_trace_k_fifo_get_enter(fifo, timeout)                                             \
459 	SEGGER_SYSVIEW_RecordU32x2(TID_FIFO_GET, (uint32_t)(uintptr_t)fifo, (uint32_t)timeout.ticks)
460 
461 #define sys_port_trace_k_fifo_get_exit(fifo, timeout, ret)                                         \
462 	SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_GET)
463 
464 #define sys_port_trace_k_fifo_peek_head_enter(fifo)                                                \
465 	SEGGER_SYSVIEW_RecordU32(TID_FIFO_PEAK_HEAD, (uint32_t)(uintptr_t)fifo)
466 
467 #define sys_port_trace_k_fifo_peek_head_exit(fifo, ret)                                            \
468 	SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_PEAK_HEAD)
469 
470 #define sys_port_trace_k_fifo_peek_tail_enter(fifo)                                                \
471 	SEGGER_SYSVIEW_RecordU32(TID_FIFO_PEAK_TAIL, (uint32_t)(uintptr_t)fifo)
472 #define sys_port_trace_k_fifo_peek_tail_exit(fifo, ret)                                            \
473 	SEGGER_SYSVIEW_RecordEndCall(TID_FIFO_PEAK_TAIL)
474 
475 #define sys_port_trace_k_lifo_init_enter(lifo)                                                     \
476 	SEGGER_SYSVIEW_RecordU32(TID_LIFO_INIT, (uint32_t)(uintptr_t)lifo)
477 
478 #define sys_port_trace_k_lifo_init_exit(lifo) SEGGER_SYSVIEW_RecordEndCall(TID_LIFO_INIT)
479 
480 #define sys_port_trace_k_lifo_put_enter(lifo, data)                                                \
481 	SEGGER_SYSVIEW_RecordU32x2(TID_LIFO_PUT, (uint32_t)(uintptr_t)lifo,                        \
482 				   (uint32_t)(uintptr_t)data)
483 
484 #define sys_port_trace_k_lifo_put_exit(lifo, data) SEGGER_SYSVIEW_RecordEndCall(TID_LIFO_PUT)
485 
486 #define sys_port_trace_k_lifo_alloc_put_enter(lifo, data)                                          \
487 	SEGGER_SYSVIEW_RecordU32x2(TID_LIFO_ALLOC_PUT, (uint32_t)(uintptr_t)lifo,                  \
488 				   (uint32_t)(uintptr_t)data)
489 #define sys_port_trace_k_lifo_alloc_put_exit(lifo, data, ret)                                      \
490 	SEGGER_SYSVIEW_RecordEndCall(TID_LIFO_ALLOC_PUT)
491 
492 #define sys_port_trace_k_lifo_get_enter(lifo, timeout)                                             \
493 	SEGGER_SYSVIEW_RecordU32x2(TID_LIFO_GET, (uint32_t)(uintptr_t)lifo, (uint32_t)timeout.ticks)
494 #define sys_port_trace_k_lifo_get_exit(lifo, timeout, ret)                                         \
495 	SEGGER_SYSVIEW_RecordEndCall(TID_LIFO_GET)
496 
497 #define sys_port_trace_k_stack_init(stack)
498 #define sys_port_trace_k_stack_alloc_init_enter(stack)
499 #define sys_port_trace_k_stack_alloc_init_exit(stack, ret)
500 #define sys_port_trace_k_stack_cleanup_enter(stack)
501 #define sys_port_trace_k_stack_cleanup_exit(stack, ret)
502 #define sys_port_trace_k_stack_push_enter(stack)
503 #define sys_port_trace_k_stack_push_exit(stack, ret)
504 #define sys_port_trace_k_stack_pop_enter(stack, timeout)
505 #define sys_port_trace_k_stack_pop_blocking(stack, timeout)
506 #define sys_port_trace_k_stack_pop_exit(stack, timeout, ret)
507 
508 #define sys_port_trace_k_msgq_init(msgq)
509 #define sys_port_trace_k_msgq_alloc_init_enter(msgq)
510 #define sys_port_trace_k_msgq_alloc_init_exit(msgq, ret)
511 #define sys_port_trace_k_msgq_cleanup_enter(msgq)
512 #define sys_port_trace_k_msgq_cleanup_exit(msgq, ret)
513 #define sys_port_trace_k_msgq_put_enter(msgq, timeout)
514 #define sys_port_trace_k_msgq_put_blocking(msgq, timeout)
515 #define sys_port_trace_k_msgq_put_exit(msgq, timeout, ret)
516 #define sys_port_trace_k_msgq_get_enter(msgq, timeout)
517 #define sys_port_trace_k_msgq_get_blocking(msgq, timeout)
518 #define sys_port_trace_k_msgq_get_exit(msgq, timeout, ret)
519 #define sys_port_trace_k_msgq_peek(msgq, ret)
520 #define sys_port_trace_k_msgq_purge(msgq)
521 
522 #define sys_port_trace_k_mbox_init(mbox)
523 #define sys_port_trace_k_mbox_message_put_enter(mbox, timeout)
524 #define sys_port_trace_k_mbox_message_put_blocking(mbox, timeout)
525 #define sys_port_trace_k_mbox_message_put_exit(mbox, timeout, ret)
526 #define sys_port_trace_k_mbox_put_enter(mbox, timeout)
527 #define sys_port_trace_k_mbox_put_exit(mbox, timeout, ret)
528 #define sys_port_trace_k_mbox_async_put_enter(mbox, sem)
529 #define sys_port_trace_k_mbox_async_put_exit(mbox, sem)
530 #define sys_port_trace_k_mbox_get_enter(mbox, timeout)
531 #define sys_port_trace_k_mbox_get_blocking(mbox, timeout)
532 #define sys_port_trace_k_mbox_get_exit(mbox, timeout, ret)
533 #define sys_port_trace_k_mbox_data_get(rx_msg)
534 
535 #define sys_port_trace_k_pipe_init(pipe)
536 #define sys_port_trace_k_pipe_cleanup_enter(pipe)
537 #define sys_port_trace_k_pipe_cleanup_exit(pipe, ret)
538 #define sys_port_trace_k_pipe_alloc_init_enter(pipe)
539 #define sys_port_trace_k_pipe_alloc_init_exit(pipe, ret)
540 #define sys_port_trace_k_pipe_flush_enter(pipe)
541 #define sys_port_trace_k_pipe_flush_exit(pipe)
542 #define sys_port_trace_k_pipe_buffer_flush_enter(pipe)
543 #define sys_port_trace_k_pipe_buffer_flush_exit(pipe)
544 #define sys_port_trace_k_pipe_put_enter(pipe, timeout)
545 #define sys_port_trace_k_pipe_put_blocking(pipe, timeout)
546 #define sys_port_trace_k_pipe_put_exit(pipe, timeout, ret)
547 #define sys_port_trace_k_pipe_get_enter(pipe, timeout)
548 #define sys_port_trace_k_pipe_get_blocking(pipe, timeout)
549 #define sys_port_trace_k_pipe_get_exit(pipe, timeout, ret)
550 
551 #define sys_port_trace_k_event_init(event)
552 #define sys_port_trace_k_event_post_enter(event, events, events_mask)
553 #define sys_port_trace_k_event_post_exit(event, events, events_mask)
554 #define sys_port_trace_k_event_wait_enter(event, events, options, timeout)
555 #define sys_port_trace_k_event_wait_blocking(event, events, options, timeout)
556 #define sys_port_trace_k_event_wait_exit(event, events, ret)
557 
558 #define sys_port_trace_k_heap_init(heap)                                                           \
559 	SEGGER_SYSVIEW_RecordU32(TID_HEAP_INIT, (uint32_t)(uintptr_t)heap)
560 
561 #define sys_port_trace_k_heap_aligned_alloc_enter(heap, timeout)                                   \
562 	SEGGER_SYSVIEW_RecordU32x2(TID_HEAP_ALIGNED_ALLOC, (uint32_t)(uintptr_t)heap,              \
563 				   (uint32_t)timeout.ticks)
564 
565 #define sys_port_trace_k_heap_aligned_alloc_blocking(heap, timeout)
566 
567 #define sys_port_trace_k_heap_aligned_alloc_exit(heap, timeout, ret)                               \
568 	SEGGER_SYSVIEW_RecordEndCallU32(TID_HEAP_ALIGNED_ALLOC, (uint32_t)ret)
569 
570 #define sys_port_trace_k_heap_alloc_enter(heap, timeout)                                           \
571 	SEGGER_SYSVIEW_RecordU32x2(TID_HEAP_ALLOC, (uint32_t)(uintptr_t)heap,                      \
572 				   (uint32_t)timeout.ticks)
573 
574 #define sys_port_trace_k_heap_alloc_exit(heap, timeout, ret)                                       \
575 	SEGGER_SYSVIEW_RecordEndCallU32(TID_HEAP_ALLOC, (uint32_t)ret)
576 
577 #define sys_port_trace_k_heap_calloc_enter(heap, timeout)                                          \
578 	SEGGER_SYSVIEW_RecordU32x2(TID_HEAP_CALLOC, (uint32_t)(uintptr_t)heap,                     \
579 				   (uint32_t)timeout.ticks)
580 
581 #define sys_port_trace_k_heap_calloc_exit(heap, timeout, ret)                                      \
582 	SEGGER_SYSVIEW_RecordEndCallU32(TID_HEAP_CALLOC, (uint32_t)ret)
583 
584 #define sys_port_trace_k_heap_free(heap)                                                           \
585 	SEGGER_SYSVIEW_RecordU32(TID_HEAP_FREE, (uint32_t)(uintptr_t)heap)
586 
587 #define sys_port_trace_k_heap_realloc_enter(heap, ptr, bytes, timeout)                             \
588 	SEGGER_SYSVIEW_RecordU32x4(TID_HEAP_REALLOC, (uint32_t)(uintptr_t)heap,                    \
589 				   (uint32_t)(uintptr_t)ptr, (uint32_t)bytes,                      \
590 				   (uint32_t)timeout.ticks)
591 
592 #define sys_port_trace_k_heap_realloc_exit(heap, ptr, bytes, timeout, ret)                         \
593 	SEGGER_SYSVIEW_RecordEndCallU32(TID_HEAP_REALLOC, (uint32_t)ret)
594 
595 #define sys_port_trace_k_heap_sys_k_aligned_alloc_enter(heap)
596 #define sys_port_trace_k_heap_sys_k_aligned_alloc_exit(heap, ret)
597 #define sys_port_trace_k_heap_sys_k_malloc_enter(heap)
598 #define sys_port_trace_k_heap_sys_k_malloc_exit(heap, ret)
599 #define sys_port_trace_k_heap_sys_k_free_enter(heap, heap_ref)
600 #define sys_port_trace_k_heap_sys_k_free_exit(heap, heap_ref)
601 #define sys_port_trace_k_heap_sys_k_calloc_enter(heap)
602 #define sys_port_trace_k_heap_sys_k_calloc_exit(heap, ret)
603 #define sys_port_trace_k_heap_sys_k_realloc_enter(heap, ptr)
604 #define sys_port_trace_k_heap_sys_k_realloc_exit(heap, ptr, ret)
605 
606 #define sys_port_trace_k_mem_slab_init(slab, rc)                                                   \
607 	SEGGER_SYSVIEW_RecordU32(TID_MSLAB_INIT, (uint32_t)(uintptr_t)slab)
608 
609 #define sys_port_trace_k_mem_slab_alloc_enter(slab, timeout)                                       \
610 	SEGGER_SYSVIEW_RecordU32x2(TID_MSLAB_ALLOC, (uint32_t)(uintptr_t)slab,                     \
611 				   (uint32_t)timeout.ticks)
612 
613 #define sys_port_trace_k_mem_slab_alloc_blocking(slab, timeout)
614 #define sys_port_trace_k_mem_slab_alloc_exit(slab, timeout, ret)                                   \
615 	SEGGER_SYSVIEW_RecordEndCallU32(TID_MSLAB_ALLOC, (uint32_t)ret)
616 
617 #define sys_port_trace_k_mem_slab_free_enter(slab)                                                 \
618 	SEGGER_SYSVIEW_RecordU32(TID_MSLAB_FREE, (uint32_t)(uintptr_t)slab)
619 
620 #define sys_port_trace_k_mem_slab_free_exit(slab) SEGGER_SYSVIEW_RecordEndCall(TID_MSLAB_ALLOC)
621 
622 #define sys_port_trace_k_timer_init(timer)                                                         \
623 	SEGGER_SYSVIEW_RecordU32(TID_TIMER_INIT, (uint32_t)(uintptr_t)timer)
624 
625 #define sys_port_trace_k_timer_start(timer, duration, period)					   \
626 	SEGGER_SYSVIEW_RecordU32x3(TID_TIMER_START, (uint32_t)(uintptr_t)timer,			   \
627 			(uint32_t)duration.ticks, (uint32_t)period.ticks)
628 
629 #define sys_port_trace_k_timer_stop(timer)                                                         \
630 	SEGGER_SYSVIEW_RecordU32(TID_TIMER_STOP, (uint32_t)(uintptr_t)timer)
631 
632 #define sys_port_trace_k_timer_status_sync_enter(timer)                                            \
633 	SEGGER_SYSVIEW_RecordU32(TID_TIMER_STATUS_SYNC, (uint32_t)(uintptr_t)timer)
634 
635 #define sys_port_trace_k_timer_status_sync_blocking(timer, timeout)
636 
637 #define sys_port_trace_k_timer_status_sync_exit(timer, result)                                     \
638 	SEGGER_SYSVIEW_RecordEndCallU32(TID_TIMER_STATUS_SYNC, (uint32_t)result)
639 
640 #define sys_port_trace_syscall_enter(id, name, ...)	\
641 	SEGGER_SYSVIEW_RecordString(TID_SYSCALL, (const char *)#name)
642 
643 #define sys_port_trace_syscall_exit(id, name, ...)	\
644 	SEGGER_SYSVIEW_RecordEndCall(TID_SYSCALL)
645 
646 void sys_trace_idle(void);
647 
648 void sys_trace_k_thread_create(struct k_thread *new_thread, size_t stack_size, int prio);
649 void sys_trace_k_thread_user_mode_enter(k_thread_entry_t entry, void *p1, void *p2, void *p3);
650 
651 void sys_trace_k_thread_join_blocking(struct k_thread *thread, k_timeout_t timeout);
652 void sys_trace_k_thread_join_exit(struct k_thread *thread, k_timeout_t timeout, int ret);
653 
654 void sys_trace_k_thread_switched_out(void);
655 void sys_trace_k_thread_switched_in(void);
656 void sys_trace_k_thread_ready(struct k_thread *thread);
657 void sys_trace_k_thread_pend(struct k_thread *thread);
658 void sys_trace_k_thread_info(struct k_thread *thread);
659 
660 void sys_trace_named_event(const char *name, uint32_t arg0, uint32_t arg1);
661 
662 #define sys_port_trace_pm_system_suspend_enter(ticks)			       \
663 	SEGGER_SYSVIEW_RecordU32(TID_PM_SYSTEM_SUSPEND, (uint32_t)ticks)
664 #define sys_port_trace_pm_system_suspend_exit(ticks, state)		       \
665 	SEGGER_SYSVIEW_RecordEndCallU32(TID_PM_SYSTEM_SUSPEND, (uint32_t)state)
666 
667 #define sys_port_trace_pm_device_runtime_get_enter(dev)			       \
668 	SEGGER_SYSVIEW_RecordU32(TID_PM_DEVICE_RUNTIME_GET,		       \
669 				 (uint32_t)(uintptr_t)dev)
670 #define sys_port_trace_pm_device_runtime_get_exit(dev, ret)		       \
671 	SEGGER_SYSVIEW_RecordEndCallU32(TID_PM_DEVICE_RUNTIME_GET,	       \
672 					(uint32_t)ret)
673 #define sys_port_trace_pm_device_runtime_put_enter(dev)			       \
674 	SEGGER_SYSVIEW_RecordU32(TID_PM_DEVICE_RUNTIME_PUT,		       \
675 				 (uint32_t)(uintptr_t)dev)
676 #define sys_port_trace_pm_device_runtime_put_exit(dev, ret)		       \
677 	SEGGER_SYSVIEW_RecordEndCallU32(TID_PM_DEVICE_RUNTIME_PUT,	       \
678 					(uint32_t)ret)
679 #define sys_port_trace_pm_device_runtime_put_async_enter(dev, delay)	       \
680 	SEGGER_SYSVIEW_RecordU32x2(TID_PM_DEVICE_RUNTIME_PUT_ASYNC,	       \
681 			 (uint32_t)(uintptr_t)dev, (uint32_t)delay.ticks)
682 #define sys_port_trace_pm_device_runtime_put_async_exit(dev, delay, ret)       \
683 	SEGGER_SYSVIEW_RecordEndCallU32(TID_PM_DEVICE_RUNTIME_PUT_ASYNC,       \
684 					(uint32_t)ret)
685 #define sys_port_trace_pm_device_runtime_enable_enter(dev)		       \
686 	SEGGER_SYSVIEW_RecordU32(TID_PM_DEVICE_RUNTIME_ENABLE,		       \
687 				 (uint32_t)(uintptr_t)dev)
688 #define sys_port_trace_pm_device_runtime_enable_exit(dev, ret)		       \
689 	SEGGER_SYSVIEW_RecordEndCallU32(TID_PM_DEVICE_RUNTIME_ENABLE,	       \
690 				     (uint32_t)ret)
691 #define sys_port_trace_pm_device_runtime_disable_enter(dev)		       \
692 	SEGGER_SYSVIEW_RecordU32(TID_PM_DEVICE_RUNTIME_DISABLE,		       \
693 				 (uint32_t)(uintptr_t)dev)
694 #define sys_port_trace_pm_device_runtime_disable_exit(dev, ret)		       \
695 	SEGGER_SYSVIEW_RecordEndCallU32(TID_PM_DEVICE_RUNTIME_DISABLE,	       \
696 					(uint32_t)ret)
697 
698 #define sys_trace_sys_init_enter(...)
699 #define sys_trace_sys_init_exit(...)
700 
701 #define sys_port_trace_socket_init(sock, family, type, proto)
702 #define sys_port_trace_socket_close_enter(sock)
703 #define sys_port_trace_socket_close_exit(sock, ret)
704 #define sys_port_trace_socket_shutdown_enter(sock, how)
705 #define sys_port_trace_socket_shutdown_exit(sock, ret)
706 #define sys_port_trace_socket_bind_enter(sock, addr, addrlen)
707 #define sys_port_trace_socket_bind_exit(sock, ret)
708 #define sys_port_trace_socket_connect_enter(sock, addr, addrlen)
709 #define sys_port_trace_socket_connect_exit(sock, ret)
710 #define sys_port_trace_socket_listen_enter(sock, backlog)
711 #define sys_port_trace_socket_listen_exit(sock, ret)
712 #define sys_port_trace_socket_accept_enter(sock)
713 #define sys_port_trace_socket_accept_exit(sock, addr, addrlen, ret)
714 #define sys_port_trace_socket_sendto_enter(sock, len, flags, dest_addr, addrlen)
715 #define sys_port_trace_socket_sendto_exit(sock, ret)
716 #define sys_port_trace_socket_sendmsg_enter(sock, msg, flags)
717 #define sys_port_trace_socket_sendmsg_exit(sock, ret)
718 #define sys_port_trace_socket_recvfrom_enter(sock, max_len, flags, addr, addrlen)
719 #define sys_port_trace_socket_recvfrom_exit(sock, src_addr, addrlen, ret)
720 #define sys_port_trace_socket_recvmsg_enter(sock, msg, flags)
721 #define sys_port_trace_socket_recvmsg_exit(sock, msg, ret)
722 #define sys_port_trace_socket_fcntl_enter(sock, cmd, flags)
723 #define sys_port_trace_socket_fcntl_exit(sock, ret)
724 #define sys_port_trace_socket_ioctl_enter(sock, req)
725 #define sys_port_trace_socket_ioctl_exit(sock, ret)
726 #define sys_port_trace_socket_poll_enter(fds, nfds, timeout)
727 #define sys_port_trace_socket_poll_exit(fds, nfds, ret)
728 #define sys_port_trace_socket_getsockopt_enter(sock, level, optname)
729 #define sys_port_trace_socket_getsockopt_exit(sock, level, optname, optval, optlen, ret)
730 #define sys_port_trace_socket_setsockopt_enter(sock, level, optname, optval, optlen)
731 #define sys_port_trace_socket_setsockopt_exit(sock, ret)
732 #define sys_port_trace_socket_getpeername_enter(sock)
733 #define sys_port_trace_socket_getpeername_exit(sock, addr, addrlen, ret)
734 #define sys_port_trace_socket_getsockname_enter(sock)
735 #define sys_port_trace_socket_getsockname_exit(sock, addr, addrlen, ret)
736 #define sys_port_trace_socket_socketpair_enter(family, type, proto, sv)
737 #define sys_port_trace_socket_socketpair_exit(sockA, sockB, ret)
738 
739 #define sys_port_trace_net_recv_data_enter(iface, pkt)
740 #define sys_port_trace_net_recv_data_exit(iface, pkt, ret)
741 #define sys_port_trace_net_send_data_enter(pkt)
742 #define sys_port_trace_net_send_data_exit(pkt, ret)
743 #define sys_port_trace_net_rx_time(pkt, end_time)
744 #define sys_port_trace_net_tx_time(pkt, end_time)
745 
746 #define sys_port_trace_gpio_pin_interrupt_configure_enter(port, pin, flags)
747 #define sys_port_trace_gpio_pin_interrupt_configure_exit(port, pin, ret)
748 #define sys_port_trace_gpio_pin_configure_enter(port, pin, flags)
749 #define sys_port_trace_gpio_pin_configure_exit(port, pin, ret)
750 #define sys_port_trace_gpio_port_get_direction_enter(port, map, inputs, outputs)
751 #define sys_port_trace_gpio_port_get_direction_exit(port, map, ret)
752 #define sys_port_trace_gpio_pin_get_config_enter(port, pin, flags)
753 #define sys_port_trace_gpio_pin_get_config_exit(port, pin, ret)
754 #define sys_port_trace_gpio_port_get_raw_enter(port, value)
755 #define sys_port_trace_gpio_port_get_raw_exit(port, ret)
756 #define sys_port_trace_gpio_port_set_masked_raw_enter(port, mask, value)
757 #define sys_port_trace_gpio_port_set_masked_raw_exit(port, ret)
758 #define sys_port_trace_gpio_port_set_bits_raw_enter(port, pins)
759 #define sys_port_trace_gpio_port_set_bits_raw_exit(port, ret)
760 #define sys_port_trace_gpio_port_clear_bits_raw_enter(port, pins)
761 #define sys_port_trace_gpio_port_clear_bits_raw_exit(port, ret)
762 #define sys_port_trace_gpio_port_toggle_bits_enter(port, pins)
763 #define sys_port_trace_gpio_port_toggle_bits_exit(port, ret)
764 #define sys_port_trace_gpio_init_callback_enter(callback, handler, pin_mask)
765 #define sys_port_trace_gpio_init_callback_exit(callback)
766 #define sys_port_trace_gpio_add_callback_enter(port, callback)
767 #define sys_port_trace_gpio_add_callback_exit(port, ret)
768 #define sys_port_trace_gpio_remove_callback_enter(port, callback)
769 #define sys_port_trace_gpio_remove_callback_exit(port, ret)
770 #define sys_port_trace_gpio_get_pending_int_enter(dev)
771 #define sys_port_trace_gpio_get_pending_int_exit(dev, ret)
772 #define sys_port_trace_gpio_fire_callbacks_enter(list, port, pins)
773 #define sys_port_trace_gpio_fire_callback(port, cb)
774 
775 #ifdef __cplusplus
776 }
777 #endif
778 
779 #endif /* ZEPHYR_TRACE_SYSVIEW_H */
780