diff options
Diffstat (limited to 'nuttx/drivers/mtd')
-rw-r--r-- | nuttx/drivers/mtd/Kconfig | 29 | ||||
-rw-r--r-- | nuttx/drivers/mtd/rammtd.c | 14 |
2 files changed, 36 insertions, 7 deletions
diff --git a/nuttx/drivers/mtd/Kconfig b/nuttx/drivers/mtd/Kconfig index 99aea5813..f7ded475a 100644 --- a/nuttx/drivers/mtd/Kconfig +++ b/nuttx/drivers/mtd/Kconfig @@ -24,6 +24,35 @@ config MTD_PARTITION managing the sub-region of flash beginning at 'offset' (in blocks) and of size 'nblocks' on the device specified by 'mtd'. +config RAMMTD + bool "RAM-based MTD driver" + default n + ---help--- + Build support for a RAM-based MTD driver. + +if RAMMTD + +config RAMMTD_BLOCKSIZE + int "RAM MTD block size" + default 512 + +config RAMMTD_ERASESIZE + int "RAM MTD erase block size" + default 4096 + +config RAMMTD_ERASESTATE + hex "Simulated erase state" + default 0xff + +config RAMMTD_FLASHSIM + bool "RAM MTD FLASH Simulation" + default n + ---help--- + RAMMTD_FLASHSIM will add some extra logic to improve the level of + FLASH simulation. + +endif + config MTD_AT24XX bool "I2C-based AT24XX eeprom" default n diff --git a/nuttx/drivers/mtd/rammtd.c b/nuttx/drivers/mtd/rammtd.c index 82a7191ea..1d7a570e1 100644 --- a/nuttx/drivers/mtd/rammtd.c +++ b/nuttx/drivers/mtd/rammtd.c @@ -75,10 +75,10 @@ # error "Must have CONFIG_RAMMTD_BLOCKSIZE <= CONFIG_RAMMTD_ERASESIZE" #endif -#undef CONFIG_RAMMTD_BLKPER -#define CONFIG_RAMMTD_BLKPER (CONFIG_RAMMTD_ERASESIZE/CONFIG_RAMMTD_BLOCKSIZE) +#undef RAMMTD_BLKPER +#define RAMMTD_BLKPER (CONFIG_RAMMTD_ERASESIZE/CONFIG_RAMMTD_BLOCKSIZE) -#if CONFIG_RAMMTD_BLKPER*CONFIG_RAMMTD_BLOCKSIZE != CONFIG_RAMMTD_ERASESIZE +#if RAMMTD_BLKPER*CONFIG_RAMMTD_BLOCKSIZE != CONFIG_RAMMTD_ERASESIZE # error "CONFIG_RAMMTD_ERASESIZE must be an even multiple of CONFIG_RAMMTD_BLOCKSIZE" #endif @@ -208,8 +208,8 @@ static int ram_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks * in logical block numbers */ - startblock *= CONFIG_RAMMTD_BLKPER; - nblocks *= CONFIG_RAMMTD_BLKPER; + startblock *= RAMMTD_BLKPER; + nblocks *= RAMMTD_BLKPER; /* Get the offset corresponding to the first block and the size * corresponding to the number of blocks. @@ -240,7 +240,7 @@ static ssize_t ram_bread(FAR struct mtd_dev_s *dev, off_t startblock, size_t nbl /* Don't let the read exceed the size of the ram buffer */ - maxblock = priv->nblocks * CONFIG_RAMMTD_BLKPER; + maxblock = priv->nblocks * RAMMTD_BLKPER; if (startblock >= maxblock) { return 0; @@ -280,7 +280,7 @@ static ssize_t ram_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, /* Don't let the write exceed the size of the ram buffer */ - maxblock = priv->nblocks * CONFIG_RAMMTD_BLKPER; + maxblock = priv->nblocks * RAMMTD_BLKPER; if (startblock >= maxblock) { return 0; |