[bsp][nxp]增加了drv_filesystem_spi_flash驱动
This commit is contained in:
parent
47d9c03937
commit
bbac8e954d
|
@ -10,11 +10,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
|
#if defined(BSP_USING_SPI7) && defined(RT_USING_SFUD) && defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
|
||||||
#include <dfs_elm.h>
|
#include <dfs_elm.h>
|
||||||
#include "spi_flash_sfud.h"
|
#include "spi_flash_sfud.h"
|
||||||
#include "dfs_fs.h"
|
#include "dfs_fs.h"
|
||||||
#include "dfs.h"
|
#include "dfs.h"
|
||||||
#include "dfs_elm.h"
|
|
||||||
#include "dfs_file.h"
|
#include "dfs_file.h"
|
||||||
|
|
||||||
#if DFS_FILESYSTEMS_MAX < 4
|
#if DFS_FILESYSTEMS_MAX < 4
|
||||||
|
@ -23,7 +24,9 @@
|
||||||
#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>
|
||||||
|
@ -53,15 +56,15 @@ 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_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");
|
rt_kprintf("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);
|
rt_kprintf("dfs mount dev:%s failed!\n", W25Q64_SPI_FLASH_NAME);
|
||||||
|
@ -69,6 +72,7 @@ static int filesystem_mount(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
|
|
||||||
}
|
}
|
||||||
INIT_APP_EXPORT(filesystem_mount);
|
INIT_APP_EXPORT(filesystem_mount);
|
||||||
|
|
||||||
|
#endif /* BSP_USING_SPI7/RT_USING_SFUD/RT_USING_DFS/RT_USING_DFS_ELMFAT */
|
Loading…
Reference in New Issue