mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
unity_utils: added helper function to disable cache and run user function
This commit is contained in:
22
components/unity/unity_utils_cache.c
Normal file
22
components/unity/unity_utils_cache.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils_cache.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "esp_private/spi_flash_os.h"
|
||||
|
||||
IRAM_ATTR void unity_utils_run_cache_disable_stub(void (*post_cache_disable)(void *), void *user_ctx)
|
||||
{
|
||||
// callback function must reside in IRAM
|
||||
TEST_ASSERT_TRUE(esp_ptr_in_iram(post_cache_disable));
|
||||
// disable flash cache
|
||||
spi_flash_guard_get()->start();
|
||||
post_cache_disable(user_ctx);
|
||||
// enable flash cache
|
||||
spi_flash_guard_get()->end();
|
||||
}
|
Reference in New Issue
Block a user