From c0658f766fa3731fc2f0191d42fa9f6c41d36691 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 9 Dec 2014 14:11:15 -0600 Subject: SmartFS: Implements wear-leveling in the SmartFS. From Ken Pettit --- nuttx/include/nuttx/fs/ioctl.h | 6 ++++++ nuttx/include/nuttx/fs/smart.h | 14 ++++++++++++++ nuttx/include/nuttx/mtd/smart.h | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) (limited to 'nuttx/include') diff --git a/nuttx/include/nuttx/fs/ioctl.h b/nuttx/include/nuttx/fs/ioctl.h index 491aed3c5..6a55d7975 100644 --- a/nuttx/include/nuttx/fs/ioctl.h +++ b/nuttx/include/nuttx/fs/ioctl.h @@ -200,6 +200,12 @@ * ProcFS data. * OUT: None (ioctl return value provides * success/failure indication). */ +#define BIOC_DEBUGCMD _BIOC(0x000B) /* Send driver specific debug command / + * data to the block device. + * IN: Pointer to a struct defined for + * the block with specific debug + * command and data. + * OUT: None. */ /* NuttX MTD driver ioctl definitions ***************************************/ diff --git a/nuttx/include/nuttx/fs/smart.h b/nuttx/include/nuttx/fs/smart.h index 50ae2c038..2621dd77f 100644 --- a/nuttx/include/nuttx/fs/smart.h +++ b/nuttx/include/nuttx/fs/smart.h @@ -89,6 +89,20 @@ struct smart_read_write_s const uint8_t *buffer; /* Pointer to the data to write */ }; +/* The following defines the procfs data exchange interface between the + * SMART MTD and FS layers. + */ + +#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS) +struct smart_procfs_data_s +{ +#ifdef CONFIG_MTD_SMART_ERASE_DEBUG + const uint16_t *erasecounts; /* Pointer to the erase counts array */ + uint16_t erasesize; /* Number of entries in the erase counts array */ +#endif +}; +#endif + /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/nuttx/include/nuttx/mtd/smart.h b/nuttx/include/nuttx/mtd/smart.h index b2239b99e..4bdcecd31 100644 --- a/nuttx/include/nuttx/mtd/smart.h +++ b/nuttx/include/nuttx/mtd/smart.h @@ -50,6 +50,9 @@ * Pre-Processor Definitions ****************************************************************************/ +#define SMART_DEBUG_CMD_SET_DEBUG_LEVEL 1 +#define SMART_DEBUG_CMD_SHOW_LOGMAP 2 + /**************************************************************************** * Public Types ****************************************************************************/ @@ -91,6 +94,19 @@ struct mtd_smart_procfs_data_s FAR const struct smart_alloc_s *allocs; /* Array of allocations */ uint16_t alloccount; /* Number of items in the array */ #endif +#ifdef CONFIG_MTD_SMART_WEAR_LEVEL + uint32_t uneven_wearcount; /* Number of uneven block erases */ +#endif +}; + +/* The following defines debug command data passed from the procfs layer to + the SMART MTD layer for debug purposes. + */ + +struct mtd_smart_debug_data_s +{ + uint8_t debugcmd; /* Debug command */ + uint32_t debugdata; /* Debug data */ }; /**************************************************************************** -- cgit v1.2.3