|
| 1 | +/* |
| 2 | + * Copyright (c) 2018 Intel Corporation |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | +#ifndef _KERNEL_TRACE_H |
| 7 | +#define _KERNEL_TRACE_H |
| 8 | + |
| 9 | +#include <kernel.h> |
| 10 | + |
| 11 | +/* Below IDs are used with systemview, not final to the zephyr tracing API */ |
| 12 | +#define SYS_TRACE_ID_OFFSET (32u) |
| 13 | + |
| 14 | +#define SYS_TRACE_ID_MUTEX_INIT (1u + SYS_TRACE_ID_OFFSET) |
| 15 | +#define SYS_TRACE_ID_MUTEX_UNLOCK (2u + SYS_TRACE_ID_OFFSET) |
| 16 | +#define SYS_TRACE_ID_MUTEX_LOCK (3u + SYS_TRACE_ID_OFFSET) |
| 17 | +#define SYS_TRACE_ID_SEMA_INIT (4u + SYS_TRACE_ID_OFFSET) |
| 18 | +#define SYS_TRACE_ID_SEMA_GIVE (5u + SYS_TRACE_ID_OFFSET) |
| 19 | +#define SYS_TRACE_ID_SEMA_TAKE (6u + SYS_TRACE_ID_OFFSET) |
| 20 | + |
| 21 | +#if CONFIG_TRACING |
| 22 | +void z_sys_trace_idle(void); |
| 23 | +void z_sys_trace_isr_enter(void); |
| 24 | +void z_sys_trace_isr_exit_to_scheduler(void); |
| 25 | +void z_sys_trace_thread_switched_in(void); |
| 26 | +#endif |
| 27 | + |
| 28 | +/** |
| 29 | + * @brief Called before a thread has been selected to run |
| 30 | + */ |
| 31 | +#define sys_trace_thread_switched_out() |
| 32 | + |
| 33 | +/** |
| 34 | + * @brief Called after a thread has been selected to run |
| 35 | + */ |
| 36 | +#define sys_trace_thread_switched_in() |
| 37 | + |
| 38 | +/** |
| 39 | + * @brief Called when setting priority of a thread |
| 40 | + */ |
| 41 | +#define sys_trace_thread_priority_set(thread) |
| 42 | + |
| 43 | +/** |
| 44 | + * @brief Called when a thread is being created |
| 45 | + */ |
| 46 | +#define sys_trace_thread_create(thread) |
| 47 | + |
| 48 | +/** |
| 49 | + * @brief Called when a thread is being aborted |
| 50 | + * |
| 51 | + */ |
| 52 | +#define sys_trace_thread_abort(thread) |
| 53 | + |
| 54 | +/** |
| 55 | + * @brief Called when a thread is being suspended |
| 56 | + * @param thread Thread structure |
| 57 | + */ |
| 58 | +#define sys_trace_thread_suspend(thread) |
| 59 | + |
| 60 | +/** |
| 61 | + * @brief Called when a thread is being resumed from suspension |
| 62 | + * @param thread Thread structure |
| 63 | + */ |
| 64 | +#define sys_trace_thread_resume(thread) |
| 65 | + |
| 66 | +/** |
| 67 | + * @brief Called when a thread is ready to run |
| 68 | + * @param thread Thread structure |
| 69 | + */ |
| 70 | +#define sys_trace_thread_ready(thread) |
| 71 | + |
| 72 | +/** |
| 73 | + * @brief Called when a thread is pending |
| 74 | + * @param thread Thread structure |
| 75 | + */ |
| 76 | +#define sys_trace_thread_pend(thread) |
| 77 | + |
| 78 | +/** |
| 79 | + * @brief Provide information about specific thread |
| 80 | + * @param thread Thread structure |
| 81 | + */ |
| 82 | +#define sys_trace_thread_info(thread) |
| 83 | + |
| 84 | +/** |
| 85 | + * @brief Called when entering an ISR |
| 86 | + */ |
| 87 | +#define sys_trace_isr_enter() |
| 88 | + |
| 89 | +/** |
| 90 | + * @brief Called when exiting an ISR |
| 91 | + */ |
| 92 | +#define sys_trace_isr_exit() |
| 93 | + |
| 94 | +/** |
| 95 | + * @brief Called when exiting an ISR and switching to scheduler |
| 96 | + */ |
| 97 | +#define sys_trace_isr_exit_to_scheduler() |
| 98 | + |
| 99 | +/** |
| 100 | + * @brief Can be called with any id signifying a new call |
| 101 | + * @param id ID of the operation that was started |
| 102 | + */ |
| 103 | +#define sys_trace_void(id) |
| 104 | + |
| 105 | +/** |
| 106 | + * @brief Can be called with any id signifying ending a call |
| 107 | + * @param id ID of the operation that was completed |
| 108 | + */ |
| 109 | +#define sys_trace_end_call(id) |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | +#define z_sys_trace_idle() |
| 114 | + |
| 115 | +#define z_sys_trace_isr_enter() |
| 116 | + |
| 117 | +#define z_sys_trace_isr_exit_to_scheduler() |
| 118 | + |
| 119 | +#define z_sys_trace_thread_switched_in() |
| 120 | + |
| 121 | +#endif |
0 commit comments