[drivers] move tf/sd card driver to spi/spi/spi_msd.c, and update Kconfig script.

This commit is contained in:
aozima 2018-02-06 20:26:49 +08:00
parent 19433e0cf5
commit cd74a4be47
6 changed files with 18 additions and 11 deletions

View File

@ -18,7 +18,6 @@ if GetDepend('RT_USING_LWIP'):
if GetDepend('RT_USING_SPI'):
src += ['rt_stm32f10x_spi.c']
src += ['msd.c']
CPPPATH = [cwd]

View File

@ -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

View File

@ -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

View File

@ -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']

View File

@ -18,7 +18,7 @@
*/
#include <string.h>
#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

View File

@ -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 <stdint.h>
#include <drivers/spi.h>
@ -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