• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * @file hi_boot_rom.h
3  *
4  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /** @defgroup iot_romboot BootRom */
19 #ifndef _HI_BOOT_ROM_H_
20 #define _HI_BOOT_ROM_H_
21 #include <hi_types.h>
22 #include <hi_boot_err.h>
23 #include <hi3861_platform.h>
24 #include <boot_rom.h>
25 
26 /** @defgroup iot_reg Registers APIs
27 * @ingroup  iot_romboot
28 */
29 /**
30 * @ingroup iot_reg
31 *
32 */
33 #define hi_reg_write(addr, val)            (*(volatile hi_u32*)(uintptr_t)(addr) = (val))
34 
35 /**
36 * @ingroup iot_reg
37 *
38 */
39 #define hi_reg_read(addr, val)             ((val) = *(volatile hi_u32*)(uintptr_t)(addr))
40 
41 /**
42 * @ingroup iot_reg
43 *
44 */
45 #define hi_reg_write16(addr, val)          (*(volatile hi_u16*)(uintptr_t)(addr) = (val))
46 
47 /**
48 * @ingroup iot_reg
49 *
50 */
51 #define hi_reg_read16(addr, val)           ((val) = *(volatile hi_u16*)(uintptr_t)(addr))
52 
53 /**
54 * @ingroup iot_reg
55 *
56 */
57 #define hi_reg_read_val32(addr)            (*(volatile hi_u32*)(uintptr_t)(addr))
58 
59 /**
60 * @ingroup iot_reg
61 *
62 */
63 #define hi_reg_read_val16(addr)            (*(volatile hi_u16*)(uintptr_t)(addr))
64 
65 /**
66 * @ingroup iot_reg
67 *
68 */
69 #define hi_reg_setbitmsk(addr, msk)        ((hi_reg_read_val32(addr)) |= (msk))
70 
71 /**
72 * @ingroup iot_reg
73 *
74 */
75 #define hi_reg_clrbitmsk(addr, msk)        ((hi_reg_read_val32(addr)) &= ~(msk))
76 
77 /**
78 * @ingroup iot_reg
79 *
80 */
81 #define hi_reg_clrbit(addr, pos)           ((hi_reg_read_val32(addr)) &= ~((hi_u32)(1) << (pos)))
82 
83 /**
84 * @ingroup iot_reg
85 *
86 */
87 #define hi_reg_setbit(addr, pos)           ((hi_reg_read_val32(addr)) |= ((hi_u32)(1) << (pos)))
88 
89 /**
90 * @ingroup iot_reg
91 *
92 */
93 #define hi_reg_clrbits(addr, pos, bits)    (hi_reg_read_val32(addr) &= ~((((hi_u32)1 << (bits)) - 1) << (pos)))
94 
95 /**
96 * @ingroup iot_reg
97 *
98 */
99 #define hi_reg_clrbits16(addr, pos, bits)  (hi_reg_read_val16(addr) &= ~((((unsigned short)1 << (bits)) - 1) << (pos)))
100 
101 /**
102 * @ingroup iot_reg
103 *
104 */
105 #define hi_reg_clrbit16(addr, pos)       ((hi_reg_read_val16(addr)) &= ~((unsigned short)(1) << (pos)))
106 
107 /**
108 * @ingroup iot_reg
109 *
110 */
111 #define hi_reg_setbit16(addr, pos)       ((hi_reg_read_val16(addr)) |= ((unsigned short)(1) << (pos)))
112 
113 /** @defgroup iot_time time APIs
114 * @ingroup iot_romboot
115 */
116 /**
117 * @ingroup  iot_time
118 * @brief  Delay, in microseconds.CNcomment:延时,毫秒级。CNend
119 *
120 * @par 描述:
121 *           Delay operation implemented by software based on the system clock, blocking the CPU.
122 CNcomment:延时操作,阻塞CPU。CNend
123 *
124 * @attention None
125 *
126 * @param  msecs                [IN] type #hi_u32,delay period (unit: millisecond).
127 CNcomment:延时时间(单位:ms)。CNend
128 *
129 * @retval  None
130 * @par 依赖:
131 *            @li hi_boot_rom.h:Describes BootRom APIs.CNcomment:文件包含BootRom相关接口。CNend
132 * @see  None
133 */
134 hi_void mdelay(hi_u32 msecs);
135 
136 /**
137 * @ingroup  iot_time
138 * @brief  Delay, in microseconds.CNcomment:延时,微秒级。CNend
139 *
140 * @par 描述:
141 *           Delay operation implemented by software based on the system clock, blocking the CPU.
142 CNcomment:延时操作,阻塞CPU。CNend
143 *
144 * @attention None
145 *
146 * @param  usecs                [IN] type #hi_u32,delay period (unit: microsecond).
147 CNcomment:延时时间(单位:μs)。CNend
148 *
149 * @retval  None
150 * @par 依赖:
151 *            @li hi_boot_rom.h:Describes BootRom APIs.CNcomment:文件包含BootRom相关接口。CNend
152 * @see  None
153 */
154 hi_void udelay(hi_u32 usecs);
155 
156 extern hi_u32 memcmp(const hi_void *cs, const hi_void *ct, hi_u32 count);
157 
158 /** @defgroup iot_secure_c Secure C library APIs
159 * @ingroup iot_romboot
160 */
161 /**
162 * @ingroup  iot_secure_c
163 * @brief  Sets the size of the destination buffer to a specific value.
164 CNcomment:设置目的缓冲区为特定值。CNend
165 *
166 * @par 描述: Sets the size of the destination buffer to a specific value.
167 CNcomment:设置目的缓冲区为特定值。CNend
168 * @attention None
169 *
170 * @param dest     [IN] type #hi_void *, Destination buffer.CNcomment:目的缓冲区。CNend
171 * @param dest_max [IN] type #hi_u32, Size of the destination buffer.CNcomment:目的缓冲区大小。CNend
172 * @param c        [IN] type #hi_u8, Specific value.CNcomment:特定值。CNend
173 * @param count    [IN] type #hi_u32, Number of specific values set in destination buffer.
174 CNcomment:目的缓冲区设置特定值的个数。CNend
175 * @param  check_sum [IN] type #hi_u32,Exclusive or of the above four parameter values,used as security check.
176 *                 example:check_sum = (uintptr_t)dest ^ (uintptr_t)dest_max ^ (uintptr_t)c ^ (uintptr_t)count.
177 CNcomment:上面4个参数值的异或,用作安全检查,
178 示例:check_sum = (uintptr_t)dest ^ (uintptr_t)dest_max ^ (uintptr_t)c ^ (uintptr_t)count。CNend
179 *
180 * @retval #EOK Success
181 * @retval #Other Failure
182 *
183 * @par 依赖:
184 * @li hi_boot_rom.h: This file declares the APIs.CNcomment:该接口声明所在的头文件。CNend
185 * @see None
186 */
187 hi_u32 memset_s(hi_void *dest, hi_u32 dest_max, hi_u8 c, hi_u32 count, hi_u32 check_sum);
188 
189 /**
190 * @ingroup  iot_secure_c
191 * @brief  Copies the data from the source buffer to the destination buffer.
192 CNcomment:复制源缓冲区的数据到目的缓冲区。CNend
193 *
194 * @par 描述: Copies the data from the source buffer to the destination buffer.
195 CNcomment:复制源缓冲区的数据到目的缓冲区。CNend
196 * @attention None
197 *
198 * @param dest     [IN] type #hi_void *, Destination buffer.CNcomment:目的缓冲区。CNend
199 * @param dest_max [IN] type #hi_u32, Size of the destination buffer.CNcomment:目的缓冲区大小。CNend
200 * @param src      [IN] type #const hi_void *, Source buffer.CNcomment:源缓冲区。CNend
201 * @param count    [IN] type #hi_u32, Number of characters copied from the source buffer.
202 CNcomment:从源缓冲区中复制的字符数。CNend
203 * @param  check_sum [IN] type #hi_u32,Exclusive or of the above four parameter values,used as security check.
204 *               example:check_sum = (uintptr_t)dest ^ (uintptr_t)dest_max ^ (uintptr_t)src ^ (uintptr_t)count.
205 CNcomment:上面4个参数值的异或,用作安全检查,
206 示例:check_sum = (uintptr_t)dest ^ (uintptr_t)dest_max ^ (uintptr_t)src ^ (uintptr_t)count。CNend
207 *
208 * @retval #EOK Success
209 * @retval #Other Failure
210 *
211 * @par 依赖:
212 * @li hi_boot_rom.h: This file declares the APIs.CNcomment:该接口声明所在的头文件。CNend
213 * @see None
214 */
215 hi_u32 memcpy_s(hi_void *dest, hi_u32 dest_max, const hi_void *src, hi_u32 count, hi_u32 check_sum);
216 
217 /** @defgroup iot_dfx Debug APIs
218 * @ingroup iot_romboot
219 */
220 /**
221  * @ingroup iot_dfx
222  *
223  * Print error code type, 0x3615 and its previous value cannot be modified.
224  CNcomment:打印错误码类型,0x3615及之前的值不可修改。CNend
225  */
226 typedef enum {
227     HI_PRINT_ERRNO_UART_INIT = 0x3600,              /* UART authentication initialization failed */
228     HI_PRINT_ERRNO_LOADER_ERR = 0x3601,             /* Failed to load loaderboot */
229     HI_PRINT_ERRNO_BOOT_DECRYPT_ERR = 0x3602,       /* Boot decryption failed */
230     HI_PRINT_ERRNO_BOOT_LEN_ERR = 0x3603,           /* Boot length check failed */
231     HI_PRINT_ERRNO_BOOT_HEAD_ERR = 0x3604,          /* Boot header verification failed */
232     HI_PRINT_ERRNO_BOOT_SECURE_BOOT_ERR = 0x3605,   /* Secure boot read failed */
233     HI_PRINT_ERRNO_BOOT_ROOT_KEY_LEN_ERR = 0x3606,  /* Rootkye length incorrect */
234     HI_PRINT_ERRNO_BOOT_ROOT_KEY_ERR = 0x3607,      /* Rootkey certificate failed */
235     HI_PRINT_ERRNO_BOOT_READ_ENCPT_ERR = 0x3608,    /* Secure flag read failed */
236     HI_PRINT_ERRNO_BOOT_SUB_KEY_LEN_ERR = 0x3609,   /* Subkey length incorrect */
237     HI_PRINT_ERRNO_BOOT_SUB_KEY_CAT_ERR = 0x360A,   /* Subkey category is incorrect */
238     HI_PRINT_ERRNO_BOOT_SUB_KEY_RSIM_ERR = 0x360B,  /* Subkey rsim verification failed */
239     HI_PRINT_ERRNO_BOOT_SUB_KEY_ERR = 0x360C,       /* Subkey authentication failed */
240     HI_PRINT_ERRNO_BOOT_CODE_VERIFY_ERR = 0x360D,   /* Code verification failed */
241     HI_PRINT_ERRNO_BOOT_DIE_ID_ERR = 0x360E,        /* Die ID verification failed */
242     HI_PRINT_ERRNO_BOOT_VER_ERR = 0x360F,           /* Flash boot version number verification failed */
243     HI_PRINT_ERRNO_BOOT_GET_TAIL_ERR = 0x3610,      /* Failed to get flash tail address */
244     HI_PRINT_ERRNO_BOOT_BACKUP_TAIL_ERR = 0x3611,   /* Backup flash boot magic word and length verification failed */
245     HI_PRINT_ERRNO_BOOT_MAIN_CHECK_ERR = 0x3612,    /* Fail to check the integrity of the main flashboot
246                                                        in non-secure boot */
247     HI_PRINT_ERRNO_BOOT_BACKUP_CHECK_ERR = 0x3613,  /* Fail to check the integrity of the backup flashboot
248                                                        in non-secure boot */
249     HI_PRINT_ERRNO_MALLOC_EXAUST_ERR = 0x3614,      /* Out of heap memory */
250     HI_PRINT_ERRNO_MALLOC_STRUCT_ERR = 0x3615,      /* Heap memory management structure destroyed */
251     HI_PRINT_ERRNO_NO_ENCPT_CNT_LEFT_ERR = 0x3616,  /* Flash encryption burn out times */
252     HI_PRINT_ERRNO_CRYPTO_PREPARE_ERR = 0x3617,     /* Flash encryption and decryption preparation failed */
253     HI_PRINT_ERRNO_CRYPTO_KEY_EMPTY_ERR = 0x3618,   /* Flash encryption and decryption work key is empty */
254     HI_PRINT_ERRNO_CRYPTO_KEY_INVALID_ERR = 0x3619, /* Flash encryption and decryption work key is invalid */
255     HI_PRINT_ERRNO_CRYPTO_KEY_SAVE_ERR = 0x361A,    /* Flash encryption and decryption work key save failed */
256     HI_PRINT_ERRNO_CRYPTO_KEY_DECRYPT_ERR = 0x361B, /* Flash encryption and decryption work key decryption failed */
257     HI_PRINT_ERRNO_CRYPTO_FW_DECRYPT_ERR = 0x361C,  /* Flash encryption and decryption kernel decryption failed */
258     HI_PRINT_ERRNO_CRYPTO_FW_ENCRYPT_ERR = 0x361D,  /* Flash encryption and decryption kernel encryption failed */
259     HI_PRINT_ERRNO_CRYPTO_NV_ENCRYPT_ERR = 0x361E,  /* Flash encryption and decryption NV area encryption failed */
260     HI_PRINT_ERRNO_CRYPTO_CHECK_KERNEL_ERR = 0x361F,  /* Flash encryption and decryption check kernel failed */
261     HI_PRINT_ERRNO_CRYPTO_KERNEL_ADDR_ERR = 0x3620, /* Flash encryption and decryption check kernel addr failed */
262     HI_PRINT_ERRNO_UPG_CRYPTO_PREPARE_ERR = 0x3621, /* Upg file decryption preparation failed */
263     HI_PRINT_ERRNO_UPG_CRYPTO_DECRYPT_ERR = 0x3622, /* Upg file decryption failed */
264     HI_PRINT_ERRNO_CRYPTO_SALT_EMPTY_ERR = 0x3623,  /* Flash encryption and decryption root key salt is empty */
265     HI_PRINT_ERRNO_IDX_MAX,                         /* Error code type maximum */
266 } hi_print_errno;
267 
268 /**
269 * @ingroup  iot_dfx
270 * @brief  The error code is forced to be printed out in romboot. The hi_print_errno definition cannot be modified.
271 CNcomment:romboot中强制打印输出错误码,不可修改hi_print_errno定义。CNend
272 *
273 * @par 描述:
274 *           Force to print out error codes to help users locate errors.
275 CNcomment:强制打印输出错误码,帮助用户定位错误。CNend
276 *
277 * @attention None.
278 *
279 * @param  print_errno [IN] type #hi_u32, error code.
280 *
281 * @retval None.
282 * @par 依赖:
283 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
284 * @see  boot_puthex|boot_msg0|boot_msg1|boot_msg2|boot_msg4.
285 */
286 hi_void boot_put_errno(hi_u32 print_errno);
287 
288 /**
289 * @ingroup  iot_dfx
290 * @brief  Output hexadecimal number.CNcomment:输出16进制数。CNend
291 *
292 * @par 描述:
293 *           Output hexadecimal number.CNcomment:输出16进制数。CNend
294 *
295 * @attention None.
296 *
297 * @param  h [IN] type #hi_u32,  Hexadecimal number to output.
298 * @param  print0 [IN] type #hi_bool, HI_TRUE: fill 0 to 4 bytes when printing. HI_FALSE: do not fill 0 alignment.
299 *
300 * @retval None.
301 * @par 依赖:
302 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
303 * @see  boot_put_errno|boot_msg0|boot_msg1|boot_msg2|boot_msg4.
304 */
305 hi_void boot_puthex(hi_u32 h, hi_bool print0);
306 
307 /**
308 * @ingroup  iot_dfx
309 * @brief  Printout information, string only.CNcomment:打印输出信息,只输出字符串。CNend
310 *
311 * @par 描述:
312 *           Printout information, string only.CNcomment:打印输出信息,只输出字符串。CNend
313 *
314 * @attention None.
315 *
316 * @param  s [IN] type #hi_char*,  String to output.
317 *
318 * @retval None.
319 * @par 依赖:
320 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
321 * @see  boot_put_errno|boot_puthex|boot_msg1|boot_msg2|boot_msg4.
322 */
323 hi_void boot_msg0(const hi_char *s);
324 
325 /**
326 * @ingroup  iot_dfx
327 * @brief  Print out information, output string and 1 values.CNcomment:打印输出信息,输出字符串及1个数值。CNend
328 *
329 * @par 描述:
330 *           Print out information, output string and 1 values.CNcomment:打印输出信息,输出字符串及1个数值。CNend
331 *
332 * @attention None.
333 *
334 * @param  s [IN] type #hi_char*,  String to output.
335 * @param  h [IN] type #hi_u32,  Value to be output, hexadecimal.
336 *
337 * @retval None.
338 * @par 依赖:
339 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
340 * @see  boot_put_errno|boot_puthex|boot_msg0|boot_msg2|boot_msg4.
341 */
342 hi_void boot_msg1(const hi_char *s, hi_u32 h);
343 
344 /**
345 * @ingroup  iot_dfx
346 * @brief  Print out information, output string and 2 values.CNcomment:打印输出信息,输出字符串及2个数值。CNend
347 *
348 * @par 描述:
349 *           Print out information, output string and 2 values.CNcomment:打印输出信息,输出字符串及2个数值。CNend
350 *
351 * @attention None.
352 *
353 * @param  s [IN] type #hi_char*,  String to output.
354 * @param  h1 [IN] type #hi_u32,  Value to be output 1, hexadecimal.
355 * @param  h2 [IN] type #hi_u32,  Value to be output 2, hexadecimal.
356 *
357 * @retval None.
358 * @par 依赖:
359 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
360 * @see  boot_put_errno|boot_puthex|boot_msg0|boot_msg1|boot_msg4.
361 */
362 hi_void boot_msg2(const hi_char *s, hi_u32 h1, hi_u32 h2);
363 
364 /**
365 * @ingroup  iot_dfx
366 * @brief  Print out information, output string and 4 values.CNcomment:打印输出信息,输出字符串及4个数值。CNend
367 *
368 * @par 描述:
369 *           Print out information, output string and 4 values.CNcomment:打印输出信息,输出字符串及4个数值。CNend
370 *
371 * @attention None.
372 *
373 * @param  s [IN] type #hi_char*,  String to output.
374 * @param  h1 [IN] type #hi_u32,  Value to be output 1, hexadecimal.
375 * @param  h2 [IN] type #hi_u32,  Value to be output 2, hexadecimal.
376 * @param  h3 [IN] type #hi_u32,  Value to be output 3, hexadecimal.
377 * @param  h4 [IN] type #hi_u32,  Value to be output 4, hexadecimal.
378 *
379 * @retval None.
380 * @par 依赖:
381 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
382 * @see  boot_put_errno|boot_puthex|boot_msg0|boot_msg1|boot_msg2.
383 */
384 hi_void boot_msg4(const hi_char *s, hi_u32 h1, hi_u32 h2, hi_u32 h3, hi_u32 h4);
385 
386 /** @defgroup iot_uart Uart APIs
387 * @ingroup iot_romboot
388 */
389 /**
390  * @ingroup iot_uart
391  *
392  * Uart ID. CNcomment:串口号。CNend
393  */
394 typedef enum {
395     UART0 = 0,    /* uart0 */
396     UART1 = 1,    /* uart1 */
397     UART2 = 2,    /* uart2 */
398     UART_MAX = 3,
399 } hi_uart;
400 
401 /**
402  * @ingroup iot_uart
403  *
404  * Uart parameter struct. CNcomment:串口参数结构体。CNend
405  */
406 typedef struct {
407     hi_u32 baudrate;          /* Baud rate */
408     hi_uchar databit;         /* 5; 6; 7; 8 */
409     hi_uchar stopbit;         /* 1:stop_bit 1;  2: stop_bit 2. */
410     hi_uchar parity;          /* 0: None; 1:Odd; 2:Even */
411     hi_uchar flow_ctrl;       /* 0: None; 1:rts&&cts. 2:only rts; 3:only cts */
412     hi_uchar fifoline_tx_int; /* 0:tx FIFO≤1/8full; 1:tx FIFO≤1/4full; 2:tx FIFO≤1/2full;
413                                  3:tx FIFO≤3/4full; 4:tx FIFO≤7/8full */
414     hi_uchar fifoline_rx_int; /* 0:rx FIFO≥1/8full; 1:rx FIFO≥1/4full; 2:rx FIFO≥1/2full;
415                                  3:rx FIFO≥3/4full; 4:rx FIFO≥7/8full */
416     hi_uchar fifoline_rts;    /* 0:rx FIFO≥1/8full; 1:rx FIFO≥1/4full; 2:rx FIFO≥1/2full;
417                                  3:rx FIFO≥3/4full; 4:rx FIFO≥7/8full */
418     hi_uchar pad;
419 } uart_param_stru;
420 
421 /**
422 * @ingroup  iot_uart
423 * @brief  Serial output forbidden.CNcomment:串口输出禁言。CNend
424 *
425 * @par 描述:
426 *           Serial output forbidden.CNcomment:串口输出禁言。CNend
427 *
428 * @attention None.
429 *
430 * @param  None.
431 *
432 * @retval None.
433 * @par 依赖:
434 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
435 * @see  serial_cancel_mute.
436 */
437 hi_void serial_set_mute(hi_void);
438 
439 /**
440 * @ingroup  iot_uart
441 * @brief  Cancel serial output forbidden.CNcomment:串口输出取消禁言。CNend
442 *
443 * @par 描述:
444 *           Cancel serial output forbidden.CNcomment:串口输出取消禁言。CNend
445 *
446 * @attention None.
447 *
448 * @param  None.
449 *
450 * @retval None.
451 * @par 依赖:
452 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
453 * @see  serial_set_mute.
454 */
455 hi_void serial_cancel_mute(hi_void);
456 
457 /**
458 * @ingroup  iot_uart
459 * @brief  Serial port initialization.CNcomment:串口初始化。CNend
460 *
461 * @par 描述:
462 *           Serial port initialization.CNcomment:串口初始化。CNend
463 *
464 * @attention None.
465 *
466 * @param  uart_num [IN] type #hi_uart, Uart ID.
467 * @param  default_uart_param [IN] type #uart_param_stru, Uart parameters.
468 *
469 * @retval #HI_ERR_FAILURE Failure.
470 * @retval #HI_ERR_SUCCESS Success.
471 * @par 依赖:
472 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
473 * @see  serial_init|serial_putc|serial_puts|serial_put_buf|serial_getc|serial_tstc|serial_puthex。
474 */
475 hi_u32 serial_init(hi_uart uart_num, uart_param_stru default_uart_param);
476 
477 /**
478 * @ingroup  iot_uart
479 * @brief  Serial output single character.CNcomment:串口输出单个字符。CNend
480 *
481 * @par 描述:
482 *           Serial output single character.CNcomment:串口输出单个字符。CNend
483 *
484 * @attention None.
485 *
486 * @param  c [IN] type #const hi_char, Char to output.
487 *
488 * @retval None.
489 * @par 依赖:
490 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
491 * @see  serial_init|serial_putc|serial_puts|serial_put_buf|serial_getc|serial_tstc|serial_puthex。
492 */
493 hi_void serial_putc(const hi_char c);
494 
495 /**
496 * @ingroup  iot_uart
497 * @brief  Serial output string.CNcomment:串口输出字符串。CNend
498 *
499 * @par 描述:
500 *           Serial output string.CNcomment:串口输出字符串。CNend
501 *
502 * @attention None.
503 *
504 * @param  s [IN] type #const hi_char*, String to output.
505 *
506 * @retval None.
507 * @par 依赖:
508 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
509 * @see  serial_init|serial_putc|serial_puts|serial_put_buf|serial_getc|serial_tstc|serial_puthex。
510 */
511 hi_void serial_puts(const hi_char *s);
512 
513 /**
514 * @ingroup  iot_uart
515 * @brief  Serial output character buffer, specify buffer length.CNcomment:串口输出字符缓冲区,指定缓冲区长度。CNend
516 *
517 * @par 描述:
518 *           Serial output character buffer, specify buffer length.CNcomment:串口输出字符缓冲区,指定缓冲区长度。CNend
519 *
520 * @attention The difference between the serial_puts() function is that the serial_puts function is for strings and
521 *            stops the output when '\ 0' is encountered. However, this interface is not affected by '\ 0' for a
522 *            specified length of character buffer.CNcomment:与serial_puts()函数的区别是:serial_puts函数是针对字符串,
523 *            遇到'\0'后停止输出;而本接口针对指定长度的字符缓冲区,不受'\0'影响。CNend
524 * @param  buffer [IN] type #const hi_char*,  String to output.
525 * @param  length [IN] type #hi_s32,          Length of string to be output.
526 *
527 * @retval None.
528 * @par 依赖:
529 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
530 * @see  serial_init|serial_putc|serial_puts|serial_put_buf|serial_getc|serial_tstc|serial_puthex。
531 */
532 hi_void serial_put_buf(const hi_char *buffer, hi_s32 length);
533 
534 /**
535 * @ingroup  iot_uart
536 * @brief  Read a character from the serial port.CNcomment:从串口读取一个字符。CNend
537 *
538 * @par 描述:
539 *           Read a character from the serial port.CNcomment:从串口读取一个字符。CNend
540 *
541 * @attention This function is a blocking interface. If the serial port does not receive characters, it will wait.
542 CNcomment:本函数为阻塞接口,如果串口没有接收到字符,会一直等待。CNend
543 * @param  None.
544 *
545 * @retval #Character    Characters read from serial port.
546 * @retval #-1           Failure.
547 * @par 依赖:
548 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
549 * @see  serial_init|serial_putc|serial_puts|serial_put_buf|serial_getc|serial_tstc|serial_puthex。
550 */
551 hi_u8 serial_getc(hi_void);
552 
553 /**
554 * @ingroup  iot_uart
555 * @brief  Whether the serial port has characters to be received.CNcomment:串口是否有字符待接收。CNend
556 *
557 * @par 描述:
558 *           Whether the serial port has characters to be received.CNcomment:串口是否有字符待接收。CNend
559 *
560 * @attention None.
561 * @param  None.
562 *
563 * @retval #0     Not received date from serial port.
564 * @retval #1     Received date from serial port.
565 * @par 依赖:
566 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
567 * @see  serial_init|serial_putc|serial_puts|serial_put_buf|serial_getc|serial_tstc|serial_puthex。
568 */
569 hi_s32 serial_tstc(hi_void);
570 
571 /**
572 * @ingroup  iot_uart
573 * @brief  Output hexadecimal number to serial port.CNcomment:向串口输出16进制数。CNend
574 *
575 * @par 描述:
576 *           向串口输出16进制数.CNcomment:向串口输出16进制数。CNend
577 *
578 * @attention None.
579 * @param  h         [IN] type #hi_u32,Hexadecimal number to be output.CNcomment:待输出的16进制数。CNend
580 * @param  print_all [IN] type #hi_u8 *,Whether to fill in 0, Align according to 4 bytes. 1 : fill, 0 : not to fill.
581 CNcomment:打印时前面是否补0,按照4字节对齐,1表示补,0表示不补。CNend
582 *
583 * @retval None.
584 * @par 依赖:
585 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
586 * @see  serial_init|serial_putc|serial_puts|serial_put_buf|serial_getc|serial_tstc|serial_puthex。
587 */
588 hi_void serial_puthex(hi_u32 h, hi_bool print_all);
589 
590 /**
591 * @ingroup  iot_uart
592 * @brief  Read a character from the serial port, and end if it is not read after waiting for the specified time.
593 CNcomment:从串口读取一个字符,等待指定时间后没有读到则结束。CNend
594 *
595 * @par 描述:
596 *           Read a character from the serial port, and end if it is not read after waiting for the specified time.
597 CNcomment:从串口读取一个字符,等待指定时间后没有读到则结束。CNend
598 *
599 * @attention None.
600 * @param  timeout_us    [IN] type #hi_u32,Specify timeout in us.CNcomment:指定超时时间,单位:us。CNend
601 * @param  ch            [IN] type #hi_u8 *,Output character.CNcomment:输出字符。CNend
602 *
603 * @retval #HI_ERR_FAILURE Failure.
604 * @retval #HI_ERR_SUCCESS Success.
605 * @par 依赖:
606 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
607 * @see  serial_init|serial_putc|serial_puts|serial_put_buf|serial_getc|serial_tstc|serial_puthex。
608 */
609 hi_u32 serial_getc_timeout(hi_u32 timeout_us, hi_u8 *ch);
610 
611 /** @defgroup iot_mem Memory APIs
612 * @ingroup iot_romboot
613 */
614 /**
615 * @ingroup  iot_mem
616 *
617 * Dynamic memory management module initialization interface function pointer.
618 CNcomment:动态内存管理模块初始化接口函数指针。CNend
619 */
620 typedef hi_void (*malloc_init_func)(hi_u32 heap_start_addr, hi_u32 heap_end_addr, hi_u32 check_sum);
621 
622 /**
623 * @ingroup  iot_mem
624 *
625 * Request dynamic memory interface function pointer.CNcomment:申请动态内存接口函数指针。CNend
626 */
627 typedef hi_void *(*malloc_func)(hi_u32 size);
628 
629 /**
630 * @ingroup  iot_mem
631 *
632 * Release dynamic memory interface function pointer.CNcomment:释放动态内存接口函数指针。CNend
633 */
634 typedef hi_u32 (*free_func)(hi_void *addr);
635 
636 /**
637 * @ingroup  iot_mem
638 *
639 * Input parameter of hi_register_malloc interface.
640 */
641 typedef struct {
642     malloc_init_func init;   /* Initialize heap memory interface */
643     malloc_func boot_malloc; /* Request heap memory interface */
644     free_func boot_free;     /* Release heap memory interface */
645 } hi_malloc_func;
646 
647 /**
648 * @ingroup  iot_mem
649 * @brief  To register malloc management related functions, be sure to register before using other interfaces.
650 CNcomment:注册malloc管理相关函数,务必先注册再使用其他接口。CNend
651 *
652 * @par 描述:
653 *           Support users to adapt memory management functions.CNcomment:支持用户自己适配内存管理函数。CNend
654 *
655 * @attention None.
656 * @param  addr      [IN] type #uintptr_t,Heap start address.CNcomment:堆空间起始地址。CNend
657 * @param  funcs     [IN] type #const hi_malloc_func *,Request memory related interface register structure pointer.
658 CNcomment:申请内存相关接口注册结构体指针。CNend
659 *
660 * @retval #HI_ERR_FAILURE Failure.
661 * @retval #HI_ERR_SUCCESS Success.
662 * @par 依赖:
663 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
664 * @see  boot_malloc_init|boot_malloc|boot_free。
665 */
666 hi_u32 hi_register_malloc(uintptr_t addr, const hi_malloc_func *funcs);
667 
668 /**
669 * @ingroup  iot_mem
670 * @brief  Heap initialize.CNcomment:堆空间初始化。CNend
671 *
672 * @par 描述:
673 *           Heap initialize.CNcomment:堆空间初始化。CNend
674 *
675 * @attention None.
676 * @param  heap_start_addr    [IN] type #uintptr_t,Heap start address.CNcomment:堆空间起始地址。CNend
677 * @param  heap_end_addr      [IN] type #uintptr_t,Heap end address.CNcomment:堆空间结束地址。CNend
678 * @param  check_sum          [IN] type #hi_u32,Exclusive or of start address and end address.
679 CNcomment:起始地址与结束地址的异或。CNend
680 *
681 * @retval #HI_ERR_FAILURE Failure.
682 * @retval #HI_ERR_SUCCESS Success.
683 * @par 依赖:
684 *            @li hi_boot_rom.h:Describes Boot APIs.CNcomment:文件用于描述Boot模块接口。CNend
685 * @see  boot_malloc_init。
686 */
687 hi_void boot_malloc_init(uintptr_t heap_start_addr, uintptr_t heap_end_addr, hi_u32 check_sum);
688 
689 /**
690 * @ingroup  iot_mem
691 * @brief  Dynamically applies for memory.CNcomment:动态申请内存。CNend
692 *
693 * @par 描述:
694 *           Dynamically applies for memory.CNcomment:动态申请内存。CNend
695 *
696 * @attention None.
697 * @param  size    [IN] type #hi_u32,Requested memory size (unit: byte)
698 CNcomment:申请内存大小(单位:byte)。CNend
699 *
700 * @retval #Other    Success
701 * @retval #HI_NULL  Failure. The memory is insufficient.
702 * @par 依赖:
703 *            @li hi_boot_rom.h:Describes memory APIs.CNcomment:文件用于描述内存相关接口。CNend
704 * @see  boot_free。
705 */
706 hi_void *boot_malloc(hi_u32 size);
707 
708 /**
709 * @ingroup  iot_mem
710 * @brief  Releases the memory that is dynamically applied for.CNcomment:释放动态申请的内存。CNend
711 *
712 * @par 描述:
713 *          Releases the memory that is dynamically applied for.CNcomment:释放动态申请的内存。CNend
714 *
715 * @attention None.
716 * @param  addr    [IN] type #hi_void *,Start address of the requested memory. The validity of the address is ensured
717 *                 by the caller.CNcomment:所申请内存的首地址,地址合法性由调用者保证。CNend
718 *
719 * @retval None.
720 * @par 依赖:
721 *            @li hi_boot_rom.h:Describes memory APIs.CNcomment:文件用于描述内存相关接口。CNend
722 * @see  boot_malloc。
723 */
724 hi_u32 boot_free(hi_void *addr);
725 
726 typedef enum {
727     HI_EFUSE_CHIP_RW_ID = 0,
728     HI_EFUSE_DIE_RW_ID = 1,
729     HI_EFUSE_PMU_FUSE1_RW_ID = 2,
730     HI_EFUSE_PMU_FUSE2_RW_ID = 3,
731     HI_EFUSE_FLASH_ENCPY_CNT3_RW_ID = 4,
732     HI_EFUSE_FLASH_ENCPY_CNT4_RW_ID = 5,
733     HI_EFUSE_FLASH_ENCPY_CNT5_RW_ID = 6,
734     HI_EFUSE_DSLEEP_FLAG_RW_ID = 7,
735     HI_EFUSE_ROOT_PUBKEY_RW_ID = 8,
736     HI_EFUSE_ROOT_KEY_WO_ID = 9,
737     HI_EFUSE_CUSTOMER_RSVD0_RW_ID = 10,
738     HI_EFUSE_SUBKEY_CAT_RW_ID = 11,
739     HI_EFUSE_ENCRYPT_FLAG_RW_ID = 12,
740     HI_EFUSE_SUBKEY_RSIM_RW_ID = 13,
741     HI_EFUSE_START_TYPE_RW_ID = 14,
742     HI_EFUSE_JTM_RW_ID = 15,
743     HI_EFUSE_UTM0_RW_ID = 16,
744     HI_EFUSE_UTM1_RW_ID = 17,
745     HI_EFUSE_UTM2_RW_ID = 18,
746     HI_EFUSE_SDC_RW_ID = 19,
747     HI_EFUSE_RSVD0_RW_ID = 20,
748     HI_EFUSE_KDF2ECC_HUK_DISABLE_RW_ID = 21,
749     HI_EFUSE_SSS_CORNER_RW_ID = 22,
750     HI_EFUSE_UART_HALT_INTERVAL_RW_ID = 23,
751     HI_EFUSE_TSENSOR_RIM_RW_ID = 24,
752     HI_EFUSE_CHIP_BK_RW_ID = 25,
753     HI_EFUSE_IPV4_MAC_ADDR_RW_ID = 26,
754     HI_EFUSE_IPV6_MAC_ADDR_RW_ID = 27,
755     HI_EFUSE_PG2GCCKA0_TRIM0_RW_ID = 28,
756     HI_EFUSE_PG2GCCKA1_TRIM0_RW_ID = 29,
757     HI_EFUSE_NVRAM_PA2GA0_TRIM0_RW_ID = 30,
758     HI_EFUSE_NVRAM_PA2GA1_TRIM0_RW_ID = 31,
759     HI_EFUSE_PG2GCCKA0_TRIM1_RW_ID = 32,
760     HI_EFUSE_PG2GCCKA1_TRIM1_RW_ID = 33,
761     HI_EFUSE_NVRAM_PA2GA0_TRIM1_RW_ID = 34,
762     HI_EFUSE_NVRAM_PA2GA1_TRIM1_RW_ID = 35,
763     HI_EFUSE_PG2GCCKA0_TRIM2_RW_ID = 36,
764     HI_EFUSE_PG2GCCKA1_TRIM2_RW_ID = 37,
765     HI_EFUSE_NVRAM_PA2GA0_TRIM2_RW_ID = 38,
766     HI_EFUSE_NVRAM_PA2GA1_TRIM2_RW_ID = 39,
767     HI_EFUSE_TEE_BOOT_VER_RW_ID = 40,
768     HI_EFUSE_TEE_KERNEL_VER_RW_ID = 41,
769     HI_EFUSE_TEE_SALT_RW_ID = 42,
770     HI_EFUSE_FLASH_ENCPY_CNT0_RW_ID = 43,
771     HI_EFUSE_FLASH_ENCPY_CNT1_RW_ID = 44,
772     HI_EFUSE_FLASH_ENCPY_CNT2_RW_ID = 45,
773     HI_EFUSE_FLASH_ENCPY_CFG_RW_ID = 46,
774     HI_EFUSE_FLASH_SCRAMBLE_EN_RW_ID = 47,
775     HI_EFUSE_USER_FLASH_IND_RW_ID = 48,
776     HI_EFUSE_RF_PDBUFFER_GCAL_RW_ID = 49,
777     HI_EFUSE_CUSTOMER_RSVD1_RW_ID = 50,
778     HI_EFUSE_DIE_2_RW_ID = 51,
779     HI_EFUSE_SEC_BOOT_RW_ID = 52,
780     HI_EFUSE_IDX_MAX,
781 } hi_efuse_idx;
782 
783 typedef enum {
784     HI_EFUSE_LOCK_CHIP_ID = 0,
785     HI_EFUSE_LOCK_DIE_ID = 1,
786     HI_EFUSE_LOCK_PMU_FUSE1_FUSE2_START_TYPE_TSENSOR_ID = 2,
787     HI_EFUSE_LOCK_ROOT_PUBKEY_ID = 3,
788     HI_EFUSE_LOCK_ROOT_KEY_ID = 4,
789     HI_EFUSE_LOCK_CUSTOMER_RSVD0_ID = 5,
790     HI_EFUSE_LOCK_SUBKEY_CAT_ID = 6,
791     HI_EFUSE_LOCK_ENCRYPT_RSIM_ID = 7,
792     HI_EFUSE_LOCK_JTM_ID = 8,
793     HI_EFUSE_LOCK_UTM0_ID = 9,
794     HI_EFUSE_LOCK_UTM1_ID = 10,
795     HI_EFUSE_LOCK_UTM2_ID = 11,
796     HI_EFUSE_LOCK_SDC_ID = 12,
797     HI_EFUSE_LOCK_RSVD0_ID = 13,
798     HI_EFUSE_LOCK_SSS_CORNER_ID = 14,
799     HI_EFUSE_LOCK_UART_HALT_INTERVAL_ID = 15,
800     HI_EFUSE_LOCK_CHIP_BK_ID = 16,
801     HI_EFUSE_LOCK_IPV4_IPV6_MAC_ADDR_ID = 17,
802     HI_EFUSE_LOCK_PG2GCCKA0_PG2GCCKA1_TRIM0_ID = 18,
803     HI_EFUSE_LOCK_NVRAM_PA2GA0_PA2GA1_TRIM0_ID = 19,
804     HI_EFUSE_LOCK_PG2GCCKA0_PG2GCCKA1_TRIM1_ID = 20,
805     HI_EFUSE_LOCK_NVRAM_PA2GA0_PA2GA1_TRIM1_ID = 21,
806     HI_EFUSE_LOCK_PG2GCCKA0_PG2GCCKA1_TRIM2_ID = 22,
807     HI_EFUSE_LOCK_NVRAM_PA2GA0_PA2GA1_TRIM2_ID = 23,
808     HI_EFUSE_LOCK_TEE_BOOT_VER_ID = 24,
809     HI_EFUSE_LOCK_TEE_KERNEL_VER_ID = 25,
810     HI_EFUSE_LOCK_TEE_SALT_ID = 26,
811     HI_EFUSE_LOCK_FLASH_ENCPY_CNT0_ID = 27,
812     HI_EFUSE_LOCK_FLASH_ENCPY_CNT1_ID = 28,
813     HI_EFUSE_LOCK_FLASH_ENCPY_CNT2_ID = 29,
814     HI_EFUSE_LOCK_FLASH_ENCPY_CFG_ID = 30,
815     HI_EFUSE_LOCK_FLASH_SCRAMBLE_EN_FLASH_IND_ID = 31,
816     HI_EFUSE_LOCK_RF_PDBUFFER_GCAL_ID = 32,
817     HI_EFUSE_LOCK_CUSTOMER_RSVD1_ID = 33,
818     HI_EFUSE_LOCK_DIE_2_ID = 34,
819     HI_EFUSE_LOCK_KDF2ECC_HUK_DISABLE_ID = 35,
820     HI_EFUSE_LOCK_FLASH_ENCPY_CNT3_ID = 36,
821     HI_EFUSE_LOCK_FLASH_ENCPY_CNT4_ID = 37,
822     HI_EFUSE_LOCK_FLASH_ENCPY_CNT5_ID = 38,
823     HI_EFUSE_LOCK_SEC_BOOT_ID = 39,
824     HI_EFUSE_LOCK_DSLEEP_FLAG_ID = 40,
825     HI_EFUSE_LOCK_MAX,
826 } hi_efuse_lock_id;
827 
828 #define EFUSE_IDX_NRW 0x0 /* Unreadable and unwritable */
829 #define EFUSE_IDX_RO  0x1 /* Read-only */
830 #define EFUSE_IDX_WO  0x2 /* Write-only */
831 #define EFUSE_IDX_RW  0x3 /* Read and write */
832 
833 /**
834 * @ingroup  iot_boot_api
835 * @brief efuse读取数据。
836 *
837 * @par 描述:
838 *           从efuse中读取数据。
839 * @attention 无。
840 * @param  efuse_id[IN] 类型 #hi_efuse_idx   efuseID号。
841 * @param  data[OUT] 类型 #hi_u8 * 用户需要先调用hi_get_efuse_cfg_by_id获取该区域长度,然后申请空间后传入该空间地址。
842 * @param  data_len[IN] 类型 #hi_u8 efuse读取长度,用户需保证给data申请的bit空间不小于hi_get_efuse_cfg_by_id获取到的efuse长度向上8bit对齐。
843 * @retval #HI_ERR_SUCCESS      success.
844 * @retval #非HI_ERR_SUCCESS    failed.
845 * @par Dependency:
846 * <ul><li>hi_boot_rom.h: 该接口声明所在的头文件.</li></ul>
847 * @see  hi_efuse_write。
848  */
849 hi_u32 hi_efuse_read(hi_efuse_idx efuse_id, hi_u8 *data, hi_u8 data_len);
850 
851 /**
852 * @ingroup  iot_boot_api
853 * @brief 写数据到efuse。
854 *
855 * @par 描述:
856 *            无。
857 * @attention 无。
858 * @param  efuse_id[IN] 类型 #hi_efuse_idx   efuseID号。
859 * @param  data[IN] 类型 #hi_u8 * 用户需要先调用hi_get_efuse_cfg_by_id获取该区域长度,申请指定大小空间后填上内容,然后传入该空间地址。
860 * @retval #HI_ERR_SUCCESS       success.
861 * @retval #非HI_ERR_SUCCESS     failed.
862 * @par Dependency:
863 * <ul><li>hi_boot_rom.h: 该接口声明所在的头文件.</li></ul>
864 * @see  hi_efuse_read。
865  */
866 hi_u32 hi_efuse_write(hi_efuse_idx efuse_id, const hi_u8 *data);
867 
868 /**
869 * @ingroup  iot_boot_api
870 * @brief 加锁efuse中的某个区域,加锁后该区域无法再写入。
871 *
872 * @par 描述:
873 *        加锁efuse中的某个区域,加锁后该区域无法再写入,每bit对应存储区域的128 bits。
874 * @attention 本加锁操作需要系统重启后才能生效。
875 * @param  efuse_lock_id[IN] 类型 #hi_efuse_lock_id   待加锁的efuseID号。
876 * @retval #HI_ERR_SUCCESS       success.
877 * @retval #非HI_ERR_SUCCESS     failed.详见hi_errno.h
878 * @par Dependency:
879 * <ul><li>hi_boot_rom.h: 该接口声明所在的头文件.</li></ul>
880 * @see  hi_efuse_write。
881  */
882 hi_u32 hi_efuse_lock(hi_efuse_lock_id efuse_lock_id);
883 
884 /**
885 * @ingroup  iot_boot_api
886 * @brief 获取efuse的锁状态,查询存储区域的锁定状态。
887 *
888 * @par 描述:
889 *          获取efuse的锁状态,查询存储区域的锁定状态,大小为64 bits。
890 * @attention 无。
891 * @param  lock_stat[IN] 类型 #hi_u64   获取efuse的锁状态。
892 * @retval #HI_ERR_SUCCESS       success.
893 * @retval #非HI_ERR_SUCCESS     failed.详见hi_errno.h
894 * @par Dependency:
895 * <ul><li>hi_boot_rom.h: 该接口声明所在的头文件.</li></ul>
896 * @see  hi_efuse_write。
897  */
898 hi_u32 hi_efuse_get_lockstat(hi_u64 *lock_stat);
899 
900 /**
901 * @ingroup  iot_boot_api
902 * @brief 用户从efuse指定位置读取数据。
903 *
904 * @par 描述:
905 *      通常用于从efuse用户区中读取数据,但支持从任意指定地址读取。
906 * @attention  此接口一般情况下用于操作用户保留区内容,其他预分配的区域#hi_efuse_idx建议使用hi_efuse_read接口。
907 * @attention 无。
908 * @param  start_bit [IN]类型 #hi_u16 起始bit位,该地址必须8 bits对齐。
909 * @param  size      [IN]  类型 #hi_u16,待读取的bit位数,如果输入不是8bit对齐则函数内部会处理为8bit对齐,用户读取数据后需处理后使用。
910 * @param  key_data  [OUT] 类型 #hi_u8*,读到的数据放到该地址。
911 *
912 * @retval #HI_ERR_SUCCESS       success.
913 * @retval #非HI_ERR_SUCCESS     failed.
914 * @par Dependency:
915 * <ul><li>hi_boot_rom.h: 该接口声明所在的头文件.</li></ul>
916 * @see  hi_efuse_usr_write。
917  */
918 hi_u32 hi_efuse_usr_read(hi_u16 start_bit, hi_u16 size, hi_u8 *key_data);
919 
920 /**
921 * @ingroup  iot_boot_api
922 * @brief 用户向efuse指定位置写入数据。
923 *
924 * @par 描述:
925 *         通常用于往efuse用户区中写入数据,但支持往任意指定地址写入。
926 * @attention
927 *         @li 此接口一般情况下用于操作用户保留区内容,其他预分配的区域#hi_efuse_idx建议使用hi_efuse_write接口和hi_efuse_lock接口。
928 *         @li 支持用户写入任意地址数据,详细地址的写入需要结合方案文档评估是否有冲突。
929 * @param  start_bit [IN] 类型 #hi_u16  写efuse入地址的起始位。
930 * @param  size      [IN] 类型 #hi_u16  待写入bit数,支持单bit写入,最大值为256bits数。
931 * @param  key_data  [IN] 类型 #hi_u8 * 待写入的数据放到该地址,最长为32字节。
932 * @retval #HI_ERR_SUCCESS       success.
933 * @retval #非HI_ERR_SUCCESS     failed.
934 * @par Dependency:
935 * <ul><li>hi_boot_rom.h: 该接口声明所在的头文件.</li></ul>
936 * @see  hi_efuse_usr_read。
937  */
938 hi_u32 hi_efuse_usr_write(hi_u16 start_bit, hi_u16 size, const hi_u8 *key_data);
939 
940 /**
941  * @ingroup iot_boot_api
942  * 默认看门狗配置时间为26秒。
943  * romboot启动后时间不可以修改,用户可以在flashboot中调用hi_watchdog_enable接口重新配置。
944  */
945 #define WDG_TIME_US 26000000 /* 默认看门狗配置时间为26秒 */
946 
947 /**
948 * @ingroup  iot_watchdog
949 * @brief Enables the watchdog.CNcomment:使能看门狗。CNend
950 *
951 * @par 描述:
952 *          Enables the watchdog.CNcomment:使能看门狗。CNend
953 *
954 * @attention None
955 * @param  None
956 *
957 * @retval None
958 * @par 依赖:
959 *            @li hi_boot_rom.h:describes the watchdog APIs.CNcomment:文件用于描述看门狗相关接口。CNend
960 * @see None
961 */
962 hi_void hi_watchdog_enable(hi_u32 over_time_us);
963 
964 /**
965 * @ingroup  iot_watchdog
966 * @brief Feeds the watchdog.CNcomment:喂狗。CNend
967 *
968 * @par 描述: Feeds the watchdog.CNcomment:喂狗。CNend
969 *
970 * @attention None
971 * @param  None
972 *
973 * @retval None
974 * @par 依赖:
975 *            @li hi_boot_rom.h:describes the watchdog APIs.CNcomment:文件用于描述看门狗相关接口。CNend
976 * @see None
977 */
978 hi_void hi_watchdog_feed(hi_void);
979 
980 /**
981 * @ingroup  iot_watchdog
982 * @brief Disables the watchdog.CNcomment:关闭看门狗。CNend
983 *
984 * @par 描述:
985 *           @li Disable the clock enable control of the watchdog.CNcomment:禁止WatchDog时钟使能控制位。CNend
986 *           @li Mask the watchdog reset function.CNcomment:屏蔽WatchDog复位功能。CNend
987 *
988 * @attention None
989 * @param  None
990 *
991 * @retval None
992 * @par 依赖:
993 *            @li hi_boot_rom.h:describes the watchdog APIs.CNcomment:文件用于描述看门狗相关接口。CNend
994 * @see None
995 */
996 hi_void hi_watchdog_disable(hi_void);
997 
998 /** @defgroup iot_crc16 CRC16 APIs
999 * @ingroup iot_romboot
1000 */
1001 /**
1002 * @ingroup  iot_crc16
1003 * @brief  Generates a 16-bit CRC value.CNcomment:生成16位CRC校验值。CNend
1004 *
1005 * @par 描述:
1006 *           Generates a 16-bit CRC value.CNcomment:生成16位CRC校验值。CNend
1007 *
1008 * @attention None
1009 * @param  crc_start         [IN] type #hi_u16,The CRC initial value.CNcomment:CRC初始值。CNend
1010 * @param  buf               [IN] type #hi_u8*,Pointer to the buffer to be verified.
1011 CNcomment:被校验Buffer指针。CNend
1012 * @param  len               [IN] type #hi_u32,Length of the buffer to be verified (unit: Byte).
1013 CNcomment:被校验Buffer长度(单位:byte)。CNend
1014 *
1015 * @retval #HI_ERR_SUCCESS   Success
1016 * @retval #Other            Failure. For details, see hi_boot_err.h.
1017 *
1018 * @par 依赖:
1019 *            @li hi_boot_rom.h:Describes CRC APIs.CNcomment:文件包含CRC校验接口。CNend
1020 * @see  None
1021 */
1022 hi_u16 hi_crc16(hi_u16 crc_start, hi_u8 *buf, hi_u32 len);
1023 
1024 /** @defgroup iot_io IO APIs
1025  * @ingroup iot_romboot
1026  */
1027 /**
1028 * @ingroup iot_io
1029 *
1030 * GPIO ID.
1031 */
1032 typedef enum {
1033     HI_GPIO_IDX_0,   /* GPIO0 */
1034     HI_GPIO_IDX_1,   /* GPIO1 */
1035     HI_GPIO_IDX_2,   /* GPIO2 */
1036     HI_GPIO_IDX_3,   /* GPIO3 */
1037     HI_GPIO_IDX_4,   /* GPIO4 */
1038     HI_GPIO_IDX_5,   /* GPIO5 */
1039     HI_GPIO_IDX_6,   /* GPIO6 */
1040     HI_GPIO_IDX_7,   /* GPIO7 */
1041     HI_GPIO_IDX_8,   /* GPIO8 */
1042     HI_GPIO_IDX_9,   /* GPIO9 */
1043     HI_GPIO_IDX_10,  /* GPIO10 */
1044     HI_GPIO_IDX_11,  /* GPIO11 */
1045     HI_GPIO_IDX_12,  /* GPIO12 */
1046     HI_GPIO_IDX_13,  /* GPIO13 */
1047     HI_GPIO_IDX_14,  /* GPIO14 */
1048     HI_GPIO_IDX_MAX, /* Maximum value, cannot be used. CNcomment:最大值,不可输入使用。CNend */
1049 } hi_gpio_idx;
1050 
1051 /**
1052  * @ingroup iot_io
1053  *
1054  * GPIO pin ID. CNcomment:IO硬件管脚编号。CNend
1055  */
1056 typedef enum {
1057     HI_IO_NAME_GPIO_0,  /* GPIO0 */
1058     HI_IO_NAME_GPIO_1,  /* GPIO1 */
1059     HI_IO_NAME_GPIO_2,  /* GPIO2 */
1060     HI_IO_NAME_GPIO_3,  /* GPIO3 */
1061     HI_IO_NAME_GPIO_4,  /* GPIO4 */
1062     HI_IO_NAME_GPIO_5,  /* GPIO5 */
1063     HI_IO_NAME_GPIO_6,  /* GPIO6 */
1064     HI_IO_NAME_GPIO_7,  /* GPIO7 */
1065     HI_IO_NAME_GPIO_8,  /* GPIO8 */
1066     HI_IO_NAME_GPIO_9,  /* GPIO9 */
1067     HI_IO_NAME_GPIO_10, /* GPIO10 */
1068     HI_IO_NAME_GPIO_11, /* GPIO11 */
1069     HI_IO_NAME_GPIO_12, /* GPIO12 */
1070     HI_IO_NAME_GPIO_13, /* GPIO13 */
1071     HI_IO_NAME_GPIO_14, /* GPIO14 */
1072     HI_IO_NAME_SFC_CSN, /* SFC_CSN */
1073     HI_IO_NAME_SFC_IO1, /* SFC_IO1 */
1074     HI_IO_NAME_SFC_IO2, /* SFC_IO2 */
1075     HI_IO_NAME_SFC_IO0, /* SFC_IO0 */
1076     HI_IO_NAME_SFC_CLK, /* SFC_CLK */
1077     HI_IO_NAME_SFC_IO3, /* SFC_IO3 */
1078     HI_IO_NAME_MAX,
1079 } hi_io_name;
1080 
1081 /**
1082  * @ingroup iot_io
1083  *
1084  * GPIO pull-up configuration.CNcomment:IO上下拉功能CNend
1085  */
1086 typedef enum {
1087     HI_IO_PULL_NONE,    /*  No pull. CNcomment:无拉。CNend */
1088     HI_IO_PULL_UP,      /*  pull up. CNcomment:上拉。CNend */
1089     HI_IO_PULL_DOWN,    /*  pull down. CNcomment:下拉。CNend */
1090     HI_IO_PULL_MAX,     /*  Invalid value. CNcomment:无效值。CNend */
1091 } hi_io_pull;
1092 
1093 /**
1094  * @ingroup iot_io
1095  *
1096  * GPIO_0 pin function.CNcomment:GPIO_0管脚功能。CNend
1097  */
1098 typedef enum {
1099     HI_IO_FUNC_GPIO_0_GPIO,
1100     HI_IO_FUNC_GPIO_0_UART1_TXD = 2,
1101     HI_IO_FUNC_GPIO_0_SPI0_CK,
1102     HI_IO_FUNC_GPIO_0_JTAG_TDO,
1103     HI_IO_FUNC_GPIO_0_PWM3_OUT,
1104     HI_IO_FUNC_GPIO_0_I2C1_SDA,
1105 } hi_io_func_gpio_0;
1106 
1107 /**
1108 * @ingroup iot_io
1109 *
1110 * GPIO_1 pin function.CNcomment:GPIO_1管脚功能。CNend
1111 */
1112 typedef enum {
1113     HI_IO_FUNC_GPIO_1_GPIO,
1114     HI_IO_FUNC_GPIO_1_UART1_RXD = 2,
1115     HI_IO_FUNC_GPIO_1_SPI0_RXD,
1116     HI_IO_FUNC_GPIO_1_JTAG_TCK,
1117     HI_IO_FUNC_GPIO_1_PWM4_OUT,
1118     HI_IO_FUNC_GPIO_1_I2C1_SCL,
1119     HI_IO_FUNC_GPIO_1_BT_FREQ,
1120 } hi_io_func_gpio_1;
1121 
1122 /**
1123 * @ingroup iot_io
1124 *
1125 * GPIO_2 pin function.CNcomment:GPIO_2管脚功能。CNend
1126 */
1127 typedef enum {
1128     HI_IO_FUNC_GPIO_2_GPIO,
1129     HI_IO_FUNC_GPIO_2_UART1_RTS_N = 2,
1130     HI_IO_FUNC_GPIO_2_SPI0_TXD,
1131     HI_IO_FUNC_GPIO_2_JTAG_TRSTN,
1132     HI_IO_FUNC_GPIO_2_PWM2_OUT,
1133     HI_IO_FUNC_GPIO_2_SSI_CLK = 7,
1134 } hi_io_func_gpio_2;
1135 
1136 /**
1137 * @ingroup iot_io
1138 *
1139 * GPIO_3 pin function.CNcomment:GPIO_3管脚功能。CNend
1140 */
1141 typedef enum {
1142     HI_IO_FUNC_GPIO_3_GPIO,
1143     HI_IO_FUNC_GPIO_3_UART0_TXD,
1144     HI_IO_FUNC_GPIO_3_UART1_CTS_N,
1145     HI_IO_FUNC_GPIO_3_SPI0_CSN,
1146     HI_IO_FUNC_GPIO_3_JTAG_TDI,
1147     HI_IO_FUNC_GPIO_3_PWM5_OUT,
1148     HI_IO_FUNC_GPIO_3_I2C1_SDA,
1149     HI_IO_FUNC_GPIO_3_SSI_DATA,
1150 } hi_io_func_gpio_3;
1151 
1152 /**
1153 * @ingroup iot_io
1154 *
1155 * GPIO_4 pin function.CNcomment:GPIO_4管脚功能。CNend
1156 */
1157 typedef enum {
1158     HI_IO_FUNC_GPIO_4_GPIO,
1159     HI_IO_FUNC_GPIO_4_UART0_RXD = 2,
1160     HI_IO_FUNC_GPIO_4_JTAG_TMS = 4,
1161     HI_IO_FUNC_GPIO_4_PWM1_OUT,
1162     HI_IO_FUNC_GPIO_4_I2C1_SCL,
1163 } hi_io_func_gpio_4;
1164 
1165 /**
1166 * @ingroup iot_io
1167 *
1168 * GPIO_5 pin function.CNcomment:GPIO_5管脚功能。CNend
1169 */
1170 typedef enum {
1171     HI_IO_FUNC_GPIO_5_GPIO,
1172     HI_IO_FUNC_GPIO_5_UART1_RXD = 2,
1173     HI_IO_FUNC_GPIO_5_SPI0_CSN,
1174     HI_IO_FUNC_GPIO_5_PWM2_OUT = 5,
1175     HI_IO_FUNC_GPIO_5_I2S0_MCLK,
1176     HI_IO_FUNC_GPIO_5_BT_STATUS,
1177 } hi_io_func_gpio_5;
1178 
1179 /**
1180 * @ingroup iot_io
1181 *
1182 * GPIO_6 pin function.CNcomment:GPIO_6管脚功能。CNend
1183 */
1184 typedef enum {
1185     HI_IO_FUNC_GPIO_6_GPIO,
1186     HI_IO_FUNC_GPIO_6_UART1_TXD = 2,
1187     HI_IO_FUNC_GPIO_6_SPI0_CK,
1188     HI_IO_FUNC_GPIO_6_PWM3_OUT = 5,
1189     HI_IO_FUNC_GPIO_6_I2S0_TX,
1190     HI_IO_FUNC_GPIO_6_COEX_SWITCH,
1191 } hi_io_func_gpio_6;
1192 
1193 /**
1194 * @ingroup iot_io
1195 *
1196 * GPIO_7 pin function.CNcomment:GPIO_7管脚功能。CNend
1197 */
1198 typedef enum {
1199     HI_IO_FUNC_GPIO_7_GPIO,
1200     HI_IO_FUNC_GPIO_7_UART1_CTS_N = 2,
1201     HI_IO_FUNC_GPIO_7_SPI0_RXD,
1202     HI_IO_FUNC_GPIO_7_PWM0_OUT = 5,
1203     HI_IO_FUNC_GPIO_7_I2S0_BCLK,
1204     HI_IO_FUNC_GPIO_7_BT_ACTIVE,
1205 } hi_io_func_gpio_7;
1206 
1207 /**
1208 * @ingroup iot_io
1209 *
1210 * GPIO_8 pin function.CNcomment:GPIO_8管脚功能。CNend
1211 */
1212 typedef enum {
1213     HI_IO_FUNC_GPIO_8_GPIO,
1214     HI_IO_FUNC_GPIO_8_UART1_RTS_N = 2,
1215     HI_IO_FUNC_GPIO_8_SPI0_TXD,
1216     HI_IO_FUNC_GPIO_8_PWM1_OUT = 5,
1217     HI_IO_FUNC_GPIO_8_I2S0_WS,
1218     HI_IO_FUNC_GPIO_8_WLAN_ACTIVE,
1219 } hi_io_func_gpio_8;
1220 
1221 /**
1222 * @ingroup iot_io
1223 *
1224 * GPIO_9 pin function.CNcomment:GPIO_9管脚功能。CNend
1225 */
1226 typedef enum {
1227     HI_IO_FUNC_GPIO_9_GPIO,
1228     HI_IO_FUNC_GPIO_9_I2C0_SCL,
1229     HI_IO_FUNC_GPIO_9_UART2_RTS_N,
1230     HI_IO_FUNC_GPIO_9_SDIO_D2,
1231     HI_IO_FUNC_GPIO_9_SPI1_TXD,
1232     HI_IO_FUNC_GPIO_9_PWM0_OUT,
1233     HI_IO_FUNC_GPIO_9_I2S0_MCLK = 7,
1234 } hi_io_func_gpio_9;
1235 
1236 /**
1237 * @ingroup iot_io
1238 *
1239 * GPIO_10 pin function.CNcomment:GPIO_10管脚功能。CNend
1240 */
1241 typedef enum {
1242     HI_IO_FUNC_GPIO_10_GPIO,
1243     HI_IO_FUNC_GPIO_10_I2C0_SDA,
1244     HI_IO_FUNC_GPIO_10_UART2_CTS_N,
1245     HI_IO_FUNC_GPIO_10_SDIO_D3,
1246     HI_IO_FUNC_GPIO_10_SPI1_CK,
1247     HI_IO_FUNC_GPIO_10_PWM1_OUT,
1248     HI_IO_FUNC_GPIO_10_I2S0_TX = 7,
1249 } hi_io_func_gpio_10;
1250 
1251 /**
1252 * @ingroup iot_io
1253 *
1254 * GPIO_11 pin function.CNcomment:GPIO_11管脚功能。CNend
1255 */
1256 typedef enum {
1257     HI_IO_FUNC_GPIO_11_GPIO,
1258     HI_IO_FUNC_GPIO_11_UART2_TXD = 2,
1259     HI_IO_FUNC_GPIO_11_SDIO_CMD,
1260     HI_IO_FUNC_GPIO_11_SPI1_RXD,
1261     HI_IO_FUNC_GPIO_11_PWM2_OUT,
1262     HI_IO_FUNC_GPIO_11_RF_TX_EN_EXT,
1263     HI_IO_FUNC_GPIO_11_I2S0_RX,
1264 } hi_io_func_gpio_11;
1265 
1266 /**
1267 * @ingroup iot_io
1268 *
1269 * GPIO_12 pin function.CNcomment:GPIO_12管脚功能。CNend
1270 */
1271 typedef enum {
1272     HI_IO_FUNC_GPIO_12_GPIO,
1273     HI_IO_FUNC_GPIO_12_UART2_RXD = 2,
1274     HI_IO_FUNC_GPIO_12_SDIO_CLK,
1275     HI_IO_FUNC_GPIO_12_SPI1_CSN,
1276     HI_IO_FUNC_GPIO_12_PWM3_OUT,
1277     HI_IO_FUNC_GPIO_12_RF_RX_EN_EXT,
1278     HI_IO_FUNC_GPIO_12_I2S0_BCLK,
1279 } hi_io_func_gpio_12;
1280 
1281 /**
1282 * @ingroup iot_io
1283 *
1284 * GPIO_13 pin function.CNcomment:GPIO_13管脚功能。CNend
1285 */
1286 typedef enum {
1287     HI_IO_FUNC_GPIO_13_SSI_DATA,
1288     HI_IO_FUNC_GPIO_13_UART0_TXD,
1289     HI_IO_FUNC_GPIO_13_UART2_RTS_N,
1290     HI_IO_FUNC_GPIO_13_SDIO_D0,
1291     HI_IO_FUNC_GPIO_13_GPIO,
1292     HI_IO_FUNC_GPIO_13_PWM4_OUT,
1293     HI_IO_FUNC_GPIO_13_I2C0_SDA,
1294     HI_IO_FUNC_GPIO_13_I2S0_WS,
1295 } hi_io_func_gpio_13;
1296 
1297 /**
1298 * @ingroup iot_io
1299 *
1300 * GPIO_14 pin function.CNcomment:GPIO_14管脚功能。CNend
1301 */
1302 typedef enum {
1303     HI_IO_FUNC_GPIO_14_SSI_CLK,
1304     HI_IO_FUNC_GPIO_14_UART0_RXD,
1305     HI_IO_FUNC_GPIO_14_UART2_CTS_N,
1306     HI_IO_FUNC_GPIO_14_SDIO_D1,
1307     HI_IO_FUNC_GPIO_14_GPIO,
1308     HI_IO_FUNC_GPIO_14_PWM5_OUT,
1309     HI_IO_FUNC_GPIO_14_I2C0_SCL,
1310 } hi_io_func_gpio_14;
1311 
1312 /**
1313 * @ingroup iot_io
1314 *
1315 * SFC_CSN pin function.CNcomment:SFC_CSN管脚功能。CNend
1316 */
1317 typedef enum {
1318     HI_IO_FUNC_SFC_CSN_SFC_CSN,
1319     HI_IO_FUNC_SFC_CSN_SDIO_D2,
1320     HI_IO_FUNC_SFC_CSN_GPIO9,
1321     HI_IO_FUNC_SFC_CSN_SPI0_TXD = 4,
1322 } hi_io_func_sfc_csn;
1323 
1324 /**
1325 * @ingroup iot_io
1326 *
1327 * SFC_DO pin function.CNcomment:SFC_DO管脚功能。CNend
1328 */
1329 typedef enum {
1330     HI_IO_FUNC_SFC_IO_1_SFC_DO,
1331     HI_IO_FUNC_SFC_IO_1_SDIO_D3,
1332     HI_IO_FUNC_SFC_IO_1_GPIO10,
1333     HI_IO_FUNC_SFC_IO_1_SPI0_CK = 4,
1334 } hi_io_func_sfc_io_1;
1335 
1336 /**
1337 * @ingroup iot_io
1338 *
1339 * SFC_WPN pin function.CNcomment:SFC_WPN管脚功能。CNend
1340 */
1341 typedef enum {
1342     HI_IO_FUNC_SFC_IO_2_SFC_WPN,
1343     HI_IO_FUNC_SFC_IO_2_SDIO_CMD,
1344     HI_IO_FUNC_SFC_IO_2_GPIO11,
1345     HI_IO_FUNC_SFC_IO_2_RF_TX_EN_EXT,
1346     HI_IO_FUNC_SFC_IO_2_SPI0_RXD,
1347 } hi_io_func_sfc_io_2;
1348 
1349 /**
1350 * @ingroup iot_io
1351 *
1352 * SFC_DI pin function.CNcomment:SFC_DI管脚功能。CNend
1353 */
1354 typedef enum {
1355     HI_IO_FUNC_SFC_IO_0_SFC_DI,
1356     HI_IO_FUNC_SFC_IO_0_SDIO_CLK,
1357     HI_IO_FUNC_SFC_IO_0_GPIO12,
1358     HI_IO_FUNC_SFC_IO_0_RF_RX_EN_EXT,
1359     HI_IO_FUNC_SFC_IO_0_SPI0_CSN,
1360 } hi_io_func_sfc_io_0;
1361 
1362 /**
1363 * @ingroup iot_io
1364 *
1365 * SFC_CLK pin function.CNcomment:SFC_CLK管脚功能。CNend
1366 */
1367 typedef enum {
1368     HI_IO_FUNC_SFC_CLK_SFC_CLK,
1369     HI_IO_FUNC_SFC_CLK_SDIO_D0,
1370     HI_IO_FUNC_SFC_CLK_GPIO13,
1371     HI_IO_FUNC_SFC_CLK_SSI_DATA = 4,
1372 } hi_io_func_sfc_clk;
1373 
1374 /**
1375 * @ingroup iot_io
1376 *
1377 * SFC_HOLDN pin function.CNcomment:SFC_HOLDN管脚功能。CNend
1378 */
1379 typedef enum {
1380     HI_IO_FUNC_SFC_IO_3_SFC_HOLDN,
1381     HI_IO_FUNC_SFC_IO_3_SDIO_D1,
1382     HI_IO_FUNC_SFC_IO_3_GPIO14,
1383     HI_IO_FUNC_SFC_IO_3_SSI_CLK = 4,
1384 } hi_io_func_sfc_io_3;
1385 
1386 /**
1387 * @ingroup  iot_io
1388 * @brief Sets the I/O multiplexing.CNcomment:配置某个IO的复用功能。CNend
1389 *
1390 * @par 描述:
1391 *           Sets the I/O multiplexing.CNcomment:配置某个IO的复用功能。CNend
1392 *
1393 * @attention None
1394 * @param  id  [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend
1395 * @param  val [IN] type #hi_u8,I/O multiplexing.See the functions below: CNcomment:IO复用功能。
1396 根据待设置的硬件管脚,从如下枚举中选择相应功能。CNend
1397                         hi_io_func_gpio_0,
1398                         hi_io_func_gpio_1,
1399                         hi_io_func_gpio_2,
1400                         hi_io_func_gpio_3,
1401                         hi_io_func_gpio_4,
1402                         hi_io_func_gpio_5,
1403                         hi_io_func_gpio_6,
1404                         hi_io_func_gpio_7,
1405                         hi_io_func_gpio_8,
1406                         hi_io_func_gpio_9,
1407                         hi_io_func_gpio_10,
1408                         hi_io_func_gpio_11,
1409                         hi_io_func_gpio_12,
1410                         hi_io_func_gpio_13,
1411                         hi_io_func_gpio_14,
1412                         hi_io_func_sfc_csn,
1413                         hi_io_func_sfc_io_1,
1414                         hi_io_func_sfc_io_2,
1415                         hi_io_func_sfc_io_0,
1416                         hi_io_func_sfc_clk,
1417                         hi_io_func_sfc_io_3
1418 *
1419 * @retval #HI_ERR_SUCCESS       Success
1420 * @retval #HI_ERR_GPIO_INVALID_PARAMETER     Failure. Input invalid.
1421 * @par 依赖:
1422 *           @li hi_boot_rom.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend
1423 * @see  hi_io_set_func。
1424 */
1425 hi_u32 hi_io_set_func(hi_io_name id, hi_u8 val);
1426 
1427 /**
1428 * @ingroup  iot_io
1429 * @brief Enables the I/O pull-up.CNcomment:设置某个IO上下拉功能。CNend
1430 *
1431 * @par 描述:
1432 *           Enables the I/O pull-up.CNcomment:设置某个IO上下拉功能。CNend
1433 *
1434 * @attention None
1435 * @param  id  [IN]  type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend
1436 * @param  val [IN]  type #hi_io_pull,I/O pull-up enable.CNcomment:待设置的上下拉状态。CNend
1437 *
1438 * @retval #HI_ERR_SUCCESS       Success
1439 * @retval #HI_ERR_GPIO_INVALID_PARAMETER     Failure. Input invalid.
1440 * @par 依赖:
1441 *           @li hi_boot_rom.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend
1442 * @see  hi_io_get_pull。
1443 */
1444 hi_u32 hi_io_set_pull(hi_io_name id, hi_io_pull val);
1445 #endif
1446 
1447