2022-07-31 11:14:08 +02:00
From 5285a8f5898074d38d71054010cf912c2d7ffb2d Mon Sep 17 00:00:00 2001
2022-02-01 20:58:14 +01:00
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 09:50:50 +0100
Subject: [PATCH 10/12] spi_flash: disable functions not required or not
supported
2022-07-31 11:14:08 +02:00
- Various cache utility functions are neither required nor can they be supported by the means of RIOT. For example, it is not possible to change the priority of a thread. They have to be therefore disabled in RIOT.
- Add alternative implementations for `spi_flash_disable_interrupts_caches_and_other_cpu` and `spi_flash_enable_interrupts_caches_and_other_cpu` if compiled for RIOT
2022-02-01 20:58:14 +01:00
---
2022-07-31 11:14:08 +02:00
components/spi_flash/cache_utils.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
2022-02-01 20:58:14 +01:00
diff --git a/components/spi_flash/cache_utils.c b/components/spi_flash/cache_utils.c
2022-07-31 11:14:08 +02:00
index 7715900055..d7d750abdd 100644
2022-02-01 20:58:14 +01:00
--- a/components/spi_flash/cache_utils.c
+++ b/components/spi_flash/cache_utils.c
2022-07-31 11:14:08 +02:00
@@ -67,6 +67,8 @@ static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_sta
2022-02-01 20:58:14 +01:00
2022-07-31 11:14:08 +02:00
static uint32_t s_flash_op_cache_state[2];
2022-02-01 20:58:14 +01:00
2022-07-31 11:14:08 +02:00
+#ifndef RIOT_VERSION
+
#ifndef CONFIG_FREERTOS_UNICORE
static SemaphoreHandle_t s_flash_op_mutex;
static volatile bool s_flash_op_can_start = false;
@@ -293,6 +295,22 @@ void IRAM_ATTR spi_flash_enable_interrupts_caches_no_os(void)
2022-02-01 20:58:14 +01:00
2022-07-31 11:14:08 +02:00
#endif // CONFIG_FREERTOS_UNICORE
2022-02-01 20:58:14 +01:00
2022-07-31 11:14:08 +02:00
+#else /* RIOT_VERSION */
+
+void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu(void)
+{
+ irq_disable();
+ spi_flash_disable_cache(0, &s_flash_op_cache_state[0]);
+}
+
+void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu(void)
+{
+ spi_flash_restore_cache(0, s_flash_op_cache_state[0]);
+ irq_enable();
+}
+
2022-02-01 20:58:14 +01:00
+#endif /* RIOT_VERSION */
2022-07-31 11:14:08 +02:00
+
/**
* The following two functions are replacements for Cache_Read_Disable and Cache_Read_Enable
* function in ROM. They are used to work around a bug where Cache_Read_Disable requires a call to
2022-02-01 20:58:14 +01:00
--
2.17.1