Merge branch 'feature/efuse_purpose_api' into 'master'
efuse: Add an API to return the efuse descriptor for a key block's purpose field See merge request espressif/esp-idf!8269
This commit is contained in:
commit
604360b98c
3 changed files with 38 additions and 3 deletions
|
@ -56,6 +56,14 @@ typedef enum {
|
||||||
EFUSE_BLK_MAX
|
EFUSE_BLK_MAX
|
||||||
} esp_efuse_block_t;
|
} esp_efuse_block_t;
|
||||||
|
|
||||||
|
struct esp_efuse_desc_s;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Given a key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY5, return
|
||||||
|
* efuse field for setting the key purpose
|
||||||
|
*/
|
||||||
|
const struct esp_efuse_desc_s **esp_efuse_get_purpose_field(esp_efuse_block_t block);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Type of coding scheme
|
* @brief Type of coding scheme
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,13 +35,18 @@ extern "C" {
|
||||||
#define ESP_ERR_CODING (ESP_ERR_EFUSE + 0x04) /*!< Error while a encoding operation. */
|
#define ESP_ERR_CODING (ESP_ERR_EFUSE + 0x04) /*!< Error while a encoding operation. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Structure eFuse field
|
* @brief Structure eFuse field
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
struct esp_efuse_desc_s {
|
||||||
esp_efuse_block_t efuse_block: 8; /**< Block of eFuse */
|
esp_efuse_block_t efuse_block: 8; /**< Block of eFuse */
|
||||||
uint8_t bit_start; /**< Start bit [0..255] */
|
uint8_t bit_start; /**< Start bit [0..255] */
|
||||||
uint16_t bit_count; /**< Length of bit field [1..-]*/
|
uint16_t bit_count; /**< Length of bit field [1..-]*/
|
||||||
} esp_efuse_desc_t;
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Type definition for an eFuse field
|
||||||
|
*/
|
||||||
|
typedef struct esp_efuse_desc_s esp_efuse_desc_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reads bits from EFUSE field and writes it into an array.
|
* @brief Reads bits from EFUSE field and writes it into an array.
|
||||||
|
|
|
@ -81,3 +81,25 @@ esp_efuse_coding_scheme_t esp_efuse_get_coding_scheme(esp_efuse_block_t blk)
|
||||||
ESP_EARLY_LOGD(TAG, "coding scheme %d", scheme);
|
ESP_EARLY_LOGD(TAG, "coding scheme %d", scheme);
|
||||||
return scheme;
|
return scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const esp_efuse_desc_t **esp_efuse_get_purpose_field(esp_efuse_block_t block)
|
||||||
|
{
|
||||||
|
switch(block) {
|
||||||
|
case EFUSE_BLK_KEY0:
|
||||||
|
return ESP_EFUSE_KEY_PURPOSE_0;
|
||||||
|
case EFUSE_BLK_KEY1:
|
||||||
|
return ESP_EFUSE_KEY_PURPOSE_1;
|
||||||
|
case EFUSE_BLK_KEY2:
|
||||||
|
return ESP_EFUSE_KEY_PURPOSE_2;
|
||||||
|
case EFUSE_BLK_KEY3:
|
||||||
|
return ESP_EFUSE_KEY_PURPOSE_3;
|
||||||
|
case EFUSE_BLK_KEY4:
|
||||||
|
return ESP_EFUSE_KEY_PURPOSE_4;
|
||||||
|
case EFUSE_BLK_KEY5:
|
||||||
|
return ESP_EFUSE_KEY_PURPOSE_5;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue