parent
577fc65b89
commit
60f70a3721
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "efifeatures.h"
|
||||
#include "obd_error_codes.h"
|
||||
#include "rusefi_generated.h"
|
||||
// we do not want to start the search for header from current folder so we use brackets here
|
||||
// https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename
|
||||
#include <rusefi_hw_enums.h>
|
||||
|
|
|
@ -14,11 +14,15 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
class Engine;
|
||||
#endif // def __cplusplus
|
||||
|
||||
|
||||
struct engine_configuration_s;
|
||||
struct persistent_config_s;
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define DECLARE_ENGINE_PTR \
|
||||
Engine *engine = nullptr; \
|
||||
engine_configuration_s *engineConfiguration = nullptr; \
|
||||
|
@ -42,10 +46,20 @@ struct persistent_config_s;
|
|||
#define PASS_ENGINE_PARAMETER_SIGNATURE engine, PASS_CONFIG_PARAMETER_SIGNATURE
|
||||
#define PASS_ENGINE_PARAMETER_SUFFIX , PASS_ENGINE_PARAMETER_SIGNATURE
|
||||
|
||||
#define EXTERN_ENGINE extern EnginePins enginePins; \
|
||||
extern engine_configuration_s & activeConfiguration
|
||||
#endif // def __cplusplus
|
||||
|
||||
#define EXTERN_CONFIG
|
||||
|
||||
#define DEFINE_CONFIG_PARAM(x, y) , x y
|
||||
#define PASS_CONFIG_PARAM(x) , x
|
||||
|
||||
#else // EFI_UNIT_TEST
|
||||
|
||||
// These are the non-unit-test (AKA real firmware) noop versions
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define DECLARE_ENGINE_PTR
|
||||
|
||||
#define INJECT_ENGINE_REFERENCE(x) {}
|
||||
|
@ -65,6 +79,46 @@ struct persistent_config_s;
|
|||
// Pass this after some other parameters are passed
|
||||
#define PASS_ENGINE_PARAMETER_SUFFIX
|
||||
|
||||
#define EXTERN_ENGINE \
|
||||
extern Engine ___engine; \
|
||||
extern Engine *engine; \
|
||||
EXTERN_CONFIG \
|
||||
extern EnginePins enginePins \
|
||||
|
||||
#define ENGINE(x) ___engine.x
|
||||
#endif // def __cplusplus
|
||||
|
||||
/**
|
||||
* this macro allows the compiled to figure out the complete static address, that's a performance
|
||||
* optimization which is hopefully useful at least for anything trigger-related
|
||||
*
|
||||
* this is related to the fact that for unit tests we prefer to explicitly pass references in method signature thus code covered by
|
||||
* unit tests would need to use by-reference access. These macro allow us to have faster by-address access in real firmware and by-reference
|
||||
* access in unit tests
|
||||
*/
|
||||
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
|
||||
|
||||
/**
|
||||
* & is reference in C++ (not C)
|
||||
* Ref is a pointer that:
|
||||
* you access with dot instead of arrow
|
||||
* Cannot be null
|
||||
* This is about EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
||||
*/
|
||||
#define EXTERN_CONFIG \
|
||||
EXTERN_ENGINE_CONFIGURATION \
|
||||
extern engine_configuration_s & activeConfiguration; \
|
||||
|
||||
#define EXTERN_ENGINE_CONFIGURATION \
|
||||
extern engine_configuration_s *engineConfiguration; \
|
||||
extern persistent_config_container_s persistentState; \
|
||||
extern persistent_config_s *config;
|
||||
|
||||
|
||||
#define DEFINE_CONFIG_PARAM(x, y)
|
||||
#define CONFIG_PARAM(x) CONFIG(x)
|
||||
#define PASS_CONFIG_PARAM(x)
|
||||
|
||||
#endif // EFI_UNIT_TEST
|
||||
|
||||
#define EXPAND_Engine \
|
||||
|
@ -72,5 +126,3 @@ struct persistent_config_s;
|
|||
persistent_config_s *config = engine->config; \
|
||||
(void)engineConfiguration; \
|
||||
(void)config;
|
||||
|
||||
#endif // def __cplusplus
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "global.h"
|
||||
#include "rusefi_enums.h"
|
||||
|
||||
/**
|
||||
* This layer has two primary usages:
|
||||
|
|
|
@ -31,50 +31,8 @@
|
|||
#include "global.h"
|
||||
#include "engine_ptr.h"
|
||||
|
||||
#define EXTERN_ENGINE_CONFIGURATION \
|
||||
extern engine_configuration_s *engineConfiguration; \
|
||||
extern persistent_config_container_s persistentState; \
|
||||
extern persistent_config_s *config;
|
||||
|
||||
/**
|
||||
* this macro allows the compiled to figure out the complete static address, that's a performance
|
||||
* optimization which is hopefully useful at least for anything trigger-related
|
||||
*
|
||||
* this is related to the fact that for unit tests we prefer to explicitly pass references in method signature thus code covered by
|
||||
* unit tests would need to use by-reference access. These macro allow us to have faster by-address access in real firmware and by-reference
|
||||
* access in unit tests
|
||||
*/
|
||||
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/**
|
||||
* & is reference in C++ (not C)
|
||||
* Ref is a pointer that:
|
||||
* you access with dot instead of arrow
|
||||
* Cannot be null
|
||||
* This is about EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
||||
*/
|
||||
#define EXTERN_CONFIG \
|
||||
EXTERN_ENGINE_CONFIGURATION \
|
||||
extern engine_configuration_s & activeConfiguration; \
|
||||
|
||||
#define EXTERN_ENGINE \
|
||||
extern Engine ___engine; \
|
||||
extern Engine *engine; \
|
||||
EXTERN_CONFIG \
|
||||
extern EnginePins enginePins \
|
||||
|
||||
#define ENGINE(x) ___engine.x
|
||||
|
||||
#define DEFINE_CONFIG_PARAM(x, y)
|
||||
#define CONFIG_PARAM(x) CONFIG(x)
|
||||
#define PASS_CONFIG_PARAM(x)
|
||||
|
||||
#define EXPECTED_REMAINING_STACK 128
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Stack debugging
|
||||
*/
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "trigger_mazda.h"
|
||||
#include "error_handling.h"
|
||||
|
||||
void initializeMazdaMiataNaShape(TriggerWaveform *s) {
|
||||
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "engine_ptr.h"
|
||||
#include "state_sequence.h"
|
||||
#include "globalaccess.h"
|
||||
#include "engine_configuration_generated_structures.h"
|
||||
|
||||
#define FOUR_STROKE_ENGINE_CYCLE 720
|
||||
|
@ -74,6 +74,7 @@ class Engine;
|
|||
class TriggerState;
|
||||
class TriggerFormDetails;
|
||||
class TriggerConfiguration;
|
||||
class Logging;
|
||||
|
||||
// https://github.com/rusefi/rusefi/issues/2010 shows the corner case wheel with huge depth requirement
|
||||
#define GAP_TRACKING_LENGTH 18
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "trigger_universal.h"
|
||||
#include "error_handling.h"
|
||||
|
||||
/**
|
||||
* @see getCycleDuration
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "trigger_vw.h"
|
||||
#include "trigger_universal.h"
|
||||
#include "error_handling.h"
|
||||
|
||||
void setVwConfiguration(TriggerWaveform *s) {
|
||||
efiAssertVoid(CUSTOM_ERR_6660, s != NULL, "TriggerWaveform is NULL");
|
||||
|
|
|
@ -64,14 +64,6 @@ void print(const char *fmt, ...);
|
|||
|
||||
#define CCM_OPTIONAL
|
||||
|
||||
#define EXTERN_ENGINE extern EnginePins enginePins; \
|
||||
extern engine_configuration_s & activeConfiguration
|
||||
|
||||
#define EXTERN_CONFIG
|
||||
|
||||
#define DEFINE_CONFIG_PARAM(x, y) , x y
|
||||
#define PASS_CONFIG_PARAM(x) , x
|
||||
|
||||
/**
|
||||
* this macro provides references to engine from EngineTestHelper
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue