allow enum_class in rusefi_hw_enums.h (#4104)

* make things c++ friendly

* install various canaries in coal mines

* using is much clearer than typedef

* fixing builds

* lps25

* trigger includes were a mess

* c -> c++ cleanup

* os util

* why did so many include os_util.h?

* fwd declare

* cypress/kinetis

* s

* eg33 happy

* happy sim

* cypress usb

* pch

* cypress

* doesn't need to include all that

* h7
This commit is contained in:
Matthew Kennedy 2022-04-25 17:38:16 -07:00 committed by GitHub
parent 9dced11c26
commit bc6a87cadc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
82 changed files with 118 additions and 159 deletions

View File

@ -1,7 +1,8 @@
#include "global.h"
#include "bootloader/bootloader.h" #include "bootloader/bootloader.h"
#include <stdint.h>
#if defined(EFI_BOOTLOADER_INCLUDE_CODE) #if defined(EFI_BOOTLOADER_INCLUDE_CODE)
#if defined __GNUC__ #if defined __GNUC__

View File

@ -8,6 +8,8 @@
#pragma once #pragma once
enum class TestCppStyleEnum : uint8_t { };
// todo: migrate/unify with pin_output_mode_e? rename? something is messy here // todo: migrate/unify with pin_output_mode_e? rename? something is messy here
// this enum is currently only used for SPI pins // this enum is currently only used for SPI pins
typedef enum __attribute__ ((__packed__)) { typedef enum __attribute__ ((__packed__)) {

View File

@ -8,6 +8,8 @@
#pragma once #pragma once
enum class TestCppStyleEnum : uint8_t { };
// todo: migrate/unify with pin_output_mode_e? rename? something is messy here // todo: migrate/unify with pin_output_mode_e? rename? something is messy here
// this enum is currently only used for SPI pins // this enum is currently only used for SPI pins
typedef enum __attribute__ ((__packed__)) { typedef enum __attribute__ ((__packed__)) {

View File

@ -8,7 +8,6 @@
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h" #include "stm32_gpio.h"
#include "efilib.h" #include "efilib.h"
#include "rusefi_hw_enums.h"
#include "board_io.h" #include "board_io.h"

View File

@ -7,6 +7,8 @@
#pragma once #pragma once
enum class TestCppStyleEnum : uint8_t { };
// todo: migrate/unify with pin_output_mode_e? rename? something is messy here // todo: migrate/unify with pin_output_mode_e? rename? something is messy here
// this enum is currently only used for SPI pins // this enum is currently only used for SPI pins
typedef enum __attribute__ ((__packed__)) { typedef enum __attribute__ ((__packed__)) {

View File

@ -37,7 +37,6 @@
#include "pch.h" #include "pch.h"
#include "console_io.h" #include "console_io.h"
#include "os_util.h"
#include "tunerstudio.h" #include "tunerstudio.h"
#include "connector_uart_dma.h" #include "connector_uart_dma.h"

View File

@ -45,7 +45,6 @@
#include "main_trigger_callback.h" #include "main_trigger_callback.h"
#include "spark_logic.h" #include "spark_logic.h"
#include "idle_thread.h" #include "idle_thread.h"
#include "os_util.h"
#include "svnversion.h" #include "svnversion.h"
#include "lcd_controller.h" #include "lcd_controller.h"
#include "can_hw.h" #include "can_hw.h"

View File

@ -16,7 +16,6 @@
#include "advance_map.h" #include "advance_map.h"
#include "speed_density.h" #include "speed_density.h"
#include "advance_map.h" #include "advance_map.h"
#include "os_util.h"
#include "os_access.h" #include "os_access.h"
#include "aux_valves.h" #include "aux_valves.h"
#include "map_averaging.h" #include "map_averaging.h"

View File

@ -7,6 +7,8 @@
#pragma once #pragma once
enum class TestCppStyleEnum : uint8_t { };
// todo: migrate/unify with pin_output_mode_e? rename? something is messy here // todo: migrate/unify with pin_output_mode_e? rename? something is messy here
// this enum is currently only used for SPI pins // this enum is currently only used for SPI pins
typedef enum __attribute__ ((__packed__)) { typedef enum __attribute__ ((__packed__)) {

View File

@ -16,7 +16,7 @@
#include <sys/types.h> #include <sys/types.h>
#else #else
// IAR // IAR
typedef unsigned int time_t; using time_t = uint32_t;
#endif #endif
#include "rusefi_generated.h" #include "rusefi_generated.h"
@ -39,7 +39,7 @@ typedef unsigned int time_t;
// time in seconds // time in seconds
typedef time_t efitimesec_t; using efitimesec_t = time_t;
/** /**
* integer time in milliseconds (1/1_000 of a second) * integer time in milliseconds (1/1_000 of a second)
@ -47,7 +47,7 @@ typedef time_t efitimesec_t;
* Please restart your ECU every 46 days? :) * Please restart your ECU every 46 days? :)
* See getTimeNowUs() * See getTimeNowUs()
*/ */
typedef uint32_t efitimems_t; using efitimems_t = uint32_t;
/** /**
* We use a signed type here so that subtraction result is a proper negative value. * We use a signed type here so that subtraction result is a proper negative value.
@ -58,61 +58,60 @@ typedef uint32_t efitimems_t;
* See US2NT * See US2NT
* See MS2US * See MS2US
*/ */
typedef int64_t efitime_t; using efitime_t = int64_t;
/** /**
* 64 bit time in microseconds (1/1_000_000 of a second), since boot * 64 bit time in microseconds (1/1_000_000 of a second), since boot
*/ */
typedef efitime_t efitimeus_t; using efitimeus_t = efitime_t;
/** /**
* 64 bit time in milliseconds (1/1_000 of a second), since boot * 64 bit time in milliseconds (1/1_000 of a second), since boot
*/ */
typedef efitime_t efitimems64_t; using efitimems64_t = efitime_t;
/** /**
* platform-dependent tick since boot * platform-dependent tick since boot
* in case of stm32f4 that's a CPU tick * in case of stm32f4 that's a CPU tick
*/ */
typedef efitime_t efitick_t; using efitick_t = efitime_t;
typedef float angle_t; using angle_t = float;
// mass in grams // mass in grams
typedef float mass_t; using mass_t = float;
// temperature, in Celsius // temperature, in Celsius
typedef float temperature_t; using temperature_t = float;
typedef float floatms_t; using floatms_t = float;
typedef float floatus_t; using floatus_t = float;
/** /**
* numeric value from 0 to 100 * numeric value from 0 to 100
*/ */
typedef float percent_t; using percent_t = float;
typedef void (*Void)(void); typedef void (*Void)(void);
typedef char lua_script_t[LUA_SCRIPT_SIZE]; using lua_script_t = char[LUA_SCRIPT_SIZE];
typedef char error_message_t[ERROR_BUFFER_SIZE]; using error_message_t = char[ERROR_BUFFER_SIZE];
typedef char vehicle_info_t[VEHICLE_INFO_SIZE]; using vehicle_info_t = char[VEHICLE_INFO_SIZE];
typedef char gppwm_note_t[GPPWM_NOTE_SIZE]; using gppwm_note_t = char[GPPWM_NOTE_SIZE];
typedef char le_formula_t[LE_COMMAND_LENGTH]; using le_formula_t = char[LE_COMMAND_LENGTH];
typedef brain_pin_e egt_cs_array_t[EGT_CHANNEL_COUNT]; using egt_cs_array_t = brain_pin_e[EGT_CHANNEL_COUNT];
using pwm_freq_t = int16_t;
typedef int16_t pwm_freq_t; using script_setting_t = float;
typedef float script_setting_t; using brain_input_pin_e = brain_pin_e;
using switch_input_pin_e = brain_pin_e;
typedef brain_pin_e brain_input_pin_e;
typedef brain_pin_e switch_input_pin_e;
typedef void (*VoidPtr)(void*); typedef void (*VoidPtr)(void*);

View File

@ -31,7 +31,6 @@
#include "main_trigger_callback.h" #include "main_trigger_callback.h"
#include "flash_main.h" #include "flash_main.h"
#include "bench_test.h" #include "bench_test.h"
#include "os_util.h"
#include "electronic_throttle.h" #include "electronic_throttle.h"
#include "map_averaging.h" #include "map_averaging.h"
#include "high_pressure_fuel_pump.h" #include "high_pressure_fuel_pump.h"

View File

@ -39,7 +39,6 @@
#include "fuel_math.h" #include "fuel_math.h"
#include "cdm_ion_sense.h" #include "cdm_ion_sense.h"
#include "tooth_logger.h" #include "tooth_logger.h"
#include "os_util.h"
#include "local_version_holder.h" #include "local_version_holder.h"
#include "event_queue.h" #include "event_queue.h"
#include "injector_model.h" #include "injector_model.h"

View File

@ -20,7 +20,6 @@
#include "tooth_logger.h" #include "tooth_logger.h"
#if EFI_PROD_CODE #if EFI_PROD_CODE
#include "os_util.h"
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
#if EFI_SENSOR_CHART #if EFI_SENSOR_CHART

View File

@ -15,7 +15,6 @@
#include "os_access.h" #include "os_access.h"
#include "event_queue.h" #include "event_queue.h"
#include "efitime.h" #include "efitime.h"
#include "os_util.h"
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
extern int timeNowUs; extern int timeNowUs;

View File

@ -5,6 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_chrysler.h" #include "trigger_chrysler.h"
#include "trigger_universal.h" #include "trigger_universal.h"

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
#define CHRYSLER_NGC4_GAP 1 #define CHRYSLER_NGC4_GAP 1
#define CHRYSLER_NGC6_GAP 1.5 #define CHRYSLER_NGC6_GAP 1.5

View File

@ -5,6 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_gm.h" #include "trigger_gm.h"
static float addTooth(float offset, TriggerWaveform *s) { static float addTooth(float offset, TriggerWaveform *s) {

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void configureGm60_2_2_2(TriggerWaveform *s); void configureGm60_2_2_2(TriggerWaveform *s);
void configureGmTriggerWaveform(TriggerWaveform *s); void configureGmTriggerWaveform(TriggerWaveform *s);

View File

@ -5,6 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_honda.h" #include "trigger_honda.h"
#include "trigger_universal.h" #include "trigger_universal.h"

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void configureHondaAccordCDDip(TriggerWaveform *s); void configureHondaAccordCDDip(TriggerWaveform *s);
void configureHondaAccordShifted(TriggerWaveform *s); void configureHondaAccordShifted(TriggerWaveform *s);

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void initializeMazdaMiataNaShape(TriggerWaveform *s); void initializeMazdaMiataNaShape(TriggerWaveform *s);
void initializeMazdaMiataNb2Crank(TriggerWaveform *s); void initializeMazdaMiataNb2Crank(TriggerWaveform *s);

View File

@ -1,3 +1,5 @@
#include "pch.h"
#include "trigger_mercedes.h" #include "trigger_mercedes.h"
#include "trigger_structure.h" #include "trigger_structure.h"

View File

@ -5,6 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_misc.h" #include "trigger_misc.h"
#include "trigger_universal.h" #include "trigger_universal.h"

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void configureFiatIAQ_P8(TriggerWaveform * s); void configureFiatIAQ_P8(TriggerWaveform * s);
void configureDaihatsu4(TriggerWaveform * s); void configureDaihatsu4(TriggerWaveform * s);

View File

@ -5,6 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_mitsubishi.h" #include "trigger_mitsubishi.h"
#include "trigger_universal.h" #include "trigger_universal.h"

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void initializeMitsubishi4g18(TriggerWaveform *s); void initializeMitsubishi4g18(TriggerWaveform *s);
void configureFordAspireTriggerWaveform(TriggerWaveform * s); void configureFordAspireTriggerWaveform(TriggerWaveform * s);

View File

@ -7,6 +7,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_nissan.h" #include "trigger_nissan.h"
#include "trigger_universal.h" #include "trigger_universal.h"

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void initializeNissanSR20VE_4(TriggerWaveform *s); void initializeNissanSR20VE_4(TriggerWaveform *s);
void initializeNissanSR20VE_4_360(TriggerWaveform *s); void initializeNissanSR20VE_4_360(TriggerWaveform *s);

View File

@ -8,6 +8,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_renix.h" #include "trigger_renix.h"
static void commonRenix(TriggerWaveform *s) { static void commonRenix(TriggerWaveform *s) {

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
// TT_RENIX_44_2_2 // TT_RENIX_44_2_2
void initializeRenix44_2_2(TriggerWaveform *s); void initializeRenix44_2_2(TriggerWaveform *s);

View File

@ -6,6 +6,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_rover.h" #include "trigger_rover.h"
/** /**

View File

@ -8,6 +8,6 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void initializeRoverK(TriggerWaveform *s); void initializeRoverK(TriggerWaveform *s);

View File

@ -5,6 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_subaru.h" #include "trigger_subaru.h"
/** /**

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void initialize36_2_2_2(TriggerWaveform *s); void initialize36_2_2_2(TriggerWaveform *s);
void initializeSubaru7_6(TriggerWaveform *s); void initializeSubaru7_6(TriggerWaveform *s);

View File

@ -5,7 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2021 * @author Andrey Belomutskiy, (c) 2012-2021
*/ */
#include "trigger_subaru.h" #include "pch.h"
#include "trigger_suzuki.h"
void initializeSuzukiG13B(TriggerWaveform *s) { void initializeSuzukiG13B(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR); s->initialize(FOUR_STROKE_CAM_SENSOR);
@ -31,6 +33,3 @@ void initializeSuzukiG13B(TriggerWaveform *s) {
s->setTriggerSynchronizationGap(0.22); s->setTriggerSynchronizationGap(0.22);
s->setSecondTriggerSynchronizationGap(1); s->setSecondTriggerSynchronizationGap(1);
} }

View File

@ -7,6 +7,6 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void initializeSuzukiG13B(TriggerWaveform *s); void initializeSuzukiG13B(TriggerWaveform *s);

View File

@ -7,6 +7,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "trigger_toyota.h" #include "trigger_toyota.h"
/** /**

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void initialize2jzGE1_12(TriggerWaveform *s); void initialize2jzGE1_12(TriggerWaveform *s);
// TT_2JZ_3_34 // TT_2JZ_3_34

View File

@ -7,7 +7,7 @@
#pragma once #pragma once
#include "trigger_structure.h" class TriggerWaveform;
void setVwConfiguration(TriggerWaveform *s); void setVwConfiguration(TriggerWaveform *s);
/** /**

View File

@ -9,7 +9,6 @@
#include "pch.h" #include "pch.h"
#include "os_util.h"
#ifndef ENABLE_PERF_TRACE #ifndef ENABLE_PERF_TRACE
#error ENABLE_PERF_TRACE must be defined! #error ENABLE_PERF_TRACE must be defined!

View File

@ -22,9 +22,6 @@
* @{ * @{
*/ */
#include "global.h"
#include "os_access.h"
#if EFI_PERF_METRICS #if EFI_PERF_METRICS
#include "test.h" #include "test.h"

View File

@ -14,8 +14,6 @@
limitations under the License. limitations under the License.
*/ */
#include "global.h"
#if EFI_PERF_METRICS #if EFI_PERF_METRICS
#include "test.h" #include "test.h"

View File

@ -1,5 +1,5 @@
/* /*
* @file mcp3208.c * @file mcp3208.cpp
* @brief MCP3208 external ADC chip implementation. Not really used right now. * @brief MCP3208 external ADC chip implementation. Not really used right now.
* *
* @date Aug 12, 2013 * @date Aug 12, 2013

View File

@ -16,7 +16,6 @@
#include "gpio/gpio_ext.h" #include "gpio/gpio_ext.h"
#include "gpio/drv8860.h" #include "gpio/drv8860.h"
#include "os_util.h"
#if (BOARD_DRV8860_COUNT > 0) #if (BOARD_DRV8860_COUNT > 0)

View File

@ -36,7 +36,6 @@
#include "persistent_configuration.h" #include "persistent_configuration.h"
#include "hardware.h" #include "hardware.h"
#include "gpio/gpio_ext.h" #include "gpio/gpio_ext.h"
#include "os_util.h"
/* /*
* TODO list: * TODO list:
* - just write code * - just write code

View File

@ -14,7 +14,6 @@
#include "pch.h" #include "pch.h"
#include "gpio/gpio_ext.h" #include "gpio/gpio_ext.h"
#include "gpio/mc33810.h" #include "gpio/mc33810.h"
#include "os_util.h"
#if (BOARD_MC33810_COUNT > 0) #if (BOARD_MC33810_COUNT > 0)

View File

@ -24,7 +24,6 @@
#include "gpio/gpio_ext.h" #include "gpio/gpio_ext.h"
#include "gpio/tle6240.h" #include "gpio/tle6240.h"
#include "os_util.h"
#if (BOARD_TLE6240_COUNT > 0) #if (BOARD_TLE6240_COUNT > 0)

View File

@ -38,7 +38,6 @@
#include "persistent_configuration.h" #include "persistent_configuration.h"
#include "hardware.h" #include "hardware.h"
#include "gpio/gpio_ext.h" #include "gpio/gpio_ext.h"
#include "os_util.h"
static Timer diagResponse; static Timer diagResponse;

View File

@ -8,14 +8,6 @@
#pragma once #pragma once
#if EFI_PROD_CODE
#include "hal.h"
#endif
#include "rusefi_hw_enums.h"
#include <cstdint>
#include <cstddef>
class BitbangI2c { class BitbangI2c {
public: public:
// Initialize the I2C driver // Initialize the I2C driver

View File

@ -5,8 +5,6 @@
#pragma once #pragma once
#include "global.h"
/* Error codes */ /* Error codes */
/** @brief Flash operation successful */ /** @brief Flash operation successful */
@ -36,10 +34,6 @@
/** @brief Flash operation error because of bad flash, corrupted memory */ /** @brief Flash operation error because of bad flash, corrupted memory */
#define FLASH_RETURN_BAD_FLASH -11 #define FLASH_RETURN_BAD_FLASH -11
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** /**
* @brief Maximum program/erase parallelism * @brief Maximum program/erase parallelism
* *
@ -172,8 +166,3 @@ int intFlashRead(flashaddr_t address, char* buffer, size_t size);
* @return FLASH_RETURN_NO_PERMISSION Access denied. * @return FLASH_RETURN_NO_PERMISSION Access denied.
*/ */
int intFlashWrite(flashaddr_t address, const char* buffer, size_t size); int intFlashWrite(flashaddr_t address, const char* buffer, size_t size);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -14,7 +14,6 @@
#include "can_hw.h" #include "can_hw.h"
#include "hardware.h" #include "hardware.h"
#include "rtc_helper.h" #include "rtc_helper.h"
#include "os_util.h"
#include "bench_test.h" #include "bench_test.h"
#include "yaw_rate_sensor.h" #include "yaw_rate_sensor.h"
#include "pin_repository.h" #include "pin_repository.h"

View File

@ -7,10 +7,6 @@ HW_LAYER_INC= $(PROJECT_DIR)/hw_layer $(PROJECT_DIR)/hw_layer/adc \
HW_INC = hw_layer/$(CPU_HWLAYER) \ HW_INC = hw_layer/$(CPU_HWLAYER) \
$(PROJECT_DIR)/hw_layer/ports $(PROJECT_DIR)/hw_layer/ports
HW_LAYER_EMS = $(HW_LAYER_EGT) \
$(PROJECT_DIR)/hw_layer/adc/mcp3208.c \
$(PROJECT_DIR)/hw_layer/mc33816_data.c
HW_LAYER_EMS_CPP = \ HW_LAYER_EMS_CPP = \
$(PROJECT_DIR)/hw_layer/pin_repository.cpp \ $(PROJECT_DIR)/hw_layer/pin_repository.cpp \
$(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer.cpp \ $(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer.cpp \
@ -30,6 +26,7 @@ HW_LAYER_EMS_CPP = \
$(PROJECT_DIR)/hw_layer/sensors/hip9011.cpp \ $(PROJECT_DIR)/hw_layer/sensors/hip9011.cpp \
$(PROJECT_DIR)/hw_layer/sensors/hip9011_logic.cpp \ $(PROJECT_DIR)/hw_layer/sensors/hip9011_logic.cpp \
$(PROJECT_DIR)/hw_layer/mc33816.cpp \ $(PROJECT_DIR)/hw_layer/mc33816.cpp \
$(PROJECT_DIR)/hw_layer/mc33816_data.cpp \
$(PROJECT_DIR)/hw_layer/stepper.cpp \ $(PROJECT_DIR)/hw_layer/stepper.cpp \
$(PROJECT_DIR)/hw_layer/stepper_dual_hbridge.cpp \ $(PROJECT_DIR)/hw_layer/stepper_dual_hbridge.cpp \
$(PROJECT_DIR)/hw_layer/servo.cpp \ $(PROJECT_DIR)/hw_layer/servo.cpp \
@ -37,6 +34,7 @@ HW_LAYER_EMS_CPP = \
$(PROJECT_DIR)/hw_layer/rtc_helper.cpp \ $(PROJECT_DIR)/hw_layer/rtc_helper.cpp \
$(PROJECT_DIR)/hw_layer/cdm_ion_sense.cpp \ $(PROJECT_DIR)/hw_layer/cdm_ion_sense.cpp \
$(PROJECT_DIR)/hw_layer/debounce.cpp \ $(PROJECT_DIR)/hw_layer/debounce.cpp \
$(PROJECT_DIR)/hw_layer/adc/mcp3208.cpp \
# #

View File

@ -188,7 +188,7 @@ void MassStorageController::attachLun(uint8_t lunIndex,
scsiStart(&lun.target, &lun.config); scsiStart(&lun.target, &lun.config);
} }
extern "C" bool msd_request_hook_new(USBDriver *usbp) { bool msd_request_hook_new(USBDriver *usbp) {
/* check that the request is for interface 0.*/ /* check that the request is for interface 0.*/
if (MSD_SETUP_INDEX(usbp->setup) != 0) { if (MSD_SETUP_INDEX(usbp->setup) != 0) {
return false; return false;

View File

@ -8,7 +8,9 @@
* see mc33816/rusefi/readme.md * see mc33816/rusefi/readme.md
*/ */
#include "global.h" #include "pch.h"
#include "mc33816_data.h"
#if EFI_MC33816 #if EFI_MC33816

View File

@ -9,7 +9,6 @@
#pragma once #pragma once
#ifdef __cplusplus
#include "tunerstudio_io.h" #include "tunerstudio_io.h"
#define DOT_MLG ".mlg" #define DOT_MLG ".mlg"
@ -18,6 +17,7 @@ void initEarlyMmcCard();
void initMmcCard(); void initMmcCard();
bool isSdCardAlive(void); bool isSdCardAlive(void);
extern "C"
#endif
void onUsbConnectedNotifyMmcI(void); void onUsbConnectedNotifyMmcI(void);
struct USBDriver;
bool msd_request_hook_new(USBDriver *usbp);

View File

@ -5,7 +5,7 @@
* @author andreika <prometheus.pcb@gmail.com> * @author andreika <prometheus.pcb@gmail.com>
*/ */
#include "global.h" #include "pch.h"
#if EFI_INTERNAL_FLASH #if EFI_INTERNAL_FLASH

View File

@ -2,16 +2,14 @@ ifeq ($(CYPRESS_CONTRIB),)
CYPRESS_CONTRIB = $(CHIBIOS_CONTRIB) CYPRESS_CONTRIB = $(CHIBIOS_CONTRIB)
endif endif
HW_LAYER_EGT = $(PROJECT_DIR)/hw_layer/ports/cypress/serial_over_usb/usbconfig.c \
$(PROJECT_DIR)/hw_layer/ports/cypress/serial_over_usb/usbconsole.c
HW_LAYER_EMS += $(PROJECT_DIR)/hw_layer/ports/cypress/flash_int.c
HW_LAYER_EMS_CPP += $(PROJECT_DIR)/hw_layer/ports/cypress/mpu_util.cpp \ HW_LAYER_EMS_CPP += $(PROJECT_DIR)/hw_layer/ports/cypress/mpu_util.cpp \
$(PROJECT_DIR)/hw_layer/ports/cypress/cypress_pins.cpp \ $(PROJECT_DIR)/hw_layer/ports/cypress/cypress_pins.cpp \
$(PROJECT_DIR)/hw_layer/ports/cypress/cypress_common.cpp \ $(PROJECT_DIR)/hw_layer/ports/cypress/cypress_common.cpp \
$(PROJECT_DIR)/hw_layer/ports/cypress/backup_ram.cpp \ $(PROJECT_DIR)/hw_layer/ports/cypress/backup_ram.cpp \
$(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer_gpt.cpp \ $(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer_gpt.cpp \
$(PROJECT_DIR)/hw_layer/ports/cypress/flash_int.cpp \
$(PROJECT_DIR)/hw_layer/ports/cypress/serial_over_usb/usbconsole.cpp \
$(PROJECT_DIR)/hw_layer/ports/cypress/serial_over_usb/usbconfig.cpp \
HW_INC += $(PROJECT_DIR)/hw_layer/ports/cypress/serial_over_usb HW_INC += $(PROJECT_DIR)/hw_layer/ports/cypress/serial_over_usb

View File

@ -12,7 +12,6 @@
#include "mpu_util.h" #include "mpu_util.h"
#include "flash_int.h" #include "flash_int.h"
#include "os_util.h"
extern "C" { extern "C" {
void _unhandled_exception(void); void _unhandled_exception(void);

View File

@ -260,7 +260,4 @@
#endif //(USB_USE_PDL == 0) && (USB_USE_L3 == 0) #endif //(USB_USE_PDL == 0) && (USB_USE_L3 == 0)
void UsbConfig_UsbInit(void);
void UsbConfig_SwitchMode(void);
#endif #endif

View File

@ -1,5 +1,4 @@
#include "global.h" #include "pch.h"
#include "os_access.h"
#if EFI_USB_SERIAL #if EFI_USB_SERIAL

View File

@ -8,16 +8,7 @@
#ifndef USBCONSOLE_H_ #ifndef USBCONSOLE_H_
#define USBCONSOLE_H_ #define USBCONSOLE_H_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void usb_serial_start(void); void usb_serial_start(void);
bool is_usb_serial_ready(void); bool is_usb_serial_ready(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* USBCONSOLE_H_ */ #endif /* USBCONSOLE_H_ */

View File

@ -159,9 +159,9 @@ const uint8_t au8ConfigDescriptor[53] =
0x00 ///bIntervall: Polling Intervall 0x00 ///bIntervall: Polling Intervall
}; };
const uint8_t au8ReportDescriptor0[1]; // Not used const uint8_t au8ReportDescriptor0[1] = { 0 }; // Not used
const uint8_t au8ReportDescriptor1[1]; // Not used const uint8_t au8ReportDescriptor1[1] = { 0 }; // Not used
const uint8_t au8ReportDescriptor2[1]; // Not used const uint8_t au8ReportDescriptor2[1] = { 0 }; // Not used
const stc_usbdevice_stringdescriptor_t pstcStringDescriptors[] = const stc_usbdevice_stringdescriptor_t pstcStringDescriptors[] =

View File

@ -5,7 +5,7 @@
* @author andreika <prometheus.pcb@gmail.com> * @author andreika <prometheus.pcb@gmail.com>
*/ */
#include "global.h" #include "pch.h"
#if EFI_INTERNAL_FLASH #if EFI_INTERNAL_FLASH

View File

@ -2,8 +2,7 @@ ifeq ($(KINETIS_CONTRIB),)
KINETIS_CONTRIB = $(CHIBIOS_CONTRIB) KINETIS_CONTRIB = $(CHIBIOS_CONTRIB)
endif endif
HW_LAYER_EMS += $(PROJECT_DIR)/hw_layer/ports/kinetis/flash_int.c \ HW_LAYER_EMS += $(KINETIS_CONTRIB)/os/hal/ports/KINETIS/KE1xF/fsl/fsl_ftfx_flexnvm.c \
$(KINETIS_CONTRIB)/os/hal/ports/KINETIS/KE1xF/fsl/fsl_ftfx_flexnvm.c \
$(KINETIS_CONTRIB)/os/hal/ports/KINETIS/KE1xF/fsl/fsl_ftfx_controller.c $(KINETIS_CONTRIB)/os/hal/ports/KINETIS/KE1xF/fsl/fsl_ftfx_controller.c
HW_LAYER_EMS_CPP += $(PROJECT_DIR)/hw_layer/ports/kinetis/mpu_util.cpp \ HW_LAYER_EMS_CPP += $(PROJECT_DIR)/hw_layer/ports/kinetis/mpu_util.cpp \
@ -12,5 +11,6 @@ HW_LAYER_EMS_CPP += $(PROJECT_DIR)/hw_layer/ports/kinetis/mpu_util.cpp \
$(PROJECT_DIR)/hw_layer/ports/kinetis/kinetis_common.cpp \ $(PROJECT_DIR)/hw_layer/ports/kinetis/kinetis_common.cpp \
$(PROJECT_DIR)/hw_layer/trigger_input_comp.cpp \ $(PROJECT_DIR)/hw_layer/trigger_input_comp.cpp \
$(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer_gpt.cpp \ $(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer_gpt.cpp \
$(PROJECT_DIR)/hw_layer/ports/kinetis/flash_int.c \
MCU = cortex-m4 MCU = cortex-m4

View File

@ -12,7 +12,6 @@
#include "mpu_util.h" #include "mpu_util.h"
#include "flash_int.h" #include "flash_int.h"
#include "os_util.h"
void baseMCUInit(void) { void baseMCUInit(void) {
} }

View File

@ -7,8 +7,7 @@
* @brief Lower-level code related to internal flash memory * @brief Lower-level code related to internal flash memory
*/ */
#include "global.h" #include "pch.h"
#include "os_access.h"
#if EFI_INTERNAL_FLASH #if EFI_INTERNAL_FLASH

View File

@ -15,12 +15,13 @@
limitations under the License. limitations under the License.
*/ */
#include "global.h" #include "pch.h"
#include "os_access.h"
#include "mmc_card.h" #include "mmc_card.h"
#if HAL_USE_SERIAL_USB #if HAL_USE_SERIAL_USB
#include "usbcfg.h"
/* Virtual serial port over USB.*/ /* Virtual serial port over USB.*/
SerialUSBDriver SDU1; SerialUSBDriver SDU1;
@ -422,8 +423,6 @@ static void sof_handler(USBDriver *usbp) {
osalSysUnlockFromISR(); osalSysUnlockFromISR();
} }
bool msd_request_hook_new(USBDriver *usbp);
// We need a custom hook to handle both MSD and CDC at the same time // We need a custom hook to handle both MSD and CDC at the same time
static bool hybridRequestHook(USBDriver *usbp) { static bool hybridRequestHook(USBDriver *usbp) {
#if HAL_USE_USB_MSD #if HAL_USE_USB_MSD

View File

@ -14,15 +14,10 @@
limitations under the License. limitations under the License.
*/ */
#ifndef USBCFG_H #pragma once
#define USBCFG_H
extern const USBConfig usbcfg; extern const USBConfig usbcfg;
extern SerialUSBConfig serusbcfg; extern const SerialUSBConfig serusbcfg;
extern SerialUSBDriver SDU1; extern SerialUSBDriver SDU1;
EXTERNC void usbPopulateSerialNumber(const uint8_t* serialNumber, size_t bytes); void usbPopulateSerialNumber(const uint8_t* serialNumber, size_t bytes);
#endif /* USBCFG_H */
/** @} */

View File

@ -1,13 +1,13 @@
HW_LAYER_EMS += $(PROJECT_DIR)/hw_layer/ports/stm32/serial_over_usb/usbcfg.c \
$(PROJECT_DIR)/hw_layer/ports/stm32/flash_int.c
HW_LAYER_EMS_CPP += \ HW_LAYER_EMS_CPP += \
$(PROJECT_DIR)/hw_layer/ports/stm32/serial_over_usb/usbconsole.cpp \ $(PROJECT_DIR)/hw_layer/ports/stm32/serial_over_usb/usbconsole.cpp \
$(PROJECT_DIR)/hw_layer/ports/stm32/stm32_pins.cpp \ $(PROJECT_DIR)/hw_layer/ports/stm32/stm32_pins.cpp \
$(PROJECT_DIR)/hw_layer/ports/stm32/stm32_common.cpp \ $(PROJECT_DIR)/hw_layer/ports/stm32/stm32_common.cpp \
$(PROJECT_DIR)/hw_layer/ports/stm32/backup_ram.cpp \ $(PROJECT_DIR)/hw_layer/ports/stm32/backup_ram.cpp \
$(PROJECT_DIR)/hw_layer/ports/stm32/microsecond_timer_stm32.cpp \ $(PROJECT_DIR)/hw_layer/ports/stm32/microsecond_timer_stm32.cpp \
$(PROJECT_DIR)/hw_layer/ports/stm32/osc_detector.cpp $(PROJECT_DIR)/hw_layer/ports/stm32/osc_detector.cpp \
$(PROJECT_DIR)/hw_layer/ports/stm32/flash_int.cpp \
$(PROJECT_DIR)/hw_layer/ports/stm32/serial_over_usb/usbcfg.cpp \
RUSEFIASM = $(PROJECT_DIR)/hw_layer/ports/stm32/rusEfiStartup.S RUSEFIASM = $(PROJECT_DIR)/hw_layer/ports/stm32/rusEfiStartup.S

View File

@ -5,6 +5,8 @@
* @author Matthew Kennedy, (c) 2021 * @author Matthew Kennedy, (c) 2021
*/ */
#include "pch.h"
#include "flash_int.h" #include "flash_int.h"
bool allowFlashWhileRunning() { bool allowFlashWhileRunning() {

View File

@ -11,7 +11,6 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include "os_access.h" #include "os_access.h"
#include "os_util.h"
#include "rtc_helper.h" #include "rtc_helper.h"
#include <sys/time.h> #include <sys/time.h>

View File

@ -42,7 +42,6 @@
#if EFI_PROD_CODE #if EFI_PROD_CODE
#include "mpu_util.h" #include "mpu_util.h"
#include "os_util.h"
#endif #endif
#if EFI_HIP_9011 #if EFI_HIP_9011

View File

@ -6,6 +6,8 @@
* @author Matthew Kennedy, (c) 2020 * @author Matthew Kennedy, (c) 2020
*/ */
#include "pch.h"
#include "lps25.h" #include "lps25.h"
static constexpr uint8_t addr = 0x5C; static constexpr uint8_t addr = 0x5C;

View File

@ -10,8 +10,6 @@
#include "i2c_bb.h" #include "i2c_bb.h"
#include "expected.h"
class Lps25 { class Lps25 {
public: public:
// Returns true if the sensor was initialized successfully. // Returns true if the sensor was initialized successfully.

View File

@ -6,7 +6,9 @@
* http://www.chibios.com/forum/viewtopic.php?t=2506 * http://www.chibios.com/forum/viewtopic.php?t=2506
*/ */
#include "global.h" #include "hal.h"
#include <string.h>
/** /**
* Executes the BKPT instruction that causes the debugger to stop. * Executes the BKPT instruction that causes the debugger to stop.

View File

@ -37,7 +37,6 @@
#include "chmtx.h" #include "chmtx.h"
#include "memstreams.h" #include "memstreams.h"
#include "console_io.h" #include "console_io.h"
#include "os_util.h"
#endif // EFI_UNIT_TEST #endif // EFI_UNIT_TEST
/** /**

View File

@ -1,5 +1,5 @@
/** /**
* @file os_util.c * @file os_util.cpp
* @brief Utility methods related to operating system usage * @brief Utility methods related to operating system usage
* *
* @date Nov 15, 2012 * @date Nov 15, 2012
@ -20,8 +20,8 @@
*/ */
#if !EFI_UNIT_TEST #if !EFI_UNIT_TEST
#include "global.h" #include "pch.h"
#include "os_access.h"
#include "os_util.h" #include "os_util.h"
void chVTSetAny(virtual_timer_t *vtp, systime_t time, vtfunc_t vtfunc, void *par) { void chVTSetAny(virtual_timer_t *vtp, systime_t time, vtfunc_t vtfunc, void *par) {

View File

@ -23,16 +23,8 @@
#define assertIsrContext(code) efiAssertVoid(code, isIsrContext(), "NOT_ISR") #define assertIsrContext(code) efiAssertVoid(code, isIsrContext(), "NOT_ISR")
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void chVTSetAny(virtual_timer_t *vtp, systime_t time, vtfunc_t vtfunc, void *par); void chVTSetAny(virtual_timer_t *vtp, systime_t time, vtfunc_t vtfunc, void *par);
#ifdef __cplusplus
}
void printHistogram(Logging *logging, histogram_s *histogram); void printHistogram(Logging *logging, histogram_s *histogram);
#endif /* __cplusplus */
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */

View File

@ -3,7 +3,6 @@ UTIL_DIR=$(PROJECT_DIR)/util
UTILSRC = \ UTILSRC = \
$(UTIL_DIR)/math/crc.c \ $(UTIL_DIR)/math/crc.c \
$(UTIL_DIR)/tinymt32.c \ $(UTIL_DIR)/tinymt32.c \
$(UTIL_DIR)/os_util.c \
UTILSRC_CPP = \ UTILSRC_CPP = \
$(UTIL_DIR)/histogram.cpp \ $(UTIL_DIR)/histogram.cpp \
@ -18,6 +17,7 @@ UTILSRC_CPP = \
$(PROJECT_DIR)/util/cli_registry.cpp \ $(PROJECT_DIR)/util/cli_registry.cpp \
$(PROJECT_DIR)/util/efilib.cpp \ $(PROJECT_DIR)/util/efilib.cpp \
$(PROJECT_DIR)/util/timer.cpp \ $(PROJECT_DIR)/util/timer.cpp \
$(UTIL_DIR)/os_util.cpp \
UTIL_INC = \ UTIL_INC = \

View File

@ -156,7 +156,6 @@ include $(PROJECT_DIR)/common.mk
# C sources that can be compiled in ARM or THUMB mode depending on the global # C sources that can be compiled in ARM or THUMB mode depending on the global
# setting. # setting.
CSRC = $(ALLCSRC) \ CSRC = $(ALLCSRC) \
main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global # C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting. # setting.
@ -170,7 +169,8 @@ CPPSRC = $(ALLCPPSRC) \
simulator/rusEfiFunctionalTest.cpp \ simulator/rusEfiFunctionalTest.cpp \
simulator/framework.cpp \ simulator/framework.cpp \
simulator/boards.cpp \ simulator/boards.cpp \
$(TEST_SRC_CPP) $(TEST_SRC_CPP) \
main.cpp
# List ASM source files here # List ASM source files here

View File

@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
*/ */
#include "global.h" #include "pch.h"
#include "chprintf.h" #include "chprintf.h"
#include "rusEfiFunctionalTest.h" #include "rusEfiFunctionalTest.h"
@ -150,7 +150,7 @@ int main(int argc, char** argv) {
printf("Running rusEFI simulator for %d seconds, then exiting.\n\n", timeoutSeconds); printf("Running rusEFI simulator for %d seconds, then exiting.\n\n", timeoutSeconds);
chSysLock(); chSysLock();
chVTSetI(&exitTimer, MY_US2ST(timeoutSeconds * 1e6), &exit, 0); chVTSetI(&exitTimer, MY_US2ST(timeoutSeconds * 1e6), [](void*) { exit(0); }, 0);
chSysUnlock(); chSysUnlock();
} }