1 /** 2 ****************************************************************************** 3 * @file bl616_l1c.h 4 * @version V1.0 5 * @date 6 * @brief This file is the standard driver header file 7 ****************************************************************************** 8 * @attention 9 * 10 * <h2><center>© COPYRIGHT(c) 2020 Bouffalo Lab</center></h2> 11 * 12 * Redistribution and use in source and binary forms, with or without modification, 13 * are permitted provided that the following conditions are met: 14 * 1. Redistributions of source code must retain the above copyright notice, 15 * this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright notice, 17 * this list of conditions and the following disclaimer in the documentation 18 * and/or other materials provided with the distribution. 19 * 3. Neither the name of Bouffalo Lab nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 ****************************************************************************** 35 */ 36 #ifndef __BL616_L1C_H__ 37 #define __BL616_L1C_H__ 38 39 // #include "pds_reg.h" 40 #include "bl616_common.h" 41 42 /** @addtogroup BL616_Peripheral_Driver 43 * @{ 44 */ 45 46 /** @addtogroup L1C 47 * @{ 48 */ 49 50 /** @defgroup L1C_Public_Types 51 * @{ 52 */ 53 54 /** 55 * @brief L1C configuration structure type definition 56 */ 57 typedef struct 58 { 59 uint8_t cacheEn; 60 uint8_t wayDis; 61 uint8_t wa; 62 uint8_t wb; 63 uint8_t wt; 64 uint8_t rsvd[3]; 65 uint32_t cacheRangeL; 66 uint32_t cacheRangeH; 67 } L1C_CACHE_Cfg_Type; 68 69 /*@} end of group L1C_Public_Types */ 70 71 /** @defgroup L1C_Public_Constants 72 * @{ 73 */ 74 75 /*@} end of group L1C_Public_Constants */ 76 77 /** @defgroup L1C_Public_Macros 78 * @{ 79 */ 80 #define L1C_WAY_DISABLE_NONE 0x00 81 #define L1C_WAY_DISABLE_ONE 0x01 82 #define L1C_WAY_DISABLE_TWO 0x03 83 #define L1C_WAY_DISABLE_ALL 0x03 84 #define L1C_WAY_DISABLE_NOT_CAHNGE 0xFF 85 86 /*@} end of group L1C_Public_Macros */ 87 88 /** @defgroup L1C_Public_Functions 89 * @{ 90 */ 91 92 /*----------*/ 93 BL_Err_Type L1C_ICache_Enable(uint8_t wayDsiable); 94 BL_Err_Type L1C_DCache_Enable(uint8_t wayDsiable); 95 BL_Err_Type L1C_ICache_Disable(void); 96 BL_Err_Type L1C_DCache_Disable(void); 97 void L1C_DCache_Write_Set(BL_Fun_Type wtEn, BL_Fun_Type wbEn, BL_Fun_Type waEn); 98 BL_Err_Type L1C_DCache_Clean_All(void); 99 BL_Err_Type L1C_DCache_Clean_Invalid_All(void); 100 BL_Err_Type L1C_ICache_Invalid_All(void); 101 BL_Err_Type L1C_DCache_Invalid_All(void); 102 BL_Err_Type L1C_DCache_Clean_By_Addr(uintptr_t addr, uint32_t len); 103 BL_Err_Type L1C_DCache_Clean_Invalid_By_Addr(uintptr_t addr, uint32_t len); 104 BL_Err_Type L1C_ICache_Invalid_By_Addr(uintptr_t addr, uint32_t len); 105 BL_Err_Type L1C_DCache_Invalid_By_Addr(uintptr_t addr, uint32_t len); 106 /*----------*/ 107 BL_Err_Type L1C_Set_Wrap(uint8_t en); 108 BL_Err_Type L1C_Set_Cache_Setting_By_ID(uint8_t core, L1C_CACHE_Cfg_Type *cacheSetting); 109 /*----------*/ 110 int L1C_Is_DCache_Range(uintptr_t addr); 111 int L1C_Get_None_Cache_Addr(uintptr_t addr); 112 /*@} end of group L1C_Public_Functions */ 113 114 /*@} end of group L1C */ 115 116 /*@} end of group BL616_Peripheral_Driver */ 117 118 #endif /* __BL616_L1C_H__ */ 119