1 /* 2 * Copyright (C) 2017-2020 Alibaba Group Holding Limited 3 */ 4 5 /****************************************************************************** 6 * @file drv/efuse.h 7 * @brief Header File for EFUSE Driver 8 * @version V1.0 9 * @date 22. Mar 2020 10 * @model efuse 11 ******************************************************************************/ 12 #ifndef _DEV_EFUSEC_H_ 13 #define _DEV_EFUSEC_H_ 14 15 #include <stdint.h> 16 #include <drv/common.h> 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 typedef struct { 23 uint32_t start; ///< Efuse start address 24 uint32_t end; ///< Efuse end address 25 } csi_efuse_info_t; 26 27 typedef struct { 28 csi_dev_t dev; 29 csi_efuse_info_t info; 30 } csi_efuse_t; 31 32 /** 33 \brief Initialize EFUSEC Interface. 1. Initializes the resources needed for the EFUSEC interface 34 \param[in] idx Device id 35 \return Error code 36 */ 37 csi_error_t drv_efuse_init(csi_efuse_t *efuse, int32_t idx); 38 39 /** 40 \brief De-initialize EFUSEC Interface. stops operation and releases the software resources used by the interface 41 \param[in] efuse Efuse efuse to operate. 42 \return None 43 */ 44 void drv_efuse_uninit(csi_efuse_t *efuse); 45 46 /** 47 \brief Read data from Efuse. 48 \param[in] efuse Efuse handle to operate. 49 \param[in] addr Data address. 50 \param[out] data Pointer to a buffer storing the data read from Efuse. 51 \param[in] size Number of data items to read. 52 \return Number of data items read or error code 53 */ 54 int32_t drv_efuse_read(csi_efuse_t *efuse, uint32_t addr, void *data, uint32_t size); 55 56 /** 57 \brief Program data to Efuse. 58 \param[in] efuse Efuse handle to operate. 59 \param[in] addr Data address. 60 \param[in] data Pointer to a buffer containing the data to be programmed to Efuse. 61 \param[in] cnt Number of data items to program. 62 \return number of data items programmed or error code 63 */ 64 int32_t drv_efuse_program(csi_efuse_t *efuse, uint32_t addr, const void *data, uint32_t size); 65 66 /** 67 \brief Get Efuse information. 68 \param[in] efuse Efuse handle to operate. 69 \param[out] info Efuse info \refs csi_efuse_info_t. 70 \return Error code 71 */ 72 csi_error_t drv_efuse_get_info(csi_efuse_t *efuse, csi_efuse_info_t *info); 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif /* _CSI_EFUSEC_H_ */ 79