Select one of the symbols to view example projects that use it.
 
Outline
#include <string.h>
#include "esp_types.h"
#include "esp_err.h"
#include "esp_efuse.h"
#include "sdkconfig.h"
esp_efuse_range_addr_t
efuse_func_proc_t
esp_efuse_utility_process(const esp_efuse_desc_t **, void *, size_t, efuse_func_proc_t);
esp_efuse_utility_write_cnt(unsigned int, esp_efuse_block_t, int, int, void *, int *);
esp_efuse_utility_write_blob(unsigned int, esp_efuse_block_t, int, int, void *, int *);
esp_efuse_utility_count_once(unsigned int, esp_efuse_block_t, int, int, void *, int *);
esp_efuse_utility_fill_buff(unsigned int, esp_efuse_block_t, int, int, void *, int *);
esp_efuse_utility_burn_efuses();
esp_efuse_utility_burn_chip();
esp_efuse_utility_burn_chip_opt(bool, bool);
esp_efuse_utility_get_number_of_items(int, int);
esp_efuse_utility_read_reg(esp_efuse_block_t, unsigned int);
esp_efuse_utility_write_reg(esp_efuse_block_t, unsigned int, uint32_t);
esp_efuse_utility_reset();
esp_efuse_utility_update_virt_blocks();
esp_efuse_utility_debug_dump_blocks();
esp_efuse_utility_debug_dump_single_block(int, bool);
esp_efuse_utility_erase_virt_blocks();
esp_efuse_utility_apply_new_coding_scheme();
esp_efuse_utility_check_errors();
esp_efuse_utility_clear_program_registers();
esp_efuse_utility_get_read_register_address(esp_efuse_block_t);
esp_efuse_utility_is_correct_written_data(esp_efuse_block_t, unsigned int);
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/efuse/private_include/esp_efuse_utility.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #pragma once #ifdef __cplusplus extern "C" { #endif #include <string.h> #include "esp_types.h" #include "esp_err.h" #include "esp_efuse.h" #include "sdkconfig.h"5 includes #include_next "esp_efuse_utility.h" #define ESP_EFUSE_CHK(ret) \ do \ { \ if( ( err = (ret) ) != ESP_OK ) \ goto err_exit; \ }{...} while( 0 )... /** * @brief Structure range address by blocks *//* ... */ typedef struct { uintptr_t start; uintptr_t end; }{ ... } esp_efuse_range_addr_t; /** * @brief This is type of function that will handle the efuse field register. * * @param[in] num_reg The register number in the block. * @param[in] efuse_block Block number. * @param[in] bit_start Start bit in the register. * @param[in] bit_count The number of bits used in the register. * @param[in/out] arr A pointer to an array or variable. * @param[in/out] bits_counter Counter bits. * * @return * - ESP_OK: The operation was successfully completed. * - other efuse component errors. *//* ... */ typedef esp_err_t (*efuse_func_proc_t) (unsigned int num_reg, esp_efuse_block_t efuse_block, int starting_bit_num_in_reg, int num_bits_used_in_reg, void* arr, int* bits_counter); /** * @brief This function processes the field by calling the passed function. * * This function selects the field, checks the length, and calls the register processing function. * @param[in] field A pointer to the structure describing the fields of efuse. * @param[in/out] ptr A pointer to an array that is used to read / write from / to the efuse field. * @param[in] ptr_size_bits The size of the data in bits for the efuse field. if = 0 then read all field bits. * @param[in] func_proc This is the function that will handle the efuse fields. * * @return * - ESP_OK: The operation was successfully completed. * - other efuse component errors. *//* ... */ esp_err_t esp_efuse_utility_process(const esp_efuse_desc_t* field[], void* ptr, size_t ptr_size_bits, efuse_func_proc_t func_proc); /** * @brief Write register with the required number of "1" bits. * @param[in/out] cnt The number of bits you need to set in the field. *//* ... */ esp_err_t esp_efuse_utility_write_cnt(unsigned int num_reg, esp_efuse_block_t efuse_block, int bit_start, int bit_count, void* cnt, int* bits_counter); /** * @brief Fill registers from array for writing. * @param[in] arr_in A pointer to an array in which the data for the writing. *//* ... */ esp_err_t esp_efuse_utility_write_blob(unsigned int num_reg, esp_efuse_block_t efuse_block, int bit_start, int bit_count, void* arr_in, int* bits_counter); /** * @brief Count a set bits in register. * @param[in/out] out_cnt A pointer to size_t variable which will contain the number of "1" bits. *//* ... */ esp_err_t esp_efuse_utility_count_once(unsigned int num_reg, esp_efuse_block_t efuse_block, int bit_start, int bit_count, void* out_cnt, int* bits_counter); /** * @brief Read efuse register and write this value to array. * @param[out] arr_out A pointer to array that will contain the result of reading. *//* ... */ esp_err_t esp_efuse_utility_fill_buff(unsigned int num_reg, esp_efuse_block_t efuse_block, int bit_start, int bit_count, void* arr_out, int* bits_counter); /** * @brief Burn values written to the efuse write registers. * * If CONFIG_EFUSE_VIRTUAL is set, writing will not be performed. * After the function is completed, the writing registers are cleared. * * @return * - ESP_OK: The operation was successfully completed. * - ESP_FAIL: The operation was not successfully completed. *//* ... */ esp_err_t esp_efuse_utility_burn_efuses(void); /** * @brief Chip specific operations to perform the burn of values written to the efuse write registers. * * @note Use esp_efuse_utility_burn_efuses() to burn efuses. * * If CONFIG_EFUSE_VIRTUAL is set, writing will not be performed. * After the function is completed, the writing registers are cleared. * * @return * - ESP_OK: The operation was successfully completed. * - ESP_FAIL: The operation was not successfully completed. *//* ... */ esp_err_t esp_efuse_utility_burn_chip(void); /** * @brief Chip specific operations to perform the burn of values written to the efuse write registers. * * If CONFIG_EFUSE_VIRTUAL is set, writing will not be performed. * After the function is completed, the writing registers are cleared. * * @param[in] ignore_coding_errors If this is true and any coding errors occur, * they will be ignored and no further attempts * will be made to correct them. * @param[in] verify_written_data If this is true, then after burning it will check that all data is set correctly. * * @return * - ESP_OK: The operation was successfully completed. * - ESP_FAIL: The operation was not successfully completed. *//* ... */ esp_err_t esp_efuse_utility_burn_chip_opt(bool ignore_coding_errors, bool verify_written_data); /** * @brief Returns the number of array elements for placing these "bits" in an array with the length of each element equal to "size_of_base". *//* ... */ int esp_efuse_utility_get_number_of_items(int bits, int size_of_base); /** * @brief Reading efuse register. *//* ... */ uint32_t esp_efuse_utility_read_reg(esp_efuse_block_t blk, unsigned int num_reg); /** * @brief Writing efuse register with checking of repeated programming of programmed bits. *//* ... */ esp_err_t esp_efuse_utility_write_reg(esp_efuse_block_t efuse_block, unsigned int num_reg, uint32_t reg_to_write); /* @brief Reset efuse write registers * * Efuse write registers are written to zero, to negate * any changes that have been staged here. *//* ... */ void esp_efuse_utility_reset(void); /** * @brief Fills the virt_blocks array by values from efuse_Rdata. *//* ... */ void esp_efuse_utility_update_virt_blocks(void); /** * @brief Prints efuse values for all registers. *//* ... */ void esp_efuse_utility_debug_dump_blocks(void); /** * @brief Prints efuse values for a single block. * @param[in] num_block Index of efuse block. * @param[in] from_read Take data from: * true - read area (already burned efuses), * false - write area (not yet burned efuses, prepared for burn). *//* ... */ void esp_efuse_utility_debug_dump_single_block(int num_block, bool from_read); /** * @brief Erase the virt_blocks array. *//* ... */ void esp_efuse_utility_erase_virt_blocks(void); /** * @brief Apply coding_scheme to write registers. * * @return * - ESP_OK: The operation was successfully completed. * - ESP_ERR_CODING: Error range of data does not match the coding scheme. *//* ... */ esp_err_t esp_efuse_utility_apply_new_coding_scheme(void); /** * @brief Checks eFuse errors in BLOCK0. * * @note Refers to ESP32-C3 only. * * It does a BLOCK0 check if eFuse EFUSE_ERR_RST_ENABLE is set. * If BLOCK0 has an error, it prints the error and returns ESP_FAIL, which should be treated as esp_restart. * * @return * - ESP_OK: No errors in BLOCK0. * - ESP_FAIL: Error in BLOCK0 requiring reboot. *//* ... */ esp_err_t esp_efuse_utility_check_errors(void); /** * @brief Efuse read operation: copies data from physical efuses to efuse read registers. *//* ... */ void esp_efuse_utility_clear_program_registers(void); #ifdef CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH /** * @brief Writes eFuses to the efuse flash partition. * * Used only when CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH is set. *//* ... */ void esp_efuse_utility_write_efuses_to_flash(void); /** * @brief Loads efuses from efuse flash partition. * * Used only when CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH is set. *//* ... */ bool esp_efuse_utility_load_efuses_from_flash(void); /** * @brief Erase efuse flash partition. * * Used only when CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH is set. *//* ... */ void esp_efuse_utility_erase_efuses_in_flash(void);/* ... */ #endif /** * @brief Return the address of a particular efuse block's first read register * * @param[in] block Index of efuse block to look up * * @return a numeric read register address of the first word in the block. *//* ... */ uintptr_t esp_efuse_utility_get_read_register_address(esp_efuse_block_t block); /** * @brief Checks the correctness of burned data in the given block. * * @note Internal use. Do not call it. * * @param[in] block Index of efuse block. * @param[in] r_data_len Block length for reading data in bytes (multiple of 4). * * @return True - written data are correct. * False - written data are incorrect. *//* ... */ bool esp_efuse_utility_is_correct_written_data(esp_efuse_block_t block, unsigned r_data_len); #ifdef __cplusplus }{...} #endif
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.