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/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 56e3053b1a mtd/smart: Fix a compile error in smart_fsck
56e3053b1a is described below

commit 56e3053b1a514a9e7b30dcc4712b16a4005b7840
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Wed Oct 19 20:24:46 2022 +0900

    mtd/smart: Fix a compile error in smart_fsck
    
    Fix a compile error caused by below commit.
    9ad75fd95d Added SMART flash filesystem to RP2040
    Add some macro functions for smartfs driver.
---
 drivers/mtd/smart.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c
index 9015a83199..2caf8365be 100644
--- a/drivers/mtd/smart.c
+++ b/drivers/mtd/smart.c
@@ -146,6 +146,28 @@
 #define CLR_BITMAP(m, n) do { (m)[(n) / 8] &= ~(1 << ((n) % 8)); } while (0)
 #define ISSET_BITMAP(m, n) ((m)[(n) / 8] & (1 << ((n) % 8)))
 
+#ifdef CONFIG_SMARTFS_ALIGNED_ACCESS
+#  define SMARTFS_NEXTSECTOR(h) \
+  (uint16_t)((FAR const uint8_t *)(h)->nextsector)[1] << 8 | \
+  (uint16_t)((FAR const uint8_t *)(h)->nextsector)[0]
+
+#  define SMARTFS_SET_NEXTSECTOR(h, v) \
+  do \
+    { \
+      ((FAR uint8_t *)(h)->nextsector)[0] = (v) & 0xff; \
+      ((FAR uint8_t *)(h)->nextsector)[1] = (v) >> 8;   \
+    } while (0)
+
+#else
+#  define SMARTFS_NEXTSECTOR(h) (*((FAR uint16_t *)(h)->nextsector))
+#  define SMARTFS_SET_NEXTSECTOR(h, v) \
+  do \
+    { \
+      ((*((FAR uint16_t *)(h)->nextsector)) = (uint16_t)(v)); \
+    } while (0)
+
+#endif
+
 #ifdef CONFIG_MTD_SMART_WEAR_LEVEL
 
 /****************************************************************************

Reply via email to