efuse: Add the batch writing mode

This mode should be used when burning several efuses at one time.
This commit is contained in:
KonstantinKondrashov
2019-09-18 21:19:48 +08:00
parent d7fa288a6c
commit cf762d91c2
4 changed files with 226 additions and 27 deletions

View File

@@ -327,6 +327,59 @@ esp_err_t esp_efuse_update_secure_version(uint32_t secure_version);
*/
void esp_efuse_init(uint32_t offset, uint32_t size);
/* @brief Set the batch mode of writing fields.
*
* This mode allows you to write the fields in the batch mode.
* If this mode is enabled, esp_efuse_batch_write_commit() must be called
* to actually burn any written efuses.
* In this mode, reading efuse is not possible.
* This mode should be used when burning several efuses at one time.
*
* \code{c}
* // Example of using the batch writing mode.
*
* // set the batch writing mode
* esp_efuse_batch_write_begin();
*
* // use any writing functions as usual
* esp_efuse_write_field_blob(ESP_EFUSE_...);
* esp_efuse_write_field_cnt(ESP_EFUSE_...);
* esp_efuse_set_write_protect(EFUSE_BLKx);
* esp_efuse_write_reg(EFUSE_BLKx, ...);
* esp_efuse_write_block(EFUSE_BLKx, ...);
* ...
*
* // Write all of these fields to the efuse registers
* esp_efuse_batch_write_commit();
*
* \endcode
*
* @return
* - ESP_OK: Successful.
*/
esp_err_t esp_efuse_batch_write_begin(void);
/* @brief Reset the batch mode of writing fields.
*
* It will reset the batch writing mode and any written changes.
*
* @return
* - ESP_OK: Successful.
* - ESP_ERR_INVALID_STATE: Tha batch mode was not set.
*/
esp_err_t esp_efuse_batch_write_cancel(void);
/* @brief Writes all prepared data for the batch mode.
*
* Must be called to ensure changes are written to the efuse registers.
* After this the batch writing mode will be reset.
*
* @return
* - ESP_OK: Successful.
* - ESP_ERR_INVALID_STATE: The deferred writing mode was not set.
*/
esp_err_t esp_efuse_batch_write_commit(void);
#ifdef __cplusplus
}
#endif