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



##########
File path: arch/xtensa/src/esp32s3/esp32s3_spiflash.c
##########
@@ -0,0 +1,343 @@
+/****************************************************************************
+ * arch/xtensa/src/esp32s3/esp32s3_spiflash.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 <string.h>
+#include <sys/types.h>
+#include <inttypes.h>
+#include <errno.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/init.h>
+
+#include "hardware/esp32s3_soc.h"
+
+#include "esp32s3_irq.h"
+
+#include "esp32s3_spiflash.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* RO data page in MMU index */
+
+#define DROM0_PAGES_START           (2)
+#define DROM0_PAGES_END             (128)
+
+/* MMU invalid value */
+
+#define INVALID_MMU_VAL             (0x100)
+
+/* MMU page size */
+
+#define SPI_FLASH_MMU_PAGE_SIZE     (0x10000)
+
+/* MMU base virtual mapped address */
+
+#define VADDR0_START_ADDR           (0x3c020000)
+
+/* Flash MMU table for CPU */
+
+#define MMU_TABLE                   ((volatile uint32_t *)DR_REG_MMU_TABLE)
+
+#define MMU_ADDR2PAGE(_addr)        ((_addr) / SPI_FLASH_MMU_PAGE_SIZE)
+#define MMU_ADDR2OFF(_addr)         ((_addr) % SPI_FLASH_MMU_PAGE_SIZE)
+#define MMU_BYTES2PAGES(_n)         (((_n) + SPI_FLASH_MMU_PAGE_SIZE - 1) / \
+                                     SPI_FLASH_MMU_PAGE_SIZE)
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* SPI Flash map request data */
+
+struct spiflash_map_req_s
+{
+  /* Request mapping SPI Flash base address */
+
+  uint32_t  src_addr;
+
+  /* Request mapping SPI Flash size */
+
+  uint32_t  size;
+
+  /* Mapped memory pointer */
+
+  void      *ptr;
+
+  /* Mapped started MMU page index */
+
+  uint32_t  start_page;
+
+  /* Mapped MMU page count */
+
+  uint32_t  page_cnt;
+};
+
+/* Structure holding SPI flash access critical sections management
+ * functions.
+ */
+
+struct spiflash_guard_funcs_s
+{
+  void (*start)(void);      /* critical section start function */
+  void (*end)(void);        /* critical section end function */
+  void (*op_lock)(void);    /* flash access API lock function */
+  void (*op_unlock)(void);  /* flash access API unlock function */
+
+  /* checks flash write addresses */
+
+  bool (*address_is_safe)(size_t addr, size_t size);
+
+  void (*yield)(void);      /* yield to the OS during flash erase */
+};
+
+struct spiflash_cachestate_s
+{
+  uint32_t value;
+  irqstate_t flags;
+};
+
+/****************************************************************************
+ * Private Functions Declaration
+ ****************************************************************************/
+
+static void spiflash_start(void);
+static void spiflash_end(void);
+
+/****************************************************************************
+ * Public Functions Declaration
+ ****************************************************************************/
+
+extern void spi_flash_guard_set(const struct spiflash_guard_funcs_s *funcs);
+extern uint32_t cache_suspend_icache(void);
+extern void cache_resume_icache(uint32_t val);

Review comment:
       ```suggestion
   extern void spi_flash_guard_set(const struct spiflash_guard_funcs_s *funcs);
   extern int cache_invalidate_addr(uint32_t addr, uint32_t size);
   extern uint32_t cache_suspend_icache(void);
   extern void cache_resume_icache(uint32_t val);
   ```
   Build is failing on a warning for missing declaration of 
`cache_invalidate_addr`.




-- 
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