# HG changeset patch # User Paul Boddie # Date 1699651839 -3600 # Node ID ba0ca04c6e22349edb5dbbff2dda7cad6b02d8e3 # Parent 3e1667db6188ea6ae77f10792e3f7be403ca535d Allow the omission of an interrupt capability in DMA channel initialisation. diff -r 3e1667db6188 -r ba0ca04c6e22 pkg/devices/lib/dma/include/dma-jz4780.h --- a/pkg/devices/lib/dma/include/dma-jz4780.h Fri Nov 10 22:30:03 2023 +0100 +++ b/pkg/devices/lib/dma/include/dma-jz4780.h Fri Nov 10 22:30:39 2023 +0100 @@ -105,7 +105,8 @@ l4_cap_idx_t _irq = L4_INVALID_CAP; public: - Dma_jz4780_channel(Dma_jz4780_chip *chip, uint8_t channel, l4_addr_t start, l4_cap_idx_t irq); + Dma_jz4780_channel(Dma_jz4780_chip *chip, uint8_t channel, l4_addr_t start, + l4_cap_idx_t irq = L4_INVALID_CAP); unsigned int transfer(uint32_t source, uint32_t destination, unsigned int count, @@ -160,7 +161,8 @@ void enable(); - Dma_jz4780_channel *get_channel(uint8_t channel, l4_cap_idx_t irq); + Dma_jz4780_channel *get_channel(uint8_t channel, + l4_cap_idx_t irq = L4_INVALID_CAP); // Transaction control. diff -r 3e1667db6188 -r ba0ca04c6e22 pkg/devices/lib/dma/src/jz4780.cc --- a/pkg/devices/lib/dma/src/jz4780.cc Fri Nov 10 22:30:03 2023 +0100 +++ b/pkg/devices/lib/dma/src/jz4780.cc Fri Nov 10 22:30:39 2023 +0100 @@ -393,7 +393,10 @@ bool Dma_jz4780_channel::wait_for_irq() { - return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel); + if (l4_is_valid_cap(_irq)) + return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel); + else + return true; } // Wait up to the given timeout (in microseconds) for an interrupt request, @@ -402,7 +405,10 @@ bool Dma_jz4780_channel::wait_for_irq(unsigned int timeout) { - return !l4_error(l4_irq_receive(_irq, l4_timeout(L4_IPC_TIMEOUT_NEVER, l4util_micros2l4to(timeout)))) && _chip->have_interrupt(_channel); + if (l4_is_valid_cap(_irq)) + return !l4_error(l4_irq_receive(_irq, l4_timeout(L4_IPC_TIMEOUT_NEVER, l4util_micros2l4to(timeout)))) && _chip->have_interrupt(_channel); + else + return true; } // Acknowledge an interrupt condition.