1 /* 2 * SPDX-FileCopyrightText: 2019-2025 SiFli Technologies(Nanjing) Co., Ltd 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef __BF0_HAL_EFUSE_H 8 #define __BF0_HAL_EFUSE_H 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 /* Includes ------------------------------------------------------------------*/ 15 #include "bf0_hal_def.h" 16 17 /** @addtogroup EFUSE 18 * @ingroup BF0_HAL_Driver 19 * @{ 20 */ 21 22 /** EFUSE bank size in bytes */ 23 #define HAL_EFUSE_BANK_SIZE 32 24 /** EFUSE bank number */ 25 #define HAL_EFUSE_BANK_NUM (4) 26 27 28 /** 29 * @brief Init Efuse controller 30 * @retval void 31 */ 32 HAL_StatusTypeDef HAL_EFUSE_Init(void); 33 34 /** 35 * @brief Configure bypass 36 * @param enabled true: enable bypass, false: disable bypass 37 * @retval void 38 */ 39 void HAL_EFUSE_ConfigBypass(bool enabled); 40 41 /** 42 * @brief Write data to efuse starting from bit_offset 43 * @param bit_offset bit_offset in efuse, must be 32bits aligned, bank0: 0~255, bank1: 256~511 44 * @param data point to the data to be written 45 * @param size data size in byte, must be multiple of 4bytes and written data cannot cross bank boundary 46 * @retval size successfully written 47 */ 48 int32_t HAL_EFUSE_Write(uint16_t bit_offset, uint8_t *data, int32_t size); 49 50 51 /** 52 * @brief Read data to efuse starting from bit_offset 53 * @param bit_offset bit_offset in efuse, must be 32bits aligned, bank0: 0~255, bank1: 256~511 54 * @param data point to buffer to save read data 55 * @param size data size in byte, must be multiple of 4bytes and read data cannot cross bank boundary 56 * @retval size successfully read 57 */ 58 int32_t HAL_EFUSE_Read(uint16_t bit_offset, uint8_t *data, int size); 59 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 ///@} EFUSE 66 67 #endif /* __BF0_HAL_EFUSE_H */