4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-15 10:09:11 +08:00

[bsp][nxp]修改 drv_filesystem_spi_flash 驱动 (#8811)

Co-authored-by: yandld <1453363089@qq.com>
Co-authored-by: Meco Man <920369182@qq.com>
This commit is contained in:
Abner 2024-04-19 09:00:49 +08:00 committed by Rbb666
parent 87cfd58224
commit e9e8b0576b

View File

@ -18,15 +18,18 @@
#include "dfs.h" #include "dfs.h"
#include "dfs_file.h" #include "dfs_file.h"
#define DBG_TAG "spi-flash"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#if DFS_FILESYSTEMS_MAX < 4 #if DFS_FILESYSTEMS_MAX < 4
#error "Please define DFS_FILESYSTEMS_MAX more than 4" #error "Please define DFS_FILESYSTEMS_MAX more than 4"
#endif #endif
#if DFS_FILESYSTEM_TYPES_MAX < 4 #if DFS_FILESYSTEM_TYPES_MAX < 4
#error "Please define DFS_FILESYSTEM_TYPES_MAX more than 4" #error "Please define DFS_FILESYSTEM_TYPES_MAX more than 4"
#endif #endif
#if RT_DFS_ELM_MAX_SECTOR_SIZE == 512
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
#endif
#define DBG_TAG "app.filesystem_spi_flash" #define DBG_TAG "app.filesystem_spi_flash"
#define DBG_LVL DBG_INFO #define DBG_LVL DBG_INFO
#include <rtdbg.h> #include <rtdbg.h>
@ -44,7 +47,7 @@ static int filesystem_mount(void)
if(!spi70) if(!spi70)
{ {
rt_kprintf("spi sample run failed! can't find %s device!\n","spi7"); LOG_W("spi sample run failed! can't find %s device!\n","spi7");
return -RT_ERROR; return -RT_ERROR;
} }
@ -56,18 +59,16 @@ static int filesystem_mount(void)
/* legcy issue */ /* legcy issue */
// rt_spi_bus_attach_device_cspin(spi70, W25Q64_SPI_DEVICE_NAME, W25Q64_SPI_BUS_NAME, 96, RT_NULL);
rt_hw_spi_device_attach(W25Q64_SPI_BUS_NAME, W25Q64_SPI_DEVICE_NAME, 96); rt_hw_spi_device_attach(W25Q64_SPI_BUS_NAME, W25Q64_SPI_DEVICE_NAME, 96);
if(RT_NULL == rt_sfud_flash_probe(W25Q64_SPI_FLASH_NAME, W25Q64_SPI_DEVICE_NAME)) if(RT_NULL == rt_sfud_flash_probe(W25Q64_SPI_FLASH_NAME, W25Q64_SPI_DEVICE_NAME))
{ {
rt_kprintf("Flash sfud Failed!\n"); LOG_E("Flash sfud Failed!\n");
return -RT_ERROR; return -RT_ERROR;
} }
// dfs_mkfs("elm", "W25Q64_SPI_FLASH_NAME");
if(dfs_mount(W25Q64_SPI_FLASH_NAME, "/", "elm", 0, 0)) if(dfs_mount(W25Q64_SPI_FLASH_NAME, "/", "elm", 0, 0))
{ {
rt_kprintf("dfs mount dev:%s failed!\n", W25Q64_SPI_FLASH_NAME); LOG_E("dfs mount dev:%s failed!\n", W25Q64_SPI_FLASH_NAME);
return -RT_ERROR; return -RT_ERROR;
} }