mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 04:25:32 +00:00
spi_flash: Expose an accessor the current SPI flash guard functions
Change places which uses g_flash_guard_default_ops to use this. Probably exact same data, but a bit cleaner.
This commit is contained in:

committed by
Angus Gratton

parent
e72e5a9706
commit
7a924bd85a
@@ -212,27 +212,27 @@ IRAM_ATTR TEST_CASE("ETSTimers arm & disarm run from IRAM", "[ets_timer]")
|
||||
|
||||
/* arm a disabled timer, then disarm a live timer */
|
||||
|
||||
g_flash_guard_default_ops.start(); // Disables flash cache
|
||||
spi_flash_guard_get()->start(); // Disables flash cache
|
||||
|
||||
ets_timer_arm(&timer1, INTERVAL, false);
|
||||
// redundant call is deliberate (test code path if already armed)
|
||||
ets_timer_arm(&timer1, INTERVAL, false);
|
||||
ets_timer_disarm(&timer1);
|
||||
|
||||
g_flash_guard_default_ops.end(); // Re-enables flash cache
|
||||
spi_flash_guard_get()->end(); // Re-enables flash cache
|
||||
|
||||
TEST_ASSERT_FALSE(flag); // didn't expire yet
|
||||
|
||||
/* do the same thing but wait for the timer to expire */
|
||||
|
||||
g_flash_guard_default_ops.start();
|
||||
spi_flash_guard_get()->start();
|
||||
ets_timer_arm(&timer1, INTERVAL, false);
|
||||
g_flash_guard_default_ops.end();
|
||||
spi_flash_guard_get()->end();
|
||||
|
||||
vTaskDelay(2 * INTERVAL / portTICK_PERIOD_MS);
|
||||
TEST_ASSERT_TRUE(flag);
|
||||
|
||||
g_flash_guard_default_ops.start();
|
||||
spi_flash_guard_get()->start();
|
||||
ets_timer_disarm(&timer1);
|
||||
g_flash_guard_default_ops.end();
|
||||
spi_flash_guard_get()->end();
|
||||
}
|
||||
|
Reference in New Issue
Block a user