gustavonihei commented on a change in pull request #5665:
URL: https://github.com/apache/incubator-nuttx/pull/5665#discussion_r818071944



##########
File path: arch/xtensa/src/esp32s3/esp32s3_spiflash_mtd.c
##########
@@ -0,0 +1,807 @@
+/****************************************************************************
+ * arch/xtensa/src/esp32s3/esp32s3_spiflash_mtd.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <assert.h>
+#include <debug.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <inttypes.h>
+#include <errno.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/init.h>
+#include <nuttx/semaphore.h>
+#include <nuttx/mtd/mtd.h>
+
+#include "hardware/esp32s3_soc.h"
+
+#include "xtensa_attr.h"
+#include "esp32s3_spiflash.h"
+
+#include "rom/esp32s3_spiflash.h"
+#include "esp32s3_spiflash_mtd.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define MTD_BLK_SIZE                CONFIG_ESP32S3_SPIFLASH_MTD_BLKSIZE
+#define MTD_ERASE_SIZE              4096
+#define MTD_ERASED_STATE            (0xff)
+
+#define MTD2PRIV(_dev)              ((struct esp32s3_mtd_dev_s *)_dev)
+#define MTD_SIZE(_priv)             ((*(_priv)->data)->chip.chip_size)
+#define MTD_BLK2SIZE(_priv, _b)     (MTD_BLK_SIZE * (_b))
+#define MTD_SIZE2BLK(_priv, _s)     ((_s) / MTD_BLK_SIZE)
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* ESP32-S3 SPI Flash device private data  */
+
+struct esp32s3_mtd_dev_s
+{
+  struct mtd_dev_s mtd;
+
+  /* SPI Flash data */
+
+  const struct spiflash_legacy_data_s **data;
+};
+
+/****************************************************************************
+ * Private Functions Prototypes
+ ****************************************************************************/
+
+/* MTD driver methods */
+
+static int esp32s3_erase(struct mtd_dev_s *dev, off_t startblock,
+                         size_t nblocks);
+static ssize_t esp32s3_read(struct mtd_dev_s *dev, off_t offset,
+                            size_t nbytes, uint8_t *buffer);
+static ssize_t esp32s3_read_decrypt(struct mtd_dev_s *dev,
+                                    off_t offset,
+                                    size_t nbytes,
+                                    uint8_t *buffer);
+static ssize_t esp32s3_bread(struct mtd_dev_s *dev, off_t startblock,
+                             size_t nblocks, uint8_t *buffer);
+static ssize_t esp32s3_bread_decrypt(struct mtd_dev_s *dev,
+                                     off_t startblock,
+                                     size_t nblocks,
+                                     uint8_t *buffer);
+static ssize_t esp32s3_write(struct mtd_dev_s *dev, off_t offset,
+                             size_t nbytes, const uint8_t *buffer);
+static ssize_t esp32s3_bwrite(struct mtd_dev_s *dev, off_t startblock,
+                              size_t nblocks, const uint8_t *buffer);
+static ssize_t esp32s3_bwrite_encrypt(struct mtd_dev_s *dev,
+                                      off_t startblock,
+                                      size_t nblocks,
+                                      const uint8_t *buffer);
+static int esp32s3_ioctl(struct mtd_dev_s *dev, int cmd,
+                         unsigned long arg);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct esp32s3_mtd_dev_s g_esp32s3_spiflash =
+{
+  .mtd =
+          {
+            .erase  = esp32s3_erase,
+            .bread  = esp32s3_bread,
+            .bwrite = esp32s3_bwrite,
+            .read   = esp32s3_read,
+            .ioctl  = esp32s3_ioctl,
+#ifdef CONFIG_MTD_BYTE_WRITE
+            .write  = esp32s3_write,
+#endif
+            .name   = "esp32s3_spiflash"
+          },
+  .data = &rom_spiflash_legacy_data,
+};
+
+static const struct esp32s3_mtd_dev_s g_esp32s3_spiflash_encrypt =
+{
+  .mtd =
+          {
+            .erase  = esp32s3_erase,
+            .bread  = esp32s3_bread_decrypt,
+            .bwrite = esp32s3_bwrite_encrypt,
+            .read   = esp32s3_read_decrypt,
+            .ioctl  = esp32s3_ioctl,
+#ifdef CONFIG_MTD_BYTE_WRITE
+            .write  = NULL,
+#endif
+            .name   = "esp32s3_spiflash_encrypt"
+          }

Review comment:
       ```suggestion
             },
   ```
   This missing comma is breaking the build.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to