refactoring - reducing duplication

This commit is contained in:
rusefi 2019-04-21 00:04:46 -04:00
parent 6ca7fd5927
commit bed7dd5684
4 changed files with 58 additions and 64 deletions

View File

@ -0,0 +1,53 @@
/*
* @file chconf_common.h
*
* @date Apr 20, 2019
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef CONFIG_CHCONF_COMMON_H_
#define CONFIG_CHCONF_COMMON_H_
#if !defined(_FROM_ASM_)
#include "obd_error_codes.h"
#endif /* _FROM_ASM_ */
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifndef __ASSEMBLER__
void firmwareError(obd_code_e code, const char *fmt, ...);
#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 */
#endif /* CONFIG_CHCONF_COMMON_H_ */

View File

@ -34,10 +34,6 @@
#define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_5_1_
#if !defined(_FROM_ASM_)
#include "obd_error_codes.h"
#endif /* _FROM_ASM_ */
/*
* __process_stack_size__ and __process_stack_size__ defaults are each hard-coded as 0x400 in ChibiOS rules.mk files
* rusEfi do not override these defaults.
@ -62,42 +58,7 @@
#define EFI_CLOCK_LOCKS FALSE
#endif /* EFI_CLOCK_LOCKS */
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifndef __ASSEMBLER__
void firmwareError(obd_code_e code, const char *fmt, ...);
#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"
/*===========================================================================*/
/**

View File

@ -34,33 +34,12 @@
#define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_5_1_
#if !defined(_FROM_ASM_)
#include "obd_error_codes.h"
#endif /* _FROM_ASM_ */
#if !defined(EFI_CLOCK_LOCKS) || defined(__DOXYGEN__)
#define EFI_CLOCK_LOCKS FALSE
#endif /* EFI_CLOCK_LOCKS */
#include "chconf_common.h"
#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 */
/*===========================================================================*/
/**
@ -745,10 +724,11 @@ void chDbgPanic3(const char *msg, const char * file, int line);
#endif
#define chDbgAssert(c, remark) do { \
#define chDbgAssert(c, remark) do { \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
firmwareError(OBD_PCM_Processor_Fault, "chDbg %s", remark); \
chSysHalt(remark); \
} \
} \

View File

@ -3,7 +3,7 @@
* @brief Hardware package entry point
*
* @date May 27, 2013
* @author Andrey Belomutskiy, (c) 2012-2018
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#include "global.h"