36 uint32_t efuse_lock:1;
37 uint32_t flash_present:1;
42 uint32_t sec_key_sel:4;
43 uint32_t sec_key_alg:3;
44 uint32_t qspi_0_pin_mux:3;
45 uint32_t qspi_2_pin_mux:3;
46 uint32_t qspi_3_pin_mux:3;
47 uint32_t qspi_4_pin_mux:3;
48 uint32_t qspi_5_pin_mux:3;
58 uint32_t dbv_present:1;
60 uint32_t drf_present:1;
62 uint32_t tx_cal_present:1;
64 uint32_t bod_present:1;
80 uint32_t vtemp_offset:16;
103 uint32_t efuse_lock:1;
104 uint32_t dbg_disable:1;
105 uint32_t flash_encrypt:1;
106 uint32_t flash_secure_boot:1;
107 uint32_t ecc_length:1;
108 uint32_t dft_if_en:1;
110 uint32_t ram_secure_boot:1;
111 uint32_t host_auth:1;
112 uint32_t spi_init_speed:2;
113 uint32_t secure_boot_w_uuid:1;
116 uint32_t aon_wdt_dis:1;
117 uint32_t aon_wdt_win:1;
118 uint32_t aon_wdt_rst:2;
122 uint32_t bod_reset:1;
123 uint32_t flash_exception:2;
124 uint32_t reset_option:1;
155 static __inline
int efuse_intr_read_done(
void)
157 return ((RD_WORD(EFUSECTRL_REG_INTR_STATUS) & EFUSECTRL_REG_INTR_STATUS_READ_DONE) ? 1: 0);
160 static __inline
int efuse_intr_prog_done(
void)
162 return ((RD_WORD(EFUSECTRL_REG_INTR_STATUS) & EFUSECTRL_REG_INTR_STATUS_PROG_DONE) ? 1 : 0);
165 static __inline
void efuse_intr_read_done_clr(
void)
167 WR_WORD(EFUSECTRL_REG_INTR_CLR, EFUSECTRL_REG_INTR_CLR_READ_DONE);
170 static __inline
void efuse_intr_prog_done_clr(
void)
172 WR_WORD(EFUSECTRL_REG_INTR_CLR, EFUSECTRL_REG_INTR_CLR_PROG_DONE);
175 static __inline
void efuse_enable(
void)
177 WR_WORD(EFUSECTRL_REG_MISC_CTRL, EFUSECTRL_REG_MISC_CTRL_CTL_EFUSE_EN);
180 static __inline
void efuse_disable(
void)
182 WR_WORD(EFUSECTRL_REG_MISC_CTRL, 0);
185 static __inline
void efuse_prog_enable(
void)
187 WR_WORD(EFUSECTRL_REG_MISC_CTRL, EFUSECTRL_REG_MISC_CTRL_CTL_EFUSE_EN | EFUSECTRL_REG_MISC_CTRL_CTL_EFUSE_PROG_EN);
190 static __inline
void efuse_prog_disable(
void)
192 WR_WORD(EFUSECTRL_REG_MISC_CTRL, 0);
195 static __inline
void efuse_prog_bit_start(uint32_t bit_adr)
197 WR_WORD(EFUSECTRL_REG_PROG_CTRL,
198 (EFUSECTRL_REG_PROG_CTRL_CTL_EFUSE_PROG_REQ | (bit_adr << EFUSECTRL_REG_PROG_CTRL_CTL_EFUSE_PROG_BIT_ADDR_SHIFT)));
201 static __inline
void efuse_prog_bit_end(
void)
203 WR_WORD(EFUSECTRL_REG_PROG_CTRL, 0);
206 #define EFUSE_READ_HWORD 0 207 #define EFUSE_READ_WORD 1 209 static __inline
void efuse_read_bit_start(uint32_t addr,
int size)
211 WR_WORD(EFUSECTRL_REG_READ_CTRL, (EFUSECTRL_REG_READ_CTRL_CTL_EFUSE_READ_REQ |
212 ((addr & EFUSECTRL_REG_READ_CTRL_CTL_EFUSE_READ_ADDR_MASK) << EFUSECTRL_REG_READ_CTRL_CTL_EFUSE_READ_ADDR_SHIFT) |
213 (size ? EFUSECTRL_REG_READ_CTRL_CTL_EFUSE_READ_MODE : 0)));
216 static __inline
void efuse_read_bit_end(
void)
218 WR_WORD(EFUSECTRL_REG_READ_CTRL, 0);
221 static __inline uint32_t efuse_read_value(
void)
223 return RD_WORD(EFUSECTRL_REG_READ_VAL);
226 static __inline
void efuse_set_prog_ctrl_reg(uint32_t val)
228 WR_WORD(EFUSECTRL_REG_PROG_CTRL, val);
231 static __inline uint32_t efuse_get_prog_ctrl_reg(
void)
233 return RD_WORD(EFUSECTRL_REG_PROG_CTRL);
236 static uint32_t efuse_read_word(uint8_t addr)
241 efuse_read_bit_start(addr, EFUSE_READ_WORD);
242 while (!efuse_intr_read_done());
243 data = efuse_read_value();
244 efuse_intr_read_done_clr();
245 efuse_read_bit_end();
251 static __inline uint32_t efuse_init_rd_val_w0(
void)
253 return RD_WORD(EFUSECTRL_REG_INPLAY_INIT_RD_VAL_W0);
256 static __inline uint32_t efuse_init_rd_val_w1(
void)
258 return RD_WORD(EFUSECTRL_REG_INPLAY_INIT_RD_VAL_W1);
261 static __inline uint32_t efuse_init_rd_val_w2(
void)
263 return RD_WORD(EFUSECTRL_REG_INPLAY_INIT_RD_VAL_W2);
266 static __inline uint32_t efuse_init_rd_val_w3(
void)
268 return RD_WORD(EFUSECTRL_REG_INPLAY_INIT_RD_VAL_W3);
271 static __inline uint32_t efuse_init_rd_val_w4(
void)
273 return RD_WORD(EFUSECTRL_REG_INPLAY_INIT_RD_VAL_W4);
276 static __inline uint32_t efuse_init_rd_val_w5(
void)
278 return RD_WORD(EFUSECTRL_REG_INPLAY_INIT_RD_VAL_W5);
281 static __inline uint32_t efuse_init_rd_val_w6(
void)
283 return RD_WORD(EFUSECTRL_REG_INPLAY_INIT_RD_VAL_W6);
286 static __inline uint32_t efuse_init_rd_val_w7(
void)
288 return RD_WORD(EFUSECTRL_REG_CUSTOMER_INIT_RD_VALUE_W0);
291 static __inline
void efuse_tpp(uint32_t tpp)
293 uint32_t reg = RD_WORD(EFUSECTRL_REG_COUNTER_CTRL_1);
294 reg &= ~EFUSECTRL_REG_COUNTER_CTRL_1_CTL_EFUSE_CNT_TPP_MASK;
295 reg |= (tpp << EFUSECTRL_REG_COUNTER_CTRL_1_CTL_EFUSE_CNT_TPP_SHIFT);
296 WR_WORD(EFUSECTRL_REG_COUNTER_CTRL_1, reg);
299 static __inline
int efuse_load_done(
void)
301 return ((((RD_WORD(EFUSECTRL_REG_MISC_STS) >> EFUSECTRL_REG_MISC_STS_STS_EFUSE_CURR_STATE_SHIFT) & 0xF) == 0xF) ? 1 : 0);
uint32_t hal_efuse_read_hw_param(void)
Read HW configuration parameters in efuse from the register Note: efuse's word 0, by default...
efuse_result_status
eFuse status result
Definition: hal_efuse.h:137
int hal_efuse_write_word(int word_num, uint32_t data)
Write eFuse word.
uint32_t hal_efuse_read_feature_param(void)
Read feature parameters in efuse from the register Note: efuse's word 4, by default, will be read by the HW and store in the register, so SW can retrieve it without accessing efuse directly..
int hal_efuse_open(void)
Initialize eFuse driver.
void hal_efuse_read_public_keys(uint8_t x[32], uint8_t y[32])
Read public keys from efuse.
Error. Os apis failed.
Definition: hal_efuse.h:143
void hal_efuse_read_uuid(uint32_t uuid[3])
Read UUID in efuse from the registers Note: efuse's word 1 - 3, by default, will be read by the HW an...
int hal_efuse_read_word(int word_num, uint32_t *out)
Read eFuse word.
uint32_t hal_efuse_read_temp_param(void)
Read temperature parameters in efuse from the register Note: efuse's word 6, by default, will be read by the HW and store in the register, so SW can retrieve it without accessing efuse directly..
No error. Good.
Definition: hal_efuse.h:139
Error. driver is not open, call hal_efuse_open.
Definition: hal_efuse.h:141
Error, already been used.
Definition: hal_efuse.h:145
uint32_t hal_efuse_read_vbat_param(void)
Read vbat parameters in efuse from the register Note: efuse's word 5, by default, will be read by the...
uint32_t hal_efuse_read_usr_param(void)
Read user configuration parameters in efuse from the register Note: efuse's word 7, by default, will be read by the HW and store in the register, so SW can retrieve it without accessing efuse directly..
int hal_efuse_close(void)
Stop and cleanup eFuse driver.