diff --git a/firmware/config/chconf_common.h b/firmware/config/chconf_common.h index 6eec83ff68..83c028e1b8 100644 --- a/firmware/config/chconf_common.h +++ b/firmware/config/chconf_common.h @@ -18,15 +18,9 @@ extern "C" #endif /* __cplusplus */ #ifndef __ASSEMBLER__ void firmwareError(obd_code_e code, const char *fmt, ...); - #if ENABLE_PERF_TRACE - void irqEnterHook(void); - void irqExitHook(void); - void contextSwitchHook(void); - #else /* EFI_CLOCK_LOCKS */ - #define irqEnterHook() {} - #define irqExitHook() {} - #define contextSwitchHook() {} - #endif /*EFI_CLOCK_LOCKS */ + void irqEnterHook(void); + void irqExitHook(void); + void contextSwitchHook(void); #endif /* __ASSEMBLER__ */ #ifdef __cplusplus } @@ -67,4 +61,28 @@ extern "C" { #endif /* _FROM_ASM_ */ +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + contextSwitchHook(); \ +} + +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ + irqEnterHook(); \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ + irqExitHook(); \ +} + #endif /* CONFIG_CHCONF_COMMON_H_ */ diff --git a/firmware/config/stm32f4ems/chconf.h b/firmware/config/stm32f4ems/chconf.h index 4abac0a88f..90ac197973 100644 --- a/firmware/config/stm32f4ems/chconf.h +++ b/firmware/config/stm32f4ems/chconf.h @@ -664,30 +664,6 @@ /* Add threads finalization code here.*/ \ } -/** - * @brief Context switch hook. - * @details This hook is invoked just before switching between threads. - */ -#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ - contextSwitchHook(); \ -} - -/** - * @brief ISR enter hook. - */ -#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ - /* IRQ prologue code here.*/ \ - irqEnterHook(); \ -} - -/** - * @brief ISR exit hook. - */ -#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ - /* IRQ epilogue code here.*/ \ - irqExitHook(); \ -} - /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions diff --git a/firmware/config/stm32f7ems/chconf.h b/firmware/config/stm32f7ems/chconf.h index d8b4e04ff2..f28eaa8e2f 100644 --- a/firmware/config/stm32f7ems/chconf.h +++ b/firmware/config/stm32f7ems/chconf.h @@ -664,30 +664,6 @@ /* Add threads finalization code here.*/ \ } -/** - * @brief Context switch hook. - * @details This hook is invoked just before switching between threads. - */ -#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ - contextSwitchHook(); \ -} - -/** - * @brief ISR enter hook. - */ -#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ - /* IRQ prologue code here.*/ \ - irqEnterHook(); \ -} - -/** - * @brief ISR exit hook. - */ -#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ - /* IRQ epilogue code here.*/ \ - irqExitHook(); \ -} - /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions diff --git a/firmware/controllers/engine_controller_misc.cpp b/firmware/controllers/engine_controller_misc.cpp index 4b13150f41..a9b4fdcb8e 100644 --- a/firmware/controllers/engine_controller_misc.cpp +++ b/firmware/controllers/engine_controller_misc.cpp @@ -16,11 +16,11 @@ extern LoggingWithStorage sharedLogger; #if ENABLE_PERF_TRACE -void irqEnterHook(void) { +void irqEnterHook() { perfEventBegin(PE::ISR); } -void irqExitHook(void) { +void irqExitHook() { perfEventEnd(PE::ISR); } @@ -28,6 +28,10 @@ void contextSwitchHook() { perfEventInstantGlobal(PE::ContextSwitch); } +#else +void irqEnterHook() {} +void irqExitHook() {} +void contextSwitchHook() {} #endif /* ENABLE_PERF_TRACE */ #if EFI_ENABLE_MOCK_ADC