Add an MTD driver to wrap another MTD driver and makes is sector size look like 512 bytes

This commit is contained in:
Gregory Nutt
2014-03-24 17:45:45 -06:00
parent bd52d9af21
commit 30c34c07cf
4 changed files with 691 additions and 0 deletions
+21
View File
@@ -26,6 +26,27 @@ 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 MTD_SECT512
bool "512B sector conversion"
default n
---help---
If enabled, a MTD driver will be created that will convert the
sector size of any other MTD driver to a 512 byte "apparent" sector
size. The managed MTD driver in this case must have an erase block
size that is greater than 512B and an event multiple of 512B.
if MTD_SECT512
config MTD_SECT512_ERASED_STATE
hex "Erased state of the FLASH"
default 0xff
config MTD_SECT512_READONLY
bool "512B read-only"
default n
endif # MTD_SECT512
config MTD_PARTITION_NAMES
bool "Support MTD partition naming"
depends on FS_PROCFS
+4
View File
@@ -45,6 +45,10 @@ ifeq ($(CONFIG_MTD_PARTITION),y)
CSRCS += mtd_partition.c
endif
ifeq ($(CONFIG_MTD_SECT512),y)
CSRCS += sector512.c
endif
ifeq ($(CONFIG_MTD_NAND),y)
CSRCS += mtd_nand.c mtd_onfi.c mtd_nandscheme.c mtd_nandmodel.c mtd_modeltab.c
ifeq ($(CONFIG_MTD_NAND_SWECC),y)
File diff suppressed because it is too large Load Diff
+18
View File
@@ -266,6 +266,24 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd,
* functions (such as a block or character driver front end).
*/
/************************************************************************************
* Name: s512_initialize
*
* Description:
* Create an initialized MTD device instance. This MTD driver contains another
* MTD driver and converts a larger sector size to a standard 512 byte sector
* size.
*
* MTD devices are not registered in the file system, but are created as instances
* that can be bound to other functions (such as a block or character driver front
* end).
*
************************************************************************************/
#ifdef CONFIG_MTD_SECT512
FAR struct mtd_dev_s *s512_initialize(FAR struct mtd_dev_s *mtd);
#endif
/****************************************************************************
* Name: at45db_initialize
*