move hooks in to common chconf.h (#1376)

* move hooks in to common

* but not for kinetis

* don't use c style void arg

* kinetis needed more, not less

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2020-04-27 13:07:05 -07:00 committed by GitHub
parent 28d0cfa91e
commit 6ce9ae4481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 122 deletions

View File

@ -52,47 +52,12 @@
#define CHPRINTF_USE_FLOAT TRUE
#if !defined(EFI_CLOCK_LOCKS) || defined(__DOXYGEN__)
#if !defined(ENABLE_PERF_TRACE) || defined(__DOXYGEN__)
// looks like this value could not be defined in efifeatures.h - please define either externally or just change the value here
#define EFI_CLOCK_LOCKS FALSE
#endif /* EFI_CLOCK_LOCKS */
#define ENABLE_PERF_TRACE FALSE
#endif /* ENABLE_PERF_TRACE */
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifndef __ASSEMBLER__
#if EFI_CLOCK_LOCKS
void irqEnterHook(void);
void irqExitHook(void);
#else /* EFI_CLOCK_LOCKS */
#define irqEnterHook() {}
#define irqExitHook() {}
#endif /*EFI_CLOCK_LOCKS */
#endif /* __ASSEMBLER__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#if EFI_CLOCK_LOCKS
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifndef __ASSEMBLER__
void onLockHook(void);
void onUnlockHook(void);
#endif /* __ASSEMBLER__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define ON_LOCK_HOOK onLockHook()
#define ON_UNLOCK_HOOK onUnlockHook()
#else /* EFI_CLOCK_LOCKS */
#define ON_LOCK_HOOK
#define ON_UNLOCK_HOOK
#endif /* EFI_CLOCK_LOCKS */
#include "chconf_common.h"
/*===========================================================================*/
/**
@ -708,30 +673,6 @@ extern "C"
/* 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) { \
/* Context switch code here.*/ \
}
/**
* @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

View File

@ -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_ */

View File

@ -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

View File

@ -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

View File

@ -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