14 #include "uart_regs.h"
36 alert_idx = UART_ALERT_TEST_FATAL_FAULT_BIT;
43 mmio_region_write32(uart->
base_addr, (ptrdiff_t)UART_ALERT_TEST_REG_OFFSET,
56 *index_out = UART_INTR_COMMON_TX_WATERMARK_BIT;
59 *index_out = UART_INTR_COMMON_RX_WATERMARK_BIT;
62 *index_out = UART_INTR_COMMON_TX_DONE_BIT;
65 *index_out = UART_INTR_COMMON_RX_OVERFLOW_BIT;
68 *index_out = UART_INTR_COMMON_RX_FRAME_ERR_BIT;
71 *index_out = UART_INTR_COMMON_RX_BREAK_ERR_BIT;
74 *index_out = UART_INTR_COMMON_RX_TIMEOUT_BIT;
77 *index_out = UART_INTR_COMMON_RX_PARITY_ERR_BIT;
80 *index_out = UART_INTR_COMMON_TX_EMPTY_BIT;
102 *type = irq_types[irq];
110 if (uart == NULL || snapshot == NULL) {
114 *snapshot = mmio_region_read32(uart->
base_addr,
115 (ptrdiff_t)UART_INTR_STATE_REG_OFFSET);
127 mmio_region_write32(uart->
base_addr, (ptrdiff_t)UART_INTR_STATE_REG_OFFSET,
136 if (uart == NULL || is_pending == NULL) {
141 if (!uart_get_irq_bit_index(irq, &index)) {
145 uint32_t intr_state_reg = mmio_region_read32(
146 uart->
base_addr, (ptrdiff_t)UART_INTR_STATE_REG_OFFSET);
160 mmio_region_write32(uart->
base_addr, (ptrdiff_t)UART_INTR_STATE_REG_OFFSET,
174 if (!uart_get_irq_bit_index(irq, &index)) {
180 mmio_region_write32(uart->
base_addr, (ptrdiff_t)UART_INTR_STATE_REG_OFFSET,
194 if (!uart_get_irq_bit_index(irq, &index)) {
199 mmio_region_write32(uart->
base_addr, (ptrdiff_t)UART_INTR_TEST_REG_OFFSET,
208 if (uart == NULL || state == NULL) {
213 if (!uart_get_irq_bit_index(irq, &index)) {
217 uint32_t intr_enable_reg = mmio_region_read32(
218 uart->
base_addr, (ptrdiff_t)UART_INTR_ENABLE_REG_OFFSET);
234 if (!uart_get_irq_bit_index(irq, &index)) {
238 uint32_t intr_enable_reg = mmio_region_read32(
239 uart->
base_addr, (ptrdiff_t)UART_INTR_ENABLE_REG_OFFSET);
243 mmio_region_write32(uart->
base_addr, (ptrdiff_t)UART_INTR_ENABLE_REG_OFFSET,
257 if (snapshot != NULL) {
258 *snapshot = mmio_region_read32(uart->
base_addr,
259 (ptrdiff_t)UART_INTR_ENABLE_REG_OFFSET);
263 mmio_region_write32(uart->
base_addr, (ptrdiff_t)UART_INTR_ENABLE_REG_OFFSET,
272 if (uart == NULL || snapshot == NULL) {
276 mmio_region_write32(uart->
base_addr, (ptrdiff_t)UART_INTR_ENABLE_REG_OFFSET,