From 5285a8f5898074d38d71054010cf912c2d7ffb2d Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 30 Jan 2022 09:50:50 +0100 Subject: [PATCH 10/12] spi_flash: disable functions not required or not supported - 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 --- components/spi_flash/cache_utils.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/spi_flash/cache_utils.c b/components/spi_flash/cache_utils.c index 7715900055..d7d750abdd 100644 --- a/components/spi_flash/cache_utils.c +++ b/components/spi_flash/cache_utils.c @@ -67,6 +67,8 @@ static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_sta static uint32_t s_flash_op_cache_state[2]; +#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) #endif // CONFIG_FREERTOS_UNICORE +#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(); +} + +#endif /* RIOT_VERSION */ + /** * 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 -- 2.17.1