• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <common/bk_include.h>
18 #include <driver/efuse_types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 
25 /* @brief Overview about this API header
26  *
27  */
28 
29 /**
30  * @brief EFUSE API
31  * @defgroup bk_api_efuse EFUSE API group
32  * @{
33  */
34 
35 /**
36  * @brief     Init the EFUSE driver
37  *
38  * This API init the resoure common:
39  *   - Init EFUSE driver control memory
40  *
41  * @attention 1. This API should be called before any other EFUSE APIs.
42  *
43  * @return
44  *    - BK_OK: succeed
45  *    - others: other errors.
46  */
47 bk_err_t bk_efuse_driver_init(void);
48 
49 /**
50  * @brief     Deinit the EFUSE driver
51  *
52  * This API free all resource related to EFUSE and disable EFUSE.
53  *
54  * @return
55  *    - BK_OK: succeed
56  *    - others: other errors.
57  */
58 bk_err_t bk_efuse_driver_deinit(void);
59 
60 /**
61  * @brief     Efuse write operation
62  *
63  * @param addr efuse write address
64  * @param data efuse write data
65  *
66  * @return
67  *    - BK_OK: succeed
68  *    - BK_ERR_EFUSE_DRIVER_NOT_INIT: EFUSE driver not init
69  *    - BK_ERR_EFUSE_ADDR_OUT_OF_RANGE: EFUSE address is out of range
70  *    - BK_ERR_EFUSE_CANNOT_WRTIE: EFUSE cannot write, cannot change bit from 1 to 0
71  *    - BK_ERR_EFUSE_WRTIE_NOT_EQUAL: EFUSE data read is not equal to the data written
72  *    - others: other errors.
73  */
74 bk_err_t bk_efuse_write_byte(uint8_t addr, uint8_t data);
75 
76 /**
77  * @brief     Efuse read operation
78  *
79  * @param addr read address
80  * @param data pointer to accept value of efuse read data
81  *
82  * @return
83  *    - BK_OK: succeed
84  *    - BK_ERR_EFUSE_DRIVER_NOT_INIT: EFUSE driver not init
85  *    - BK_ERR_EFUSE_ADDR_OUT_OF_RANGE: EFUSE address is out of range
86  *    - others: other errors.
87  */
88 bk_err_t bk_efuse_read_byte(uint8_t addr, uint8_t *data);
89 
90 /**
91  * @}
92  */
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 
99 
100