1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: RISCV31 PATCH. 15 * 16 * Create: 2022-2-12 17 */ 18 #ifndef RISCV31_PATCH_H 19 #define RISCV31_PATCH_H 20 21 #include <stdint.h> 22 #include <stdbool.h> 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif /* __cplusplus */ 28 #endif /* __cplusplus */ 29 30 #define RISCV31_PATCH_CMP_REG_NUM 192 31 32 typedef struct { 33 uint32_t cmp_start_addr; 34 uint32_t remap_addr; 35 bool off_region; /*!< The jump range, false for within 1MB, true for out of the 1M range. */ 36 uint8_t flplacmp0_en; 37 uint8_t flplacmp1_en; 38 } riscv_cfg_t; 39 40 /** 41 * @brief Initialises the patch. 42 * @param patch_cfg RISC-V patch configuration. 43 */ 44 void riscv_patch_init(riscv_cfg_t patch_cfg); 45 46 #ifdef __cplusplus 47 #if __cplusplus 48 } 49 #endif /* __cplusplus */ 50 #endif /* __cplusplus */ 51 52 #endif 53