diff --git a/bsp/stm32f107/drivers/SConscript b/bsp/stm32f107/drivers/SConscript index 0bdb61e301..43d7f2c19c 100644 --- a/bsp/stm32f107/drivers/SConscript +++ b/bsp/stm32f107/drivers/SConscript @@ -18,7 +18,6 @@ if GetDepend('RT_USING_LWIP'): if GetDepend('RT_USING_SPI'): src += ['rt_stm32f10x_spi.c'] - src += ['msd.c'] CPPPATH = [cwd] diff --git a/bsp/stm32f107/drivers/platform.c b/bsp/stm32f107/drivers/platform.c index a429e232a9..830b9a4c55 100644 --- a/bsp/stm32f107/drivers/platform.c +++ b/bsp/stm32f107/drivers/platform.c @@ -8,8 +8,8 @@ #ifdef RT_USING_SPI #include "rt_stm32f10x_spi.h" -#if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT) -#include "msd.h" +#if defined(RT_USING_DFS) && defined(RT_USING_SPI_MSD) +#include "spi_msd.h" #endif /* RT_USING_DFS */ /* @@ -70,7 +70,7 @@ void rt_platform_init(void) #ifdef RT_USING_SPI rt_hw_spi_init(); -#if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT) +#if defined(RT_USING_DFS) && defined(RT_USING_SPI_MSD) /* init sdcard driver */ { extern void rt_hw_msd_init(void); @@ -90,7 +90,7 @@ void rt_platform_init(void) msd_init("sd0", "spi10"); } -#endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */ +#endif /* RT_USING_DFS && RT_USING_SPI_MSD */ #endif // RT_USING_SPI diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index dcd23715b0..9f4147f9fd 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -87,6 +87,11 @@ config RT_USING_SPI default n if RT_USING_SPI + config RT_USING_SPI_MSD + bool "Using SD/TF card driver with spi" + select RT_USING_DFS + default n + config RT_USING_SFUD bool "Using Serial Flash Universal Driver" default n diff --git a/components/drivers/spi/SConscript b/components/drivers/spi/SConscript index 01cc608c2b..ee423c33db 100644 --- a/components/drivers/spi/SConscript +++ b/components/drivers/spi/SConscript @@ -28,7 +28,10 @@ if GetDepend('RT_USING_SST25VFXX'): if GetDepend('RT_USING_GD'): src_device += ['spi_flash_gd.c'] - + +if GetDepend('RT_USING_SPI_MSD'): + src_device += ['spi_msd.c'] + if GetDepend('RT_USING_SFUD'): src_device += ['spi_flash_sfud.c', 'sfud/src/sfud.c'] CPPPATH += [cwd + '/sfud/inc'] diff --git a/bsp/stm32f107/drivers/msd.c b/components/drivers/spi/spi_msd.c similarity index 99% rename from bsp/stm32f107/drivers/msd.c rename to components/drivers/spi/spi_msd.c index dc04804039..cd278df0c2 100644 --- a/bsp/stm32f107/drivers/msd.c +++ b/components/drivers/spi/spi_msd.c @@ -18,7 +18,7 @@ */ #include -#include "msd.h" +#include "spi_msd.h" //#define MSD_TRACE @@ -30,7 +30,7 @@ #define DUMMY 0xFF -#define CARD_NCR_MAX 8 +#define CARD_NCR_MAX 9 #define CARD_NRC 1 #define CARD_NCR 1 diff --git a/bsp/stm32f107/drivers/msd.h b/components/drivers/spi/spi_msd.h similarity index 98% rename from bsp/stm32f107/drivers/msd.h rename to components/drivers/spi/spi_msd.h index e004944332..98722711d3 100644 --- a/bsp/stm32f107/drivers/msd.h +++ b/components/drivers/spi/spi_msd.h @@ -13,8 +13,8 @@ * 2009-04-17 Bernard first version. */ -#ifndef MSD_H_INCLUDED -#define MSD_H_INCLUDED +#ifndef SPI_MSD_H_INCLUDED +#define SPI_MSD_H_INCLUDED #include #include @@ -129,4 +129,4 @@ struct msd_device extern rt_err_t msd_init(const char * sd_device_name, const char * spi_device_name); -#endif // MSD_H_INCLUDED +#endif // SPI_MSD_H_INCLUDED