From 6e41aeb1658494c6d52de9ed7020bc1dc2f55bbd Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Wed, 24 Feb 2021 09:08:03 -1000 Subject: [PATCH] deduplication in halconf (#2377) * rusefi_halconf * h7 gpt * don't redefine that * maybe this was necessary * format * no usb in cypress * flags for bl * cypress * maybe bootloader * no smart build for cypress/kinetis * no smart build * no really, disable smart build * don't need to clean that env var * cypress * format --- firmware/bootloader/src/Makefile | 5 +- firmware/config/boards/clean_env_variables.sh | 1 - .../config/boards/hellen/hellen72/board.mk | 3 - firmware/config/boards/microrusefi/board.mk | 3 - firmware/config/boards/prometheus/halconf.h | 9 - firmware/config/boards/proteus/board.mk | 3 - firmware/config/stm32f4ems/efifeatures.h | 4 - firmware/hw_layer/ports/rusefi_halconf.h | 64 +++++ .../ports/stm32/stm32f4/cfg/halconf.h | 203 +-------------- .../stm32/stm32f4/cfg/halconf_community.h | 157 ------------ .../ports/stm32/stm32f7/cfg/halconf.h | 201 +-------------- .../ports/stm32/stm32h7/cfg/halconf.h | 234 +----------------- .../ports/stm32/stm32h7/cfg/mcuconf.h | 2 +- 13 files changed, 75 insertions(+), 814 deletions(-) create mode 100644 firmware/hw_layer/ports/rusefi_halconf.h delete mode 100644 firmware/hw_layer/ports/stm32/stm32f4/cfg/halconf_community.h diff --git a/firmware/bootloader/src/Makefile b/firmware/bootloader/src/Makefile index 76ae2887a1..edf6bf667b 100644 --- a/firmware/bootloader/src/Makefile +++ b/firmware/bootloader/src/Makefile @@ -13,14 +13,15 @@ ifeq ($(DEBUG_LEVEL_OPT),) endif # disable some modules to shrink bootloader binary -DDEFS += -DHAL_USE_ADC=FALSE -DHAL_USE_CAN=FALSE -DHAL_USE_EXT=FALSE -DHAL_USE_GPT=FALSE -DHAL_USE_ICU=FALSE -DHAL_USE_PWM=FALSE -DHAL_USE_RTC=FALSE +DDEFS += -DEFI_BOOTLOADER +DDEFS += -DHAL_USE_EXT=FALSE -DHAL_USE_ICU=FALSE -DHAL_USE_PWM=FALSE -DHAL_USE_RTC=FALSE #disable ChibiOS flsah driver and prevent header from include DDEFS += -DHAL_USE_FLASH=FALSE DDEFS += -DPRIMARY_UART_DMA_MODE=FALSE # disable USB (The bootloader has currently UART support only) -DDEFS += -DEFI_USB_SERIAL=FALSE -DHAL_USE_SERIAL_USB=FALSE -DHAL_USE_USB=FALSE -DHAL_USE_USB_MSD=FALSE +DDEFS += -DEFI_USB_SERIAL=FALSE # disable CAN DDEFS += -DEFI_CAN_SUPPORT=FALSE diff --git a/firmware/config/boards/clean_env_variables.sh b/firmware/config/boards/clean_env_variables.sh index 8212c942dd..33edb9a55a 100644 --- a/firmware/config/boards/clean_env_variables.sh +++ b/firmware/config/boards/clean_env_variables.sh @@ -12,5 +12,4 @@ export BUILDDIR="" export DEBUG_LEVEL_OPT="" export USE_FATFS="" export USE_LIS302="" -export USE_SMART_BUILD="" export SC_BUFFER_SIZE="" diff --git a/firmware/config/boards/hellen/hellen72/board.mk b/firmware/config/boards/hellen/hellen72/board.mk index 1763cd36e9..c544d381a5 100644 --- a/firmware/config/boards/hellen/hellen72/board.mk +++ b/firmware/config/boards/hellen/hellen72/board.mk @@ -34,9 +34,6 @@ DDEFS += -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE -DHAL_VSS_USE_PAL=TRU # todo: is it broken? DDEFS += -DEFI_LOGIC_ANALYZER=FALSE -# USB mass storage support -DDEFS += -DHAL_USE_COMMUNITY=TRUE -DHAL_USE_USB_MSD=TRUE - # We are running on Hellen-One hardware! DDEFS += -DHW_HELLEN=1 diff --git a/firmware/config/boards/microrusefi/board.mk b/firmware/config/boards/microrusefi/board.mk index d0a5d7792c..445d6123ee 100644 --- a/firmware/config/boards/microrusefi/board.mk +++ b/firmware/config/boards/microrusefi/board.mk @@ -30,9 +30,6 @@ EFI_CONSOLE_TTL_PINS = -DEFI_CONSOLE_TX_BRAIN_PIN=GPIOB_10 -DEFI_CONSOLE_RX_BRAI # Add them all together DDEFS += -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"microRusEFI\" $(DEFAULT_ENGINE_TYPE) $(LED_CRITICAL_ERROR_BRAIN_PIN) $(EFI_CONSOLE_TTL_PINS) -DEFI_SOFTWARE_KNOCK=TRUE -DSTM32_ADC_USE_ADC3=TRUE -# USB mass storage support -DDEFS += -DHAL_USE_COMMUNITY=TRUE -DHAL_USE_USB_MSD=TRUE - # We are running on microRusEFI hardware! DDEFS += -DHW_MICRO_RUSEFI=1 diff --git a/firmware/config/boards/prometheus/halconf.h b/firmware/config/boards/prometheus/halconf.h index 5f5d4ecc4c..ba1d5d43c6 100644 --- a/firmware/config/boards/prometheus/halconf.h +++ b/firmware/config/boards/prometheus/halconf.h @@ -14,9 +14,6 @@ #ifndef _HALCONF_PROMETHEUS_H_ #define _HALCONF_PROMETHEUS_H_ -#undef HAL_USE_SERIAL_USB -#define HAL_USE_SERIAL_USB FALSE - #undef HAL_USE_SERIAL #define HAL_USE_SERIAL FALSE @@ -27,10 +24,4 @@ #define HAL_USE_UART FALSE #endif -#undef HAL_USE_USB -#define HAL_USE_USB FALSE - -#undef HAL_USE_USB_MSD -#define HAL_USE_USB_MSD FALSE - #endif /* _HALCONF_PROMETHEUS_H_ */ diff --git a/firmware/config/boards/proteus/board.mk b/firmware/config/boards/proteus/board.mk index 36f08789d3..0aba58bf19 100644 --- a/firmware/config/boards/proteus/board.mk +++ b/firmware/config/boards/proteus/board.mk @@ -21,9 +21,6 @@ DDEFS += -DSTM32_ADC_USE_ADC3=TRUE DDEFS += -DEFI_SOFTWARE_KNOCK=TRUE DDEFS += -DEFI_CONSOLE_TX_BRAIN_PIN=GPIO_UNASSIGNED -DEFI_CONSOLE_RX_BRAIN_PIN=GPIO_UNASSIGNED -# USB mass storage support -DDEFS += -DHAL_USE_COMMUNITY=TRUE -DHAL_USE_USB_MSD=TRUE - # We are running on Proteus hardware! DDEFS += -DHW_PROTEUS=1 diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index 0881875a1b..570439b2e5 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -37,10 +37,6 @@ #define EFI_HPFP TRUE -#ifndef HAL_USE_USB_MSD -#define HAL_USE_USB_MSD FALSE -#endif - #define EFI_ENABLE_CRITICAL_ENGINE_STOP TRUE #define EFI_ENABLE_ENGINE_WARNING TRUE diff --git a/firmware/hw_layer/ports/rusefi_halconf.h b/firmware/hw_layer/ports/rusefi_halconf.h new file mode 100644 index 0000000000..f3213e5a95 --- /dev/null +++ b/firmware/hw_layer/ports/rusefi_halconf.h @@ -0,0 +1,64 @@ +#pragma once + +#include "efifeatures.h" + +/*===========================================================================*/ +/* Conditional EFI feature settings */ +/*===========================================================================*/ + +// If EFI_CAN_SUPPORT, enable CAN driver +#define HAL_USE_CAN EFI_CAN_SUPPORT + +// If EFI_USB_SERIAL, enable USB features +#define HAL_USE_USB EFI_USB_SERIAL +#define HAL_USE_SERIAL_USB EFI_USB_SERIAL + +// If EFI_FILE_LOGGING, enable MMC SPI driver +#define HAL_USE_MMC_SPI EFI_FILE_LOGGING + +// If USB and File logging, enable USB Mass Storage & community +#define HAL_USE_USB_MSD (EFI_FILE_LOGGING && EFI_USB_SERIAL) +#define HAL_USE_COMMUNITY (EFI_FILE_LOGGING && EFI_USB_SERIAL) +// only the MSD driver requires USB_USE_WAIT +#define USB_USE_WAIT (EFI_FILE_LOGGING && EFI_USB_SERIAL) + +/*===========================================================================*/ +/* Required rusEFI settings */ +/*===========================================================================*/ + +// Enable flags +#ifdef EFI_BOOTLOADER + // Disable stuff we don't need in the bootloader + #define HAL_USE_ADC FALSE + #define HAL_USE_GPT FALSE +#else + // We are not the bootloader, enable stuff! + #define HAL_USE_ADC TRUE + #define HAL_USE_GPT TRUE +#endif + +#define HAL_USE_PAL TRUE + +// Options for individual drivers + +// ADC +#define ADC_USE_WAIT TRUE +#define ADC_USE_MUTUAL_EXCLUSION FALSE +#define CAN_USE_SLEEP_MODE FALSE + +// CAN +#define CAN_USE_SLEEP_MODE FALSE + +// MMC SPI +#define MMC_NICE_WAITING TRUE + +// PAL +#define PAL_USE_CALLBACKS TRUE + +// USB Serial +#define SERIAL_USB_BUFFERS_SIZE 320 +#define SERIAL_USB_BUFFERS_NUMBER 2 + +// SPI +#define SPI_USE_WAIT TRUE +#define SPI_USE_MUTUAL_EXCLUSION TRUE diff --git a/firmware/hw_layer/ports/stm32/stm32f4/cfg/halconf.h b/firmware/hw_layer/ports/stm32/stm32f4/cfg/halconf.h index 891fe78896..a6fe744210 100644 --- a/firmware/hw_layer/ports/stm32/stm32f4/cfg/halconf.h +++ b/firmware/hw_layer/ports/stm32/stm32f4/cfg/halconf.h @@ -33,6 +33,8 @@ #include "mcuconf.h" +#include "rusefi_halconf.h" + /** * @brief Enables the FLASH subsystem. */ @@ -40,36 +42,10 @@ #define HAL_USE_FLASH FALSE #endif -/** - * @brief Enables the PAL subsystem. - */ -#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) -#define HAL_USE_PAL TRUE -#endif - #if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) #define PAL_USE_WAIT FALSE #endif -// rusEfi uses callback for PAL input capture -#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) -#define PAL_USE_CALLBACKS TRUE -#endif - -/** - * @brief Enables the ADC subsystem. - */ -#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) -#define HAL_USE_ADC TRUE -#endif - -/** - * @brief Enables the CAN subsystem. - */ -#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) -#define HAL_USE_CAN TRUE -#endif - /** * @brief Enables the DAC subsystem. */ @@ -84,13 +60,6 @@ #define HAL_USE_EXT FALSE #endif -/** - * @brief Enables the GPT subsystem. - */ -#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) -#define HAL_USE_GPT TRUE -#endif - /** * @brief Enables the I2C subsystem. */ @@ -98,13 +67,6 @@ #define HAL_USE_I2C FALSE #endif -/** - * @brief Enables the I2S subsystem. - */ -#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) -#define HAL_USE_I2S FALSE -#endif - /** * @brief Enables the ICU subsystem. */ @@ -112,20 +74,6 @@ #define HAL_USE_ICU TRUE #endif -/** - * @brief Enables the MAC subsystem. - */ -#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) -#define HAL_USE_MAC FALSE -#endif - -/** - * @brief Enables the MMC_SPI subsystem. - */ -#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define HAL_USE_MMC_SPI TRUE -#endif - /** * @brief Enables the PWM subsystem. */ @@ -154,13 +102,6 @@ #define HAL_USE_SERIAL TRUE #endif -/** - * @brief Enables the SERIAL over USB subsystem. - */ -#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB TRUE -#endif - /** * @brief Enables the SPI subsystem. */ @@ -180,13 +121,6 @@ #endif #endif -/** - * @brief Enables the USB subsystem. - */ -#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) -#define HAL_USE_USB TRUE -#endif - /** * @brief Enables the WDG subsystem. */ @@ -194,82 +128,6 @@ #define HAL_USE_WDG FALSE #endif -/*===========================================================================*/ -/* ADC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) -#define ADC_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define ADC_USE_MUTUAL_EXCLUSION FALSE -#endif - -/*===========================================================================*/ -/* CAN driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Sleep mode related APIs inclusion switch. - */ -#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE FALSE -#endif - -/*===========================================================================*/ -/* I2C driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the mutual exclusion APIs on the I2C bus. - */ -#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define I2C_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* MAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables an event sources for incoming packets. - */ -#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) -#define MAC_USE_ZERO_COPY FALSE -#endif - -/** - * @brief Enables an event sources for incoming packets. - */ -#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) -#define MAC_USE_EVENTS TRUE -#endif - -/*===========================================================================*/ -/* MMC_SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - * This option is recommended also if the SPI driver does not - * use a DMA channel and heavily loads the CPU. - */ -#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) -#define MMC_NICE_WAITING TRUE -#endif - /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ @@ -325,49 +183,6 @@ #define SERIAL_BUFFERS_SIZE 16 #endif -/*===========================================================================*/ -/* SERIAL_USB driver related setting. */ -/*===========================================================================*/ - -/** - * @brief Serial over USB buffers size. - * @details Configuration parameter, the buffer size must be a multiple of - * the USB data endpoint maximum packet size. - * @note The default is 256 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 320 -#endif - -/** - * @brief Serial over USB number of buffers. - * @note The default is 2 buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_NUMBER 2 -#endif - -/*===========================================================================*/ -/* SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) -#define SPI_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define SPI_USE_MUTUAL_EXCLUSION TRUE -#endif - /*===========================================================================*/ /* UART driver related settings. */ /*===========================================================================*/ @@ -393,20 +208,6 @@ #define UART_USE_MUTUAL_EXCLUSION FALSE #endif -/*===========================================================================*/ -/* USB driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) -#define USB_USE_WAIT TRUE -#endif - -#include "halconf_community.h" - #endif /* HALCONF_H */ /** @} */ diff --git a/firmware/hw_layer/ports/stm32/stm32f4/cfg/halconf_community.h b/firmware/hw_layer/ports/stm32/stm32f4/cfg/halconf_community.h deleted file mode 100644 index 421ffa92ff..0000000000 --- a/firmware/hw_layer/ports/stm32/stm32f4/cfg/halconf_community.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef _HALCONF_COMMUNITY_H_ -#define _HALCONF_COMMUNITY_H_ - -/** - * @brief Enables the community overlay. - */ -#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) -#define HAL_USE_COMMUNITY FALSE -#endif - -/** - * @brief Enables the FSMC subsystem. - */ -#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) -#define HAL_USE_FSMC FALSE -#endif - -/** - * @brief Enables the NAND subsystem. - */ -#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) -#define HAL_USE_NAND FALSE -#endif - -/** - * @brief Enables the 1-wire subsystem. - */ -#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) -#define HAL_USE_ONEWIRE FALSE -#endif - -/** - * @brief Enables the EICU subsystem. - */ -#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) -#define HAL_USE_EICU FALSE -#endif - -/** - * @brief Enables the CRC subsystem. - */ -#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) -#define HAL_USE_CRC FALSE -#endif - -/** - * @brief Enables the USBH subsystem. - */ -#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) -#define HAL_USE_USBH FALSE -#endif - -/** - * @brief Enables the EEPROM subsystem. - */ -#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) -#define HAL_USE_EEPROM FALSE -#endif - -/** - * @brief Enables the TIMCAP subsystem. - */ -#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) -#define HAL_USE_TIMCAP FALSE -#endif - -/** - * @brief Enables the RNG subsystem. - */ -#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) -#define HAL_USE_RNG FALSE -#endif - -/** - * @brief Enables the USB_MSD subsystem. - */ -#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) -#define HAL_USE_USB_MSD TRUE -#endif - -/*===========================================================================*/ -/* FSMCNAND driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define NAND_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* 1-wire driver related settings. */ -/*===========================================================================*/ -/** - * @brief Enables strong pull up feature. - * @note Disabling this option saves both code and data space. - */ -#define ONEWIRE_USE_STRONG_PULLUP FALSE - -/** - * @brief Enables search ROM feature. - * @note Disabling this option saves both code and data space. - */ -#define ONEWIRE_USE_SEARCH_ROM FALSE - - -/*===========================================================================*/ -/* EEProm driver related settings. */ -/*===========================================================================*/ - -#define EEPROM_USE_EE24XX FALSE -#define EEPROM_USE_EE25XX TRUE - - - -/*===========================================================================*/ -/* CRC driver settings. */ -/*===========================================================================*/ - -/** - * @brief Enables DMA engine when performing CRC transactions. - * @note Enabling this option also enables asynchronous API. - */ -#if !defined(CRC_USE_DMA) || defined(__DOXYGEN__) -#define CRC_USE_DMA FALSE -#endif - -/** - * @brief Enables the @p crcAcquireUnit() and @p crcReleaseUnit() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(CRC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define CRC_USE_MUTUAL_EXCLUSION TRUE -#endif - - -#endif /* _HALCONF_COMMUNITY_H_ */ - -/** @} */ diff --git a/firmware/hw_layer/ports/stm32/stm32f7/cfg/halconf.h b/firmware/hw_layer/ports/stm32/stm32f7/cfg/halconf.h index d3986e8277..7c83eaed3a 100644 --- a/firmware/hw_layer/ports/stm32/stm32f7/cfg/halconf.h +++ b/firmware/hw_layer/ports/stm32/stm32f7/cfg/halconf.h @@ -33,6 +33,8 @@ #include "mcuconf.h" +#include "rusefi_halconf.h" + /** * @brief Enables the FLASH subsystem. */ @@ -40,36 +42,10 @@ #define HAL_USE_FLASH FALSE #endif -/** - * @brief Enables the PAL subsystem. - */ -#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) -#define HAL_USE_PAL TRUE -#endif - #if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) #define PAL_USE_WAIT FALSE #endif -// rusEfi uses callback for PAL input capture -#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) -#define PAL_USE_CALLBACKS TRUE -#endif - -/** - * @brief Enables the ADC subsystem. - */ -#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) -#define HAL_USE_ADC TRUE -#endif - -/** - * @brief Enables the CAN subsystem. - */ -#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) -#define HAL_USE_CAN TRUE -#endif - /** * @brief Enables the DAC subsystem. */ @@ -84,13 +60,6 @@ #define HAL_USE_EXT FALSE #endif -/** - * @brief Enables the GPT subsystem. - */ -#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) -#define HAL_USE_GPT TRUE -#endif - /** * @brief Enables the I2C subsystem. */ @@ -98,13 +67,6 @@ #define HAL_USE_I2C FALSE #endif -/** - * @brief Enables the I2S subsystem. - */ -#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) -#define HAL_USE_I2S FALSE -#endif - /** * @brief Enables the ICU subsystem. */ @@ -112,20 +74,6 @@ #define HAL_USE_ICU TRUE #endif -/** - * @brief Enables the MAC subsystem. - */ -#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) -#define HAL_USE_MAC FALSE -#endif - -/** - * @brief Enables the MMC_SPI subsystem. - */ -#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define HAL_USE_MMC_SPI TRUE -#endif - /** * @brief Enables the PWM subsystem. */ @@ -161,13 +109,6 @@ #define HAL_USE_SERIAL TRUE #endif -/** - * @brief Enables the SERIAL over USB subsystem. - */ -#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB TRUE -#endif - /** * @brief Enables the SPI subsystem. */ @@ -187,13 +128,6 @@ #endif #endif -/** - * @brief Enables the USB subsystem. - */ -#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) -#define HAL_USE_USB TRUE -#endif - /** * @brief Enables the WDG subsystem. */ @@ -201,82 +135,6 @@ #define HAL_USE_WDG FALSE #endif -/*===========================================================================*/ -/* ADC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) -#define ADC_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define ADC_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* CAN driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Sleep mode related APIs inclusion switch. - */ -#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE FALSE -#endif - -/*===========================================================================*/ -/* I2C driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the mutual exclusion APIs on the I2C bus. - */ -#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define I2C_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* MAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables an event sources for incoming packets. - */ -#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) -#define MAC_USE_ZERO_COPY FALSE -#endif - -/** - * @brief Enables an event sources for incoming packets. - */ -#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) -#define MAC_USE_EVENTS TRUE -#endif - -/*===========================================================================*/ -/* MMC_SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - * This option is recommended also if the SPI driver does not - * use a DMA channel and heavily loads the CPU. - */ -#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) -#define MMC_NICE_WAITING TRUE -#endif - /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ @@ -332,49 +190,6 @@ #define SERIAL_BUFFERS_SIZE 16 #endif -/*===========================================================================*/ -/* SERIAL_USB driver related setting. */ -/*===========================================================================*/ - -/** - * @brief Serial over USB buffers size. - * @details Configuration parameter, the buffer size must be a multiple of - * the USB data endpoint maximum packet size. - * @note The default is 256 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 320 -#endif - -/** - * @brief Serial over USB number of buffers. - * @note The default is 2 buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_NUMBER 2 -#endif - -/*===========================================================================*/ -/* SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) -#define SPI_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define SPI_USE_MUTUAL_EXCLUSION TRUE -#endif - /*===========================================================================*/ /* UART driver related settings. */ /*===========================================================================*/ @@ -400,18 +215,6 @@ #define UART_USE_MUTUAL_EXCLUSION FALSE #endif -/*===========================================================================*/ -/* USB driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) -#define USB_USE_WAIT TRUE -#endif - #endif /* HALCONF_H */ /** @} */ diff --git a/firmware/hw_layer/ports/stm32/stm32h7/cfg/halconf.h b/firmware/hw_layer/ports/stm32/stm32h7/cfg/halconf.h index f265476422..61ff6e9787 100644 --- a/firmware/hw_layer/ports/stm32/stm32h7/cfg/halconf.h +++ b/firmware/hw_layer/ports/stm32/stm32h7/cfg/halconf.h @@ -33,26 +33,11 @@ #include "mcuconf.h" -/** - * @brief Enables the PAL subsystem. - */ -#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) -#define HAL_USE_PAL TRUE -#endif +#include "rusefi_halconf.h" -/** - * @brief Enables the ADC subsystem. - */ -#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +// TODO: implement ADC on H7 +#undef HAL_USE_ADC #define HAL_USE_ADC FALSE -#endif - -/** - * @brief Enables the CAN subsystem. - */ -#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) -#define HAL_USE_CAN FALSE -#endif /** * @brief Enables the cryptographic subsystem. @@ -75,13 +60,6 @@ #define HAL_USE_EFL FALSE #endif -/** - * @brief Enables the GPT subsystem. - */ -#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) -#define HAL_USE_GPT FALSE -#endif - /** * @brief Enables the I2C subsystem. */ @@ -89,13 +67,6 @@ #define HAL_USE_I2C FALSE #endif -/** - * @brief Enables the I2S subsystem. - */ -#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) -#define HAL_USE_I2S FALSE -#endif - /** * @brief Enables the ICU subsystem. */ @@ -103,20 +74,6 @@ #define HAL_USE_ICU TRUE #endif -/** - * @brief Enables the MAC subsystem. - */ -#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) -#define HAL_USE_MAC FALSE -#endif - -/** - * @brief Enables the MMC_SPI subsystem. - */ -#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define HAL_USE_MMC_SPI TRUE -#endif - /** * @brief Enables the PWM subsystem. */ @@ -145,13 +102,6 @@ #define HAL_USE_SERIAL TRUE #endif -/** - * @brief Enables the SERIAL over USB subsystem. - */ -#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB TRUE -#endif - /** * @brief Enables the SIO subsystem. */ @@ -180,13 +130,6 @@ #define HAL_USE_UART TRUE #endif -/** - * @brief Enables the USB subsystem. - */ -#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) -#define HAL_USE_USB TRUE -#endif - /** * @brief Enables the WDG subsystem. */ @@ -205,14 +148,6 @@ /* PAL driver related settings. */ /*===========================================================================*/ -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) -#define PAL_USE_CALLBACKS TRUE -#endif - /** * @brief Enables synchronous APIs. * @note Disabling this option saves both code and data space. @@ -221,37 +156,10 @@ #define PAL_USE_WAIT FALSE #endif -/*===========================================================================*/ -/* ADC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) -#define ADC_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define ADC_USE_MUTUAL_EXCLUSION TRUE -#endif - /*===========================================================================*/ /* CAN driver related settings. */ /*===========================================================================*/ -/** - * @brief Sleep mode related APIs inclusion switch. - */ -#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE TRUE -#endif - /** * @brief Enforces the driver to use direct callbacks rather than OSAL events. */ @@ -281,71 +189,6 @@ #define HAL_CRY_ENFORCE_FALLBACK FALSE #endif -/*===========================================================================*/ -/* DAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) -#define DAC_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define DAC_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* I2C driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the mutual exclusion APIs on the I2C bus. - */ -#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define I2C_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* MAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the zero-copy API. - */ -#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) -#define MAC_USE_ZERO_COPY FALSE -#endif - -/** - * @brief Enables an event sources for incoming packets. - */ -#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) -#define MAC_USE_EVENTS TRUE -#endif - -/*===========================================================================*/ -/* MMC_SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - * This option is recommended also if the SPI driver does not - * use a DMA channel and heavily loads the CPU. - */ -#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) -#define MMC_NICE_WAITING TRUE -#endif - /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ @@ -415,41 +258,10 @@ #define SERIAL_BUFFERS_SIZE 16 #endif -/*===========================================================================*/ -/* SERIAL_USB driver related setting. */ -/*===========================================================================*/ - -/** - * @brief Serial over USB buffers size. - * @details Configuration parameter, the buffer size must be a multiple of - * the USB data endpoint maximum packet size. - * @note The default is 256 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 320 -#endif - -/** - * @brief Serial over USB number of buffers. - * @note The default is 2 buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_NUMBER 2 -#endif - /*===========================================================================*/ /* SPI driver related settings. */ /*===========================================================================*/ -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) -#define SPI_USE_WAIT TRUE -#endif - /** * @brief Enables circular transfers APIs. * @note Disabling this option saves both code and data space. @@ -458,14 +270,6 @@ #define SPI_USE_CIRCULAR FALSE #endif -/** - * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define SPI_USE_MUTUAL_EXCLUSION TRUE -#endif - /** * @brief Handling method for SPI CS line. * @note Disabling this option saves both code and data space. @@ -494,38 +298,6 @@ #define UART_USE_MUTUAL_EXCLUSION FALSE #endif -/*===========================================================================*/ -/* USB driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) -#define USB_USE_WAIT TRUE -#endif - -/*===========================================================================*/ -/* WSPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) -#define WSPI_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define WSPI_USE_MUTUAL_EXCLUSION TRUE -#endif - #endif /* HALCONF_H */ /** @} */ diff --git a/firmware/hw_layer/ports/stm32/stm32h7/cfg/mcuconf.h b/firmware/hw_layer/ports/stm32/stm32h7/cfg/mcuconf.h index aa12eda978..96fc96092a 100644 --- a/firmware/hw_layer/ports/stm32/stm32h7/cfg/mcuconf.h +++ b/firmware/hw_layer/ports/stm32/stm32h7/cfg/mcuconf.h @@ -263,7 +263,7 @@ #define STM32_GPT_USE_TIM3 FALSE #define STM32_GPT_USE_TIM4 FALSE #define STM32_GPT_USE_TIM5 FALSE -#define STM32_GPT_USE_TIM6 FALSE +#define STM32_GPT_USE_TIM6 TRUE #define STM32_GPT_USE_TIM7 FALSE #define STM32_GPT_USE_TIM8 FALSE #define STM32_GPT_USE_TIM12 FALSE