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;
91 if (otp_ctrl == NULL || type == NULL || irq < 0 ||
96 *type = irq_types[irq];
105 if (otp_ctrl == NULL || snapshot == NULL) {
109 *snapshot = mmio_region_read32(otp_ctrl->
base_addr,
110 (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET);
119 if (otp_ctrl == NULL) {
124 (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET, snapshot);
133 if (otp_ctrl == NULL || is_pending == NULL) {
138 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
142 uint32_t intr_state_reg = mmio_region_read32(
143 otp_ctrl->
base_addr, (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET);
152 if (otp_ctrl == NULL) {
158 (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET, UINT32_MAX);
166 if (otp_ctrl == NULL) {
171 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
178 (ptrdiff_t)OTP_CTRL_INTR_STATE_REG_OFFSET,
187 if (otp_ctrl == NULL) {
192 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
198 (ptrdiff_t)OTP_CTRL_INTR_TEST_REG_OFFSET, intr_test_reg);
207 if (otp_ctrl == NULL || state == NULL) {
212 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
216 uint32_t intr_enable_reg = mmio_region_read32(
217 otp_ctrl->
base_addr, (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET);
229 if (otp_ctrl == NULL) {
234 if (!otp_ctrl_get_irq_bit_index(irq, &index)) {
238 uint32_t intr_enable_reg = mmio_region_read32(
239 otp_ctrl->
base_addr, (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET);
244 (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET,
254 if (otp_ctrl == NULL) {
259 if (snapshot != NULL) {
260 *snapshot = mmio_region_read32(otp_ctrl->
base_addr,
261 (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET);
266 (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET, 0u);
275 if (otp_ctrl == NULL || snapshot == NULL) {
280 (ptrdiff_t)OTP_CTRL_INTR_ENABLE_REG_OFFSET, *snapshot);