mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
efuse: Fix 3/4 coding scheme UTs
This commit is contained in:
committed by
morris
parent
adc9261443
commit
4be976e40d
@ -272,10 +272,19 @@ static void apply_repeat_encoding(const uint8_t *in_bytes, uint32_t *out_words,
|
|||||||
}
|
}
|
||||||
#endif // CONFIG_EFUSE_VIRTUAL
|
#endif // CONFIG_EFUSE_VIRTUAL
|
||||||
|
|
||||||
|
static void read_r_data(esp_efuse_block_t num_block, uint32_t* buf_r_data)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for (uint32_t addr_rd_block = range_read_addr_blocks[num_block].start; addr_rd_block <= range_read_addr_blocks[num_block].end; addr_rd_block += 4, ++i) {
|
||||||
|
buf_r_data[i] = esp_efuse_utility_read_reg(num_block, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This function just checkes that given data for blocks will not rise a coding issue during the burn operation.
|
// This function just checkes that given data for blocks will not rise a coding issue during the burn operation.
|
||||||
// Encoded data will be set during the burn operation.
|
// Encoded data will be set during the burn operation.
|
||||||
esp_err_t esp_efuse_utility_apply_new_coding_scheme()
|
esp_err_t esp_efuse_utility_apply_new_coding_scheme()
|
||||||
{
|
{
|
||||||
|
uint8_t buf_r_data[COUNT_EFUSE_REG_PER_BLOCK * 4];
|
||||||
// start with EFUSE_BLK1. EFUSE_BLK0 - always uses EFUSE_CODING_SCHEME_NONE.
|
// start with EFUSE_BLK1. EFUSE_BLK0 - always uses EFUSE_CODING_SCHEME_NONE.
|
||||||
for (int num_block = EFUSE_BLK1; num_block < EFUSE_BLK_MAX; num_block++) {
|
for (int num_block = EFUSE_BLK1; num_block < EFUSE_BLK_MAX; num_block++) {
|
||||||
esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block);
|
esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block);
|
||||||
@ -284,11 +293,12 @@ esp_err_t esp_efuse_utility_apply_new_coding_scheme()
|
|||||||
for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) {
|
for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) {
|
||||||
if (REG_READ(addr_wr_block)) {
|
if (REG_READ(addr_wr_block)) {
|
||||||
is_write_data = true;
|
is_write_data = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_write_data) {
|
if (is_write_data) {
|
||||||
|
read_r_data(num_block, (uint32_t*)buf_r_data);
|
||||||
uint8_t* buf_w_data = (uint8_t*)range_write_addr_blocks[num_block].start;
|
uint8_t* buf_w_data = (uint8_t*)range_write_addr_blocks[num_block].start;
|
||||||
uint8_t* buf_r_data = (uint8_t*)range_read_addr_blocks[num_block].start;
|
|
||||||
if (scheme == EFUSE_CODING_SCHEME_3_4) {
|
if (scheme == EFUSE_CODING_SCHEME_3_4) {
|
||||||
if (*((uint32_t*)buf_w_data + 6) != 0 || *((uint32_t*)buf_w_data + 7) != 0) {
|
if (*((uint32_t*)buf_w_data + 6) != 0 || *((uint32_t*)buf_w_data + 7) != 0) {
|
||||||
return ESP_ERR_CODING;
|
return ESP_ERR_CODING;
|
||||||
|
@ -169,7 +169,7 @@ TEST_CASE("Test Coding Scheme for efuse manager", "[efuse]")
|
|||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
TEST_ASSERT_EQUAL_HEX32_ARRAY(encoded, w_data_after_coding, 8);
|
TEST_ASSERT_EQUAL_HEX32_ARRAY(buf, w_data_after_coding, 8);
|
||||||
}
|
}
|
||||||
esp_efuse_utility_reset();
|
esp_efuse_utility_reset();
|
||||||
bootloader_random_disable();
|
bootloader_random_disable();
|
||||||
@ -193,7 +193,7 @@ TEST_CASE("Test data does not match the coding scheme", "[efuse]")
|
|||||||
esp_efuse_utility_reset();
|
esp_efuse_utility_reset();
|
||||||
|
|
||||||
for (int i = 0; i < count_useful_reg; ++i) {
|
for (int i = 0; i < count_useful_reg; ++i) {
|
||||||
REG_WRITE(EFUSE_BLK2_WDATA0_REG + i * 4, 0xABCDEF01 + i);
|
TEST_ESP_OK(esp_efuse_utility_write_reg(2, i, 0xABCDEF01 + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coding_scheme == EFUSE_CODING_SCHEME_NONE) {
|
if (coding_scheme == EFUSE_CODING_SCHEME_NONE) {
|
||||||
|
Reference in New Issue
Block a user