[bsp/bouffalo_lab]update sdio host driver (#7642)
Co-authored-by: chenyisong <chenyisong@tuya.com>
This commit is contained in:
parent
10551b54cc
commit
0b6f7743f1
|
@ -121,7 +121,43 @@ CONFIG_FINSH_ARG_MAX=10
|
|||
#
|
||||
# DFS: device virtual file system
|
||||
#
|
||||
# CONFIG_RT_USING_DFS is not set
|
||||
CONFIG_RT_USING_DFS=y
|
||||
CONFIG_DFS_USING_POSIX=y
|
||||
CONFIG_DFS_USING_WORKDIR=y
|
||||
# CONFIG_RT_USING_DFS_MNTTABLE is not set
|
||||
CONFIG_DFS_FD_MAX=16
|
||||
CONFIG_RT_USING_DFS_V1=y
|
||||
# CONFIG_RT_USING_DFS_V2 is not set
|
||||
CONFIG_DFS_FILESYSTEMS_MAX=4
|
||||
CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
|
||||
CONFIG_RT_USING_DFS_ELMFAT=y
|
||||
|
||||
#
|
||||
# elm-chan's FatFs, Generic FAT Filesystem Module
|
||||
#
|
||||
CONFIG_RT_DFS_ELM_CODE_PAGE=437
|
||||
CONFIG_RT_DFS_ELM_WORD_ACCESS=y
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
|
||||
CONFIG_RT_DFS_ELM_USE_LFN_3=y
|
||||
CONFIG_RT_DFS_ELM_USE_LFN=3
|
||||
CONFIG_RT_DFS_ELM_LFN_UNICODE_0=y
|
||||
# CONFIG_RT_DFS_ELM_LFN_UNICODE_1 is not set
|
||||
# CONFIG_RT_DFS_ELM_LFN_UNICODE_2 is not set
|
||||
# CONFIG_RT_DFS_ELM_LFN_UNICODE_3 is not set
|
||||
CONFIG_RT_DFS_ELM_LFN_UNICODE=0
|
||||
CONFIG_RT_DFS_ELM_MAX_LFN=255
|
||||
CONFIG_RT_DFS_ELM_DRIVES=2
|
||||
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
|
||||
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
|
||||
CONFIG_RT_DFS_ELM_REENTRANT=y
|
||||
CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000
|
||||
CONFIG_RT_USING_DFS_DEVFS=y
|
||||
CONFIG_RT_USING_DFS_ROMFS=y
|
||||
# CONFIG_RT_USING_DFS_CROMFS is not set
|
||||
# CONFIG_RT_USING_DFS_RAMFS is not set
|
||||
# CONFIG_RT_USING_DFS_TMPFS is not set
|
||||
# CONFIG_RT_USING_FAL is not set
|
||||
|
||||
#
|
||||
|
@ -152,7 +188,13 @@ CONFIG_RT_USING_PIN=y
|
|||
# CONFIG_RT_USING_PM is not set
|
||||
# CONFIG_RT_USING_FDT is not set
|
||||
# CONFIG_RT_USING_RTC is not set
|
||||
# CONFIG_RT_USING_SDIO is not set
|
||||
CONFIG_RT_USING_SDIO=y
|
||||
CONFIG_RT_SDIO_STACK_SIZE=512
|
||||
CONFIG_RT_SDIO_THREAD_PRIORITY=15
|
||||
CONFIG_RT_MMCSD_STACK_SIZE=2048
|
||||
CONFIG_RT_MMCSD_THREAD_PREORITY=22
|
||||
CONFIG_RT_MMCSD_MAX_PARTITION=16
|
||||
# CONFIG_RT_SDIO_DEBUG is not set
|
||||
# CONFIG_RT_USING_SPI is not set
|
||||
# CONFIG_RT_USING_WDT is not set
|
||||
# CONFIG_RT_USING_AUDIO is not set
|
||||
|
@ -513,6 +555,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# CONFIG_PKG_USING_QPC is not set
|
||||
# CONFIG_PKG_USING_AGILE_UPGRADE is not set
|
||||
# CONFIG_PKG_USING_FLASH_BLOB is not set
|
||||
# CONFIG_PKG_USING_MLIBC is not set
|
||||
|
||||
#
|
||||
# peripheral libraries and drivers
|
||||
|
@ -597,6 +640,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# CONFIG_PKG_USING_FT5426 is not set
|
||||
# CONFIG_PKG_USING_FT6236 is not set
|
||||
# CONFIG_PKG_USING_XPT2046_TOUCH is not set
|
||||
# CONFIG_PKG_USING_CST816X is not set
|
||||
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
|
||||
# CONFIG_PKG_USING_STM32_SDIO is not set
|
||||
# CONFIG_PKG_USING_ESP_IDF is not set
|
||||
|
@ -673,7 +717,9 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# CONFIG_PKG_USING_IO_INPUT_FILTER is not set
|
||||
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
|
||||
# CONFIG_PKG_USING_LRF_NV7LIDAR is not set
|
||||
# CONFIG_PKG_USING_AIP650 is not set
|
||||
# CONFIG_PKG_USING_FINGERPRINT is not set
|
||||
# CONFIG_PKG_USING_SPI_TOOLS is not set
|
||||
|
||||
#
|
||||
# AI packages
|
||||
|
@ -692,7 +738,10 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# Signal Processing and Control Algorithm Packages
|
||||
#
|
||||
# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
|
||||
# CONFIG_PKG_USING_QPID is not set
|
||||
# CONFIG_PKG_USING_UKAL is not set
|
||||
# CONFIG_PKG_USING_DIGITALCTRL is not set
|
||||
# CONFIG_PKG_USING_KISSFFT is not set
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
|
@ -739,7 +788,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# CONFIG_PKG_USING_DSTR is not set
|
||||
# CONFIG_PKG_USING_TINYFRAME is not set
|
||||
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
|
||||
# CONFIG_PKG_USING_DIGITALCTRL is not set
|
||||
# CONFIG_PKG_USING_UPACKER is not set
|
||||
# CONFIG_PKG_USING_UPARAM is not set
|
||||
# CONFIG_PKG_USING_HELLO is not set
|
||||
|
@ -766,6 +814,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
#
|
||||
# Projects
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_MSGQ_C_CPP_DEMO is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ULTRASOUND_RADAR is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_SENSOR_KIT is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_MATLAB_SUPPORT is not set
|
||||
|
@ -912,14 +961,20 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
#
|
||||
# Display
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_TFT_ESPI is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_GFX_LIBRARY is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_U8G2 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_U8GLIB_ARDUINO is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ST7735 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SSD1306 is not set
|
||||
# CONFIG_PKG_USING_SEEED_TM1637 is not set
|
||||
|
||||
#
|
||||
# Timing
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_MSTIMER2 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_TICKER is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_TASKSCHEDULER is not set
|
||||
|
||||
#
|
||||
# Data Processing
|
||||
|
@ -973,10 +1028,13 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
CONFIG_BSP_USING_BL61X=y
|
||||
CONFIG_BSP_USING_ROMAPI=y
|
||||
# CONFIG_BSP_USING_PSRAM is not set
|
||||
CONFIG_BSP_USING_BL61X_MODULE_DEFAULT=y
|
||||
# CONFIG_BSP_USING_BL61X_MODULE_M0P is not set
|
||||
|
||||
#
|
||||
# General Drivers Configuration
|
||||
#
|
||||
# CONFIG_BSP_DRIVER_DEBUG is not set
|
||||
|
||||
#
|
||||
# General Purpose UARTs
|
||||
|
@ -1059,11 +1117,7 @@ CONFIG_UART0_RX_USING_GPIO22=y
|
|||
# CONFIG_BSP_USING_WDT is not set
|
||||
# CONFIG_BSP_USING_PWM is not set
|
||||
# CONFIG_BSP_USING_HWTIMER is not set
|
||||
|
||||
#
|
||||
# General Purpose I2C
|
||||
#
|
||||
# CONFIG_BSP_USING_I2C1 is not set
|
||||
# CONFIG_BSP_USING_I2C is not set
|
||||
# CONFIG_BSP_USING_SPI is not set
|
||||
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
|
||||
# CONFIG_BSP_USING_FS is not set
|
||||
# CONFIG_BSP_USING_SDH is not set
|
||||
|
|
|
@ -56,10 +56,6 @@ static void peripheral_clock_init(void)
|
|||
GLB_Set_CAM_CLK(ENABLE, GLB_CAM_CLK_WIFIPLL_96M, 3);
|
||||
|
||||
GLB_Set_PKA_CLK_Sel(GLB_PKA_CLK_MCU_MUXPLL_160M);
|
||||
#ifdef CONFIG_BSP_SDH_SDCARD
|
||||
PERIPHERAL_CLOCK_SDH_ENABLE();
|
||||
GLB_AHB_MCU_Software_Reset(GLB_AHB_MCU_SW_EXT_SDH);
|
||||
#endif
|
||||
|
||||
GLB_Set_USB_CLK_From_WIFIPLL(1);
|
||||
GLB_Swap_MCU_SPI_0_MOSI_With_MISO(0);
|
||||
|
|
|
@ -75,6 +75,30 @@
|
|||
|
||||
/* DFS: device virtual file system */
|
||||
|
||||
#define RT_USING_DFS
|
||||
#define DFS_USING_POSIX
|
||||
#define DFS_USING_WORKDIR
|
||||
#define DFS_FD_MAX 16
|
||||
#define RT_USING_DFS_V1
|
||||
#define DFS_FILESYSTEMS_MAX 4
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 4
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
|
||||
/* elm-chan's FatFs, Generic FAT Filesystem Module */
|
||||
|
||||
#define RT_DFS_ELM_CODE_PAGE 437
|
||||
#define RT_DFS_ELM_WORD_ACCESS
|
||||
#define RT_DFS_ELM_USE_LFN_3
|
||||
#define RT_DFS_ELM_USE_LFN 3
|
||||
#define RT_DFS_ELM_LFN_UNICODE_0
|
||||
#define RT_DFS_ELM_LFN_UNICODE 0
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
|
||||
#define RT_USING_DFS_DEVFS
|
||||
#define RT_USING_DFS_ROMFS
|
||||
|
||||
/* Device Drivers */
|
||||
|
||||
|
@ -85,6 +109,12 @@
|
|||
#define RT_SERIAL_USING_DMA
|
||||
#define RT_SERIAL_RB_BUFSZ 64
|
||||
#define RT_USING_PIN
|
||||
#define RT_USING_SDIO
|
||||
#define RT_SDIO_STACK_SIZE 512
|
||||
#define RT_SDIO_THREAD_PRIORITY 15
|
||||
#define RT_MMCSD_STACK_SIZE 2048
|
||||
#define RT_MMCSD_THREAD_PREORITY 22
|
||||
#define RT_MMCSD_MAX_PARTITION 16
|
||||
|
||||
/* Using USB */
|
||||
|
||||
|
@ -226,16 +256,15 @@
|
|||
|
||||
#define BSP_USING_BL61X
|
||||
#define BSP_USING_ROMAPI
|
||||
#define BSP_USING_BL61X_MODULE_DEFAULT
|
||||
|
||||
/* General Drivers Configuration */
|
||||
|
||||
|
||||
/* General Purpose UARTs */
|
||||
|
||||
#define BSP_USING_UART0
|
||||
#define UART0_TX_USING_GPIO21
|
||||
#define UART0_RX_USING_GPIO22
|
||||
|
||||
/* General Purpose I2C */
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
[cfg]
|
||||
# 0: no erase, 1:programmed section erase, 2: chip erase
|
||||
erase = 1
|
||||
# skip mode set first para is skip addr, second para is skip len, multi-segment region with ; separated
|
||||
skip_mode = 0x0, 0x0
|
||||
# 0: not use isp mode, #1: isp mode
|
||||
boot2_isp_mode = 0
|
||||
|
||||
[FW]
|
||||
filedir = ./rtthread_lp.bin
|
||||
address = 0xC0000
|
||||
|
|
@ -121,7 +121,43 @@ CONFIG_FINSH_ARG_MAX=10
|
|||
#
|
||||
# DFS: device virtual file system
|
||||
#
|
||||
# CONFIG_RT_USING_DFS is not set
|
||||
CONFIG_RT_USING_DFS=y
|
||||
CONFIG_DFS_USING_POSIX=y
|
||||
CONFIG_DFS_USING_WORKDIR=y
|
||||
# CONFIG_RT_USING_DFS_MNTTABLE is not set
|
||||
CONFIG_DFS_FD_MAX=16
|
||||
CONFIG_RT_USING_DFS_V1=y
|
||||
# CONFIG_RT_USING_DFS_V2 is not set
|
||||
CONFIG_DFS_FILESYSTEMS_MAX=4
|
||||
CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
|
||||
CONFIG_RT_USING_DFS_ELMFAT=y
|
||||
|
||||
#
|
||||
# elm-chan's FatFs, Generic FAT Filesystem Module
|
||||
#
|
||||
CONFIG_RT_DFS_ELM_CODE_PAGE=437
|
||||
CONFIG_RT_DFS_ELM_WORD_ACCESS=y
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
|
||||
CONFIG_RT_DFS_ELM_USE_LFN_3=y
|
||||
CONFIG_RT_DFS_ELM_USE_LFN=3
|
||||
CONFIG_RT_DFS_ELM_LFN_UNICODE_0=y
|
||||
# CONFIG_RT_DFS_ELM_LFN_UNICODE_1 is not set
|
||||
# CONFIG_RT_DFS_ELM_LFN_UNICODE_2 is not set
|
||||
# CONFIG_RT_DFS_ELM_LFN_UNICODE_3 is not set
|
||||
CONFIG_RT_DFS_ELM_LFN_UNICODE=0
|
||||
CONFIG_RT_DFS_ELM_MAX_LFN=255
|
||||
CONFIG_RT_DFS_ELM_DRIVES=2
|
||||
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
|
||||
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
|
||||
CONFIG_RT_DFS_ELM_REENTRANT=y
|
||||
CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000
|
||||
CONFIG_RT_USING_DFS_DEVFS=y
|
||||
CONFIG_RT_USING_DFS_ROMFS=y
|
||||
# CONFIG_RT_USING_DFS_CROMFS is not set
|
||||
# CONFIG_RT_USING_DFS_RAMFS is not set
|
||||
# CONFIG_RT_USING_DFS_TMPFS is not set
|
||||
# CONFIG_RT_USING_FAL is not set
|
||||
|
||||
#
|
||||
|
@ -154,7 +190,13 @@ CONFIG_RT_USING_PWM=y
|
|||
CONFIG_RT_USING_RTC=y
|
||||
# CONFIG_RT_USING_ALARM is not set
|
||||
# CONFIG_RT_USING_SOFT_RTC is not set
|
||||
# CONFIG_RT_USING_SDIO is not set
|
||||
CONFIG_RT_USING_SDIO=y
|
||||
CONFIG_RT_SDIO_STACK_SIZE=512
|
||||
CONFIG_RT_SDIO_THREAD_PRIORITY=15
|
||||
CONFIG_RT_MMCSD_STACK_SIZE=2048
|
||||
CONFIG_RT_MMCSD_THREAD_PREORITY=22
|
||||
CONFIG_RT_MMCSD_MAX_PARTITION=16
|
||||
# CONFIG_RT_SDIO_DEBUG is not set
|
||||
# CONFIG_RT_USING_SPI is not set
|
||||
CONFIG_RT_USING_WDT=y
|
||||
# CONFIG_RT_USING_AUDIO is not set
|
||||
|
@ -515,6 +557,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# CONFIG_PKG_USING_QPC is not set
|
||||
# CONFIG_PKG_USING_AGILE_UPGRADE is not set
|
||||
# CONFIG_PKG_USING_FLASH_BLOB is not set
|
||||
# CONFIG_PKG_USING_MLIBC is not set
|
||||
|
||||
#
|
||||
# peripheral libraries and drivers
|
||||
|
@ -599,6 +642,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# CONFIG_PKG_USING_FT5426 is not set
|
||||
# CONFIG_PKG_USING_FT6236 is not set
|
||||
# CONFIG_PKG_USING_XPT2046_TOUCH is not set
|
||||
# CONFIG_PKG_USING_CST816X is not set
|
||||
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
|
||||
# CONFIG_PKG_USING_STM32_SDIO is not set
|
||||
# CONFIG_PKG_USING_ESP_IDF is not set
|
||||
|
@ -675,7 +719,9 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# CONFIG_PKG_USING_IO_INPUT_FILTER is not set
|
||||
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
|
||||
# CONFIG_PKG_USING_LRF_NV7LIDAR is not set
|
||||
# CONFIG_PKG_USING_AIP650 is not set
|
||||
# CONFIG_PKG_USING_FINGERPRINT is not set
|
||||
# CONFIG_PKG_USING_SPI_TOOLS is not set
|
||||
|
||||
#
|
||||
# AI packages
|
||||
|
@ -694,7 +740,10 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# Signal Processing and Control Algorithm Packages
|
||||
#
|
||||
# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
|
||||
# CONFIG_PKG_USING_QPID is not set
|
||||
# CONFIG_PKG_USING_UKAL is not set
|
||||
# CONFIG_PKG_USING_DIGITALCTRL is not set
|
||||
# CONFIG_PKG_USING_KISSFFT is not set
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
|
@ -741,7 +790,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
# CONFIG_PKG_USING_DSTR is not set
|
||||
# CONFIG_PKG_USING_TINYFRAME is not set
|
||||
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
|
||||
# CONFIG_PKG_USING_DIGITALCTRL is not set
|
||||
# CONFIG_PKG_USING_UPACKER is not set
|
||||
# CONFIG_PKG_USING_UPARAM is not set
|
||||
# CONFIG_PKG_USING_HELLO is not set
|
||||
|
@ -768,6 +816,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
#
|
||||
# Projects
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_MSGQ_C_CPP_DEMO is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ULTRASOUND_RADAR is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_SENSOR_KIT is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_MATLAB_SUPPORT is not set
|
||||
|
@ -914,14 +963,20 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
|||
#
|
||||
# Display
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_TFT_ESPI is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_GFX_LIBRARY is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_U8G2 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_U8GLIB_ARDUINO is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ST7735 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SSD1306 is not set
|
||||
# CONFIG_PKG_USING_SEEED_TM1637 is not set
|
||||
|
||||
#
|
||||
# Timing
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_MSTIMER2 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_TICKER is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_TASKSCHEDULER is not set
|
||||
|
||||
#
|
||||
# Data Processing
|
||||
|
@ -980,6 +1035,7 @@ CONFIG_BSP_USING_PSRAM=y
|
|||
#
|
||||
# General Drivers Configuration
|
||||
#
|
||||
# CONFIG_BSP_DRIVER_DEBUG is not set
|
||||
|
||||
#
|
||||
# General Purpose UARTs
|
||||
|
@ -1077,11 +1133,7 @@ CONFIG_UART0_RX_USING_GPIO15=y
|
|||
# CONFIG_BSP_USING_WDT is not set
|
||||
# CONFIG_BSP_USING_PWM is not set
|
||||
# CONFIG_BSP_USING_HWTIMER is not set
|
||||
|
||||
#
|
||||
# General Purpose I2C
|
||||
#
|
||||
# CONFIG_BSP_USING_I2C1 is not set
|
||||
# CONFIG_BSP_USING_I2C is not set
|
||||
# CONFIG_BSP_USING_SPI is not set
|
||||
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
|
||||
# CONFIG_BSP_USING_FS is not set
|
||||
# CONFIG_BSP_USING_SDH is not set
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-08 wcx1024979076 first version
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#define DBG_TAG "mnt"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_fs.h>
|
||||
|
||||
#ifdef RT_USING_FAL
|
||||
#include "fal.h"
|
||||
|
||||
#ifdef BSP_USING_ON_CHIP_FLASH
|
||||
int mnt_init(void)
|
||||
{
|
||||
struct rt_device *rootfs = RT_NULL;
|
||||
|
||||
/* 使用 filesystem 分区创建块设备,块设备名称为 filesystem */
|
||||
rootfs = fal_blk_device_create("filesystem");
|
||||
if(rootfs == RT_NULL)
|
||||
{
|
||||
LOG_E("Failed to create device.\n");
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
/* 将 elm fat 文件系统挂载 filesystem 分区 */
|
||||
if (dfs_mount("filesystem", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
LOG_D("file system initialization done!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_I("file system initialization failed!\n");
|
||||
if(dfs_mkfs("elm", "filesystem") == 0)
|
||||
{
|
||||
if (dfs_mount("filesystem", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
LOG_D("file system initialization done!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_D("file system initialization failed!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_ENV_EXPORT(mnt_init);
|
||||
|
||||
#endif /* BSP_USING_ON_CHIP_FLASH */
|
||||
|
||||
#endif /* RT_USING_FAL */
|
||||
|
||||
#endif /* RT_USING_DFS */
|
|
@ -15,10 +15,6 @@
|
|||
#include "board.h"
|
||||
#include "drv_uart.h"
|
||||
|
||||
#ifdef BSP_USING_SDH_SDCARD
|
||||
#include "sdh_sdcard.h"
|
||||
#endif
|
||||
|
||||
static void system_clock_init(void)
|
||||
{
|
||||
/* wifipll/audiopll */
|
||||
|
@ -64,17 +60,6 @@ static void peripheral_clock_init(void)
|
|||
|
||||
GLB_Set_PKA_CLK_Sel(GLB_PKA_CLK_MCU_MUXPLL_160M);
|
||||
|
||||
#ifdef BSP_USING_SDH_SDCARD
|
||||
PERIPHERAL_CLOCK_SDH_ENABLE();
|
||||
uint32_t tmp_val;
|
||||
tmp_val = BL_RD_REG(PDS_BASE, PDS_CTL5);
|
||||
uint32_t tmp_val2 = BL_GET_REG_BITS_VAL(tmp_val, PDS_CR_PDS_GPIO_KEEP_EN);
|
||||
tmp_val2 &= ~(1 << 0);
|
||||
tmp_val = BL_SET_REG_BITS_VAL(tmp_val, PDS_CR_PDS_GPIO_KEEP_EN, tmp_val2);
|
||||
BL_WR_REG(PDS_BASE, PDS_CTL5, tmp_val);
|
||||
GLB_AHB_MCU_Software_Reset(GLB_AHB_MCU_SW_SDH);
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_CSI
|
||||
GLB_CSI_Config_MIPIPLL(2, 0x21000);
|
||||
GLB_CSI_Power_Up_MIPIPLL();
|
||||
|
|
|
@ -75,6 +75,30 @@
|
|||
|
||||
/* DFS: device virtual file system */
|
||||
|
||||
#define RT_USING_DFS
|
||||
#define DFS_USING_POSIX
|
||||
#define DFS_USING_WORKDIR
|
||||
#define DFS_FD_MAX 16
|
||||
#define RT_USING_DFS_V1
|
||||
#define DFS_FILESYSTEMS_MAX 4
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 4
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
|
||||
/* elm-chan's FatFs, Generic FAT Filesystem Module */
|
||||
|
||||
#define RT_DFS_ELM_CODE_PAGE 437
|
||||
#define RT_DFS_ELM_WORD_ACCESS
|
||||
#define RT_DFS_ELM_USE_LFN_3
|
||||
#define RT_DFS_ELM_USE_LFN 3
|
||||
#define RT_DFS_ELM_LFN_UNICODE_0
|
||||
#define RT_DFS_ELM_LFN_UNICODE 0
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
|
||||
#define RT_USING_DFS_DEVFS
|
||||
#define RT_USING_DFS_ROMFS
|
||||
|
||||
/* Device Drivers */
|
||||
|
||||
|
@ -87,6 +111,12 @@
|
|||
#define RT_USING_PIN
|
||||
#define RT_USING_PWM
|
||||
#define RT_USING_RTC
|
||||
#define RT_USING_SDIO
|
||||
#define RT_SDIO_STACK_SIZE 512
|
||||
#define RT_SDIO_THREAD_PRIORITY 15
|
||||
#define RT_MMCSD_STACK_SIZE 2048
|
||||
#define RT_MMCSD_THREAD_PREORITY 22
|
||||
#define RT_MMCSD_MAX_PARTITION 16
|
||||
#define RT_USING_WDT
|
||||
|
||||
/* Using USB */
|
||||
|
@ -234,13 +264,11 @@
|
|||
|
||||
/* General Drivers Configuration */
|
||||
|
||||
|
||||
/* General Purpose UARTs */
|
||||
|
||||
#define BSP_USING_UART0
|
||||
#define UART0_TX_USING_GPIO14
|
||||
#define UART0_RX_USING_GPIO15
|
||||
|
||||
/* General Purpose I2C */
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1400,27 +1400,26 @@ menu "General Drivers Configuration"
|
|||
range 0 4095
|
||||
endif
|
||||
endif
|
||||
|
||||
config BSP_USING_ON_CHIP_FLASH
|
||||
|
||||
menuconfig BSP_USING_ON_CHIP_FLASH
|
||||
bool "Enable On-Chip FLASH"
|
||||
default n
|
||||
config BSP_USING_SDH
|
||||
select RT_USING_SDIO
|
||||
select RT_USING_DFS
|
||||
bool "Enable Secure Digital Host Controller(SDH)"
|
||||
default n
|
||||
menuconfig BSP_USING_FS
|
||||
bool "Enable File System"
|
||||
select RT_USING_DFS
|
||||
select RT_USING_DFS_ELMFAT
|
||||
select RT_USING_FAL
|
||||
select FAL_DEBUG_CONFIG
|
||||
select FAL_PART_HAS_TABLE_CFG
|
||||
default n
|
||||
if BSP_USING_FS
|
||||
config BSP_USING_ON_CHIP_FLASH_FATFS
|
||||
bool "Enable On-Chip Flash File System"
|
||||
select BSP_USING_ON_CHIP_FLASH
|
||||
if BSP_USING_ON_CHIP_FLASH
|
||||
config BSP_USING_ON_CHIP_FLASH_FS
|
||||
bool "Enable On-Chip FLASH File System"
|
||||
select PKG_USING_LITTLEFS
|
||||
default n
|
||||
endif
|
||||
|
||||
config BSP_USING_SDH
|
||||
depends on BSP_USING_BL61X || BSP_USING_BL808
|
||||
select RT_USING_SDIO
|
||||
select RT_USING_DFS
|
||||
select RT_USING_DFS_ELMFAT
|
||||
select RT_USING_DFS_ROMFS
|
||||
bool "Enable Secure Digital Host Controller(SDH)"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -40,9 +40,12 @@ if GetDepend('BSP_USING_SPI'):
|
|||
if GetDepend('BSP_USING_ON_CHIP_FLASH'):
|
||||
src += ['drv_flash.c']
|
||||
|
||||
if GetDepend('RT_USING_DFS'):
|
||||
if GetDepend('BSP_USING_SDH'):
|
||||
src += ['drv_sdh.c']
|
||||
|
||||
if GetDepend('RT_USING_DFS'):
|
||||
src += ['port/mnt.c']
|
||||
|
||||
group = DefineGroup('rt_drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
objs = [group]
|
||||
|
|
|
@ -45,10 +45,10 @@
|
|||
#include "bflb_mtimer.h"
|
||||
#include "bflb_l1c.h"
|
||||
|
||||
#define SDIO_BUFF_SIZE 4096
|
||||
static uint8_t sdh_buffer[SDIO_BUFF_SIZE];
|
||||
#define SDIO_BUFF_SIZE 512
|
||||
static uint8_t sdh_buffer[SDIO_BUFF_SIZE] __attribute__ ((aligned (8)));
|
||||
|
||||
#define SDIO_CMDTIMEOUT_MS (2000)
|
||||
#define SDIO_CMDTIMEOUT_MS (1000)
|
||||
|
||||
static uint32_t sdhClockInit = 100ul;
|
||||
static uint32_t sdhClockSrc = 100ul;
|
||||
|
@ -290,7 +290,7 @@ static rt_err_t SDH_CardTransferNonBlocking(SDH_DMA_Cfg_Type *dmaCfg, SDH_Trans_
|
|||
}
|
||||
else if ((uint32_t)bflb_mtimer_get_time_ms() - time_node > SDIO_CMDTIMEOUT_MS)
|
||||
{
|
||||
LOG_E("SDH read data timeout: %ld ms", (uint32_t)bflb_mtimer_get_time_ms() - time_node);
|
||||
LOG_E("SDH Transfer data timeout: %ld ms", (uint32_t)bflb_mtimer_get_time_ms() - time_node);
|
||||
return -RT_ETIMEOUT;
|
||||
}
|
||||
BL_DRV_DUMMY;
|
||||
|
@ -303,6 +303,7 @@ static rt_err_t SDH_CardTransferNonBlocking(SDH_DMA_Cfg_Type *dmaCfg, SDH_Trans_
|
|||
LOG_E("sd_status :%d", sd_status);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
LOG_D("Transfer data used time: %ld ms", (uint32_t)bflb_mtimer_get_time_ms() - time_node);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -311,17 +312,9 @@ static rt_err_t rt_hw_sdh_data_transfer(struct rt_mmcsd_host *host, struct rt_mm
|
|||
{
|
||||
rt_err_t ret = RT_EOK;
|
||||
SDH_Data_Cfg_Type SDH_Data_Cfg_TypeInstance;
|
||||
SDH_CMD_Cfg_Type SDH_CMD_Cfg_TypeInstance = {0};
|
||||
SDH_CMD_Cfg_Type SDH_CMD_Cfg_TypeInstance;
|
||||
SDH_Trans_Cfg_Type SDH_Trans_Cfg_TypeInstance = { &SDH_Data_Cfg_TypeInstance, &SDH_CMD_Cfg_TypeInstance };
|
||||
|
||||
#if defined(BL808) || defined(BL606P)
|
||||
/* BL808/BL606 supports only 8-byte aligned addresses */
|
||||
if ((uintptr_t)data->buf % 8 != 0)
|
||||
{
|
||||
return -RT_EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDH_CMD_Cfg_TypeInstance.index = cmd->cmd_code;
|
||||
SDH_CMD_Cfg_TypeInstance.argument = cmd->arg;
|
||||
SDH_CMD_Cfg_TypeInstance.type = SDH_CMD_NORMAL;
|
||||
|
@ -357,20 +350,13 @@ static rt_err_t rt_hw_sdh_data_transfer(struct rt_mmcsd_host *host, struct rt_mm
|
|||
/*set parameters for SDH_DMA_Cfg_TypeInstance*/
|
||||
SDH_DMA_Cfg_TypeInstance.dmaMode = SDH_DMA_MODE_ADMA2;
|
||||
SDH_DMA_Cfg_TypeInstance.burstSize = SDH_BURST_SIZE_128_BYTES;
|
||||
|
||||
if (cmd->cmd_code == READ_SINGLE_BLOCK || cmd->cmd_code == READ_MULTIPLE_BLOCK)
|
||||
{
|
||||
SDH_DMA_Cfg_TypeInstance.fifoThreshold = SDH_BURST_SIZE_128_BYTES;
|
||||
}
|
||||
else
|
||||
SDH_DMA_Cfg_TypeInstance.fifoThreshold = SDH_FIFO_THRESHOLD_256_BYTES;
|
||||
|
||||
SDH_DMA_Cfg_TypeInstance.fifoThreshold = SDH_FIFO_THRESHOLD_256_BYTES;
|
||||
SDH_DMA_Cfg_TypeInstance.admaEntries = (rt_uint32_t *)adma2Entries;
|
||||
SDH_DMA_Cfg_TypeInstance.maxEntries = sizeof(adma2Entries) / sizeof(adma2Entries[0]);
|
||||
|
||||
if (data->flags & DATA_DIR_WRITE)
|
||||
{
|
||||
bflb_l1c_dcache_clean_range((void *)(data->buf), data->blksize * data->blks);
|
||||
bflb_l1c_dcache_clean_range((void *)(sdh_buffer), data->blksize * data->blks);
|
||||
}
|
||||
|
||||
ret = SDH_CardTransferNonBlocking(&SDH_DMA_Cfg_TypeInstance, &SDH_Trans_Cfg_TypeInstance);
|
||||
|
@ -400,7 +386,7 @@ static rt_err_t rt_hw_sdh_cmd_transfer(struct rt_mmcsd_host *host, struct rt_mmc
|
|||
rt_err_t ret = RT_EOK;
|
||||
SDH_Stat_Type stat = SDH_STAT_SUCCESS;
|
||||
SDH_Data_Cfg_Type SDH_Data_Cfg_TypeInstance;
|
||||
SDH_CMD_Cfg_Type SDH_CMD_Cfg_TypeInstance = {0};
|
||||
SDH_CMD_Cfg_Type SDH_CMD_Cfg_TypeInstance;
|
||||
|
||||
if (data != RT_NULL)
|
||||
{
|
||||
|
@ -425,7 +411,9 @@ static rt_err_t rt_hw_sdh_cmd_transfer(struct rt_mmcsd_host *host, struct rt_mmc
|
|||
SDH_CMD_Cfg_TypeInstance.flag = SDH_TRANS_FLAG_DATA_PRESENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDH_CMD_Cfg_TypeInstance.flag = SDH_TRANS_FLAG_NONE;
|
||||
}
|
||||
|
||||
SDH_CMD_Cfg_TypeInstance.index = cmd->cmd_code;
|
||||
SDH_CMD_Cfg_TypeInstance.argument = cmd->arg;
|
||||
|
@ -548,6 +536,36 @@ static void rt_hw_sdh_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *r
|
|||
else
|
||||
{
|
||||
cmd->err = rt_hw_sdh_cmd_transfer(host, cmd, data);
|
||||
if (cmd->cmd_code == SD_SEND_IF_COND && cmd->err != RT_EOK)
|
||||
{
|
||||
LOG_D("retry cmd: %d", SD_SEND_IF_COND);
|
||||
struct rt_mmcsd_cmd user_cmd;
|
||||
rt_uint8_t retries = 0;
|
||||
rt_err_t ret = RT_EOK;
|
||||
|
||||
do
|
||||
{
|
||||
rt_memset(&user_cmd, 0, sizeof(struct rt_mmcsd_cmd));
|
||||
|
||||
user_cmd.cmd_code = GO_IDLE_STATE;
|
||||
user_cmd.arg = 0;
|
||||
user_cmd.flags = RESP_SPI_R1 | RESP_NONE | CMD_BC;
|
||||
|
||||
rt_hw_sdh_cmd_transfer(host, &user_cmd, RT_NULL);
|
||||
|
||||
rt_thread_mdelay(1);
|
||||
|
||||
cmd->err = rt_hw_sdh_cmd_transfer(host, cmd, data);
|
||||
if(cmd->err == RT_EOK)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
retries ++;
|
||||
LOG_D("cmd: %d retries: %d", SD_SEND_IF_COND, retries);
|
||||
}
|
||||
while (retries < 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022/12/25 flyingcys first version
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_fs.h>
|
||||
#include "dfs_romfs.h"
|
||||
|
||||
#define DBG_TAG "app.filesystem"
|
||||
#define DBG_LVL DBG_LOG
|
||||
#include <rtdbg.h>
|
||||
|
||||
static const struct romfs_dirent _romfs_root[] =
|
||||
{
|
||||
#ifdef BSP_USING_ON_CHIP_FLASH
|
||||
{ROMFS_DIRENT_DIR, "flash", RT_NULL, 0},
|
||||
#endif
|
||||
{ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0}
|
||||
};
|
||||
|
||||
const struct romfs_dirent romfs_root =
|
||||
{
|
||||
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root) / sizeof(_romfs_root[0])
|
||||
};
|
||||
|
||||
static void sd_mount(void *parameter)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
rt_thread_mdelay(500);
|
||||
|
||||
if (rt_device_find("sd0") != RT_NULL)
|
||||
{
|
||||
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
|
||||
{
|
||||
LOG_I("sd card mount to '/sdcard'");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_W("sd card mount to '/sdcard' failed! %d\n", rt_get_errno());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int mount_init(void)
|
||||
{
|
||||
if(dfs_mount(RT_NULL, "/", "rom", 0, &romfs_root) != 0)
|
||||
{
|
||||
LOG_E("rom mount to '/' failed!");
|
||||
}
|
||||
|
||||
#ifdef BSP_USING_ON_CHIP_FLASH_FS
|
||||
struct rt_device *flash_dev = RT_NULL;
|
||||
|
||||
/* 使用 filesystem 分区创建块设备,块设备名称为 filesystem */
|
||||
flash_dev = fal_blk_device_create("filesystem");
|
||||
if(flash_dev == RT_NULL)
|
||||
{
|
||||
LOG_E("Failed to create device.\n");
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
if (dfs_mount("filesystem", "/flash", "lfs", 0, 0) != 0)
|
||||
{
|
||||
LOG_I("file system initialization failed!\n");
|
||||
if(dfs_mkfs("lfs", "filesystem") == 0)
|
||||
{
|
||||
if (dfs_mount("filesystem", "/flash", "lfs", 0, 0) == 0)
|
||||
{
|
||||
LOG_I("mount to '/flash' success!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_I("mount to '/flash' success!");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_SDH
|
||||
rt_thread_t tid;
|
||||
|
||||
tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
|
||||
2048, RT_THREAD_PRIORITY_MAX - 2, 20);
|
||||
if (tid != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(tid);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E("create sd_mount thread err!");
|
||||
}
|
||||
#endif
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_APP_EXPORT(mount_init);
|
||||
|
||||
#endif /* RT_USING_DFS */
|
Loading…
Reference in New Issue