# HG changeset patch # User Paul Boddie # Date 1717769295 -7200 # Node ID bf3aeeccde0985fa2875f3e8e926972dbd9ceef6 # Parent 31a89347c36e9fb2a6886a43c76b88fc1946c300 Permit the acquisition of DMA channels without IRQ capabilities. diff -r 31a89347c36e -r bf3aeeccde09 pkg/devices/lib/dma/include/dma-jz4730.h --- a/pkg/devices/lib/dma/include/dma-jz4730.h Thu Jun 06 23:57:07 2024 +0200 +++ b/pkg/devices/lib/dma/include/dma-jz4730.h Fri Jun 07 16:08:15 2024 +0200 @@ -177,7 +177,7 @@ void enable(); - Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq); + Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq = L4_INVALID_CAP); bool have_interrupt(uint8_t channel); }; diff -r 31a89347c36e -r bf3aeeccde09 pkg/devices/lib/dma/include/dma-jz4780.h --- a/pkg/devices/lib/dma/include/dma-jz4780.h Thu Jun 06 23:57:07 2024 +0200 +++ b/pkg/devices/lib/dma/include/dma-jz4780.h Fri Jun 07 16:08:15 2024 +0200 @@ -162,8 +162,7 @@ void enable(); - Dma_channel *get_channel(uint8_t channel, - l4_cap_idx_t irq = L4_INVALID_CAP); + Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq = L4_INVALID_CAP); // Transaction control. diff -r 31a89347c36e -r bf3aeeccde09 pkg/devices/lib/dma/include/dma-x1600.h --- a/pkg/devices/lib/dma/include/dma-x1600.h Thu Jun 06 23:57:07 2024 +0200 +++ b/pkg/devices/lib/dma/include/dma-x1600.h Fri Jun 07 16:08:15 2024 +0200 @@ -158,7 +158,7 @@ void enable(); - Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq); + Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq = L4_INVALID_CAP); // Transaction control. diff -r 31a89347c36e -r bf3aeeccde09 pkg/devices/lib/dma/src/jz4730.cc --- a/pkg/devices/lib/dma/src/jz4730.cc Thu Jun 06 23:57:07 2024 +0200 +++ b/pkg/devices/lib/dma/src/jz4730.cc Fri Jun 07 16:08:15 2024 +0200 @@ -348,10 +348,15 @@ bool Dma_jz4730_channel::wait_for_irq() { - if (l4_error(l4_rcv_ep_bind_thread(_irq, get_current_thread(), 0))) - return false; + if (l4_is_valid_cap(_irq)) + { + if (l4_error(l4_rcv_ep_bind_thread(_irq, get_current_thread(), 0))) + return false; - return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel); + 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, diff -r 31a89347c36e -r bf3aeeccde09 pkg/devices/lib/dma/src/x1600.cc --- a/pkg/devices/lib/dma/src/x1600.cc Thu Jun 06 23:57:07 2024 +0200 +++ b/pkg/devices/lib/dma/src/x1600.cc Fri Jun 07 16:08:15 2024 +0200 @@ -387,10 +387,15 @@ bool Dma_x1600_channel::wait_for_irq() { - if (l4_error(l4_rcv_ep_bind_thread(_irq, get_current_thread(), 0))) - return false; + if (l4_is_valid_cap(_irq)) + { + if (l4_error(l4_rcv_ep_bind_thread(_irq, get_current_thread(), 0))) + return false; - return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel); + 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,