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
|
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_
|
|
|
|
|
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
|
|
|
|
|
|
|
#include "boards.h"
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2016-11-03 20:02:58 -07:00
|
|
|
#define EXTERN_ENGINE extern EnginePins enginePins
|
2019-01-10 16:25:07 -08:00
|
|
|
#define EXTERN_CONFIG
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
class Engine;
|
2018-12-08 11:32:45 -08:00
|
|
|
#endif /* __cplusplus */
|
2015-07-10 06:01:56 -07:00
|
|
|
|
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
|
|
|
|
2019-01-10 14:07:29 -08:00
|
|
|
#define DECLARE_CONFIG_PARAMETER_SIGNATURE engine_configuration_s *engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration
|
|
|
|
#define DECLARE_CONFIG_PARAMETER_SUFFIX , engine_configuration_s *engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration
|
|
|
|
#define PASS_CONFIG_PARAMETER_SIGNATURE engineConfiguration, config, boardConfiguration
|
|
|
|
#define PASS_CONFIG_PARAMETER_SUFFIX , engineConfiguration, config, boardConfiguration
|
2018-07-28 11:33:05 -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 is a work-around for uint tests to get all needed pointers only
|
|
|
|
* if engine is in scope
|
|
|
|
*/
|
|
|
|
#define EXPAND_Engine \
|
2019-01-04 21:11:17 -08:00
|
|
|
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr; \
|
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
|
|
|
|
|
2019-01-19 17:42:29 -08:00
|
|
|
#define WITH_ENGINE_TEST_HELPER(x) EngineTestHelper eth(x); \
|
|
|
|
EXPAND_EngineTestHelper;
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
#define CONFIG(x) engineConfiguration->x
|
2019-01-09 19:16:30 -08:00
|
|
|
// todo: fix this! this does not work because of 'prepareVoidConfiguration(&activeConfiguration);'
|
|
|
|
//#define CONFIGB(x) engine->engineConfigurationPtr->bc.x
|
|
|
|
#define CONFIGB(x) CONFIG(bc.x)
|
2015-07-10 06:01:56 -07:00
|
|
|
#define ENGINE(x) engine->x
|
|
|
|
|
2018-12-25 19:47:29 -08:00
|
|
|
#define CONFIG_PARAM(x) (x)
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
#endif /* GLOBAL_H_ */
|