mtd:add dhara compatiblity layer

to support dhara ftl for fatfs

Signed-off-by: guohao15 <guohao15@xiaomi.com>
This commit is contained in:
guohao15
2023-04-03 15:11:09 +08:00
committed by Xiang Xiao
parent e2166eca55
commit d4cebd5d77
4 changed files with 875 additions and 0 deletions
+15
View File
@@ -1215,4 +1215,19 @@ config GD5F_SPIFREQUENCY
endif # MTD_GD5F
config MTD_DHARA
bool "MTD Nandflash use dhara map"
default n
if MTD_DHARA
config DHARA_GC_RATIO
int "dhara garbage collection ratio"
default 4
config DHARA_READ_NCACHES
int "dhara read cache numbers"
default 4
endif
endif # MTD
+25
View File
@@ -164,6 +164,31 @@ CSRCS += smart.c
endif
endif
ifeq ($(CONFIG_MTD_DHARA),y)
master.zip:
$(call DOWNLOAD,https://github.com/dlbeer/dhara/archive/refs/heads,master.zip)
.dharaunpack: master.zip
$(Q) unzip master.zip -d mtd/
$(Q) mv mtd/dhara-master mtd/dhara
$(Q) touch mtd/dhara/.dharaunpack
ifeq ($(wildcard mtd/dhara/.git),)
context:: .dharaunpack
distclean::
$(call DELFILE, master.zip)
$(call DELDIR, mtd/dhara)
endif
CSRCS += dhara.c
CSRCS += mtd/dhara/dhara/map.c
CSRCS += mtd/dhara/dhara/error.c
CSRCS += mtd/dhara/dhara/journal.c
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)drivers$(DELIM)mtd$(DELIM)dhara
endif
# Include MTD driver support
DEPPATH += --dep-path mtd
+801
View File
File diff suppressed because it is too large Load Diff
+34
View File
@@ -723,6 +723,40 @@ int rpmsgmtd_register(FAR const char *remotecpu, FAR const char *remotepath,
int rpmsgmtd_server_init(void);
#endif
/****************************************************************************
* Name: dhara_initialize
*
* Description:
* Initialize to provide a block driver wrapper around an MTD interface
*
* Input Parameters:
* minor - The minor device number. The MTD block device will be
* registered as as /dev/mtdblockN where N is the minor number.
* mtd - The MTD device that supports the FLASH interface.
*
****************************************************************************/
#ifdef CONFIG_MTD_DHARA
int dhara_initialize(int minor, FAR struct mtd_dev_s *mtd);
#endif
/****************************************************************************
* Name: dhara_initialize_by_path
*
* Description:
* Initialize to provide a block driver wrapper around an MTD interface
*
* Input Parameters:
* path - The block device path.
* mtd - The MTD device that supports the FLASH interface.
*
****************************************************************************/
#ifdef CONFIG_MTD_DHARA
int dhara_initialize_by_path(FAR const char *path,
FAR struct mtd_dev_s *mtd);
#endif
#undef EXTERN
#ifdef __cplusplus
}