diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-04-30 15:54:02 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-04-30 15:54:02 -0600 |
commit | 45c144ba134835b0a66bdcb7dd40114c7b6a8249 (patch) | |
tree | 3ee75ed806c7f0de92d28b1bb00dd6d017fab0cf /apps/examples/nxffs | |
parent | 8241609e9edbab8443fb4a3f278bfc7a924c05b1 (diff) | |
download | px4-nuttx-45c144ba134835b0a66bdcb7dd40114c7b6a8249.tar.gz px4-nuttx-45c144ba134835b0a66bdcb7dd40114c7b6a8249.tar.bz2 px4-nuttx-45c144ba134835b0a66bdcb7dd40114c7b6a8249.zip |
Add configuration and example to test MTD partitions
Diffstat (limited to 'apps/examples/nxffs')
-rw-r--r-- | apps/examples/nxffs/Kconfig | 58 | ||||
-rw-r--r-- | apps/examples/nxffs/nxffs_main.c | 11 |
2 files changed, 61 insertions, 8 deletions
diff --git a/apps/examples/nxffs/Kconfig b/apps/examples/nxffs/Kconfig index 074ace872..57c55787c 100644 --- a/apps/examples/nxffs/Kconfig +++ b/apps/examples/nxffs/Kconfig @@ -10,4 +10,62 @@ config EXAMPLES_NXFFS Enable the NXFFS file system example if EXAMPLES_NXFFS + +config EXAMPLES_NXFFS_ARCHINIT + bool "Architecture-specific initialization" + default n + ---help--- + The default is to use the RAM MTD device at drivers/mtd/rammtd.c. + But an architecture-specific MTD driver can be used instead by + defining EXAMPLES_NXFFS_ARCHINIT. In this case, the + initialization logic will call mtdpart_archinitialize() to obtain + the MTD driver instance. + +config EXAMPLES_NXFFS_NEBLOCKS + int "Number of erase blocks (simulated)" + default 32 + depends on !EXAMPLES_NXFFS_ARCHINIT + ---help--- + When EXAMPLES_NXFFS_ARCHINIT is not defined, this test will use + the RAM MTD device at drivers/mtd/rammtd.c to simulate FLASH. In + this case, this value must be provided to give the nubmer of erase + blocks in MTD RAM device. + + The size of the allocated RAM drive will be: + + RAMMTD_ERASESIZE * EXAMPLES_NXFFS_NEBLOCKS + +config EXAMPLES_NXFFS_MAXNAME + int "Max name size" + default 128 + range 1 255 + ---help--- + Determines the maximum size of names used in the filesystem + + config EXAMPLES_NXFFS_MAXFILE + int "Max file size" + default 8192 + ---help--- + Determines the maximum size of a file + +config EXAMPLES_NXFFS_MAXIO + int "Max I/O" + default 347 + +config EXAMPLES_NXFFS_MAXOPEN + int "Max open files" + default 512 + +config EXAMPLES_NXFFS_MOUNTPT + string "NXFFS mountpoint" + default "/mnt/nxffs" + +config EXAMPLES_NXFFS_NLOOPS + int "Number of test loops" + default 100 + +config EXAMPLES_NXFFS_VERBOSE + bool "Verbose output" + default n + endif diff --git a/apps/examples/nxffs/nxffs_main.c b/apps/examples/nxffs/nxffs_main.c index 8bb5cd1fe..23b02cc16 100644 --- a/apps/examples/nxffs/nxffs_main.c +++ b/apps/examples/nxffs/nxffs_main.c @@ -69,10 +69,6 @@ /* This must exactly match the default configuration in drivers/mtd/rammtd.c */ -# ifndef CONFIG_RAMMTD_BLOCKSIZE -# define CONFIG_RAMMTD_BLOCKSIZE 512 -# endif - # ifndef CONFIG_RAMMTD_ERASESIZE # define CONFIG_RAMMTD_ERASESIZE 4096 # endif @@ -81,8 +77,7 @@ # define CONFIG_EXAMPLES_NXFFS_NEBLOCKS (32) # endif -# undef CONFIG_EXAMPLES_NXFFS_BUFSIZE -# define CONFIG_EXAMPLES_NXFFS_BUFSIZE \ +# define EXAMPLES_NXFFS_BUFSIZE \ (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_NXFFS_NEBLOCKS) #endif @@ -145,7 +140,7 @@ struct nxffs_filedesc_s /* Pre-allocated simulated flash */ #ifndef CONFIG_EXAMPLES_NXFFS_ARCHINIT -static uint8_t g_simflash[CONFIG_EXAMPLES_NXFFS_BUFSIZE]; +static uint8_t g_simflash[EXAMPLES_NXFFS_BUFSIZE]; #endif static uint8_t g_fileimage[CONFIG_EXAMPLES_NXFFS_MAXFILE]; @@ -807,7 +802,7 @@ int nxffs_main(int argc, char *argv[]) #ifdef CONFIG_EXAMPLES_NXFFS_ARCHINIT mtd = nxffs_archinitialize(); #else - mtd = rammtd_initialize(g_simflash, CONFIG_EXAMPLES_NXFFS_BUFSIZE); + mtd = rammtd_initialize(g_simflash, EXAMPLES_NXFFS_BUFSIZE); #endif if (!mtd) { |