14 #include "otp_ctrl_regs.h"
19 if (otp_ctrl == NULL) {
30 if (otp_ctrl == NULL) {
37 alert_idx = OTP_CTRL_ALERT_TEST_FATAL_MACRO_ERROR_BIT;
40 alert_idx = OTP_CTRL_ALERT_TEST_FATAL_CHECK_ERROR_BIT;
43 alert_idx = OTP_CTRL_ALERT_TEST_FATAL_BUS_INTEG_ERROR_BIT;
46 alert_idx = OTP_CTRL_ALERT_TEST_FATAL_PRIM_OTP_ALERT_BIT;
49 alert_idx = OTP_CTRL_ALERT_TEST_RECOV_PRIM_OTP_ALERT_BIT;
57 (ptrdiff_t)OTP_CTRL_ALERT_TEST_REG_OFFSET,
70 *index_out = OTP_CTRL_INTR_COMMON_OTP_OPERATION_DONE_BIT;
73 *index_out = OTP_CTRL_INTR_COMMON_OTP_ERROR_BIT;
95 *type = irq_types[irq];
104 if (otp_ctrl == NULL || snapshot == NULL) {
108 *snapshot = mmio_region_read32(otp_ctrl->
base_addr,
109 (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET);
118 if (otp_ctrl == NULL) {
123 (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET, snapshot);
132 if (otp_ctrl == NULL || is_pending == NULL) {
137 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
141 uint32_t intr_state_reg = mmio_region_read32(
142 otp_ctrl->
base_addr, (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET);
151 if (otp_ctrl == NULL) {
157 (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET, UINT32_MAX);
165 if (otp_ctrl == NULL) {
170 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
177 (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET,
186 if (otp_ctrl == NULL) {
191 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
197 (ptrdiff_t)OTP_CTRL_INTR_TEST_REG_OFFSET, intr_test_reg);
206 if (otp_ctrl == NULL || state == NULL) {
211 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
215 uint32_t intr_enable_reg = mmio_region_read32(
216 otp_ctrl->
base_addr, (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET);
228 if (otp_ctrl == NULL) {
233 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
237 uint32_t intr_enable_reg = mmio_region_read32(
238 otp_ctrl->
base_addr, (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET);
243 (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET,
253 if (otp_ctrl == NULL) {
258 if (snapshot != NULL) {
259 *snapshot = mmio_region_read32(otp_ctrl->
base_addr,
260 (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET);
265 (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET, 0u);
274 if (otp_ctrl == NULL || snapshot == NULL) {
279 (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET, *snapshot);