1 // Copyright (C) 2022 Beken Corporation 2 // 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 15 #pragma once 16 17 #include "hal_config.h" 18 #include "efuse_hw.h" 19 #include "efuse_ll.h" 20 #include <driver/hal/hal_efuse_types.h> 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 typedef struct { 27 efuse_hw_t *hw; 28 efuse_unit_t id; 29 } efuse_hal_t; 30 31 #define efuse_hal_disable(hal) efuse_ll_disable((hal)->hw) 32 #define efuse_hal_reset_config_to_default(hal) efuse_ll_reset_config_to_default((hal)->hw) 33 34 bk_err_t efuse_hal_init(efuse_hal_t *hal); 35 bk_err_t efuse_hal_write(efuse_hal_t *hal, uint8_t addr, uint8_t wr_data); 36 uint8_t efuse_hal_read(efuse_hal_t *hal, uint8_t addr); 37 38 #if CFG_HAL_DEBUG_EFUSE 39 void efuse_struct_dump(void); 40 #else 41 #define efuse_struct_dump() 42 #endif 43 44 #ifdef __cplusplus 45 } 46 #endif 47 48 49 50