14 #include "usbdev_regs.h"
36 alert_idx = USBDEV_ALERT_TEST_FATAL_FAULT_BIT;
44 (ptrdiff_t)USBDEV_ALERT_TEST_REG_OFFSET, alert_test_reg);
56 *index_out = USBDEV_INTR_COMMON_PKT_RECEIVED_BIT;
59 *index_out = USBDEV_INTR_COMMON_PKT_SENT_BIT;
62 *index_out = USBDEV_INTR_COMMON_DISCONNECTED_BIT;
65 *index_out = USBDEV_INTR_COMMON_HOST_LOST_BIT;
68 *index_out = USBDEV_INTR_COMMON_LINK_RESET_BIT;
71 *index_out = USBDEV_INTR_COMMON_LINK_SUSPEND_BIT;
74 *index_out = USBDEV_INTR_COMMON_LINK_RESUME_BIT;
77 *index_out = USBDEV_INTR_COMMON_AV_OUT_EMPTY_BIT;
80 *index_out = USBDEV_INTR_COMMON_RX_FULL_BIT;
83 *index_out = USBDEV_INTR_COMMON_AV_OVERFLOW_BIT;
86 *index_out = USBDEV_INTR_COMMON_LINK_IN_ERR_BIT;
89 *index_out = USBDEV_INTR_COMMON_RX_CRC_ERR_BIT;
92 *index_out = USBDEV_INTR_COMMON_RX_PID_ERR_BIT;
95 *index_out = USBDEV_INTR_COMMON_RX_BITSTUFF_ERR_BIT;
98 *index_out = USBDEV_INTR_COMMON_FRAME_BIT;
101 *index_out = USBDEV_INTR_COMMON_POWERED_BIT;
104 *index_out = USBDEV_INTR_COMMON_LINK_OUT_ERR_BIT;
107 *index_out = USBDEV_INTR_COMMON_AV_SETUP_EMPTY_BIT;
132 *type = irq_types[irq];
140 if (usbdev == NULL || snapshot == NULL) {
144 *snapshot = mmio_region_read32(usbdev->
base_addr,
145 (ptrdiff_t)USBDEV_INTR_STATE_REG_OFFSET);
153 if (usbdev == NULL) {
158 (ptrdiff_t)USBDEV_INTR_STATE_REG_OFFSET, snapshot);
166 if (usbdev == NULL || is_pending == NULL) {
171 if (!usbdev_get_irq_bit_index(irq, &index)) {
175 uint32_t intr_state_reg = mmio_region_read32(
176 usbdev->
base_addr, (ptrdiff_t)USBDEV_INTR_STATE_REG_OFFSET);
185 if (usbdev == NULL) {
191 (ptrdiff_t)USBDEV_INTR_STATE_REG_OFFSET, UINT32_MAX);
199 if (usbdev == NULL) {
204 if (!usbdev_get_irq_bit_index(irq, &index)) {
211 (ptrdiff_t)USBDEV_INTR_STATE_REG_OFFSET, intr_state_reg);
219 if (usbdev == NULL) {
224 if (!usbdev_get_irq_bit_index(irq, &index)) {
229 mmio_region_write32(usbdev->
base_addr, (ptrdiff_t)USBDEV_INTR_TEST_REG_OFFSET,
239 if (usbdev == NULL || state == NULL) {
244 if (!usbdev_get_irq_bit_index(irq, &index)) {
248 uint32_t intr_enable_reg = mmio_region_read32(
249 usbdev->
base_addr, (ptrdiff_t)USBDEV_INTR_ENABLE_REG_OFFSET);
261 if (usbdev == NULL) {
266 if (!usbdev_get_irq_bit_index(irq, &index)) {
270 uint32_t intr_enable_reg = mmio_region_read32(
271 usbdev->
base_addr, (ptrdiff_t)USBDEV_INTR_ENABLE_REG_OFFSET);
276 (ptrdiff_t)USBDEV_INTR_ENABLE_REG_OFFSET,
285 if (usbdev == NULL) {
290 if (snapshot != NULL) {
291 *snapshot = mmio_region_read32(usbdev->
base_addr,
292 (ptrdiff_t)USBDEV_INTR_ENABLE_REG_OFFSET);
297 (ptrdiff_t)USBDEV_INTR_ENABLE_REG_OFFSET, 0u);
306 if (usbdev == NULL || snapshot == NULL) {
311 (ptrdiff_t)USBDEV_INTR_ENABLE_REG_OFFSET, *snapshot);