[bsp][stm32][stm32f103-dofly-M3S]Add spi sdcard port code
Signed-off-by: Willian Chan <chentingwei@rt-thread.com>
This commit is contained in:
parent
200f3d4480
commit
aba81f65f4
|
@ -7,7 +7,7 @@ config SOC_STM32F103ZE
|
|||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
config BSP_USING_SDCARD
|
||||
config BSP_USING_SDIO_SDCARD
|
||||
bool "Enable SDCARD (sdio)"
|
||||
select BSP_USING_SDIO
|
||||
select RT_USING_DFS
|
||||
|
@ -15,6 +15,15 @@ menu "Onboard Peripheral Drivers"
|
|||
select RT_USING_PIN
|
||||
default n
|
||||
|
||||
config BSP_USING_SPI_SDCARD
|
||||
bool "Enable SDCARD (spi2)"
|
||||
select BSP_USING_SPI
|
||||
select BSP_USING_SPI2
|
||||
select RT_USING_SPI_MSD
|
||||
select RT_USING_DFS
|
||||
select RT_USING_DFS_ELMFAT
|
||||
default n
|
||||
|
||||
config BSP_USING_SPI_FLASH
|
||||
bool "Enable SPI FLASH (W25Q64 spi2)"
|
||||
select BSP_USING_SPI
|
||||
|
|
|
@ -12,7 +12,10 @@ board.c
|
|||
CubeMX_Config/Src/stm32f1xx_hal_msp.c
|
||||
''')
|
||||
|
||||
if GetDepend(['BSP_USING_SDCARD']):
|
||||
if GetDepend(['BSP_USING_SDIO_SDCARD']):
|
||||
src += Glob('ports/drv_sdcard.c')
|
||||
|
||||
if GetDepend(['BSP_USING_SPI_SDCARD']):
|
||||
src += Glob('ports/drv_sdcard.c')
|
||||
|
||||
if GetDepend(['BSP_USING_SPI_FLASH']):
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-12-13 balanceTWK add sdcard port file
|
||||
* 2019-08-23 WillianChan add spi sdcard port code
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef BSP_USING_SDCARD
|
||||
|
||||
#if defined BSP_USING_SDIO_SDCARD || defined BSP_USING_SPI_SDCARD
|
||||
#include <dfs_elm.h>
|
||||
#include <dfs_fs.h>
|
||||
#include <dfs_posix.h>
|
||||
|
@ -58,5 +58,16 @@ int stm32_sdcard_mount(void)
|
|||
return RT_EOK;
|
||||
}
|
||||
INIT_APP_EXPORT(stm32_sdcard_mount);
|
||||
#endif /* BSP_USING_SDIO_SDCARD || BSP_USING_SPI_SDCARD */
|
||||
|
||||
#endif /* BSP_USING_SDCARD */
|
||||
#ifdef BSP_USING_SPI_SDCARD
|
||||
#include "drv_spi.h"
|
||||
#include "spi_msd.h"
|
||||
static int rt_hw_spi2_tfcard(void)
|
||||
{
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
rt_hw_spi_device_attach("spi2", "spi20", GPIOD, GPIO_PIN_2);
|
||||
return msd_init("sd0", "spi20");
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_hw_spi2_tfcard);
|
||||
#endif /* BSP_USING_SPI_SDCARD */
|
||||
|
|
Loading…
Reference in New Issue