Function esp_idf_svc::sys::esp_efuse_batch_write_begin

source ·
pub unsafe extern "C" fn esp_efuse_batch_write_begin() -> i32
Expand description

@brief Set the batch mode of writing fields.

This mode allows you to write the fields in the batch mode when need to burn several efuses at one time. To enable batch mode call begin() then perform as usually the necessary operations read and write and at the end call commit() to actually burn all written efuses. The batch mode can be used nested. The commit will be done by the last commit() function. The number of begin() functions should be equal to the number of commit() functions.

@note Please note that reading in the batch mode does not show uncommitted changes.

Note: If batch mode is enabled by the first task, at this time the second task cannot write/read efuses. The second task will wait for the first task to complete the batch operation.

\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, …); esp_efuse_write(ESP_EFUSE_1, 3); // ESP_EFUSE_1 == 1, here we write a new value = 3. The changes will be burn by the commit() function. esp_efuse_read_…(ESP_EFUSE_1); // this function returns ESP_EFUSE_1 == 1 because uncommitted changes are not readable, it will be available only after commit. …

// esp_efuse_batch_write APIs can be called recursively. esp_efuse_batch_write_begin(); esp_efuse_set_write_protect(EFUSE_BLKx); esp_efuse_batch_write_commit(); // the burn will be skipped here, it will be done in the last commit().

// Write all of these fields to the efuse registers esp_efuse_batch_write_commit(); esp_efuse_read_…(ESP_EFUSE_1); // this function returns ESP_EFUSE_1 == 3.

\endcode

@return - ESP_OK: Successful.