From 5d86560eda09fcef798241b7a813e38ccf2eefca Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Tue, 10 Sep 2019 11:15:26 +0200 Subject: [PATCH] QSPI test should use defined QSPI pins Example: "NUCLEO_L4R5ZI": { "target.device_has_add": ["QSPI"], "target.components": ["QSPIF"], "drivers.qspi_io0": "PE_12", "drivers.qspi_io1": "PB_0", "drivers.qspi_io2": "PE_14", "drivers.qspi_io3": "PE_15", "drivers.qspi_sck": "PB_10", "drivers.qspi_csn": "PA_2", "target.macros_add": ["QSPI_FLASH_CHIP=MX25R6435F"], "qspif.QSPI_FREQ": "8000000" }, --- .../qspi/flash_configs/flash_configs.h | 22 +++++++++++++++++++ TESTS/mbed_hal/qspi/main.cpp | 12 +++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/TESTS/mbed_hal/qspi/flash_configs/flash_configs.h b/TESTS/mbed_hal/qspi/flash_configs/flash_configs.h index 90c61e98bfa7..0bed43d8e64b 100644 --- a/TESTS/mbed_hal/qspi/flash_configs/flash_configs.h +++ b/TESTS/mbed_hal/qspi/flash_configs/flash_configs.h @@ -17,6 +17,27 @@ #ifndef MBED_FLASH_CONFIGS_H #define MBED_FLASH_CONFIGS_H +enum MemoryType { + MX25R6435F, + N25Q128A, + MT25Q +}; + +#if defined(QSPI_FLASH_CHIP) + +#if (QSPI_FLASH_CHIP == MX25R6435F) +#include "MX25RXX35F_config.h" + +#elif (QSPI_FLASH_CHIP == N25Q128A) +#include "N25Q128A_config.h" + +#elif (QSPI_FLASH_CHIP == MT25Q) +#include "MT25Q_config.h" + +#endif + +#else // QSPI_FLASH_CHIP not defined + #if defined(TARGET_DISCO_L475VG_IOT01A) #include "MX25RXX35F_config.h" // MX25R6435F @@ -88,5 +109,6 @@ #include "S25FL128S_config.h" #endif +#endif // QSPI_FLASH_CHIP #endif // MBED_FLASH_CONFIGS_H diff --git a/TESTS/mbed_hal/qspi/main.cpp b/TESTS/mbed_hal/qspi/main.cpp index c24036a610d4..4b28d1f9de38 100644 --- a/TESTS/mbed_hal/qspi/main.cpp +++ b/TESTS/mbed_hal/qspi/main.cpp @@ -70,12 +70,12 @@ uint8_t rx_buf[DATA_SIZE_1024]; // some target defines QSPI pins as integers thus conversion needed -#define QPIN_0 static_cast(QSPI_FLASH1_IO0) -#define QPIN_1 static_cast(QSPI_FLASH1_IO1) -#define QPIN_2 static_cast(QSPI_FLASH1_IO2) -#define QPIN_3 static_cast(QSPI_FLASH1_IO3) -#define QSCK static_cast(QSPI_FLASH1_SCK) -#define QCSN static_cast(QSPI_FLASH1_CSN) +#define QPIN_0 static_cast(MBED_CONF_DRIVERS_QSPI_IO0) +#define QPIN_1 static_cast(MBED_CONF_DRIVERS_QSPI_IO1) +#define QPIN_2 static_cast(MBED_CONF_DRIVERS_QSPI_IO2) +#define QPIN_3 static_cast(MBED_CONF_DRIVERS_QSPI_IO3) +#define QSCK static_cast(MBED_CONF_DRIVERS_QSPI_SCK) +#define QCSN static_cast(MBED_CONF_DRIVERS_QSPI_CSN) static uint32_t gen_flash_address()