efuse: Validates data after burning and re-burnes it if necessary

This commit is contained in:
Konstantin Kondrashov
2022-04-27 01:10:41 +08:00
parent 1f0e27ca63
commit df30b362a8
25 changed files with 721 additions and 127 deletions
+17
View File
@@ -11,6 +11,7 @@
#include "hal/efuse_hal.h"
#include "hal/efuse_ll.h"
#define ESP_EFUSE_BLOCK_ERROR_BITS(error_reg, block) ((error_reg) & (0x0F << (4 * (block))))
uint32_t efuse_hal_get_chip_revision(void)
{
@@ -61,3 +62,19 @@ void efuse_hal_rs_calculate(const void *data, void *rs_values)
}
/******************* eFuse control functions *************************/
bool efuse_hal_is_coding_error_in_block(unsigned block)
{
if (block == 0) {
for (unsigned i = 0; i < 5; i++) {
if (REG_READ(EFUSE_RD_REPEAT_ERR_REG + i * 4)) {
return true;
}
}
} else if (block <= 3) {
// EFUSE_RD_RS_ERR_REG: (hi) ----, ----, ----, ----, ----, BLOCK3, BLOCK2, BLOCK1 (low)
uint32_t error_reg = REG_READ(EFUSE_RD_RS_ERR_REG);
return ESP_EFUSE_BLOCK_ERROR_BITS(error_reg, block - 1) != 0;
}
return false;
}
@@ -54,6 +54,16 @@ void efuse_hal_program(uint32_t block);
*/
void efuse_hal_rs_calculate(const void *data, void *rs_values);
/**
* @brief Checks coding error in a block
*
* @param block Index of efuse block
*
* @return True - block has an error.
* False - no error.
*/
bool efuse_hal_is_coding_error_in_block(unsigned block);
#ifdef __cplusplus
}
#endif