14 #include "sysrst_ctrl_regs.h"
19 if (sysrst_ctrl == NULL) {
30 if (sysrst_ctrl == NULL) {
37 alert_idx = SYSRST_CTRL_ALERT_TEST_FATAL_FAULT_BIT;
44 mmio_region_write32(sysrst_ctrl->
base_addr,
45 (ptrdiff_t)SYSRST_CTRL_ALERT_TEST_REG_OFFSET,
58 *index_out = SYSRST_CTRL_INTR_COMMON_EVENT_DETECTED_BIT;
75 if (sysrst_ctrl == NULL || type == NULL || irq < 0 ||
80 *type = irq_types[irq];
89 if (sysrst_ctrl == NULL || snapshot == NULL) {
93 *snapshot = mmio_region_read32(sysrst_ctrl->
base_addr,
94 (ptrdiff_t)SYSRST_CTRL_INTR_STATE_REG_OFFSET);
103 if (sysrst_ctrl == NULL) {
107 mmio_region_write32(sysrst_ctrl->
base_addr,
108 (ptrdiff_t)SYSRST_CTRL_INTR_STATE_REG_OFFSET, snapshot);
117 if (sysrst_ctrl == NULL || is_pending == NULL) {
122 if (!sysrst_ctrl_get_irq_bit_index(irq, &index)) {
126 uint32_t intr_state_reg = mmio_region_read32(
127 sysrst_ctrl->
base_addr, (ptrdiff_t)SYSRST_CTRL_INTR_STATE_REG_OFFSET);
137 if (sysrst_ctrl == NULL) {
142 mmio_region_write32(sysrst_ctrl->
base_addr,
143 (ptrdiff_t)SYSRST_CTRL_INTR_STATE_REG_OFFSET, UINT32_MAX);
151 if (sysrst_ctrl == NULL) {
156 if (!sysrst_ctrl_get_irq_bit_index(irq, &index)) {
162 mmio_region_write32(sysrst_ctrl->
base_addr,
163 (ptrdiff_t)SYSRST_CTRL_INTR_STATE_REG_OFFSET,
173 if (sysrst_ctrl == NULL) {
178 if (!sysrst_ctrl_get_irq_bit_index(irq, &index)) {
183 mmio_region_write32(sysrst_ctrl->
base_addr,
184 (ptrdiff_t)SYSRST_CTRL_INTR_TEST_REG_OFFSET,
194 if (sysrst_ctrl == NULL || state == NULL) {
199 if (!sysrst_ctrl_get_irq_bit_index(irq, &index)) {
203 uint32_t intr_enable_reg = mmio_region_read32(
204 sysrst_ctrl->
base_addr, (ptrdiff_t)SYSRST_CTRL_INTR_ENABLE_REG_OFFSET);
216 if (sysrst_ctrl == NULL) {
221 if (!sysrst_ctrl_get_irq_bit_index(irq, &index)) {
225 uint32_t intr_enable_reg = mmio_region_read32(
226 sysrst_ctrl->
base_addr, (ptrdiff_t)SYSRST_CTRL_INTR_ENABLE_REG_OFFSET);
230 mmio_region_write32(sysrst_ctrl->
base_addr,
231 (ptrdiff_t)SYSRST_CTRL_INTR_ENABLE_REG_OFFSET,
241 if (sysrst_ctrl == NULL) {
246 if (snapshot != NULL) {
247 *snapshot = mmio_region_read32(
248 sysrst_ctrl->
base_addr, (ptrdiff_t)SYSRST_CTRL_INTR_ENABLE_REG_OFFSET);
252 mmio_region_write32(sysrst_ctrl->
base_addr,
253 (ptrdiff_t)SYSRST_CTRL_INTR_ENABLE_REG_OFFSET, 0u);
262 if (sysrst_ctrl == NULL || snapshot == NULL) {
266 mmio_region_write32(sysrst_ctrl->
base_addr,
267 (ptrdiff_t)SYSRST_CTRL_INTR_ENABLE_REG_OFFSET, *snapshot);