gr55xx_hal_efuse.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr55xx_hal_efuse.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of eFuse HAL library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup HAL_DRIVER HAL Driver
43 * @{
44 */
45
46 /** @defgroup HAL_EFUSE EFUSE
47 * @brief eFuse HAL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_EFUSE_H__
53 #define __GR55xx_HAL_EFUSE_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_hal_def.h"
61 #include "gr55xx_ll_efuse.h"
62
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_EFUSE_ENUMERATIONS Enumerations
65 * @{
66 */
67
68 /** @defgroup HAL_EFUSE_state HAL EFUSE state
69 * @{
70 */
71
72 /**
73 * @brief HAL eFuse State Enumerations definition
74 */
75 typedef enum
76 {
77 HAL_EFUSE_STATE_RESET = 0x00, /**< Peripheral not yet initialized or disabled */
78 HAL_EFUSE_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */
79 HAL_EFUSE_STATE_BUSY = 0x02, /**< An internal process is ongoing */
80 HAL_EFUSE_STATE_ERROR = 0x04 /**< Reception process is error */
81 } hal_efuse_state_t;
82 /** @} */
83
84 /** @} */
85
86 /** @addtogroup HAL_EFUSE_STRUCTURES Structures
87 * @{
88 */
89
90 /** @defgroup EFUSE_Configuration EFUSE Configuration
91 * @{
92 */
93
94 /**
95 * @brief eFuse init Structure definition
96 */
97 typedef struct _efuse_init
98 {
99 uint32_t info_mode; /**< Specifies the info mode, enable or disable main or backup info. */
100
101 } efuse_init_t;
102
103 /** @} */
104
105 /** @defgroup EFUSE_handle EFUSE handle
106 * @{
107 */
108
109 /**
110 * @brief eFuse handle Structure definition
111 */
112 typedef struct _efuse_handle
113 {
114 efuse_regs_t *p_instance; /**< Register base address */
115
116 efuse_init_t init; /**< eFuse base required parameters */
117
118 __IO hal_lock_t lock; /**< Locking object */
119
120 __IO hal_efuse_state_t state; /**< eFuse operation state */
121
122 __IO uint32_t error_code; /**< eFuse Error code */
123
124 } efuse_handle_t;
125 /** @} */
126
127 /** @defgroup EFUSE_Keyram Keyram configuration
128 * @{
129 */
130
131 /**
132 * @brief eFuse Keyram Structure definition
133 */
134 typedef struct _keyram_mask
135 {
136 uint32_t aes_mask; /**< AES port mask. */
137
138 uint32_t hmac_mask; /**< HMAC port mask. */
139
140 uint32_t present_mcu_mask; /**< Present of MCU port mask. */
141
142 uint32_t present_xip_mask; /**< Present of XIP port mask. */
143
144 uint32_t efuse_mask; /**< eFuse port mask. */
145
146 uint32_t enc_key_low; /**< encrypt key low 32bit mask. */
147
148 uint32_t enc_key_high; /**< encrypt key high 32bit mask. */
149 } keyram_mask_t;
150
151 /** @} */
152
153 /** @} */
154
155 /** @addtogroup HAL_EFUSE_CALLBACK_STRUCTURES Callback Structures
156 * @{
157 */
158
159 /** @defgroup HAL_EFUSE_Callback Callback
160 * @{
161 */
162
163 /**
164 * @brief HAL_EFUSE Callback function definition
165 */
166
167 typedef struct _hal_efuse_callback
168 {
169 void (*efuse_msp_init)(efuse_handle_t *p_efuse); /**< EFUSE init MSP callback */
170 void (*efuse_msp_deinit)(efuse_handle_t *p_efuse); /**< EFUSE de-init MSP callback */
171 } hal_efuse_callback_t;
172
173 /** @} */
174
175 /** @} */
176
177 /**
178 * @defgroup HAL_EFUSE_MACRO Defines
179 * @{
180 */
181
182 /* Exported constants------------------------------------------------------------*/
183 /** @defgroup EFUSE_Exported_Constants EFUSE Exported Constants
184 * @{
185 */
186
187 /** @defgroup EFUSE_Error_Code EFUSE Error Code
188 * @{
189 */
190 #define HAL_EFUSE_ERROR_NONE ((uint32_t)0x00000000) /**< No error */
191 #define HAL_EFUSE_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */
192 #define HAL_EFUSE_ERROR_INVALID_PARAM ((uint32_t)0x00000002) /**< Invalid parameters error */
193 /** @} */
194
195 /** @defgroup EFUSE_Flags EFUSE Flags
196 * @{
197 */
198 #define EFUSE_FLAG_WRITE_KEYRAM_BUSY LL_EFUSE_WRITE_KEYRAM_BUSY /**< Write keyram operation is in process */
199 #define EFUSE_FLAG_READ_TRIM_DONE LL_EFUSE_READ_TRIM_DONE /**< Read trim from eFuse has done */
200 #define EFUSE_FLAG_CRC_CHECK_DONE LL_EFUSE_CRC_CHECK_DONE /**< eFuse CRC check done */
201 #define EFUSE_FLAG_CRC_CHECK_SUCCESS LL_EFUSE_CRC_CHECK_SUCCESS /**< CRC check succeeded */
202 #define EFUSE_FLAG_INIT_CHECK_DONE LL_EFUSE_INIT_CHECK_DONE /**< eFuse initial value check done */
203 #define EFUSE_FLAG_INIT_CHECK_SUCCESS LL_EFUSE_INIT_CHECK_SUCCESS /**< eFuse initial value check succeeded */
204 #define EFUSE_FLAG_WRITE_DONE LL_EFUSE_WRITE_DONE /**< eFuse one word write done */
205 #define EFUSE_FLAG_TEST_DONE LL_EFUSE_TEST_DONE /**< Read from eFuse has done in test mode */
206 /** @} */
207
208 /** @defgroup EFUSE_Loyout_Map EFUSE Loyout Map
209 * @{
210 */
211 #define EFUSE_OFFSET_USER_DSVD (0x0000UL) /**< Reserved offset in backup info block */
212 #define EFUSE_OFFSET_BBLK_TRIM (0x0020UL) /**< Triming offset in backup info block */
213 #define EFUSE_OFFSET_BBLK_CONFIG (0x005CUL) /**< Configuration offset in backup info block */
214 #define EFUSE_OFFSET_BBLK_SWD (0x0060UL) /**< SWD Enable offset in backup info block */
215 #define EFUSE_OFFSET_BBLK_EncMode (0x0062UL) /**< Encryption Mode offset in backup info block */
216 #define EFUSE_OFFSET_BBLK_CRC32 (0x0064UL) /**< CRC32 offset in backup info block */
217 #define EFUSE_OFFSET_BBLK_CHIP_ID (0x0068UL) /**< Chip ID offset in backup info block */
218 #define EFUSE_OFFSET_BBLK_PRODUCT_ID (0x006EUL) /**< Product ID offset in backup info block */
219 #define EFUSE_OFFSET_BBLK_FW_PUBLICKEY (0x0070UL) /**< Firmware public key offset in backup info block */
220 #define EFUSE_OFFSET_BBLK_ROOT_PUBLICKEY (0x0080UL) /**< Root public key offset in backup info block */
221 #define EFUSE_OFFSET_BBLK_ECC_KEY (0x0090UL) /**< ECC key offset in backup info block */
222 #define EFUSE_OFFSET_BBLK_FW_KEY (0x00B0UL) /**< Firmware key offset in backup info block */
223 #define EFUSE_OFFSET_BBLK_HMAC_KEY (0x00D0UL) /**< HMAC key offset in backup info block */
224 #define EFUSE_OFFSET_BBLK_DATA_KEY (0x00F0UL) /**< Data key offset in backup info block */
225 #define EFUSE_OFFSET_MBLK_TRIM (0x0110UL) /**< Triming offset in main info block */
226 #define EFUSE_OFFSET_MBLK_CONFIG (0x014CUL) /**< Configuration offset in main info block */
227 #define EFUSE_OFFSET_MBLK_SWD (0x0150UL) /**< SWD Enable offset in main info block */
228 #define EFUSE_OFFSET_MBLK_EncMode (0x0152UL) /**< Encryption Mode offset in main info block */
229 #define EFUSE_OFFSET_MBLK_CRC32 (0x0154UL) /**< CRC32 offset in main info block */
230 #define EFUSE_OFFSET_MBLK_CHIP_ID (0x0158UL) /**< Chip ID offset in main info block */
231 #define EFUSE_OFFSET_MBLK_PRODUCT_ID (0x015EUL) /**< Product ID offset in main info block */
232 #define EFUSE_OFFSET_MBLK_FW_PUBLICKEY (0x0160UL) /**< Firmware public key offset in main info block */
233 #define EFUSE_OFFSET_MBLK_ROOT_PUBLICKEY (0x0170UL) /**< Root public key offset in main info block */
234 #define EFUSE_OFFSET_MBLK_ECC_KEY (0x0180UL) /**< ECC key offset in main info block */
235 #define EFUSE_OFFSET_MBLK_FW_KEY (0x01A0UL) /**< Firmware key offset in main info block */
236 #define EFUSE_OFFSET_MBLK_HMAC_KEY (0x01C0UL) /**< HMAC key offset in main info block */
237 #define EFUSE_OFFSET_MBLK_DATA_KEY (0x01E0UL) /**< Data key offset in main info block */
238 #define EFUSE_OFFSET_END (0x0200UL) /**< eFuse Offset end */
239 /** @} */
240
241 /** @} */
242
243 /* Exported macro ------------------------------------------------------------*/
244 /** @defgroup EFUSE_Exported_Macros EFUSE Exported Macros
245 * @{
246 */
247 /** @brief Enable the eFuse main or backup.
248 * @param __HANDLE__ Specifies the eFuse Handle.
249 * @retval None.
250 */
251 #define __HAL_EFUSE_ENABLE_MAIN_BACKUP(__HANDLE__) ll_efuse_enable_main_backup((__HANDLE__)->p_instance)
252
253 /** @brief Disable the eFuse main or backup.
254 * @param __HANDLE__ Specifies the eFuse Handle.
255 * @retval None.
256 */
257 #define __HAL_EFUSE_DISABLE_MAIN_BACKUP(__HANDLE__) ll_efuse_disable_main_backup((__HANDLE__)->p_instance)
258
259 /** @brief Enable the eFuse PGENB.
260 * @param __HANDLE__ Specifies the eFuse Handle.
261 * @retval None.
262 */
263 #define __HAL_EFUSE_ENABLE_PGENB(__HANDLE__) ll_efuse_enable_pgenb((__HANDLE__)->p_instance)
264
265 /** @brief Disable the eFuse PGENB.
266 * @param __HANDLE__ Specifies the eFuse Handle.
267 * @retval None.
268 */
269 #define __HAL_EFUSE_DISABLE_PGENB(__HANDLE__) ll_efuse_disable_pgenb((__HANDLE__)->p_instance)
270
271 /** @brief Check whether the specified eFuse flag is set or not.
272 * @param __HANDLE__ specifies the eFuse Handle.
273 * @param __FLAG__ specifies the flag to check.
274 * This parameter can be one of the following values:
275 * @arg @ref EFUSE_FLAG_WRITE_KEYRAM_BUSY Write keyram operation is in process
276 * @arg @ref EFUSE_FLAG_READ_TRIM_DONE Read trim from eFuse has done
277 * @arg @ref EFUSE_FLAG_CRC_CHECK_DONE eFuse CRC check done
278 * @arg @ref EFUSE_FLAG_CRC_CHECK_SUCCESS CRC check succeeded
279 * @arg @ref EFUSE_FLAG_INIT_CHECK_DONE eFuse initial value check done
280 * @arg @ref EFUSE_FLAG_INIT_CHECK_SUCCESS eFuse initial value check succeeded
281 * @arg @ref EFUSE_FLAG_WRITE_DONE eFuse one word write done
282 * @arg @ref EFUSE_FLAG_TEST_DONE Read from eFuse has done in test mode
283 * @retval The new state of __FLAG__ (TRUE or FALSE).
284 */
285 #define __HAL_EFUSE_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0) ? SET : RESET)
286 /** @} */
287
288 /** @} */
289
290 /* Exported functions --------------------------------------------------------*/
291 /** @addtogroup HAL_EFUSE_DRIVER_FUNCTIONS Functions
292 * @{
293 */
294
295 /** @defgroup EFUSE_Exported_Functions_Group1 Initialization and de-initialization functions
296 * @brief Initialization and de-initialization functions
297 *
298 @verbatim
299 ===============================================================================
300 ##### Initialization and de-initialization functions #####
301 ===============================================================================
302 [..] This subsection provides a set of functions allowing to initialize and
303 de-initialize the EFUSEx peripheral:
304
305 (+) User must implement hal_efuse_msp_init() function in which he configures
306 all related peripherals resources (GPIO, DMA, IT and NVIC ).
307
308 (+) Call the function hal_efuse_init() to configure the selected device with
309 the selected configuration:
310 (++) info_mode
311
312 (+) Call the function hal_efuse_deinit() to restore the default configuration
313 of the selected EFUSEx peripheral.
314
315 @endverbatim
316 * @{
317 */
318
319 /**
320 ****************************************************************************************
321 * @brief Initialize the eFuse according to the specified parameters
322 * in the efuse_init_t and initialize the associated handle.
323 *
324 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
325 *
326 * @retval ::HAL_OK: Operation is OK.
327 * @retval ::HAL_ERROR: Parameter error or operation not supported.
328 * @retval ::HAL_BUSY: Driver is busy.
329 * @retval ::HAL_TIMEOUT: Timeout occurred.
330 ****************************************************************************************
331 */
332 hal_status_t hal_efuse_init(efuse_handle_t *p_efuse);
333
334 /**
335 ****************************************************************************************
336 * @brief De-initialize the eFuse peripheral.
337 *
338 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
339 *
340 * @retval ::HAL_OK: Operation is OK.
341 * @retval ::HAL_ERROR: Parameter error or operation not supported.
342 * @retval ::HAL_BUSY: Driver is busy.
343 * @retval ::HAL_TIMEOUT: Timeout occurred.
344 ****************************************************************************************
345 */
346 hal_status_t hal_efuse_deinit(efuse_handle_t *p_efuse);
347
348 /**
349 ****************************************************************************************
350 * @brief Initialize the eFuse MSP.
351 *
352 * @note This function should not be modified. When the callback is needed,
353 * the hal_efuse_msp_init can be implemented in the user file.
354 *
355 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
356 ****************************************************************************************
357 */
358 void hal_efuse_msp_init(efuse_handle_t *p_efuse);
359
360 /**
361 ****************************************************************************************
362 * @brief De-initialize the eFuse MSP.
363 *
364 * @note This function should not be modified. When the callback is needed,
365 * the hal_efuse_msp_deinit can be implemented in the user file.
366 *
367 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
368 ****************************************************************************************
369 */
370 void hal_efuse_msp_deinit(efuse_handle_t *p_efuse);
371
372 /** @} */
373
374 /** @defgroup EFUSE_Exported_Functions_Group2 EFUSE operation functions
375 * @brief eFuse Data manage functions
376 *
377 * @{
378 */
379
380 /**
381 ****************************************************************************************
382 * @brief Write the eFuse memory data.
383 *
384 * @note Address should be eFuse memory address.
385 *
386 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
387 * @param[in] word_offset: eFuse memory offset, unit word, this parament can be a value between: 0x00 ~ 0x80.
388 * @param[in] p_data: Pointer to data buffer for storage eFuse data.
389 * @param[in] nword: Size of data to be write, unit word.
390 *
391 * @retval ::HAL_OK: Operation is OK.
392 * @retval ::HAL_ERROR: Parameter error or operation not supported.
393 * @retval ::HAL_BUSY: Driver is busy.
394 * @retval ::HAL_TIMEOUT: Timeout occurred.
395 ****************************************************************************************
396 */
397 hal_status_t hal_efuse_write(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword);
398
399 /**
400 ****************************************************************************************
401 * @brief Read the eFuse memory data.
402 *
403 * @note Address should be eFuse memory address.
404 *
405 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
406 * @param[in] word_offset: eFuse memory offset, unit word, this parament can be a value between: 0x000 ~ 0x80.
407 * @param[in] p_data: Pointer to data buffer for storage eFuse data.
408 * @param[in] nword: Size of data to be read, unit word.
409 *
410 * @retval ::HAL_OK: Operation is OK.
411 * @retval ::HAL_ERROR: Parameter error or operation not supported.
412 * @retval ::HAL_BUSY: Driver is busy.
413 * @retval ::HAL_TIMEOUT: Timeout occurred.
414 ****************************************************************************************
415 */
416 hal_status_t hal_efuse_read(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword);
417
418 /**
419 ****************************************************************************************
420 * @brief Read the key from eFuse memory and write to keyram.
421 *
422 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
423 * @param[in] p_mask: Pointer to a KEYRAM handle which contains the configuration information for the specified KEYRAM MASK.
424 *
425 * @retval ::HAL_OK: Operation is OK.
426 * @retval ::HAL_ERROR: Parameter error or operation not supported.
427 * @retval ::HAL_BUSY: Driver is busy.
428 * @retval ::HAL_TIMEOUT: Timeout occurred.
429 ****************************************************************************************
430 */
431 hal_status_t hal_efuse_write_keyram(efuse_handle_t *p_efuse, keyram_mask_t *p_mask);
432
433 /**
434 ****************************************************************************************
435 * @brief Check the eFuse memory with 0, if memory are all 0, return HAL_OK, then return HAL_ERROR.
436 *
437 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
438 *
439 * @retval ::HAL_OK: Operation is OK.
440 * @retval ::HAL_ERROR: Parameter error or operation not supported.
441 * @retval ::HAL_BUSY: Driver is busy.
442 * @retval ::HAL_TIMEOUT: Timeout occurred.
443 ****************************************************************************************
444 */
445 hal_status_t hal_efuse_initial_value_check(efuse_handle_t *p_efuse);
446
447 /**
448 ****************************************************************************************
449 * @brief Calculate CRC of the eFuse memory data.
450 *
451 * @note Address must be main info eFuse memory address.
452 *
453 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
454 * @param[in] word_offset: eFuse memory offset, unit word, this parament can be a value between: 0x00 ~ 0x80.
455 * @param[in] nword: Size of data to be read, unit word, this parament can be a value between: 1 ~ 60.
456 * @param[in] p_result: Pointer to result.
457 *
458 * @retval ::HAL_OK: Operation is OK.
459 * @retval ::HAL_ERROR: Parameter error or operation not supported.
460 * @retval ::HAL_BUSY: Driver is busy.
461 * @retval ::HAL_TIMEOUT: Timeout occurred.
462 ****************************************************************************************
463 */
464 hal_status_t hal_efuse_crc_calculate(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t nword, uint32_t *p_result);
465
466 /**
467 ****************************************************************************************
468 * @brief Read trim value from eFuse memory data.
469 *
470 * @note Address must be main info eFuse memory address.
471 *
472 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
473 * @param[in] word_offset: eFuse memory offset, unit word, this parament can be a value between: 0x00 ~ 0x80.
474 * @param[in] p_data: Pointer to data buffer for storage eFuse data.
475 * @param[in] nword: Size of data to be read, unit word, this parament can be a value between: 1 ~ 20.
476 *
477 * @retval ::HAL_OK: Operation is OK.
478 * @retval ::HAL_ERROR: Parameter error or operation not supported.
479 * @retval ::HAL_BUSY: Driver is busy.
480 * @retval ::HAL_TIMEOUT: Timeout occurred.
481 ****************************************************************************************
482 */
483 hal_status_t hal_efuse_read_trim(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword);
484
485 /**
486 ****************************************************************************************
487 * @brief Set the main or backup info of the eFuse memory.
488 *
489 * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module.
490 *
491 * @retval ::HAL_OK: Operation is OK.
492 * @retval ::HAL_ERROR: Parameter error or operation not supported.
493 * @retval ::HAL_BUSY: Driver is busy.
494 * @retval ::HAL_TIMEOUT: Timeout occurred.
495 ****************************************************************************************
496 */
497 hal_status_t hal_efuse_set_main_backup(efuse_handle_t *p_efuse);
498
499 /** @} */
500
501 /** @} */
502
503 #ifdef __cplusplus
504 }
505 #endif
506
507 #endif /* __GR55xx_HAL_EFUSE_H__ */
508
509 /** @} */
510
511 /** @} */
512
513 /** @} */
hal_efuse_read
hal_status_t hal_efuse_read(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword)
Read the eFuse memory data.
hal_efuse_set_main_backup
hal_status_t hal_efuse_set_main_backup(efuse_handle_t *p_efuse)
Set the main or backup info of the eFuse memory.
gr55xx_ll_efuse.h
Header file containing functions prototypes of eFuse LL library.
_keyram_mask::present_xip_mask
uint32_t present_xip_mask
Present of XIP port mask.
Definition: gr55xx_hal_efuse.h:142
efuse_handle_t
struct _efuse_handle efuse_handle_t
eFuse handle Structure definition
_keyram_mask::aes_mask
uint32_t aes_mask
AES port mask.
Definition: gr55xx_hal_efuse.h:136
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
_efuse_handle
eFuse handle Structure definition
Definition: gr55xx_hal_efuse.h:113
_efuse_init::info_mode
uint32_t info_mode
Specifies the info mode, enable or disable main or backup info.
Definition: gr55xx_hal_efuse.h:99
_keyram_mask::present_mcu_mask
uint32_t present_mcu_mask
Present of MCU port mask.
Definition: gr55xx_hal_efuse.h:140
efuse_init_t
struct _efuse_init efuse_init_t
eFuse init Structure definition
_efuse_handle::init
efuse_init_t init
eFuse base required parameters
Definition: gr55xx_hal_efuse.h:116
_keyram_mask
eFuse Keyram Structure definition
Definition: gr55xx_hal_efuse.h:135
_hal_efuse_callback::efuse_msp_init
void(* efuse_msp_init)(efuse_handle_t *p_efuse)
EFUSE init MSP callback
Definition: gr55xx_hal_efuse.h:169
hal_efuse_callback_t
struct _hal_efuse_callback hal_efuse_callback_t
HAL_EFUSE Callback function definition.
hal_efuse_crc_calculate
hal_status_t hal_efuse_crc_calculate(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t nword, uint32_t *p_result)
Calculate CRC of the eFuse memory data.
hal_efuse_write
hal_status_t hal_efuse_write(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword)
Write the eFuse memory data.
HAL_EFUSE_STATE_RESET
@ HAL_EFUSE_STATE_RESET
Peripheral not yet initialized or disabled
Definition: gr55xx_hal_efuse.h:77
hal_efuse_init
hal_status_t hal_efuse_init(efuse_handle_t *p_efuse)
Initialize the eFuse according to the specified parameters in the efuse_init_t and initialize the ass...
hal_efuse_read_trim
hal_status_t hal_efuse_read_trim(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword)
Read trim value from eFuse memory data.
_keyram_mask::hmac_mask
uint32_t hmac_mask
HMAC port mask.
Definition: gr55xx_hal_efuse.h:138
_hal_efuse_callback
HAL_EFUSE Callback function definition.
Definition: gr55xx_hal_efuse.h:168
_efuse_handle::p_instance
efuse_regs_t * p_instance
Register base address
Definition: gr55xx_hal_efuse.h:114
_efuse_init
eFuse init Structure definition
Definition: gr55xx_hal_efuse.h:98
keyram_mask_t
struct _keyram_mask keyram_mask_t
eFuse Keyram Structure definition
hal_efuse_msp_deinit
void hal_efuse_msp_deinit(efuse_handle_t *p_efuse)
De-initialize the eFuse MSP.
hal_efuse_initial_value_check
hal_status_t hal_efuse_initial_value_check(efuse_handle_t *p_efuse)
Check the eFuse memory with 0, if memory are all 0, return HAL_OK, then return HAL_ERROR.
_keyram_mask::enc_key_low
uint32_t enc_key_low
encrypt key low 32bit mask.
Definition: gr55xx_hal_efuse.h:146
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
HAL_EFUSE_STATE_READY
@ HAL_EFUSE_STATE_READY
Peripheral Initialized and ready for use
Definition: gr55xx_hal_efuse.h:78
_keyram_mask::efuse_mask
uint32_t efuse_mask
eFuse port mask.
Definition: gr55xx_hal_efuse.h:144
_efuse_handle::state
__IO hal_efuse_state_t state
eFuse operation state
Definition: gr55xx_hal_efuse.h:120
_keyram_mask::enc_key_high
uint32_t enc_key_high
encrypt key high 32bit mask.
Definition: gr55xx_hal_efuse.h:148
_efuse_handle::error_code
__IO uint32_t error_code
eFuse Error code
Definition: gr55xx_hal_efuse.h:122
hal_efuse_deinit
hal_status_t hal_efuse_deinit(efuse_handle_t *p_efuse)
De-initialize the eFuse peripheral.
hal_efuse_msp_init
void hal_efuse_msp_init(efuse_handle_t *p_efuse)
Initialize the eFuse MSP.
HAL_EFUSE_STATE_BUSY
@ HAL_EFUSE_STATE_BUSY
An internal process is ongoing
Definition: gr55xx_hal_efuse.h:79
HAL_EFUSE_STATE_ERROR
@ HAL_EFUSE_STATE_ERROR
Reception process is error
Definition: gr55xx_hal_efuse.h:80
hal_efuse_state_t
hal_efuse_state_t
HAL eFuse State Enumerations definition.
Definition: gr55xx_hal_efuse.h:76
hal_efuse_write_keyram
hal_status_t hal_efuse_write_keyram(efuse_handle_t *p_efuse, keyram_mask_t *p_mask)
Read the key from eFuse memory and write to keyram.
_hal_efuse_callback::efuse_msp_deinit
void(* efuse_msp_deinit)(efuse_handle_t *p_efuse)
EFUSE de-init MSP callback
Definition: gr55xx_hal_efuse.h:170
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
_efuse_handle::lock
__IO hal_lock_t lock
Locking object
Definition: gr55xx_hal_efuse.h:118