2015-07-10 06:01:56 -07:00
|
|
|
/*
|
2019-01-03 15:29:38 -08:00
|
|
|
* @file global.h
|
2015-07-10 06:01:56 -07:00
|
|
|
*
|
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
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2019-11-19 22:35:08 -08:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-09-16 19:00:14 -07:00
|
|
|
#include <stdio.h>
|
2018-09-16 20:10:06 -07:00
|
|
|
#include <time.h>
|
2018-09-16 19:00:14 -07:00
|
|
|
|
2018-09-16 20:10:06 -07:00
|
|
|
#include "common_headers.h"
|
2018-09-16 19:00:14 -07:00
|
|
|
|
2019-09-19 18:55:27 -07:00
|
|
|
typedef uint32_t iomode_t;
|
|
|
|
typedef uint32_t ioportid_t;
|
|
|
|
typedef uint32_t ioportmask_t;
|
|
|
|
|
2019-12-13 15:37:11 -08:00
|
|
|
// just a stub implementation for unit tests
|
|
|
|
#define EXPECTED_REMAINING_STACK 1
|
2019-02-23 09:33:49 -08:00
|
|
|
#define getCurrentRemainingStack() (999999)
|
|
|
|
|
2019-01-20 20:44:05 -08:00
|
|
|
// this is needed by all DECLARE_ENGINE_PARAMETER_* usages
|
|
|
|
#include "engine_configuration_generated_structures.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
// this is needed by all DECLARE_ENGINE_PARAMETER_* usages
|
|
|
|
class Engine;
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
2018-09-16 19:00:14 -07:00
|
|
|
#ifdef __cplusplus
|
2018-12-08 15:11:28 -08:00
|
|
|
// todo: include it right here? #include "unit_test_framework.h"
|
2018-09-16 19:00:14 -07:00
|
|
|
extern "C"
|
|
|
|
{
|
2018-12-08 11:32:45 -08:00
|
|
|
#endif /* __cplusplus */
|
2018-09-16 19:00:14 -07:00
|
|
|
|
|
|
|
#define CH_FREQUENCY 1000
|
2020-04-13 10:12:55 -07:00
|
|
|
#define NO_CACHE
|
2018-09-16 19:00:14 -07:00
|
|
|
|
|
|
|
typedef int bool_t;
|
|
|
|
typedef uint32_t systime_t;
|
|
|
|
|
|
|
|
void chDbgAssert(int c, char *msg, void *arg);
|
|
|
|
|
|
|
|
void print(const char *fmt, ...);
|
|
|
|
|
|
|
|
#define TICKS_IN_MS 100
|
|
|
|
|
|
|
|
#define chDbgCheck(x, y) chDbgAssert(x, y, NULL)
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2018-12-08 11:32:45 -08:00
|
|
|
#endif /* __cplusplus */
|
2018-09-16 19:00:14 -07:00
|
|
|
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
#define US_TO_NT_MULTIPLIER 100
|
2019-01-11 16:08:15 -08:00
|
|
|
#define VCS_VERSION "321"
|
|
|
|
#define RUS_EFI_VERSION_TAG "rusEfiVersion"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#define ALWAYS_INLINE INLINE
|
|
|
|
|
|
|
|
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
|
|
|
|
|
|
|
|
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
|
|
|
|
|
|
|
|
#define INLINE inline
|
|
|
|
|
|
|
|
#define EFI_ERROR_CODE 0xffffffff
|
|
|
|
|
|
|
|
#define CCM_OPTIONAL
|
|
|
|
|
2019-10-21 20:47:40 -07:00
|
|
|
#define EXTERN_ENGINE extern EnginePins enginePins; \
|
2019-10-31 13:06:34 -07:00
|
|
|
extern engine_configuration_s & activeConfiguration
|
2019-10-21 20:47:40 -07:00
|
|
|
|
2019-01-10 16:25:07 -08:00
|
|
|
#define EXTERN_CONFIG
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-12-25 19:47:29 -08:00
|
|
|
#define DEFINE_CONFIG_PARAM(x, y) , x y
|
|
|
|
#define PASS_CONFIG_PARAM(x) , x
|
|
|
|
|
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
|
|
|
|
|
2020-04-15 13:20:45 -07:00
|
|
|
#define WITH_ENGINE_TEST_HELPER_SENS(x, sensorvals) \
|
|
|
|
EngineTestHelper eth(x, sensorvals); \
|
|
|
|
EXPAND_EngineTestHelper;
|
|
|
|
|
|
|
|
#define WITH_ENGINE_TEST_HELPER(x) \
|
|
|
|
EngineTestHelper eth(x, std::unordered_map<SensorType, float>{}); \
|
|
|
|
EXPAND_EngineTestHelper;
|
2019-01-19 17:42:29 -08:00
|
|
|
|
2018-12-25 19:47:29 -08:00
|
|
|
#define CONFIG_PARAM(x) (x)
|
|
|
|
|
2019-10-14 13:04:28 -07:00
|
|
|
#define lockAnyContext() false
|
|
|
|
|
|
|
|
#define unlockAnyContext() {}
|