gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732185107
##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -155,6 +155,96 @@ void up_invalidate_icache_all(void)
}
#endif
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ * Prefetch and lock the instruction 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_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_lock_icache(uintptr_t start, uint32_t end)
+{
+ /* align to XCHAL_ICACHE_SIZE */
+
+ uint32_t addr = start - (start & (XCHAL_ICACHE_LINESIZE - 1));
+
+ for (; addr < end; addr += XCHAL_ICACHE_LINESIZE)
+ {
+ __asm__ __volatile__ ("ipfl %0, 0\n": : "r"(addr));
+ };
+
+ __asm__ __volatile__ ("isync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache
+ *
+ * Description:
+ * Unlock the instruction 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_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_unlock_icache(uintptr_t start, uint32_t end)
+{
+ /* align to XCHAL_ICACHE_SIZE */
Review comment:
```suggestion
/* Align to XCHAL_ICACHE_LINESIZE */
```
--
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]