333553caf2
fix(hal/include): fix header violations in hal component fix(hal/include): Move type definitions from `xx_hal.h` to `xx_types.h` fix(hal/include): Move type definitions from `xx_hal.h` to `xx_types.h` fix(hal/include): Add comment for a far away `#endif` fix(hal/include): change scope for cpp guard ci: Remove components/hal/ comment from public headers check exceptions Add missing include macro sdkconfig.h for header files Add missing include macro stdbool.h for header files Add missing include macro stdint.h for header files Add missing capability guard macro for header files Add missing cpp guard macro for header files Remove some useless include macros Add some missing `inline` attribute for functions defined in header files Remove components/hal/ from public headers check exceptions fix(hal/include): fix invalid licenses fix(hal/include): fix invalid licenses fix(hal/include): add missing soc_caps.h fix(hal): include soc_caps.h before cap macro is used fix(hal): Remove unnecessary target check fix(hal): fix header and macro problems Add missing include macro Remove loop dependency in hal Add comment for far-away endif fix(hal): Add missing soc_caps.h ci: update check_copyright_ignore.txt Change the sequence of `#include` macro, cpp guard macro Change the wrap scope of capacity macro fix(hal): Change position of C++ guard to pass test
127 lines
2.8 KiB
C
127 lines
2.8 KiB
C
|
||
/*
|
||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||
*
|
||
* SPDX-License-Identifier: Apache-2.0
|
||
*/
|
||
|
||
#pragma once
|
||
|
||
#include <stdbool.h>
|
||
#include <stdint.h>
|
||
#include "hal/cache_types.h"
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/**
|
||
* Cache init and cache hal context init
|
||
*/
|
||
void cache_hal_init(void);
|
||
|
||
/**
|
||
* @brief Disable cache
|
||
*
|
||
* Disable the ICache or DCache or both, all the items in the corresponding Cache(s) will be invalideated.
|
||
* Next request to these items will trigger a transaction to the external memory (flash / psram)
|
||
*
|
||
* @note If the autoload feature is enabled, this API will return until the ICache autoload is disabled.
|
||
*
|
||
* @param type see `cache_type_t`
|
||
*/
|
||
void cache_hal_disable(cache_type_t type);
|
||
|
||
/**
|
||
* @brief Enable cache
|
||
*
|
||
* Enable the ICache or DCache or both.
|
||
*
|
||
* @param type see `cache_type_t`
|
||
*/
|
||
void cache_hal_enable(cache_type_t type);
|
||
|
||
/**
|
||
* @brief Suspend cache
|
||
*
|
||
* Suspend the ICache or DCache or both,suspends the CPU access to cache for a while, without invalidation.
|
||
*
|
||
* @param type see `cache_type_t`
|
||
*
|
||
* @return Current status of corresponding Cache(s)
|
||
*/
|
||
void cache_hal_suspend(cache_type_t type);
|
||
|
||
/**
|
||
* @brief Resume cache
|
||
*
|
||
* Resume the ICache or DCache or both.
|
||
*
|
||
* @param type see `cache_type_t`
|
||
*/
|
||
void cache_hal_resume(cache_type_t type);
|
||
|
||
/**
|
||
* @brief Check if corresponding cache is enabled or not
|
||
*
|
||
* @param type see `cache_type_t`
|
||
*
|
||
* @return true: enabled; false: disabled
|
||
*/
|
||
bool cache_hal_is_cache_enabled(cache_type_t type);
|
||
|
||
/**
|
||
* @brief Invalidate cache supported addr
|
||
*
|
||
* Invalidate a Cache item for either ICache or DCache.
|
||
*
|
||
* @param vaddr Start address of the region to be invalidated
|
||
* @param size Size of the region to be invalidated
|
||
*/
|
||
void cache_hal_invalidate_addr(uint32_t vaddr, uint32_t size);
|
||
|
||
#if SOC_CACHE_WRITEBACK_SUPPORTED
|
||
/**
|
||
* @brief Writeback cache supported addr
|
||
*
|
||
* Writeback the DCache item to external memory
|
||
*
|
||
* @param vaddr Start address of the region to writeback
|
||
* @param size Size of the region to writeback
|
||
*/
|
||
void cache_hal_writeback_addr(uint32_t vaddr, uint32_t size);
|
||
#endif //#if SOC_CACHE_WRITEBACK_SUPPORTED
|
||
|
||
#if SOC_CACHE_FREEZE_SUPPORTED
|
||
/**
|
||
* @brief Freeze cache
|
||
*
|
||
* Freeze cache, CPU access to cache will be suspended, until the cache is unfrozen.
|
||
*
|
||
* @param type see `cache_type_t`
|
||
*/
|
||
void cache_hal_freeze(cache_type_t type);
|
||
|
||
/**
|
||
* @brief Unfreeze cache
|
||
*
|
||
* Unfreeze cache, CPU access to cache will be restored
|
||
*
|
||
* @param type see `cache_type_t`
|
||
*/
|
||
void cache_hal_unfreeze(cache_type_t type);
|
||
#endif //#if SOC_CACHE_FREEZE_SUPPORTED
|
||
|
||
/**
|
||
* @brief Get cache line size, in bytes
|
||
*
|
||
* @param type see `cache_type_t`
|
||
*
|
||
* @return cache line size, in bytes
|
||
*/
|
||
uint32_t cache_hal_get_cache_line_size(cache_type_t type);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|