14 #include "spi_host_regs.h"
19 if (spi_host == NULL) {
30 if (spi_host == NULL) {
37 alert_idx = SPI_HOST_ALERT_TEST_FATAL_FAULT_BIT;
45 (ptrdiff_t)SPI_HOST_ALERT_TEST_REG_OFFSET,
58 *index_out = SPI_HOST_INTR_COMMON_ERROR_BIT;
61 *index_out = SPI_HOST_INTR_COMMON_SPI_EVENT_BIT;
79 if (spi_host == NULL || type == NULL || irq < 0 ||
84 *type = irq_types[irq];
93 if (spi_host == NULL || snapshot == NULL) {
97 *snapshot = mmio_region_read32(spi_host->
base_addr,
98 (ptrdiff_t)SPI_HOST_INTR_STATE_REG_OFFSET);
107 if (spi_host == NULL) {
112 (ptrdiff_t)SPI_HOST_INTR_STATE_REG_OFFSET, snapshot);
121 if (spi_host == NULL || is_pending == NULL) {
126 if (!spi_host_get_irq_bit_index(irq, &index)) {
130 uint32_t intr_state_reg = mmio_region_read32(
131 spi_host->
base_addr, (ptrdiff_t)SPI_HOST_INTR_STATE_REG_OFFSET);
140 if (spi_host == NULL) {
146 (ptrdiff_t)SPI_HOST_INTR_STATE_REG_OFFSET, UINT32_MAX);
154 if (spi_host == NULL) {
159 if (!spi_host_get_irq_bit_index(irq, &index)) {
166 (ptrdiff_t)SPI_HOST_INTR_STATE_REG_OFFSET,
175 if (spi_host == NULL) {
180 if (!spi_host_get_irq_bit_index(irq, &index)) {
186 (ptrdiff_t)SPI_HOST_INTR_TEST_REG_OFFSET, intr_test_reg);
195 if (spi_host == NULL || state == NULL) {
200 if (!spi_host_get_irq_bit_index(irq, &index)) {
204 uint32_t intr_enable_reg = mmio_region_read32(
205 spi_host->
base_addr, (ptrdiff_t)SPI_HOST_INTR_ENABLE_REG_OFFSET);
217 if (spi_host == NULL) {
222 if (!spi_host_get_irq_bit_index(irq, &index)) {
226 uint32_t intr_enable_reg = mmio_region_read32(
227 spi_host->
base_addr, (ptrdiff_t)SPI_HOST_INTR_ENABLE_REG_OFFSET);
232 (ptrdiff_t)SPI_HOST_INTR_ENABLE_REG_OFFSET,
242 if (spi_host == NULL) {
247 if (snapshot != NULL) {
248 *snapshot = mmio_region_read32(spi_host->
base_addr,
249 (ptrdiff_t)SPI_HOST_INTR_ENABLE_REG_OFFSET);
254 (ptrdiff_t)SPI_HOST_INTR_ENABLE_REG_OFFSET, 0u);
263 if (spi_host == NULL || snapshot == NULL) {
268 (ptrdiff_t)SPI_HOST_INTR_ENABLE_REG_OFFSET, *snapshot);