14 #include "gpio_regs.h"
36 alert_idx = GPIO_ALERT_TEST_FATAL_FAULT_BIT;
43 mmio_region_write32(gpio->
base_addr, (ptrdiff_t)GPIO_ALERT_TEST_REG_OFFSET,
58 case kDifGpioIrqGpio1:
61 case kDifGpioIrqGpio2:
64 case kDifGpioIrqGpio3:
67 case kDifGpioIrqGpio4:
70 case kDifGpioIrqGpio5:
73 case kDifGpioIrqGpio6:
76 case kDifGpioIrqGpio7:
79 case kDifGpioIrqGpio8:
82 case kDifGpioIrqGpio9:
85 case kDifGpioIrqGpio10:
88 case kDifGpioIrqGpio11:
91 case kDifGpioIrqGpio12:
94 case kDifGpioIrqGpio13:
97 case kDifGpioIrqGpio14:
100 case kDifGpioIrqGpio15:
103 case kDifGpioIrqGpio16:
106 case kDifGpioIrqGpio17:
109 case kDifGpioIrqGpio18:
112 case kDifGpioIrqGpio19:
115 case kDifGpioIrqGpio20:
118 case kDifGpioIrqGpio21:
121 case kDifGpioIrqGpio22:
124 case kDifGpioIrqGpio23:
127 case kDifGpioIrqGpio24:
130 case kDifGpioIrqGpio25:
133 case kDifGpioIrqGpio26:
136 case kDifGpioIrqGpio27:
139 case kDifGpioIrqGpio28:
142 case kDifGpioIrqGpio29:
145 case kDifGpioIrqGpio30:
148 case kDifGpioIrqGpio31:
172 if (gpio == NULL || type == NULL || irq == kDifGpioIrqGpio31 + 1) {
176 *type = irq_types[irq];
184 if (gpio == NULL || snapshot == NULL) {
188 *snapshot = mmio_region_read32(gpio->
base_addr,
189 (ptrdiff_t)GPIO_INTR_STATE_REG_OFFSET);
201 mmio_region_write32(gpio->
base_addr, (ptrdiff_t)GPIO_INTR_STATE_REG_OFFSET,
210 if (gpio == NULL || is_pending == NULL) {
215 if (!gpio_get_irq_bit_index(irq, &index)) {
219 uint32_t intr_state_reg = mmio_region_read32(
220 gpio->
base_addr, (ptrdiff_t)GPIO_INTR_STATE_REG_OFFSET);
234 mmio_region_write32(gpio->
base_addr, (ptrdiff_t)GPIO_INTR_STATE_REG_OFFSET,
248 if (!gpio_get_irq_bit_index(irq, &index)) {
254 mmio_region_write32(gpio->
base_addr, (ptrdiff_t)GPIO_INTR_STATE_REG_OFFSET,
268 if (!gpio_get_irq_bit_index(irq, &index)) {
273 mmio_region_write32(gpio->
base_addr, (ptrdiff_t)GPIO_INTR_TEST_REG_OFFSET,
282 if (gpio == NULL || state == NULL) {
287 if (!gpio_get_irq_bit_index(irq, &index)) {
291 uint32_t intr_enable_reg = mmio_region_read32(
292 gpio->
base_addr, (ptrdiff_t)GPIO_INTR_ENABLE_REG_OFFSET);
308 if (!gpio_get_irq_bit_index(irq, &index)) {
312 uint32_t intr_enable_reg = mmio_region_read32(
313 gpio->
base_addr, (ptrdiff_t)GPIO_INTR_ENABLE_REG_OFFSET);
317 mmio_region_write32(gpio->
base_addr, (ptrdiff_t)GPIO_INTR_ENABLE_REG_OFFSET,
331 if (snapshot != NULL) {
332 *snapshot = mmio_region_read32(gpio->
base_addr,
333 (ptrdiff_t)GPIO_INTR_ENABLE_REG_OFFSET);
337 mmio_region_write32(gpio->
base_addr, (ptrdiff_t)GPIO_INTR_ENABLE_REG_OFFSET,
346 if (gpio == NULL || snapshot == NULL) {
350 mmio_region_write32(gpio->
base_addr, (ptrdiff_t)GPIO_INTR_ENABLE_REG_OFFSET,