1 /* 2 * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #pragma once 7 8 #include <stdlib.h> 9 #include <stdint.h> 10 #include "esp_err.h" 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * @brief Private header for cache drivers, where cache functionality requires other components 18 * 19 * @note Now only esp32, can be applied to other similar chips 20 */ 21 typedef struct cache_driver_s cache_driver_t; 22 23 /** 24 * @brief Cache driver 25 */ 26 struct cache_driver_s { 27 28 /** 29 * @brief Cache flush 30 * 31 * @param[in] cpu_no CPU id 32 */ 33 void (*cache_flush)(int cpu_no); 34 35 /** 36 * @brief Cache writeback to psram 37 */ 38 void (*cache_writeback_psram)(void); 39 }; 40 41 /** 42 * @brief Register cache writeback 43 * 44 * @param[in] func Cache driver 45 */ 46 void cache_register_writeback(cache_driver_t *func); 47 48 /** 49 * @brief Cache sync 50 * 51 * @note This API only do cache sync, but doesn't guarantee concurrent access to cache 52 * @note Do not use in your application 53 */ 54 void cache_sync(void); 55 56 57 #ifdef __cplusplus 58 } 59 #endif 60