diff --git a/arch/arm/core/irq_manage.c b/arch/arm/core/irq_manage.c index 8b981533c05..b03c646ad77 100644 --- a/arch/arm/core/irq_manage.c +++ b/arch/arm/core/irq_manage.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include extern void __reserved(void); diff --git a/arch/nios2/core/irq_manage.c b/arch/nios2/core/irq_manage.c index 8ccd7c6343c..2b764db2cf6 100644 --- a/arch/nios2/core/irq_manage.c +++ b/arch/nios2/core/irq_manage.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include void z_irq_spurious(void *unused) { diff --git a/arch/posix/core/cpuhalt.c b/arch/posix/core/cpuhalt.c index ddbccdd03a0..81ade08e2fc 100644 --- a/arch/posix/core/cpuhalt.c +++ b/arch/posix/core/cpuhalt.c @@ -22,7 +22,7 @@ #include "posix_core.h" #include "posix_soc_if.h" -#include +#include /** * diff --git a/arch/x86/core/ia32/cpuhalt.c b/arch/x86/core/ia32/cpuhalt.c index 36282bfc777..21cb729d650 100644 --- a/arch/x86/core/ia32/cpuhalt.c +++ b/arch/x86/core/ia32/cpuhalt.c @@ -24,7 +24,7 @@ */ #include -#include +#include #include #ifdef CONFIG_BOOT_TIME_MEASUREMENT diff --git a/arch/x86/core/ia32/irq_manage.c b/arch/x86/core/ia32/irq_manage.c index cab3a5c6167..90fec202a58 100644 --- a/arch/x86/core/ia32/irq_manage.c +++ b/arch/x86/core/ia32/irq_manage.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include diff --git a/arch/x86_64/core/x86_64.c b/arch/x86_64/core/x86_64.c index ac37a4d08da..da40a85e875 100644 --- a/arch/x86_64/core/x86_64.c +++ b/arch/x86_64/core/x86_64.c @@ -5,7 +5,7 @@ */ #include #include -#include +#include #include #include #include "xuk.h" diff --git a/arch/xtensa/core/cpu_idle.c b/arch/xtensa/core/cpu_idle.c index c088ea60672..3a67a3daa4f 100644 --- a/arch/xtensa/core/cpu_idle.c +++ b/arch/xtensa/core/cpu_idle.c @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include +#include /* * @brief Put the CPU in low-power mode diff --git a/boards/posix/native_posix/irq_handler.c b/boards/posix/native_posix/irq_handler.c index 3e6911e4b9b..d7b65789056 100644 --- a/boards/posix/native_posix/irq_handler.c +++ b/boards/posix/native_posix/irq_handler.c @@ -18,7 +18,7 @@ #include "board_soc.h" #include "sw_isr_table.h" #include "soc.h" -#include +#include typedef void (*normal_irq_f_ptr)(void *); typedef int (*direct_irq_f_ptr)(void); diff --git a/boards/posix/nrf52_bsim/irq_handler.c b/boards/posix/nrf52_bsim/irq_handler.c index e892e48b5d9..7bdd2a403a9 100644 --- a/boards/posix/nrf52_bsim/irq_handler.c +++ b/boards/posix/nrf52_bsim/irq_handler.c @@ -17,7 +17,7 @@ #include "sw_isr_table.h" #include "soc.h" #include "bs_tracing.h" -#include +#include #include "bstests.h" static bool CPU_will_be_awaken_from_WFE; diff --git a/include/debug/tracing.h b/include/debug/tracing.h new file mode 100644 index 00000000000..a7f6e1fa8fb --- /dev/null +++ b/include/debug/tracing.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2018 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_INCLUDE_DEBUG_TRACING_H_ +#define ZEPHYR_INCLUDE_DEBUG_TRACING_H_ + +#include + +/* Below IDs are used with systemview, not final to the zephyr tracing API */ +#define SYS_TRACE_ID_OFFSET (32u) + +#define SYS_TRACE_ID_MUTEX_INIT (1u + SYS_TRACE_ID_OFFSET) +#define SYS_TRACE_ID_MUTEX_UNLOCK (2u + SYS_TRACE_ID_OFFSET) +#define SYS_TRACE_ID_MUTEX_LOCK (3u + SYS_TRACE_ID_OFFSET) +#define SYS_TRACE_ID_SEMA_INIT (4u + SYS_TRACE_ID_OFFSET) +#define SYS_TRACE_ID_SEMA_GIVE (5u + SYS_TRACE_ID_OFFSET) +#define SYS_TRACE_ID_SEMA_TAKE (6u + SYS_TRACE_ID_OFFSET) + +#ifdef CONFIG_TRACING +void z_sys_trace_idle(void); +void z_sys_trace_isr_enter(void); +void z_sys_trace_isr_exit(void); +void z_sys_trace_isr_exit_to_scheduler(void); +void z_sys_trace_thread_switched_in(void); +void z_sys_trace_thread_switched_out(void); +#endif + +#ifdef CONFIG_SEGGER_SYSTEMVIEW +#include "tracing_sysview.h" + +#elif defined CONFIG_TRACING_CPU_STATS +#include "tracing_cpu_stats.h" + +#elif defined CONFIG_TRACING_CTF +#include "tracing_ctf.h" + +#else + +/** + * @brief Called before a thread has been selected to run + */ +#define sys_trace_thread_switched_out() + +/** + * @brief Called after a thread has been selected to run + */ +#define sys_trace_thread_switched_in() + +/** + * @brief Called when setting priority of a thread + */ +#define sys_trace_thread_priority_set(thread) + +/** + * @brief Called when a thread is being created + */ +#define sys_trace_thread_create(thread) + +/** + * @brief Called when a thread is being aborted + * + */ +#define sys_trace_thread_abort(thread) + +/** + * @brief Called when a thread is being suspended + * @param thread Thread structure + */ +#define sys_trace_thread_suspend(thread) + +/** + * @brief Called when a thread is being resumed from suspension + * @param thread Thread structure + */ +#define sys_trace_thread_resume(thread) + +/** + * @brief Called when a thread is ready to run + * @param thread Thread structure + */ +#define sys_trace_thread_ready(thread) + +/** + * @brief Called when a thread is pending + * @param thread Thread structure + */ +#define sys_trace_thread_pend(thread) + +/** + * @brief Provide information about specific thread + * @param thread Thread structure + */ +#define sys_trace_thread_info(thread) + +/** + * @brief Called when entering an ISR + */ +#define sys_trace_isr_enter() + +/** + * @brief Called when exiting an ISR + */ +#define sys_trace_isr_exit() + +/** + * @brief Called when exiting an ISR and switching to scheduler + */ +#define sys_trace_isr_exit_to_scheduler() + +/** + * @brief Can be called with any id signifying a new call + * @param id ID of the operation that was started + */ +#define sys_trace_void(id) + +/** + * @brief Can be called with any id signifying ending a call + * @param id ID of the operation that was completed + */ +#define sys_trace_end_call(id) + + +#define z_sys_trace_idle() + +#define z_sys_trace_isr_enter() + +#define z_sys_trace_isr_exit() + +#define z_sys_trace_isr_exit_to_scheduler() + +#define z_sys_trace_thread_switched_in() + +#define z_sys_trace_thread_switched_out() + +#endif +#endif diff --git a/include/kernel.h b/include/kernel.h index ba25da64277..8840afc6a0b 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -5025,7 +5025,7 @@ __syscall int k_float_disable(struct k_thread *thread); } #endif -#include +#include #include #endif /* !_ASMLANGUAGE */ diff --git a/include/tracing.h b/include/tracing.h index f041e718659..8c61e1943f3 100644 --- a/include/tracing.h +++ b/include/tracing.h @@ -1,138 +1,15 @@ /* - * Copyright (c) 2018 Intel Corporation + * Copyright (c) 2019 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_TRACING_H_ #define ZEPHYR_INCLUDE_TRACING_H_ -#include - -/* Below IDs are used with systemview, not final to the zephyr tracing API */ -#define SYS_TRACE_ID_OFFSET (32u) - -#define SYS_TRACE_ID_MUTEX_INIT (1u + SYS_TRACE_ID_OFFSET) -#define SYS_TRACE_ID_MUTEX_UNLOCK (2u + SYS_TRACE_ID_OFFSET) -#define SYS_TRACE_ID_MUTEX_LOCK (3u + SYS_TRACE_ID_OFFSET) -#define SYS_TRACE_ID_SEMA_INIT (4u + SYS_TRACE_ID_OFFSET) -#define SYS_TRACE_ID_SEMA_GIVE (5u + SYS_TRACE_ID_OFFSET) -#define SYS_TRACE_ID_SEMA_TAKE (6u + SYS_TRACE_ID_OFFSET) - -#ifdef CONFIG_TRACING -void z_sys_trace_idle(void); -void z_sys_trace_isr_enter(void); -void z_sys_trace_isr_exit(void); -void z_sys_trace_isr_exit_to_scheduler(void); -void z_sys_trace_thread_switched_in(void); -void z_sys_trace_thread_switched_out(void); +#ifndef CONFIG_COMPAT_INCLUDES +#warning "This header file has moved, include instead." #endif -#ifdef CONFIG_SEGGER_SYSTEMVIEW -#include "tracing_sysview.h" +#include -#elif defined CONFIG_TRACING_CPU_STATS -#include "tracing_cpu_stats.h" - -#elif defined CONFIG_TRACING_CTF -#include "tracing_ctf.h" - -#else - -/** - * @brief Called before a thread has been selected to run - */ -#define sys_trace_thread_switched_out() - -/** - * @brief Called after a thread has been selected to run - */ -#define sys_trace_thread_switched_in() - -/** - * @brief Called when setting priority of a thread - */ -#define sys_trace_thread_priority_set(thread) - -/** - * @brief Called when a thread is being created - */ -#define sys_trace_thread_create(thread) - -/** - * @brief Called when a thread is being aborted - * - */ -#define sys_trace_thread_abort(thread) - -/** - * @brief Called when a thread is being suspended - * @param thread Thread structure - */ -#define sys_trace_thread_suspend(thread) - -/** - * @brief Called when a thread is being resumed from suspension - * @param thread Thread structure - */ -#define sys_trace_thread_resume(thread) - -/** - * @brief Called when a thread is ready to run - * @param thread Thread structure - */ -#define sys_trace_thread_ready(thread) - -/** - * @brief Called when a thread is pending - * @param thread Thread structure - */ -#define sys_trace_thread_pend(thread) - -/** - * @brief Provide information about specific thread - * @param thread Thread structure - */ -#define sys_trace_thread_info(thread) - -/** - * @brief Called when entering an ISR - */ -#define sys_trace_isr_enter() - -/** - * @brief Called when exiting an ISR - */ -#define sys_trace_isr_exit() - -/** - * @brief Called when exiting an ISR and switching to scheduler - */ -#define sys_trace_isr_exit_to_scheduler() - -/** - * @brief Can be called with any id signifying a new call - * @param id ID of the operation that was started - */ -#define sys_trace_void(id) - -/** - * @brief Can be called with any id signifying ending a call - * @param id ID of the operation that was completed - */ -#define sys_trace_end_call(id) - - -#define z_sys_trace_idle() - -#define z_sys_trace_isr_enter() - -#define z_sys_trace_isr_exit() - -#define z_sys_trace_isr_exit_to_scheduler() - -#define z_sys_trace_thread_switched_in() - -#define z_sys_trace_thread_switched_out() - -#endif -#endif +#endif /* ZEPHYR_INCLUDE_TRACING_H_ */ diff --git a/kernel/include/ksched.h b/kernel/include/ksched.h index bf5e242bf5b..4914f12c805 100644 --- a/kernel/include/ksched.h +++ b/kernel/include/ksched.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include BUILD_ASSERT(K_LOWEST_APPLICATION_THREAD_PRIO diff --git a/kernel/init.c b/kernel/init.c index d1697ecf276..1c5868d73bd 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/kernel/mutex.c b/kernel/mutex.c index d5142158741..fd570aa90dc 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include /* We use a global spinlock here because some of the synchronization * is protecting things like owner thread priorities which aren't diff --git a/kernel/sem.c b/kernel/sem.c index f6f5bb9afe6..53e0f81a3ab 100644 --- a/kernel/sem.c +++ b/kernel/sem.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include /* We use a system-wide lock to synchronize semaphores, which has * unfortunate performance impact vs. using a per-object lock diff --git a/kernel/thread.c b/kernel/thread.c index e6d30fe37f1..6a7aaa1fce7 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include static struct k_spinlock lock; diff --git a/soc/riscv32/riscv-privilege/common/idle.c b/soc/riscv32/riscv-privilege/common/idle.c index a18376ce156..c89cb1e7ef5 100644 --- a/soc/riscv32/riscv-privilege/common/idle.c +++ b/soc/riscv32/riscv-privilege/common/idle.c @@ -9,7 +9,7 @@ #include #include -#include +#include static ALWAYS_INLINE void riscv_idle(unsigned int key) {