From bc9715eeceb50e213d6cc74a59a88a9dfcb82045 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Wed, 5 Feb 2020 06:07:00 +1300 Subject: [PATCH] Merge pull request #9445 from mikeller/fix_sdcard_default Fixed default for 'sdcard_mode' to 'none'. --- src/main/pg/sdcard.c | 8 ++--- src/main/target/NUCLEOH743/config.c | 7 ++++- src/main/target/NUCLEOH743/target.mk | 8 ++--- src/main/target/SPRACINGH7EXTREME/config.c | 6 +++- src/main/target/SPRACINGH7NANO/config.c | 2 +- src/main/target/SPRACINGH7NANO/target.h | 9 ------ src/main/target/SPRACINGH7ZERO/config.c | 6 +++- src/main/target/WORMFC/config.c | 35 ++++++++++++++++++++++ src/main/target/WORMFC/target.h | 2 ++ 9 files changed, 59 insertions(+), 24 deletions(-) create mode 100644 src/main/target/WORMFC/config.c diff --git a/src/main/pg/sdcard.c b/src/main/pg/sdcard.c index 896324c3f4..61660abf68 100644 --- a/src/main/pg/sdcard.c +++ b/src/main/pg/sdcard.c @@ -47,16 +47,12 @@ void pgResetFn_sdcardConfig(sdcardConfig_t *config) config->device = SPI_DEV_TO_CFG(SPIINVALID); config->mode = SDCARD_MODE_NONE; -#ifdef USE_SDCARD_SDIO - config->mode = SDCARD_MODE_SDIO; - config->useDma = true; -#endif - #ifdef USE_SDCARD_SPI + // These settings do not work for Unified Targets + // They are only left in place to support legacy targets SPIDevice spidevice = spiDeviceByInstance(SDCARD_SPI_INSTANCE); config->device = SPI_DEV_TO_CFG(spidevice); config->chipSelectTag = IO_TAG(SDCARD_SPI_CS_PIN); - config->useDma = false; if (spidevice != SPIINVALID && config->chipSelectTag) { config->mode = SDCARD_MODE_SPI; diff --git a/src/main/target/NUCLEOH743/config.c b/src/main/target/NUCLEOH743/config.c index 7fb7f89854..ffdb004119 100644 --- a/src/main/target/NUCLEOH743/config.c +++ b/src/main/target/NUCLEOH743/config.c @@ -28,7 +28,8 @@ #include "config_helper.h" #include "io/serial.h" -#include "pg/pg.h" + +#include "pg/sdcard.h" static targetSerialPortFunction_t targetSerialPortFunction[] = { { SERIAL_PORT_USART1, FUNCTION_MSP }, @@ -38,5 +39,9 @@ static targetSerialPortFunction_t targetSerialPortFunction[] = { void targetConfiguration(void) { targetSerialPortFunctionConfig(targetSerialPortFunction, ARRAYLEN(targetSerialPortFunction)); +#if !defined(NUCLEOH743_RAMBASED) + sdcardConfigMutable()->mode = SDCARD_MODE_SDIO; + sdcardConfigMutable()->useDma = true; +#endif } #endif diff --git a/src/main/target/NUCLEOH743/target.mk b/src/main/target/NUCLEOH743/target.mk index d12cb8daf4..8853fd10ec 100644 --- a/src/main/target/NUCLEOH743/target.mk +++ b/src/main/target/NUCLEOH743/target.mk @@ -1,9 +1,11 @@ H743xI_TARGETS += $(TARGET) -FEATURES += VCP ONBOARDFLASH SDCARD_SDIO ifeq ($(TARGET), NUCLEOH743_RAMBASED) +FEATURES += VCP ONBOARDFLASH RAM_BASED = yes +else +FEATURES += VCP ONBOARDFLASH SDCARD_SDIO endif # Top level Makefile adds, if not defined, HSE_VALUE, as default for F4 targets. @@ -30,7 +32,3 @@ TARGET_SRC = \ drivers/barometer/barometer_ms5611.c \ drivers/compass/compass_hmc5883l.c \ drivers/max7456.c \ - -# drivers/accgyro/accgyro_fake.c \ -# drivers/barometer/barometer_fake.c \ -# drivers/compass/compass_fake.c \ diff --git a/src/main/target/SPRACINGH7EXTREME/config.c b/src/main/target/SPRACINGH7EXTREME/config.c index 016d37ad21..7d29627fb5 100644 --- a/src/main/target/SPRACINGH7EXTREME/config.c +++ b/src/main/target/SPRACINGH7EXTREME/config.c @@ -28,8 +28,10 @@ #include "config_helper.h" #include "io/serial.h" + #include "osd/osd.h" -#include "pg/pg.h" + +#include "pg/sdcard.h" static targetSerialPortFunction_t targetSerialPortFunction[] = { { SERIAL_PORT_USART1, FUNCTION_MSP }, @@ -40,5 +42,7 @@ void targetConfiguration(void) { osdConfigMutable()->core_temp_alarm = 85; targetSerialPortFunctionConfig(targetSerialPortFunction, ARRAYLEN(targetSerialPortFunction)); + sdcardConfigMutable()->mode = SDCARD_MODE_SDIO; + sdcardConfigMutable()->useDma = true; } #endif diff --git a/src/main/target/SPRACINGH7NANO/config.c b/src/main/target/SPRACINGH7NANO/config.c index 016d37ad21..21508d4d36 100644 --- a/src/main/target/SPRACINGH7NANO/config.c +++ b/src/main/target/SPRACINGH7NANO/config.c @@ -28,8 +28,8 @@ #include "config_helper.h" #include "io/serial.h" + #include "osd/osd.h" -#include "pg/pg.h" static targetSerialPortFunction_t targetSerialPortFunction[] = { { SERIAL_PORT_USART1, FUNCTION_MSP }, diff --git a/src/main/target/SPRACINGH7NANO/target.h b/src/main/target/SPRACINGH7NANO/target.h index 093eb0c289..a98272a2e7 100644 --- a/src/main/target/SPRACINGH7NANO/target.h +++ b/src/main/target/SPRACINGH7NANO/target.h @@ -170,17 +170,8 @@ // SD card not present on hardware, but pins are reserved. //#define USE_SDCARD #ifdef USE_SDCARD -#define USE_SDCARD_SDIO #define SDCARD_DETECT_PIN PD10 #define SDCARD_DETECT_INVERTED -#define SDIO_DEVICE SDIODEV_1 -#define SDIO_USE_4BIT true -#define SDIO_CK_PIN PC12 -#define SDIO_CMD_PIN PD2 -#define SDIO_D0_PIN PC8 -#define SDIO_D1_PIN PC9 -#define SDIO_D2_PIN PC10 -#define SDIO_D3_PIN PC11 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT #else #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT diff --git a/src/main/target/SPRACINGH7ZERO/config.c b/src/main/target/SPRACINGH7ZERO/config.c index 016d37ad21..7d29627fb5 100644 --- a/src/main/target/SPRACINGH7ZERO/config.c +++ b/src/main/target/SPRACINGH7ZERO/config.c @@ -28,8 +28,10 @@ #include "config_helper.h" #include "io/serial.h" + #include "osd/osd.h" -#include "pg/pg.h" + +#include "pg/sdcard.h" static targetSerialPortFunction_t targetSerialPortFunction[] = { { SERIAL_PORT_USART1, FUNCTION_MSP }, @@ -40,5 +42,7 @@ void targetConfiguration(void) { osdConfigMutable()->core_temp_alarm = 85; targetSerialPortFunctionConfig(targetSerialPortFunction, ARRAYLEN(targetSerialPortFunction)); + sdcardConfigMutable()->mode = SDCARD_MODE_SDIO; + sdcardConfigMutable()->useDma = true; } #endif diff --git a/src/main/target/WORMFC/config.c b/src/main/target/WORMFC/config.c new file mode 100644 index 0000000000..199accd668 --- /dev/null +++ b/src/main/target/WORMFC/config.c @@ -0,0 +1,35 @@ +/* + * This file is part of Cleanflight and Betaflight. + * + * Cleanflight and Betaflight are free software. You can redistribute + * this software and/or modify this software under the terms of the + * GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * Cleanflight and Betaflight are distributed in the hope that they + * will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. + * + * If not, see . + */ + +#include + +#include "platform.h" + +#if defined(USE_TARGET_CONFIG) + +#include "pg/sdcard.h" + +void targetConfiguration(void) +{ + + sdcardConfigMutable()->mode = SDCARD_MODE_SDIO; + sdcardConfigMutable()->useDma = true; +} +#endif diff --git a/src/main/target/WORMFC/target.h b/src/main/target/WORMFC/target.h index 09b8d7ab43..415b39b229 100644 --- a/src/main/target/WORMFC/target.h +++ b/src/main/target/WORMFC/target.h @@ -32,6 +32,8 @@ #endif +#define USE_TARGET_CONFIGURATION + //LEDs #if defined(PIRXF4) #define LED0_PIN PC13