1 /*
2  * Copyright (c) 2018 Oticon A/S
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef _TRACE_CTF_H
8 #define _TRACE_CTF_H
9 
10 #include <zephyr/kernel.h>
11 #include <zephyr/kernel_structs.h>
12 #include <zephyr/init.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 
19 #define sys_port_trace_k_thread_foreach_enter()
20 #define sys_port_trace_k_thread_foreach_exit()
21 #define sys_port_trace_k_thread_foreach_unlocked_enter()
22 #define sys_port_trace_k_thread_foreach_unlocked_exit()
23 
24 #define sys_port_trace_k_thread_create(new_thread)                             \
25 	sys_trace_k_thread_create(new_thread, stack_size, prio)
26 
27 #define sys_port_trace_k_thread_user_mode_enter()                              \
28 	sys_trace_k_thread_user_mode_enter()
29 
30 #define sys_port_trace_k_thread_heap_assign(thread, heap)
31 #define sys_port_trace_k_thread_join_enter(thread, timeout)
32 #define sys_port_trace_k_thread_join_blocking(thread, timeout)
33 #define sys_port_trace_k_thread_join_exit(thread, timeout, ret)
34 #define sys_port_trace_k_thread_sleep_enter(timeout)
35 #define sys_port_trace_k_thread_sleep_exit(timeout, ret)
36 #define sys_port_trace_k_thread_msleep_enter(ms)
37 #define sys_port_trace_k_thread_msleep_exit(ms, ret)
38 #define sys_port_trace_k_thread_usleep_enter(us)
39 #define sys_port_trace_k_thread_usleep_exit(us, ret)
40 #define sys_port_trace_k_thread_busy_wait_enter(usec_to_wait)
41 #define sys_port_trace_k_thread_busy_wait_exit(usec_to_wait)
42 #define sys_port_trace_k_thread_yield()
43 #define sys_port_trace_k_thread_wakeup(thread) sys_trace_k_thread_wakeup(thread)
44 #define sys_port_trace_k_thread_start(thread) sys_trace_k_thread_start(thread)
45 #define sys_port_trace_k_thread_abort(thread) sys_trace_k_thread_abort(thread)
46 #define sys_port_trace_k_thread_suspend_enter(thread)                          \
47 	sys_trace_k_thread_suspend(thread)
48 #define sys_port_trace_k_thread_suspend_exit(thread)
49 #define sys_port_trace_k_thread_resume_enter(thread)                           \
50 	sys_trace_k_thread_resume(thread)
51 
52 #define sys_port_trace_k_thread_sched_lock()
53 
54 #define sys_port_trace_k_thread_sched_unlock()
55 
56 #define sys_port_trace_k_thread_name_set(thread, ret)                          \
57 	sys_trace_k_thread_name_set(thread, ret)
58 
59 #define sys_port_trace_k_thread_switched_out() sys_trace_k_thread_switched_out()
60 
61 #define sys_port_trace_k_thread_switched_in() sys_trace_k_thread_switched_in()
62 
63 #define sys_port_trace_k_thread_info(thread) sys_trace_k_thread_info(thread)
64 
65 #define sys_port_trace_k_thread_sched_wakeup(thread)
66 #define sys_port_trace_k_thread_sched_abort(thread)
67 #define sys_port_trace_k_thread_sched_priority_set(thread, prio)
68 #define sys_port_trace_k_thread_sched_ready(thread)
69 
70 #define sys_port_trace_k_thread_sched_pend(thread)
71 
72 #define sys_port_trace_k_thread_sched_resume(thread)
73 
74 #define sys_port_trace_k_thread_sched_suspend(thread)
75 
76 #define sys_port_trace_k_work_init(work)
77 #define sys_port_trace_k_work_submit_to_queue_enter(queue, work)
78 #define sys_port_trace_k_work_submit_to_queue_exit(queue, work, ret)
79 #define sys_port_trace_k_work_submit_enter(work)
80 #define sys_port_trace_k_work_submit_exit(work, ret)
81 #define sys_port_trace_k_work_flush_enter(work)
82 #define sys_port_trace_k_work_flush_blocking(work, timeout)
83 #define sys_port_trace_k_work_flush_exit(work, ret)
84 #define sys_port_trace_k_work_cancel_enter(work)
85 #define sys_port_trace_k_work_cancel_exit(work, ret)
86 #define sys_port_trace_k_work_cancel_sync_enter(work, sync)
87 #define sys_port_trace_k_work_cancel_sync_blocking(work, sync)
88 #define sys_port_trace_k_work_cancel_sync_exit(work, sync, ret)
89 
90 #define sys_port_trace_k_work_queue_init(queue)
91 #define sys_port_trace_k_work_queue_start_enter(queue)
92 #define sys_port_trace_k_work_queue_start_exit(queue)
93 #define sys_port_trace_k_work_queue_drain_enter(queue)
94 #define sys_port_trace_k_work_queue_drain_exit(queue, ret)
95 #define sys_port_trace_k_work_queue_unplug_enter(queue)
96 #define sys_port_trace_k_work_queue_unplug_exit(queue, ret)
97 
98 #define sys_port_trace_k_work_delayable_init(dwork)
99 #define sys_port_trace_k_work_schedule_for_queue_enter(queue, dwork, delay)
100 #define sys_port_trace_k_work_schedule_for_queue_exit(queue, dwork, delay,     \
101 						      ret)
102 #define sys_port_trace_k_work_schedule_enter(dwork, delay)
103 #define sys_port_trace_k_work_schedule_exit(dwork, delay, ret)
104 #define sys_port_trace_k_work_reschedule_for_queue_enter(queue, dwork, delay)
105 #define sys_port_trace_k_work_reschedule_for_queue_exit(queue, dwork, delay,   \
106 							ret)
107 #define sys_port_trace_k_work_reschedule_enter(dwork, delay)
108 #define sys_port_trace_k_work_reschedule_exit(dwork, delay, ret)
109 #define sys_port_trace_k_work_flush_delayable_enter(dwork, sync)
110 #define sys_port_trace_k_work_flush_delayable_exit(dwork, sync, ret)
111 #define sys_port_trace_k_work_cancel_delayable_enter(dwork)
112 #define sys_port_trace_k_work_cancel_delayable_exit(dwork, ret)
113 #define sys_port_trace_k_work_cancel_delayable_sync_enter(dwork, sync)
114 #define sys_port_trace_k_work_cancel_delayable_sync_exit(dwork, sync, ret)
115 
116 #define sys_port_trace_k_work_poll_init_enter(work)
117 #define sys_port_trace_k_work_poll_init_exit(work)
118 #define sys_port_trace_k_work_poll_submit_to_queue_enter(work_q, work,         \
119 							 timeout)
120 #define sys_port_trace_k_work_poll_submit_to_queue_blocking(work_q, work,      \
121 							    timeout)
122 #define sys_port_trace_k_work_poll_submit_to_queue_exit(work_q, work, timeout, \
123 							ret)
124 #define sys_port_trace_k_work_poll_submit_enter(work, timeout)
125 #define sys_port_trace_k_work_poll_submit_exit(work, timeout, ret)
126 #define sys_port_trace_k_work_poll_cancel_enter(work)
127 #define sys_port_trace_k_work_poll_cancel_exit(work, ret)
128 
129 #define sys_port_trace_k_poll_api_event_init(event)
130 #define sys_port_trace_k_poll_api_poll_enter(events)
131 #define sys_port_trace_k_poll_api_poll_exit(events, ret)
132 #define sys_port_trace_k_poll_api_signal_init(signal)
133 #define sys_port_trace_k_poll_api_signal_reset(signal)
134 #define sys_port_trace_k_poll_api_signal_check(signal)
135 #define sys_port_trace_k_poll_api_signal_raise(signal, ret)
136 
137 #define sys_port_trace_k_sem_init(sem, ret)                                    \
138 	sys_trace_k_sem_init(sem, ret)
139 
140 #define sys_port_trace_k_sem_give_enter(sem) sys_trace_k_sem_give_enter(sem)
141 #define sys_port_trace_k_sem_give_exit(sem) sys_trace_k_sem_give_exit(sem)
142 #define sys_port_trace_k_sem_take_enter(sem, timeout)                          \
143 	sys_trace_k_sem_take_enter(sem, timeout)
144 #define sys_port_trace_k_sem_take_blocking(sem, timeout)                       \
145 	sys_trace_k_sem_take_blocking(sem, timeout)
146 #define sys_port_trace_k_sem_take_exit(sem, timeout, ret)                      \
147 	sys_trace_k_sem_take_exit(sem, timeout, ret)
148 #define sys_port_trace_k_sem_reset(sem) sys_trace_k_sem_reset(sem)
149 
150 #define sys_port_trace_k_mutex_init(mutex, ret)                                \
151 	sys_trace_k_mutex_init(mutex, ret)
152 #define sys_port_trace_k_mutex_lock_enter(mutex, timeout)                      \
153 	sys_trace_k_mutex_lock_enter(mutex, timeout)
154 #define sys_port_trace_k_mutex_lock_blocking(mutex, timeout)                   \
155 	sys_trace_k_mutex_lock_blocking(mutex, timeout)
156 #define sys_port_trace_k_mutex_lock_exit(mutex, timeout, ret)                  \
157 	sys_trace_k_mutex_lock_exit(mutex, timeout, ret)
158 #define sys_port_trace_k_mutex_unlock_enter(mutex)                             \
159 	sys_trace_k_mutex_unlock_enter(mutex)
160 #define sys_port_trace_k_mutex_unlock_exit(mutex, ret)                         \
161 	sys_trace_k_mutex_unlock_exit(mutex, ret)
162 
163 /* Timer */
164 #define sys_port_trace_k_timer_init(timer)					\
165 	sys_trace_k_timer_init(timer)
166 #define sys_port_trace_k_timer_start(timer, duration, period)			\
167 	sys_trace_k_timer_start(timer, duration, period)
168 #define sys_port_trace_k_timer_stop(timer)					\
169 	sys_trace_k_timer_stop(timer)
170 #define sys_port_trace_k_timer_status_sync_enter(timer)				\
171 	sys_trace_k_timer_status_sync_enter(timer)
172 #define sys_port_trace_k_timer_status_sync_blocking(timer, timeout)		\
173 	sys_trace_k_timer_status_sync_blocking(timer, timeout)
174 #define sys_port_trace_k_timer_status_sync_exit(timer, result)			\
175 	sys_trace_k_timer_status_sync_exit(timer, result)
176 
177 
178 #define sys_port_trace_k_condvar_init(condvar, ret)
179 #define sys_port_trace_k_condvar_signal_enter(condvar)
180 #define sys_port_trace_k_condvar_signal_blocking(condvar, timeout)
181 #define sys_port_trace_k_condvar_signal_exit(condvar, ret)
182 #define sys_port_trace_k_condvar_broadcast_enter(condvar)
183 #define sys_port_trace_k_condvar_broadcast_exit(condvar, ret)
184 #define sys_port_trace_k_condvar_wait_enter(condvar)
185 #define sys_port_trace_k_condvar_wait_exit(condvar, ret)
186 
187 #define sys_port_trace_k_queue_init(queue)
188 #define sys_port_trace_k_queue_cancel_wait(queue)
189 #define sys_port_trace_k_queue_queue_insert_enter(queue, alloc)
190 #define sys_port_trace_k_queue_queue_insert_blocking(queue, alloc, timeout)
191 #define sys_port_trace_k_queue_queue_insert_exit(queue, alloc, ret)
192 #define sys_port_trace_k_queue_append_enter(queue)
193 #define sys_port_trace_k_queue_append_exit(queue)
194 #define sys_port_trace_k_queue_alloc_append_enter(queue)
195 #define sys_port_trace_k_queue_alloc_append_exit(queue, ret)
196 #define sys_port_trace_k_queue_prepend_enter(queue)
197 #define sys_port_trace_k_queue_prepend_exit(queue)
198 #define sys_port_trace_k_queue_alloc_prepend_enter(queue)
199 #define sys_port_trace_k_queue_alloc_prepend_exit(queue, ret)
200 #define sys_port_trace_k_queue_insert_enter(queue)
201 #define sys_port_trace_k_queue_insert_blocking(queue, timeout)
202 #define sys_port_trace_k_queue_insert_exit(queue)
203 #define sys_port_trace_k_queue_append_list_enter(queue)
204 #define sys_port_trace_k_queue_append_list_exit(queue, ret)
205 #define sys_port_trace_k_queue_merge_slist_enter(queue)
206 #define sys_port_trace_k_queue_merge_slist_exit(queue, ret)
207 #define sys_port_trace_k_queue_get_enter(queue, timeout)
208 #define sys_port_trace_k_queue_get_blocking(queue, timeout)
209 #define sys_port_trace_k_queue_get_exit(queue, timeout, ret)
210 #define sys_port_trace_k_queue_remove_enter(queue)
211 #define sys_port_trace_k_queue_remove_exit(queue, ret)
212 #define sys_port_trace_k_queue_unique_append_enter(queue)
213 #define sys_port_trace_k_queue_unique_append_exit(queue, ret)
214 #define sys_port_trace_k_queue_peek_head(queue, ret)
215 #define sys_port_trace_k_queue_peek_tail(queue, ret)
216 
217 #define sys_port_trace_k_fifo_init_enter(fifo)
218 #define sys_port_trace_k_fifo_init_exit(fifo)
219 #define sys_port_trace_k_fifo_cancel_wait_enter(fifo)
220 #define sys_port_trace_k_fifo_cancel_wait_exit(fifo)
221 #define sys_port_trace_k_fifo_put_enter(fifo, data)
222 #define sys_port_trace_k_fifo_put_exit(fifo, data)
223 #define sys_port_trace_k_fifo_alloc_put_enter(fifo, data)
224 #define sys_port_trace_k_fifo_alloc_put_exit(fifo, data, ret)
225 #define sys_port_trace_k_fifo_put_list_enter(fifo, head, tail)
226 #define sys_port_trace_k_fifo_put_list_exit(fifo, head, tail)
227 #define sys_port_trace_k_fifo_put_slist_enter(fifo, list)
228 #define sys_port_trace_k_fifo_put_slist_exit(fifo, list)
229 #define sys_port_trace_k_fifo_get_enter(fifo, timeout)
230 #define sys_port_trace_k_fifo_get_exit(fifo, timeout, ret)
231 #define sys_port_trace_k_fifo_peek_head_enter(fifo)
232 #define sys_port_trace_k_fifo_peek_head_exit(fifo, ret)
233 #define sys_port_trace_k_fifo_peek_tail_enter(fifo)
234 #define sys_port_trace_k_fifo_peek_tail_exit(fifo, ret)
235 
236 #define sys_port_trace_k_lifo_init_enter(lifo)
237 #define sys_port_trace_k_lifo_init_exit(lifo)
238 #define sys_port_trace_k_lifo_put_enter(lifo, data)
239 #define sys_port_trace_k_lifo_put_exit(lifo, data)
240 #define sys_port_trace_k_lifo_alloc_put_enter(lifo, data)
241 #define sys_port_trace_k_lifo_alloc_put_exit(lifo, data, ret)
242 #define sys_port_trace_k_lifo_get_enter(lifo, timeout)
243 #define sys_port_trace_k_lifo_get_exit(lifo, timeout, ret)
244 
245 #define sys_port_trace_k_stack_init(stack)
246 #define sys_port_trace_k_stack_alloc_init_enter(stack)
247 #define sys_port_trace_k_stack_alloc_init_exit(stack, ret)
248 #define sys_port_trace_k_stack_cleanup_enter(stack)
249 #define sys_port_trace_k_stack_cleanup_exit(stack, ret)
250 #define sys_port_trace_k_stack_push_enter(stack)
251 #define sys_port_trace_k_stack_push_exit(stack, ret)
252 #define sys_port_trace_k_stack_pop_enter(stack, timeout)
253 #define sys_port_trace_k_stack_pop_blocking(stack, timeout)
254 #define sys_port_trace_k_stack_pop_exit(stack, timeout, ret)
255 
256 #define sys_port_trace_k_msgq_init(msgq)
257 #define sys_port_trace_k_msgq_alloc_init_enter(msgq)
258 #define sys_port_trace_k_msgq_alloc_init_exit(msgq, ret)
259 #define sys_port_trace_k_msgq_cleanup_enter(msgq)
260 #define sys_port_trace_k_msgq_cleanup_exit(msgq, ret)
261 #define sys_port_trace_k_msgq_put_enter(msgq, timeout)
262 #define sys_port_trace_k_msgq_put_blocking(msgq, timeout)
263 #define sys_port_trace_k_msgq_put_exit(msgq, timeout, ret)
264 #define sys_port_trace_k_msgq_get_enter(msgq, timeout)
265 #define sys_port_trace_k_msgq_get_blocking(msgq, timeout)
266 #define sys_port_trace_k_msgq_get_exit(msgq, timeout, ret)
267 #define sys_port_trace_k_msgq_peek(msgq, ret)
268 #define sys_port_trace_k_msgq_purge(msgq)
269 
270 #define sys_port_trace_k_mbox_init(mbox)
271 #define sys_port_trace_k_mbox_message_put_enter(mbox, timeout)
272 #define sys_port_trace_k_mbox_message_put_blocking(mbox, timeout)
273 #define sys_port_trace_k_mbox_message_put_exit(mbox, timeout, ret)
274 #define sys_port_trace_k_mbox_put_enter(mbox, timeout)
275 #define sys_port_trace_k_mbox_put_exit(mbox, timeout, ret)
276 #define sys_port_trace_k_mbox_async_put_enter(mbox, sem)
277 #define sys_port_trace_k_mbox_async_put_exit(mbox, sem)
278 #define sys_port_trace_k_mbox_get_enter(mbox, timeout)
279 #define sys_port_trace_k_mbox_get_blocking(mbox, timeout)
280 #define sys_port_trace_k_mbox_get_exit(mbox, timeout, ret)
281 #define sys_port_trace_k_mbox_data_get(rx_msg)
282 
283 #define sys_port_trace_k_pipe_init(pipe)
284 #define sys_port_trace_k_pipe_cleanup_enter(pipe)
285 #define sys_port_trace_k_pipe_cleanup_exit(pipe, ret)
286 #define sys_port_trace_k_pipe_alloc_init_enter(pipe)
287 #define sys_port_trace_k_pipe_alloc_init_exit(pipe, ret)
288 #define sys_port_trace_k_pipe_flush_enter(pipe)
289 #define sys_port_trace_k_pipe_flush_exit(pipe)
290 #define sys_port_trace_k_pipe_buffer_flush_enter(pipe)
291 #define sys_port_trace_k_pipe_buffer_flush_exit(pipe)
292 #define sys_port_trace_k_pipe_put_enter(pipe, timeout)
293 #define sys_port_trace_k_pipe_put_blocking(pipe, timeout)
294 #define sys_port_trace_k_pipe_put_exit(pipe, timeout, ret)
295 #define sys_port_trace_k_pipe_get_enter(pipe, timeout)
296 #define sys_port_trace_k_pipe_get_blocking(pipe, timeout)
297 #define sys_port_trace_k_pipe_get_exit(pipe, timeout, ret)
298 
299 #define sys_port_trace_k_heap_init(heap)
300 #define sys_port_trace_k_heap_aligned_alloc_enter(heap, timeout)
301 #define sys_port_trace_k_heap_aligned_alloc_blocking(heap, timeout)
302 #define sys_port_trace_k_heap_aligned_alloc_exit(heap, timeout, ret)
303 #define sys_port_trace_k_heap_alloc_enter(heap, timeout)
304 #define sys_port_trace_k_heap_alloc_exit(heap, timeout, ret)
305 #define sys_port_trace_k_heap_free(heap)
306 #define sys_port_trace_k_heap_realloc_enter(h, ptr, bytes, timeout)
307 #define sys_port_trace_k_heap_realloc_exit(h, ptr, bytes, timeout, ret)
308 #define sys_port_trace_k_heap_sys_k_aligned_alloc_enter(heap)
309 #define sys_port_trace_k_heap_sys_k_aligned_alloc_exit(heap, ret)
310 #define sys_port_trace_k_heap_sys_k_malloc_enter(heap)
311 #define sys_port_trace_k_heap_sys_k_malloc_exit(heap, ret)
312 #define sys_port_trace_k_heap_sys_k_free_enter(heap, heap_ref)
313 #define sys_port_trace_k_heap_sys_k_free_exit(heap, heap_ref)
314 #define sys_port_trace_k_heap_sys_k_calloc_enter(heap)
315 #define sys_port_trace_k_heap_sys_k_calloc_exit(heap, ret)
316 #define sys_port_trace_k_heap_sys_k_realloc_enter(heap, ptr)
317 #define sys_port_trace_k_heap_sys_k_realloc_exit(heap, ptr, ret)
318 
319 #define sys_port_trace_k_mem_slab_init(slab, rc)
320 #define sys_port_trace_k_mem_slab_alloc_enter(slab, timeout)
321 #define sys_port_trace_k_mem_slab_alloc_blocking(slab, timeout)
322 #define sys_port_trace_k_mem_slab_alloc_exit(slab, timeout, ret)
323 #define sys_port_trace_k_mem_slab_free_enter(slab)
324 #define sys_port_trace_k_mem_slab_free_exit(slab)
325 
326 #define sys_port_trace_k_event_init(event)
327 #define sys_port_trace_k_event_post_enter(event, events, events_mask)
328 #define sys_port_trace_k_event_post_exit(event, events, events_mask)
329 #define sys_port_trace_k_event_wait_enter(event, events, options, timeout)
330 #define sys_port_trace_k_event_wait_blocking(event, events, options, timeout)
331 #define sys_port_trace_k_event_wait_exit(event, events, ret)
332 
333 #define sys_port_trace_k_thread_abort_exit(thread)
334 #define sys_port_trace_k_thread_abort_enter(thread)
335 #define sys_port_trace_k_thread_resume_exit(thread)
336 
337 
338 #define sys_port_trace_pm_system_suspend_enter(ticks)
339 #define sys_port_trace_pm_system_suspend_exit(ticks, state)
340 
341 #define sys_port_trace_pm_device_runtime_get_enter(dev)
342 #define sys_port_trace_pm_device_runtime_get_exit(dev, ret)
343 #define sys_port_trace_pm_device_runtime_put_enter(dev)
344 #define sys_port_trace_pm_device_runtime_put_exit(dev, ret)
345 #define sys_port_trace_pm_device_runtime_put_async_enter(dev, delay)
346 #define sys_port_trace_pm_device_runtime_put_async_exit(dev, delay, ret)
347 #define sys_port_trace_pm_device_runtime_enable_enter(dev)
348 #define sys_port_trace_pm_device_runtime_enable_exit(dev, ret)
349 #define sys_port_trace_pm_device_runtime_disable_enter(dev)
350 #define sys_port_trace_pm_device_runtime_disable_exit(dev, ret)
351 
352 #define sys_trace_sys_init_enter(...)
353 #define sys_trace_sys_init_exit(...)
354 
355 void sys_trace_idle(void);
356 void sys_trace_isr_enter(void);
357 void sys_trace_isr_exit(void);
358 
359 void sys_trace_k_thread_abort_exit(struct k_thread *thread);
360 void sys_trace_k_thread_abort_enter(struct k_thread *thread);
361 void sys_trace_k_thread_resume_exit(struct k_thread *thread);
362 void sys_trace_k_thread_sched_abort(struct k_thread *thread);
363 void sys_trace_k_thread_sched_ready(struct k_thread *thread);
364 
365 void sys_trace_k_thread_sched_resume(struct k_thread *thread);
366 void sys_trace_k_thread_sched_suspend(struct k_thread *thread);
367 
368 void sys_trace_k_thread_foreach_enter(k_thread_user_cb_t user_cb,
369 				      void *user_data);
370 void sys_trace_k_thread_foreach_exit(k_thread_user_cb_t user_cb,
371 				     void *user_data);
372 void sys_trace_k_thread_foreach_unlocked_enter(k_thread_user_cb_t user_cb,
373 					       void *user_data);
374 void sys_trace_k_thread_foreach_unlocked_exit(k_thread_user_cb_t user_cb,
375 					      void *user_data);
376 void sys_trace_k_thread_create(struct k_thread *new_thread, size_t stack_size,
377 			       int prio);
378 void sys_trace_k_thread_user_mode_enter(void);
379 void sys_trace_k_thread_heap_assign(struct k_thread *thread,
380 				    struct k_heap *heap);
381 void sys_trace_k_thread_join_blocking(struct k_thread *thread,
382 				      k_timeout_t timeout);
383 void sys_trace_k_thread_join_exit(struct k_thread *thread, k_timeout_t timeout,
384 				  int ret);
385 void sys_trace_k_thread_sleep_enter(k_timeout_t timeout);
386 void sys_trace_k_thread_sleep_exit(k_timeout_t timeout, int ret);
387 void sys_trace_k_thread_msleep_enter(int32_t ms);
388 void sys_trace_k_thread_msleep_exit(int32_t ms, int ret);
389 void sys_trace_k_thread_usleep_enter(int32_t us);
390 void sys_trace_k_thread_usleep_exit(int32_t us, int ret);
391 void sys_trace_k_thread_busy_wait_enter(uint32_t usec_to_wait);
392 void sys_trace_k_thread_busy_wait_exit(uint32_t usec_to_wait);
393 void sys_trace_k_thread_yield(void);
394 void sys_trace_k_thread_wakeup(struct k_thread *thread);
395 void sys_trace_k_thread_abort(struct k_thread *thread);
396 void sys_trace_k_thread_start(struct k_thread *thread);
397 void sys_trace_k_thread_priority_set(struct k_thread *thread);
398 void sys_trace_k_thread_suspend(struct k_thread *thread);
399 void sys_trace_k_thread_resume(struct k_thread *thread);
400 void sys_trace_k_thread_sched_lock(void);
401 void sys_trace_k_thread_sched_unlock(void);
402 void sys_trace_k_thread_name_set(struct k_thread *thread, int ret);
403 void sys_trace_k_thread_switched_out(void);
404 void sys_trace_k_thread_switched_in(void);
405 void sys_trace_k_thread_ready(struct k_thread *thread);
406 void sys_trace_k_thread_pend(struct k_thread *thread);
407 void sys_trace_k_thread_info(struct k_thread *thread);
408 
409 /* Semaphore */
410 
411 void sys_trace_k_sem_init(struct k_sem *sem, int ret);
412 void sys_trace_k_sem_give_enter(struct k_sem *sem);
413 
414 void sys_trace_k_sem_give_exit(struct k_sem *sem);
415 
416 void sys_trace_k_sem_take_enter(struct k_sem *sem, k_timeout_t timeout);
417 void sys_trace_k_sem_take_blocking(struct k_sem *sem, k_timeout_t timeout);
418 void sys_trace_k_sem_take_exit(struct k_sem *sem, k_timeout_t timeout, int ret);
419 void sys_trace_k_sem_reset(struct k_sem *sem);
420 
421 /* Mutex */
422 void sys_trace_k_mutex_init(struct k_mutex *mutex, int ret);
423 void sys_trace_k_mutex_lock_enter(struct k_mutex *mutex, k_timeout_t timeout);
424 void sys_trace_k_mutex_lock_blocking(struct k_mutex *mutex,
425 				     k_timeout_t timeout);
426 void sys_trace_k_mutex_lock_exit(struct k_mutex *mutex, k_timeout_t timeout,
427 				 int ret);
428 void sys_trace_k_mutex_unlock_enter(struct k_mutex *mutex);
429 void sys_trace_k_mutex_unlock_exit(struct k_mutex *mutex, int ret);
430 
431 /* Timer */
432 void sys_trace_k_timer_init(struct k_timer *timer);
433 
434 void sys_trace_k_timer_start(struct k_timer *timer, k_timeout_t duration,
435 			     k_timeout_t period);
436 void sys_trace_k_timer_stop(struct k_timer *timer);
437 void sys_trace_k_timer_status_sync_blocking(struct k_timer *timer, k_timeout_t timeout);
438 void sys_trace_k_timer_status_sync_enter(struct k_timer *timer);
439 void sys_trace_k_timer_status_sync_exit(struct k_timer *timer, uint32_t result);
440 
441 void sys_trace_k_event_init(struct k_event *event);
442 
443 
444 #define sys_port_trace_socket_init(sock, family, type, proto)	\
445 	sys_trace_socket_init(sock, family, type, proto)
446 #define sys_port_trace_socket_close_enter(sock) \
447 	sys_trace_socket_close_enter(sock)
448 #define sys_port_trace_socket_close_exit(sock, ret) \
449 	sys_trace_socket_close_exit(sock, ret)
450 #define sys_port_trace_socket_shutdown_enter(sock, how) \
451 	sys_trace_socket_shutdown_enter(sock, how)
452 #define sys_port_trace_socket_shutdown_exit(sock, ret) \
453 	sys_trace_socket_shutdown_exit(sock, ret)
454 #define sys_port_trace_socket_bind_enter(sock, addr, addrlen) \
455 	sys_trace_socket_bind_enter(sock, addr, addrlen)
456 #define sys_port_trace_socket_bind_exit(sock, ret) \
457 	sys_trace_socket_bind_exit(sock, ret)
458 #define sys_port_trace_socket_connect_enter(sock, addr, addrlen) \
459 	sys_trace_socket_connect_enter(sock, addr, addrlen)
460 #define sys_port_trace_socket_connect_exit(sock, ret) \
461 	sys_trace_socket_connect_exit(sock, ret)
462 #define sys_port_trace_socket_listen_enter(sock, backlog) \
463 	sys_trace_socket_listen_enter(sock, backlog)
464 #define sys_port_trace_socket_listen_exit(sock, ret) \
465 	sys_trace_socket_listen_exit(sock, ret)
466 #define sys_port_trace_socket_accept_enter(sock) \
467 	sys_trace_socket_accept_enter(sock)
468 #define sys_port_trace_socket_accept_exit(sock, addr, addrlen, ret) \
469 	sys_trace_socket_accept_exit(sock, addr, addrlen, ret)
470 #define sys_port_trace_socket_sendto_enter(sock, len, flags, dest_addr, addrlen) \
471 	sys_trace_socket_sendto_enter(sock, len, flags, dest_addr, addrlen)
472 #define sys_port_trace_socket_sendto_exit(sock, ret) \
473 	sys_trace_socket_sendto_exit(sock, ret)
474 #define sys_port_trace_socket_sendmsg_enter(sock, msg, flags) \
475 	sys_trace_socket_sendmsg_enter(sock, msg, flags)
476 #define sys_port_trace_socket_sendmsg_exit(sock, ret) \
477 	sys_trace_socket_sendmsg_exit(sock, ret)
478 #define sys_port_trace_socket_recvfrom_enter(sock, max_len, flags, addr, addrlen) \
479 	sys_trace_socket_recvfrom_enter(sock, max_len, flags, addr, addrlen)
480 #define sys_port_trace_socket_recvfrom_exit(sock, src_addr, addrlen, ret) \
481 	sys_trace_socket_recvfrom_exit(sock, src_addr, addrlen, ret)
482 #define sys_port_trace_socket_recvmsg_enter(sock, msg, flags) \
483 	sys_trace_socket_recvmsg_enter(sock, msg, flags)
484 #define sys_port_trace_socket_recvmsg_exit(sock, msg, ret) \
485 	sys_trace_socket_recvmsg_exit(sock, msg, ret)
486 #define sys_port_trace_socket_fcntl_enter(sock, cmd, flags) \
487 	sys_trace_socket_fcntl_enter(sock, cmd, flags)
488 #define sys_port_trace_socket_fcntl_exit(sock, ret) \
489 	sys_trace_socket_fcntl_exit(sock, ret)
490 #define sys_port_trace_socket_ioctl_enter(sock, req) \
491 	sys_trace_socket_ioctl_enter(sock, req)
492 #define sys_port_trace_socket_ioctl_exit(sock, ret) \
493 	sys_trace_socket_ioctl_exit(sock, ret)
494 #define sys_port_trace_socket_poll_enter(fds, nfds, timeout) \
495 	sys_trace_socket_poll_enter(fds, nfds, timeout)
496 #define sys_port_trace_socket_poll_exit(fds, nfds, ret) \
497 	sys_trace_socket_poll_exit(fds, nfds, ret)
498 #define sys_port_trace_socket_getsockopt_enter(sock, level, optname) \
499 	sys_trace_socket_getsockopt_enter(sock, level, optname)
500 #define sys_port_trace_socket_getsockopt_exit(sock, level, optname, optval, optlen, ret) \
501 	sys_trace_socket_getsockopt_exit(sock, level, optname, optval, optlen, ret)
502 #define sys_port_trace_socket_setsockopt_enter(sock, level, optname, optval, optlen) \
503 	sys_trace_socket_setsockopt_enter(sock, level, optname, optval, optlen)
504 #define sys_port_trace_socket_setsockopt_exit(sock, ret) \
505 	sys_trace_socket_setsockopt_exit(sock, ret)
506 #define sys_port_trace_socket_getpeername_enter(sock) \
507 	sys_trace_socket_getpeername_enter(sock)
508 #define sys_port_trace_socket_getpeername_exit(sock, addr, addrlen, ret) \
509 	sys_trace_socket_getpeername_exit(sock, addr, addrlen, ret)
510 #define sys_port_trace_socket_getsockname_enter(sock) \
511 	sys_trace_socket_getsockname_enter(sock)
512 #define sys_port_trace_socket_getsockname_exit(sock, addr, addrlen, ret) \
513 	sys_trace_socket_getsockname_exit(sock, addr, addrlen, ret)
514 #define sys_port_trace_socket_socketpair_enter(family, type, proto, sv)	\
515 	sys_trace_socket_socketpair_enter(family, type, proto, sv)
516 #define sys_port_trace_socket_socketpair_exit(sockA, sockB, ret) \
517 	sys_trace_socket_socketpair_exit(sockA, sockB, ret)
518 
519 /* Do not try to include network headers as it just leads to inclusion
520  * nightmare, just declare couple of structs that are needed.
521  */
522 struct sockaddr;
523 struct msghdr;
524 struct zsock_pollfd;
525 
526 void sys_trace_socket_init(int sock, int family, int type, int proto);
527 void sys_trace_socket_close_enter(int sock);
528 void sys_trace_socket_close_exit(int sock, int ret);
529 void sys_trace_socket_shutdown_enter(int sock, int how);
530 void sys_trace_socket_shutdown_exit(int sock, int ret);
531 void sys_trace_socket_bind_enter(int sock, const struct sockaddr *addr, size_t addrlen);
532 void sys_trace_socket_bind_exit(int sock, int ret);
533 void sys_trace_socket_connect_enter(int sock, const struct sockaddr *addr, size_t addrlen);
534 void sys_trace_socket_connect_exit(int sock, int ret);
535 void sys_trace_socket_listen_enter(int sock, int backlog);
536 void sys_trace_socket_listen_exit(int sock, int ret);
537 void sys_trace_socket_accept_enter(int sock);
538 void sys_trace_socket_accept_exit(int sock, const struct sockaddr *addr, const size_t *addrlen,
539 				  int ret);
540 void sys_trace_socket_sendto_enter(int sock, int len, int flags, const struct sockaddr *dest_addr,
541 				   size_t addrlen);
542 void sys_trace_socket_sendto_exit(int sock, int ret);
543 void sys_trace_socket_sendmsg_enter(int sock, const struct msghdr *msg, int flags);
544 void sys_trace_socket_sendmsg_exit(int sock, int ret);
545 void sys_trace_socket_recvfrom_enter(int sock, int max_len, int flags, struct sockaddr *addr,
546 				     size_t *addrlen);
547 void sys_trace_socket_recvfrom_exit(int sock, const struct sockaddr *src_addr,
548 				    const size_t *addrlen, int ret);
549 void sys_trace_socket_recvmsg_enter(int sock, const struct msghdr *msg, int flags);
550 void sys_trace_socket_recvmsg_exit(int sock, const struct msghdr *msg, int ret);
551 void sys_trace_socket_fcntl_enter(int sock, int cmd, int flags);
552 void sys_trace_socket_fcntl_exit(int sock, int ret);
553 void sys_trace_socket_ioctl_enter(int sock, int req);
554 void sys_trace_socket_ioctl_exit(int sock, int ret);
555 void sys_trace_socket_poll_enter(const struct zsock_pollfd *fds, int nfds, int timeout);
556 void sys_trace_socket_poll_exit(const struct zsock_pollfd *fds, int nfds, int ret);
557 void sys_trace_socket_getsockopt_enter(int sock, int level, int optname);
558 void sys_trace_socket_getsockopt_exit(int sock, int level, int optname, void *optval,
559 				      size_t optlen, int ret);
560 void sys_trace_socket_setsockopt_enter(int sock, int level, int optname, const void *optval,
561 				       size_t optlen);
562 void sys_trace_socket_setsockopt_exit(int sock, int ret);
563 void sys_trace_socket_getpeername_enter(int sock);
564 void sys_trace_socket_getpeername_exit(int sock,  struct sockaddr *addr, const size_t *addrlen,
565 				       int ret);
566 void sys_trace_socket_getsockname_enter(int sock);
567 void sys_trace_socket_getsockname_exit(int sock, const struct sockaddr *addr, const size_t *addrlen,
568 				       int ret);
569 void sys_trace_socket_socketpair_enter(int family, int type, int proto, int *sv);
570 void sys_trace_socket_socketpair_exit(int sock_A, int sock_B, int ret);
571 
572 #ifdef __cplusplus
573 }
574 #endif
575 
576 #endif /* _TRACE_CTF_H */
577