2015-07-10 06:01:56 -07:00
|
|
|
/*
|
|
|
|
* @file global.h
|
|
|
|
*
|
2018-09-16 17:12:25 -07:00
|
|
|
* Global header file for unit tests
|
|
|
|
*
|
2015-07-10 06:01:56 -07:00
|
|
|
* @date Nov 28, 2013
|
2017-03-05 18:59:00 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GLOBAL_H_
|
|
|
|
#define GLOBAL_H_
|
|
|
|
|
2016-09-21 21:03:00 -07:00
|
|
|
#define DEFAULT_ENGINE_TYPE CUSTOM_ENGINE
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
#include <stdbool.h>
|
2018-09-16 17:12:25 -07:00
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#include "efitime.h"
|
2016-01-24 15:01:56 -08:00
|
|
|
#include "auto_generated_enums.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#define US_TO_NT_MULTIPLIER 100
|
|
|
|
|
|
|
|
#define ALWAYS_INLINE INLINE
|
|
|
|
|
|
|
|
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
|
|
|
|
|
|
|
|
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
|
|
|
|
|
|
|
|
#define INLINE inline
|
|
|
|
|
|
|
|
typedef int bool_t;
|
|
|
|
|
|
|
|
#define EFI_ERROR_CODE 0xffffffff
|
|
|
|
#define TRUE 1
|
|
|
|
#define FALSE 0
|
|
|
|
|
|
|
|
#define CCM_OPTIONAL
|
|
|
|
|
2016-11-03 20:02:58 -07:00
|
|
|
#define EXTERN_ENGINE extern EnginePins enginePins
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
class Engine;
|
|
|
|
#endif
|
|
|
|
|
2017-03-06 22:43:58 -08:00
|
|
|
/**
|
|
|
|
* @see firmware/global.h for explanation
|
|
|
|
*/
|
2017-05-15 20:28:49 -07:00
|
|
|
#define DECLARE_ENGINE_PARAMETER_SIGNATURE Engine *engine, engine_configuration_s *engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration
|
|
|
|
#define DECLARE_ENGINE_PARAMETER_SUFFIX , Engine *engine, engine_configuration_s *engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration
|
|
|
|
#define PASS_ENGINE_PARAMETER_SIGNATURE engine, engineConfiguration, config, boardConfiguration
|
|
|
|
#define PASS_ENGINE_PARAMETER_SUFFIX , engine, engineConfiguration, config, boardConfiguration
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-07-28 11:33:05 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* this macro is a work-around for uint tests to get all needed pointers only
|
|
|
|
* if engine is in scope
|
|
|
|
*/
|
|
|
|
#define EXPAND_Engine \
|
|
|
|
engine_configuration_s *engineConfiguration = engine->engineConfiguration; \
|
2015-07-10 06:01:56 -07:00
|
|
|
persistent_config_s *config = engine->config; \
|
|
|
|
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
|
|
|
|
2016-09-03 10:02:55 -07:00
|
|
|
|
2018-07-28 11:33:05 -07:00
|
|
|
/**
|
|
|
|
* this macro provides references to engine from EngineTestHelper
|
|
|
|
*/
|
|
|
|
#define EXPAND_EngineTestHelper \
|
|
|
|
Engine *engine = ð.engine; \
|
2016-09-03 10:02:55 -07:00
|
|
|
EXPAND_Engine
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
#define CONFIG(x) engineConfiguration->x
|
|
|
|
#define ENGINE(x) engine->x
|
2017-03-01 19:18:25 -08:00
|
|
|
#define TRIGGER_SHAPE(x) engine->triggerCentral.triggerShape.x
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#endif /* GLOBAL_H_ */
|