1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef _HAL_EFUSE_H_ 20 #define _HAL_EFUSE_H_ 21 22 #include "hi_types.h" 23 24 #define hal_cipher_read_reg(addr, result) (*(result) = *(volatile unsigned int *)(hi_uintptr_t)(addr)) 25 #define hal_cipher_write_reg(addr, result) (*(volatile unsigned int *)(hi_uintptr_t)(addr) = (result)) 26 27 #define hal_set_bit(src, bit) (src |= (1 << (bit))) 28 #define hal_clear_bit(src, bit) (src &= ~(1 << (bit))) 29 30 hi_s32 hal_efuse_write_key(hi_u32 *p_key, hi_u32 opt_id); 31 hi_s32 hal_efuse_otp_load_cipher_key(hi_u32 chn_id, hi_u32 opt_id); 32 hi_s32 hal_efuse_load_hash_key(hi_u32 opt_id); 33 hi_s32 hal_efuse_otp_init(hi_void); 34 hi_void hal_efuse_otp_set_reg_base(hi_u8 *reg_base); 35 hi_u8 *hal_efuse_otp_get_reg_base(hi_void); 36 37 #endif 38 39