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
@@ -50,6 +50,16 @@ void efuse_hal_clear_program_registers(void);
*/
void efuse_hal_program(uint32_t block);
/**
* @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
@@ -15,6 +15,8 @@
extern "C" {
#endif
#define ESP_EFUSE_BLOCK_ERROR_BITS(error_reg, block) ((error_reg) & (0x0F << (4 * (block))))
// Always inline these functions even no gcc optimization is applied.
/******************* eFuse fields *************************/
@@ -151,6 +153,15 @@ __attribute__((always_inline)) static inline uint32_t efuse_ll_get_adc2_tp_high(
return REG_GET_FIELD(EFUSE_BLK3_RDATA3_REG, EFUSE_RD_ADC2_TP_HIGH);
}
__attribute__((always_inline)) static inline bool efuse_ll_get_dec_warnings(unsigned block)
{
if (block == 0 || block > 4) {
return false;
}
uint32_t error_reg = REG_GET_FIELD(EFUSE_DEC_STATUS_REG, EFUSE_DEC_WARNINGS);
return ESP_EFUSE_BLOCK_ERROR_BITS(error_reg, block - 1) != 0;
}
/******************* eFuse control functions *************************/
__attribute__((always_inline)) static inline bool efuse_ll_get_cmd(void)