mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 23:53:34 +08:00
Add NXFFS configuration for Mirtoo
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4871 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@@ -48,6 +50,7 @@
|
||||
#ifdef CONFIG_PIC32MX_SPI2
|
||||
# include <nuttx/spi.h>
|
||||
# include <nuttx/mtd.h>
|
||||
# include <nuttx/fs/nxffs.h>
|
||||
#endif
|
||||
|
||||
#include "pic32mx-internal.h"
|
||||
@@ -76,6 +79,12 @@
|
||||
# define CONFIG_NSH_SST25MINOR 0
|
||||
#endif
|
||||
|
||||
/* Can't support both FAT and NXFFS */
|
||||
|
||||
#if defined(CONFIG_FS_FAT) && defined(CONFIG_FS_NXFFS)
|
||||
# warning "Can't support both FAT and NXFFS -- using FAT"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -113,14 +122,34 @@ int nsh_archinitialize(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_FS_NXFFS
|
||||
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(CONFIG_NSH_SST25MINOR, mtd);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("ERROR: Initialize the FTL layer\n");
|
||||
return -ENODEV;
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
/* Initialize to provide NXFFS on the MTD interface */
|
||||
|
||||
ret = nxffs_initialize(mtd);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("ERROR: NXFFS initialization failed: %d\n", -ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Mount the file system at /mnt/sst25 */
|
||||
|
||||
ret = mount(NULL, "/mnt/sst25", "nxffs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("ERROR: Failed to mount the NXFFS volume: %d\n", errno);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user