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



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -439,6 +529,96 @@ void up_flush_dcache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_lock_dcache(uintptr_t start, uint32_t end)

Review comment:
       ```suggestion
   void up_lock_dcache(uintptr_t start, uintptr_t end)
   ```

##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -439,6 +529,96 @@ void up_flush_dcache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_lock_dcache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_DCACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_DCACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_DCACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("dpfl %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("dsync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_dcache
+ *
+ * Description:
+ *   Unlock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_unlock_dcache(uintptr_t start, uint32_t end)

Review comment:
       ```suggestion
   void up_unlock_dcache(uintptr_t start, uintptr_t end)
   ```




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to