11bd4fe43Sopenharmony_ci/**
21bd4fe43Sopenharmony_ci * @file hi_efuse.h
31bd4fe43Sopenharmony_ci *
41bd4fe43Sopenharmony_ci * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
51bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
61bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License.
71bd4fe43Sopenharmony_ci * You may obtain a copy of the License at
81bd4fe43Sopenharmony_ci *
91bd4fe43Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
101bd4fe43Sopenharmony_ci *
111bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
121bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
131bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and
151bd4fe43Sopenharmony_ci * limitations under the License.
161bd4fe43Sopenharmony_ci */
171bd4fe43Sopenharmony_ci
181bd4fe43Sopenharmony_ci/**
191bd4fe43Sopenharmony_ci * @defgroup iot_efuse Efuse
201bd4fe43Sopenharmony_ci * @ingroup drivers
211bd4fe43Sopenharmony_ci */
221bd4fe43Sopenharmony_ci#ifndef __HI_EFUSE_H__
231bd4fe43Sopenharmony_ci#define __HI_EFUSE_H__
241bd4fe43Sopenharmony_ci#include <hi_types_base.h>
251bd4fe43Sopenharmony_ci
261bd4fe43Sopenharmony_ci#ifdef __cplusplus
271bd4fe43Sopenharmony_ci#if __cplusplus
281bd4fe43Sopenharmony_ciextern "C" {
291bd4fe43Sopenharmony_ci#endif
301bd4fe43Sopenharmony_ci#endif /* __cplusplus */
311bd4fe43Sopenharmony_ci
321bd4fe43Sopenharmony_citypedef enum {
331bd4fe43Sopenharmony_ci    HI_EFUSE_CHIP_RW_ID = 0,
341bd4fe43Sopenharmony_ci    HI_EFUSE_DIE_RW_ID = 1,
351bd4fe43Sopenharmony_ci    HI_EFUSE_PMU_FUSE1_RW_ID = 2,
361bd4fe43Sopenharmony_ci    HI_EFUSE_PMU_FUSE2_RW_ID = 3,
371bd4fe43Sopenharmony_ci    HI_EFUSE_FLASH_ENCPY_CNT3_RW_ID = 4,
381bd4fe43Sopenharmony_ci    HI_EFUSE_FLASH_ENCPY_CNT4_RW_ID = 5,
391bd4fe43Sopenharmony_ci    HI_EFUSE_FLASH_ENCPY_CNT5_RW_ID = 6,
401bd4fe43Sopenharmony_ci    HI_EFUSE_DSLEEP_FLAG_RW_ID = 7,
411bd4fe43Sopenharmony_ci    HI_EFUSE_ROOT_PUBKEY_RW_ID = 8,
421bd4fe43Sopenharmony_ci    HI_EFUSE_ROOT_KEY_WO_ID = 9,
431bd4fe43Sopenharmony_ci    HI_EFUSE_CUSTOMER_RSVD0_RW_ID = 10,
441bd4fe43Sopenharmony_ci    HI_EFUSE_SUBKEY_CAT_RW_ID = 11,
451bd4fe43Sopenharmony_ci    HI_EFUSE_ENCRYPT_FLAG_RW_ID = 12,
461bd4fe43Sopenharmony_ci    HI_EFUSE_SUBKEY_RSIM_RW_ID = 13,
471bd4fe43Sopenharmony_ci    HI_EFUSE_START_TYPE_RW_ID = 14,
481bd4fe43Sopenharmony_ci    HI_EFUSE_JTM_RW_ID = 15,
491bd4fe43Sopenharmony_ci    HI_EFUSE_UTM0_RW_ID = 16,
501bd4fe43Sopenharmony_ci    HI_EFUSE_UTM1_RW_ID = 17,
511bd4fe43Sopenharmony_ci    HI_EFUSE_UTM2_RW_ID = 18,
521bd4fe43Sopenharmony_ci    HI_EFUSE_SDC_RW_ID = 19,
531bd4fe43Sopenharmony_ci    HI_EFUSE_RSVD0_RW_ID = 20,
541bd4fe43Sopenharmony_ci    HI_EFUSE_KDF2ECC_HUK_DISABLE_RW_ID = 21,
551bd4fe43Sopenharmony_ci    HI_EFUSE_SSS_CORNER_RW_ID = 22,
561bd4fe43Sopenharmony_ci    HI_EFUSE_UART_HALT_INTERVAL_RW_ID = 23,
571bd4fe43Sopenharmony_ci    HI_EFUSE_TSENSOR_RIM_RW_ID = 24,
581bd4fe43Sopenharmony_ci    HI_EFUSE_CHIP_BK_RW_ID = 25,
591bd4fe43Sopenharmony_ci    HI_EFUSE_IPV4_MAC_ADDR_RW_ID = 26,
601bd4fe43Sopenharmony_ci    HI_EFUSE_IPV6_MAC_ADDR_RW_ID = 27,
611bd4fe43Sopenharmony_ci    HI_EFUSE_PG2GCCKA0_TRIM0_RW_ID = 28,
621bd4fe43Sopenharmony_ci    HI_EFUSE_PG2GCCKA1_TRIM0_RW_ID = 29,
631bd4fe43Sopenharmony_ci    HI_EFUSE_NVRAM_PA2GA0_TRIM0_RW_ID = 30,
641bd4fe43Sopenharmony_ci    HI_EFUSE_NVRAM_PA2GA1_TRIM0_RW_ID = 31,
651bd4fe43Sopenharmony_ci    HI_EFUSE_PG2GCCKA0_TRIM1_RW_ID = 32,
661bd4fe43Sopenharmony_ci    HI_EFUSE_PG2GCCKA1_TRIM1_RW_ID = 33,
671bd4fe43Sopenharmony_ci    HI_EFUSE_NVRAM_PA2GA0_TRIM1_RW_ID = 34,
681bd4fe43Sopenharmony_ci    HI_EFUSE_NVRAM_PA2GA1_TRIM1_RW_ID = 35,
691bd4fe43Sopenharmony_ci    HI_EFUSE_PG2GCCKA0_TRIM2_RW_ID = 36,
701bd4fe43Sopenharmony_ci    HI_EFUSE_PG2GCCKA1_TRIM2_RW_ID = 37,
711bd4fe43Sopenharmony_ci    HI_EFUSE_NVRAM_PA2GA0_TRIM2_RW_ID = 38,
721bd4fe43Sopenharmony_ci    HI_EFUSE_NVRAM_PA2GA1_TRIM2_RW_ID = 39,
731bd4fe43Sopenharmony_ci    HI_EFUSE_TEE_BOOT_VER_RW_ID = 40,
741bd4fe43Sopenharmony_ci    HI_EFUSE_TEE_KERNEL_VER_RW_ID = 41,
751bd4fe43Sopenharmony_ci    HI_EFUSE_TEE_SALT_RW_ID = 42,
761bd4fe43Sopenharmony_ci    HI_EFUSE_FLASH_ENCPY_CNT0_RW_ID = 43,
771bd4fe43Sopenharmony_ci    HI_EFUSE_FLASH_ENCPY_CNT1_RW_ID = 44,
781bd4fe43Sopenharmony_ci    HI_EFUSE_FLASH_ENCPY_CNT2_RW_ID = 45,
791bd4fe43Sopenharmony_ci    HI_EFUSE_FLASH_ENCPY_CFG_RW_ID = 46,
801bd4fe43Sopenharmony_ci    HI_EFUSE_FLASH_SCRAMBLE_EN_RW_ID = 47,
811bd4fe43Sopenharmony_ci    HI_EFUSE_USER_FLASH_IND_RW_ID = 48,
821bd4fe43Sopenharmony_ci    HI_EFUSE_RF_PDBUFFER_GCAL_RW_ID = 49,
831bd4fe43Sopenharmony_ci    HI_EFUSE_CUSTOMER_RSVD1_RW_ID = 50,
841bd4fe43Sopenharmony_ci    HI_EFUSE_DIE_2_RW_ID = 51,
851bd4fe43Sopenharmony_ci    HI_EFUSE_SEC_BOOT_RW_ID = 52,
861bd4fe43Sopenharmony_ci    HI_EFUSE_IDX_MAX,
871bd4fe43Sopenharmony_ci} hi_efuse_idx;
881bd4fe43Sopenharmony_ci
891bd4fe43Sopenharmony_citypedef enum {
901bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_CHIP_ID = 0,
911bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_DIE_ID = 1,
921bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_PMU_FUSE1_FUSE2_START_TYPE_TSENSOR_ID = 2,
931bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_ROOT_PUBKEY_ID = 3,
941bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_ROOT_KEY_ID = 4,
951bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_CUSTOMER_RSVD0_ID = 5,
961bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_SUBKEY_CAT_ID = 6,
971bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_ENCRYPT_RSIM_ID = 7,
981bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_JTM_ID = 8,
991bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_UTM0_ID = 9,
1001bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_UTM1_ID = 10,
1011bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_UTM2_ID = 11,
1021bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_SDC_ID = 12,
1031bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_RSVD0_ID = 13,
1041bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_SSS_CORNER_ID = 14,
1051bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_UART_HALT_INTERVAL_ID = 15,
1061bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_CHIP_BK_ID = 16,
1071bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_IPV4_IPV6_MAC_ADDR_ID = 17,
1081bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_PG2GCCKA0_PG2GCCKA1_TRIM0_ID = 18,
1091bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_NVRAM_PA2GA0_PA2GA1_TRIM0_ID = 19,
1101bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_PG2GCCKA0_PG2GCCKA1_TRIM1_ID = 20,
1111bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_NVRAM_PA2GA0_PA2GA1_TRIM1_ID = 21,
1121bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_PG2GCCKA0_PG2GCCKA1_TRIM2_ID = 22,
1131bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_NVRAM_PA2GA0_PA2GA1_TRIM2_ID = 23,
1141bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_TEE_BOOT_VER_ID = 24,
1151bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_TEE_KERNEL_VER_ID = 25,
1161bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_TEE_SALT_ID = 26,
1171bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_FLASH_ENCPY_CNT0_ID = 27,
1181bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_FLASH_ENCPY_CNT1_ID = 28,
1191bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_FLASH_ENCPY_CNT2_ID = 29,
1201bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_FLASH_ENCPY_CFG_ID = 30,
1211bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_FLASH_SCRAMBLE_EN_FLASH_IND_ID = 31,
1221bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_RF_PDBUFFER_GCAL_ID = 32,
1231bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_CUSTOMER_RSVD1_ID = 33,
1241bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_DIE_2_ID = 34,
1251bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_KDF2ECC_HUK_DISABLE_ID = 35,
1261bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_FLASH_ENCPY_CNT3_ID = 36,
1271bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_FLASH_ENCPY_CNT4_ID = 37,
1281bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_FLASH_ENCPY_CNT5_ID = 38,
1291bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_SEC_BOOT_ID = 39,
1301bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_DSLEEP_FLAG_ID = 40,
1311bd4fe43Sopenharmony_ci    HI_EFUSE_LOCK_MAX,
1321bd4fe43Sopenharmony_ci} hi_efuse_lock_id;
1331bd4fe43Sopenharmony_ci
1341bd4fe43Sopenharmony_ci/**
1351bd4fe43Sopenharmony_ci* @ingroup  iot_efuse
1361bd4fe43Sopenharmony_ci* @brief Obtains the preset length of each eFUSE area.CNcomment:根据EFUSE ID号获取该EFUSE数据长度。CNend
1371bd4fe43Sopenharmony_ci*
1381bd4fe43Sopenharmony_ci* @par 描述:
1391bd4fe43Sopenharmony_ci*           Obtains the preset length of each eFUSE area.CNcomment:获取EFUSE数据长度。CNend
1401bd4fe43Sopenharmony_ci*
1411bd4fe43Sopenharmony_ci* @attention None
1421bd4fe43Sopenharmony_ci* @param  efuse_id  [IN]  type #hi_efuse_idx,EFUSE ID
1431bd4fe43Sopenharmony_ci*
1441bd4fe43Sopenharmony_ci* @retval #HI_ERR_EFUSE_INVALIDATE_ID Invalid ID.CNcomment: 无效EFUSE ID。CNend
1451bd4fe43Sopenharmony_ci* @retval #Other Length of EFUSE data.(Unit bytes).CNcomment: EFUSE数据长度(单位为bit)。CNend
1461bd4fe43Sopenharmony_ci* @par 依赖:
1471bd4fe43Sopenharmony_ci*            @li hi_efuse.h:Describes the encryption and decryption APIs.
1481bd4fe43Sopenharmony_ciCNcomment:文件用于描述efuse字段操作相关接口。CNend
1491bd4fe43Sopenharmony_ci* @see  hi_efuse_get_id_size。
1501bd4fe43Sopenharmony_ci*/
1511bd4fe43Sopenharmony_cihi_u32 hi_efuse_get_id_size(hi_efuse_idx efuse_id);
1521bd4fe43Sopenharmony_ci
1531bd4fe43Sopenharmony_ci/**
1541bd4fe43Sopenharmony_ci* @ingroup  iot_efuse
1551bd4fe43Sopenharmony_ci* @brief Reads the eFUSE.CNcomment:EFUSE读取数据。CNend
1561bd4fe43Sopenharmony_ci*
1571bd4fe43Sopenharmony_ci* @par 描述:
1581bd4fe43Sopenharmony_ci*           Reads the eFUSE.CNcomment:从EFUSE中读取数据。CNend
1591bd4fe43Sopenharmony_ci*
1601bd4fe43Sopenharmony_ci* @attention Ensure that the value of (data_len*8) is not less than efuse_id and the length of the efuse field is 8bit
1611bd4fe43Sopenharmony_ci*            aligned.CNcomment:需保证(data_len*8)不小于efuse_id对应efuse字段的长度向上8bit对齐。CNend
1621bd4fe43Sopenharmony_ci*
1631bd4fe43Sopenharmony_ci* @param  efuse_id [IN]  type #hi_efuse_idx,EFUSE ID
1641bd4fe43Sopenharmony_ci* @param  data     [OUT] type #hi_u8*,Address for saving the read data.CNcomment:读到的数据放到该地址。CNend
1651bd4fe43Sopenharmony_ci* @param  data_len [IN]  type #hi_u8 Space allocated to data, in bytes.CNcomment:给data分配的空间,单位byte。CNend
1661bd4fe43Sopenharmony_ci*
1671bd4fe43Sopenharmony_ci* @retval #0         Success
1681bd4fe43Sopenharmony_ci* @retval #Other     Failure. For details, see hi_errno.h.
1691bd4fe43Sopenharmony_ci* @par 依赖:
1701bd4fe43Sopenharmony_ci*            @li hi_efuse.h:Describes the encryption and decryption APIs.
1711bd4fe43Sopenharmony_ciCNcomment:文件用于描述efuse字段操作相关接口。CNend
1721bd4fe43Sopenharmony_ci* @see  hi_efuse_write。
1731bd4fe43Sopenharmony_ci*/
1741bd4fe43Sopenharmony_cihi_u32 hi_efuse_read(hi_efuse_idx efuse_id, hi_u8 *data, hi_u8 data_len);
1751bd4fe43Sopenharmony_ci
1761bd4fe43Sopenharmony_ci/**
1771bd4fe43Sopenharmony_ci* @ingroup  iot_efuse
1781bd4fe43Sopenharmony_ci* @brief Writes the eFUSE.CNcomment:写数据到EFUSE。CNend
1791bd4fe43Sopenharmony_ci*
1801bd4fe43Sopenharmony_ci* @par 描述:
1811bd4fe43Sopenharmony_ci*           Writes the eFUSE.CNcomment:写数据到EFUSE。CNend
1821bd4fe43Sopenharmony_ci*
1831bd4fe43Sopenharmony_ci* @attention None
1841bd4fe43Sopenharmony_ci* @param  efuse_id  [IN] type #hi_efuse_idx,EFUSE ID
1851bd4fe43Sopenharmony_ci* @param  data      [IN] type #const hi_u8*,Data to be written to the eFUSE.CNcomment:写该数据到EFUSE中。CNend
1861bd4fe43Sopenharmony_ci*
1871bd4fe43Sopenharmony_ci* @retval #0         Success
1881bd4fe43Sopenharmony_ci* @retval #Other     Failure. For details, see hi_errno.h.
1891bd4fe43Sopenharmony_ci* @par 依赖:
1901bd4fe43Sopenharmony_ci*            @li hi_efuse.h:Describes the encryption and decryption APIs.
1911bd4fe43Sopenharmony_ciCNcomment:文件用于描述efuse字段操作相关接口。CNend
1921bd4fe43Sopenharmony_ci* @see  hi_efuse_read。
1931bd4fe43Sopenharmony_ci*/
1941bd4fe43Sopenharmony_cihi_u32 hi_efuse_write(hi_efuse_idx efuse_id, const hi_u8 *data);
1951bd4fe43Sopenharmony_ci
1961bd4fe43Sopenharmony_ci/**
1971bd4fe43Sopenharmony_ci* @ingroup  iot_efuse
1981bd4fe43Sopenharmony_ci* @brief Locks an area in the eFUSE. After the lock takes effect upon reboot, the area cannot be written.
1991bd4fe43Sopenharmony_ciCNcomment:加锁EFUSE中的某个区域,加锁后重启单板生效,该区域无法再写入。CNend
2001bd4fe43Sopenharmony_ci*
2011bd4fe43Sopenharmony_ci* @par 描述:
2021bd4fe43Sopenharmony_ci*           Locks an area in the eFUSE. After the lock takes effect upon reboot, the area cannot be written.
2031bd4fe43Sopenharmony_ciCNcomment:加锁EFUSE中的某个区域,加锁后重启单板生效,该区域无法再写入。CNend
2041bd4fe43Sopenharmony_ci*
2051bd4fe43Sopenharmony_ci* @attention None
2061bd4fe43Sopenharmony_ci* @param  lock_id  [IN] type #hi_efuse_lock_id,eFUSE ID to be locked.CNcomment:待加锁的EFUSE ID项。CNend
2071bd4fe43Sopenharmony_ci*
2081bd4fe43Sopenharmony_ci* @retval #0         Success
2091bd4fe43Sopenharmony_ci* @retval #Other     Failure. For details, see hi_errno.h.
2101bd4fe43Sopenharmony_ci* @par 依赖:
2111bd4fe43Sopenharmony_ci*            @li hi_efuse.h:Describes the encryption and decryption APIs.
2121bd4fe43Sopenharmony_ciCNcomment:文件用于描述efuse字段操作相关接口。CNend
2131bd4fe43Sopenharmony_ci* @see  hi_efuse_write。
2141bd4fe43Sopenharmony_ci*/
2151bd4fe43Sopenharmony_cihi_u32 hi_efuse_lock(hi_efuse_lock_id lock_id);
2161bd4fe43Sopenharmony_ci
2171bd4fe43Sopenharmony_ci/**
2181bd4fe43Sopenharmony_ci* @ingroup  iot_efuse
2191bd4fe43Sopenharmony_ci* @brief Obtains the lock status of the eFUSE and queries which areas are locked.
2201bd4fe43Sopenharmony_ciCNcomment:获取EFUSE的锁状态,查询哪些区域已锁定。CNend
2211bd4fe43Sopenharmony_ci*
2221bd4fe43Sopenharmony_ci* @par 描述:
2231bd4fe43Sopenharmony_ci*           Obtains the lock status of the eFUSE and queries which areas are locked.
2241bd4fe43Sopenharmony_ciCNcomment:获取EFUSE的锁状态,查询哪些区域已锁定。CNend
2251bd4fe43Sopenharmony_ci*
2261bd4fe43Sopenharmony_ci* @attention None
2271bd4fe43Sopenharmony_ci* @param  lock_stat   [OUT] type #hi_u64*,Lock status of the eFUSE.CNcomment:获取EFUSE的锁状态。CNend
2281bd4fe43Sopenharmony_ci*
2291bd4fe43Sopenharmony_ci* @retval #0         Success
2301bd4fe43Sopenharmony_ci* @retval #Other     Failure. For details, see hi_errno.h.
2311bd4fe43Sopenharmony_ci* @par 依赖:
2321bd4fe43Sopenharmony_ci*            @li hi_efuse.h:Describes the encryption and decryption APIs.
2331bd4fe43Sopenharmony_ciCNcomment:文件用于描述efuse字段操作相关接口。CNend
2341bd4fe43Sopenharmony_ci* @see  hi_efuse_write。
2351bd4fe43Sopenharmony_ci*/
2361bd4fe43Sopenharmony_cihi_u32 hi_efuse_get_lockstat(hi_u64 *lock_stat);
2371bd4fe43Sopenharmony_ci
2381bd4fe43Sopenharmony_ci/**
2391bd4fe43Sopenharmony_ci* @ingroup  iot_efuse
2401bd4fe43Sopenharmony_ci* @brief Reads the user eFUSE.CNcomment:EFUSE用户读取数据。CNend
2411bd4fe43Sopenharmony_ci*
2421bd4fe43Sopenharmony_ci* @par 描述:
2431bd4fe43Sopenharmony_ci*            Reads a reserved area in the eFUSE.CNcomment:用户从EFUSE中读取数据。CNend
2441bd4fe43Sopenharmony_ci*
2451bd4fe43Sopenharmony_ci* @attention None
2461bd4fe43Sopenharmony_ci* @param  start_bit  [IN]  type #hi_u16,Start bit. The address must be 8-bit aligned.
2471bd4fe43Sopenharmony_ciCNcomment:起始bit位,该地址必须8bit对齐。CNend
2481bd4fe43Sopenharmony_ci* @param  size       [IN]  type #hi_u16,Number of bits to be read. If the input is not 8-bit aligned,
2491bd4fe43Sopenharmony_ci* the function performs 8-bit alignment internally. The user needs to process the read data before using it.
2501bd4fe43Sopenharmony_ciCNcomment:待读取的bit位数,如果输入不是8bit对齐则函数内部会处理为8bit对齐,用户读取数据后需处理后使用。CNend
2511bd4fe43Sopenharmony_ci* @param  key_data  [OUT]  type #hi_u8*,Address for saving the read data.
2521bd4fe43Sopenharmony_ciCNcommnet:读到的数据放到该地址。CNend
2531bd4fe43Sopenharmony_ci*
2541bd4fe43Sopenharmony_ci* @retval #0         Success
2551bd4fe43Sopenharmony_ci* @retval #Other     Failure. For details, see hi_errno.h.
2561bd4fe43Sopenharmony_ci* @par 依赖:
2571bd4fe43Sopenharmony_ci*            @li hi_efuse.h:Describes the encryption and decryption APIs.
2581bd4fe43Sopenharmony_ciCNcomment:文件用于描述efuse字段操作相关接口。CNend
2591bd4fe43Sopenharmony_ci* @see  hi_efuse_usr_write。
2601bd4fe43Sopenharmony_ci*/
2611bd4fe43Sopenharmony_cihi_u32 hi_efuse_usr_read(hi_u16 start_bit, hi_u16 size, hi_u8 *key_data);
2621bd4fe43Sopenharmony_ci
2631bd4fe43Sopenharmony_ci/**
2641bd4fe43Sopenharmony_ci* @ingroup  iot_efuse
2651bd4fe43Sopenharmony_ci* @brief Writes data to reserved area of the eFUSE.CNcomment:EFUSE用户区写入数据。CNend
2661bd4fe43Sopenharmony_ci*
2671bd4fe43Sopenharmony_ci* @par 描述:
2681bd4fe43Sopenharmony_ci*           Writes data to reserved area of the eFUSE.CNcomment:用户往EFUSE写入数据。CNend
2691bd4fe43Sopenharmony_ci*
2701bd4fe43Sopenharmony_ci* @attention Generally, this API is used to write a reserved area. To write other pre-allocated areas,
2711bd4fe43Sopenharmony_ci*            should check the design spec to avoid conflict.CNcomment:支持用户写入任意地址数据,
2721bd4fe43Sopenharmony_ci建议用户使用用户预留区,其他区域的写入需要结合方案文档评估是否有冲突。CNend
2731bd4fe43Sopenharmony_ci*
2741bd4fe43Sopenharmony_ci* @param  start_bit  [IN] type  #hi_u16,Start bit.CNcomment:起始bit位。CNend
2751bd4fe43Sopenharmony_ci* @param  size       [IN] type  #hi_u16,Number of bits to be written. 1-to-256-bit write is supported.
2761bd4fe43Sopenharmony_ciCNcomment:待写入bit数,支持单bit写入,最大值为256bit数。CNend
2771bd4fe43Sopenharmony_ci* @param  key_data  [IN]  type  #const hi_u8*,Address for the data to be written. The maximum length is 32 bytes.
2781bd4fe43Sopenharmony_ciCNcomment:待写入的数据放到该地址,最长为32byte。CNend
2791bd4fe43Sopenharmony_ci*
2801bd4fe43Sopenharmony_ci* @retval #0         Success
2811bd4fe43Sopenharmony_ci* @retval #Other     Failure. For details, see hi_errno.h.
2821bd4fe43Sopenharmony_ci* @par 依赖:
2831bd4fe43Sopenharmony_ci*            @li hi_efuse.h:Describes the encryption and decryption APIs.
2841bd4fe43Sopenharmony_ciCNcomment:文件用于描述efuse字段操作相关接口。CNend
2851bd4fe43Sopenharmony_ci* @see  hi_efuse_usr_read。
2861bd4fe43Sopenharmony_ci*/
2871bd4fe43Sopenharmony_cihi_u32 hi_efuse_usr_write(hi_u16 start_bit, hi_u16 size, const hi_u8 *key_data);
2881bd4fe43Sopenharmony_ci
2891bd4fe43Sopenharmony_ci#ifdef __cplusplus
2901bd4fe43Sopenharmony_ci#if __cplusplus
2911bd4fe43Sopenharmony_ci}
2921bd4fe43Sopenharmony_ci#endif
2931bd4fe43Sopenharmony_ci#endif /* __cplusplus */
2941bd4fe43Sopenharmony_ci
2951bd4fe43Sopenharmony_ci#endif /* __HI_EFUSE_H__ */
296