This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a4fbcd123 drivers/mtd: add Kconfig options for RAMTRON emulated page 
& sector size
0a4fbcd123 is described below

commit 0a4fbcd123607e7ecb576b82793b60ab2d04371f
Author: Igor Mišić <[email protected]>
AuthorDate: Tue Feb 7 13:31:12 2023 +0100

    drivers/mtd: add Kconfig options for RAMTRON emulated page & sector size
---
 drivers/mtd/Kconfig   | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/ramtron.c |  4 ++--
 2 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index a07389d5ae..dcabd571e3 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -927,6 +927,54 @@ config RAMTRON_CHUNKING
                Some Re-RAMs like MB85AS4MT have write buffer size limitation 
and
                require smaller, "chunked" writes.
 
+config RAMTRON_EMULATE_SECTOR_SHIFT
+       int "RAMTRON emulates sector size by setting shift value"
+       default 9
+       ---help---
+               RAMTRON devices do not have pages and sectors.
+               For purpose of the VFAT file system, we emulate them.
+
+               Specify sector shift value to determine emulated sector size.
+               The relationship between sector shift value and emulated sector 
size is
+               described in the equation:
+               RAMTRON_EMULATE_SECTOR_SIZE = (1 << 
RAMTRON_EMULATE_SECTOR_SHIFT)
+
+               sector shift value      : sector size in bytes
+                                               0       : 1
+                                               1       : 2
+                                               2       : 4
+                                               3       : 8
+                                               4       : 16
+                                               5       : 32
+                                               6       : 64
+                                               7       : 128
+                                               8       : 256
+                                               9       : 512
+
+config RAMTRON_EMULATE_PAGE_SHIFT
+       int "RAMTRON emulates page size by setting shift value"
+       default 9
+       ---help---
+               RAMTRON devices do not have pages and sectors.
+               For purpose of the VFAT file system, we emulate them.
+
+               Specify page shift value to determine emulated page size.
+               The relationship between page shift value and emulated page 
size is
+               described in the equation:
+               RAMTRON_EMULATE_PAGE_SIZE = (1 << RAMTRON_EMULATE_PAGE_SHIFT)
+
+               page shift value        : page size in bytes
+                                               0       : 1
+                                               1       : 2
+                                               2       : 4
+                                               3       : 8
+                                               4       : 16
+                                               5       : 32
+                                               6       : 64
+                                               7       : 128
+                                               8       : 256
+                                               9       : 512
+
 endif # MTD_RAMTRON
 
 config MTD_SST25
diff --git a/drivers/mtd/ramtron.c b/drivers/mtd/ramtron.c
index 504328dc7d..3ce90661e2 100644
--- a/drivers/mtd/ramtron.c
+++ b/drivers/mtd/ramtron.c
@@ -69,8 +69,8 @@
  *  configuration:
  */
 
-#define RAMTRON_EMULATE_SECTOR_SHIFT  9
-#define RAMTRON_EMULATE_PAGE_SHIFT    9
+#define RAMTRON_EMULATE_SECTOR_SHIFT  CONFIG_RAMTRON_EMULATE_SECTOR_SHIFT
+#define RAMTRON_EMULATE_PAGE_SHIFT    CONFIG_RAMTRON_EMULATE_PAGE_SHIFT
 #define RAMTRON_EMULATE_PAGE_SIZE     (1 << RAMTRON_EMULATE_PAGE_SHIFT)
 
 /* RAMTRON Identification register values */

Reply via email to