rusefi/simulator/simulator/global.h

120 lines
2.4 KiB
C
Raw Normal View History

2018-09-16 17:28:23 -07:00
/*
* @file global.h
*
* Global header file for win32 or posix simulator
*
* @date May 27, 2013
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef GLOBAL_H_
#define GLOBAL_H_
2015-07-10 06:01:56 -07:00
2016-09-21 21:03:00 -07:00
#define DEFAULT_ENGINE_TYPE FORD_ESCORT_GT
2015-07-10 06:01:56 -07:00
#include <ch.h>
#include <hal.h>
2018-09-16 17:28:23 -07:00
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
2015-07-10 06:01:56 -07:00
#include <time.h>
#include <math.h>
2017-06-22 10:26:12 -07:00
#include <float.h>
2015-07-10 06:01:56 -07:00
2016-09-23 22:02:43 -07:00
#include "efifeatures.h"
2017-03-31 01:36:51 -07:00
2015-07-10 06:01:56 -07:00
#include "auto_generated_enums.h"
#include "boards.h"
#include "efilib.h"
#include "efitime.h"
2018-09-16 17:28:23 -07:00
#include "error_handling.h"
#include "rusefi_enums.h"
#include "obd_error_codes.h"
2015-07-10 06:01:56 -07:00
2017-03-23 17:59:14 -07:00
#define EFI_UNIT_TEST FALSE
2016-04-01 17:02:26 -07:00
2017-03-23 17:59:14 -07:00
#define hasFatalError() (FALSE)
2016-04-01 17:02:26 -07:00
2015-07-10 06:01:56 -07:00
#define US_TO_NT_MULTIPLIER 100
2017-03-23 17:59:14 -07:00
#define ALWAYS_INLINE
2015-07-10 06:01:56 -07:00
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
// need to fight 32bit int overflow
#define MY_US2ST(x) ((x) / 10)
#define EFI_ERROR_CODE 0xffffffff
#define DL_OUTPUT_BUFFER 9000
#define CCM_OPTIONAL
#include "rusefi_enums.h"
#define EFI_CUSTOM_PANIC_METHOD 1
// project-wide default thread stack size
#define UTILITY_THREAD_STACK_SIZE 1384
/**
* @brief @p Win32TestStream virtual methods table.
*/
struct Win32TestStreamVMT {
_base_channel_methods
};
typedef struct {
const struct Win32TestStreamVMT *vmt;
} TestStream;
extern TestStream testStream;
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void printToWin32Console(char *p);
int systicks2ms(int systicks);
2016-04-01 17:02:26 -07:00
int getRemainingStack(thread_t *otp);
2015-07-10 06:01:56 -07:00
// todo: move somewhere else?
2016-04-01 17:02:26 -07:00
bool lockAnyContext(void);
2015-07-10 06:01:56 -07:00
void unlockAnyContext(void);
void applyNewConfiguration(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/**
* number of SysClock ticks in one ms
*/
#define TICKS_IN_MS (CH_FREQUENCY / 1000)
#define hal_lld_get_counter_value() 0
#define EXTERN_ENGINE extern Engine *engine; \
extern engine_configuration_s *engineConfiguration; \
extern board_configuration_s *boardConfiguration; \
extern persistent_config_s *config; \
2016-01-12 07:04:06 -08:00
extern persistent_config_container_s persistentState; \
2016-11-03 20:02:58 -07:00
extern EnginePins enginePins
2015-07-10 06:01:56 -07:00
2017-05-15 20:28:49 -07:00
#define DECLARE_ENGINE_PARAMETER_SIGNATURE void
#define DECLARE_ENGINE_PARAMETER_SUFFIX
#define PASS_ENGINE_PARAMETER_SIGNATURE
#define PASS_ENGINE_PARAMETER_SUFFIX
2015-07-10 06:01:56 -07:00
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
#define ENGINE(x) engine->x
2017-03-01 19:20:34 -08:00
#define TRIGGER_SHAPE(x) engine->triggerCentral.triggerShape.x
2018-09-16 17:28:23 -07:00
#endif /* GLOBAL_H_ */