1.1 --- a/pkg/devices/lib/dma/include/dma-jz4730.h Thu Jun 06 23:57:07 2024 +0200
1.2 +++ b/pkg/devices/lib/dma/include/dma-jz4730.h Fri Jun 07 16:08:15 2024 +0200
1.3 @@ -177,7 +177,7 @@
1.4
1.5 void enable();
1.6
1.7 - Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq);
1.8 + Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq = L4_INVALID_CAP);
1.9
1.10 bool have_interrupt(uint8_t channel);
1.11 };
2.1 --- a/pkg/devices/lib/dma/include/dma-jz4780.h Thu Jun 06 23:57:07 2024 +0200
2.2 +++ b/pkg/devices/lib/dma/include/dma-jz4780.h Fri Jun 07 16:08:15 2024 +0200
2.3 @@ -162,8 +162,7 @@
2.4
2.5 void enable();
2.6
2.7 - Dma_channel *get_channel(uint8_t channel,
2.8 - l4_cap_idx_t irq = L4_INVALID_CAP);
2.9 + Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq = L4_INVALID_CAP);
2.10
2.11 // Transaction control.
2.12
3.1 --- a/pkg/devices/lib/dma/include/dma-x1600.h Thu Jun 06 23:57:07 2024 +0200
3.2 +++ b/pkg/devices/lib/dma/include/dma-x1600.h Fri Jun 07 16:08:15 2024 +0200
3.3 @@ -158,7 +158,7 @@
3.4
3.5 void enable();
3.6
3.7 - Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq);
3.8 + Dma_channel *get_channel(uint8_t channel, l4_cap_idx_t irq = L4_INVALID_CAP);
3.9
3.10 // Transaction control.
3.11
4.1 --- a/pkg/devices/lib/dma/src/jz4730.cc Thu Jun 06 23:57:07 2024 +0200
4.2 +++ b/pkg/devices/lib/dma/src/jz4730.cc Fri Jun 07 16:08:15 2024 +0200
4.3 @@ -348,10 +348,15 @@
4.4 bool
4.5 Dma_jz4730_channel::wait_for_irq()
4.6 {
4.7 - if (l4_error(l4_rcv_ep_bind_thread(_irq, get_current_thread(), 0)))
4.8 - return false;
4.9 + if (l4_is_valid_cap(_irq))
4.10 + {
4.11 + if (l4_error(l4_rcv_ep_bind_thread(_irq, get_current_thread(), 0)))
4.12 + return false;
4.13
4.14 - return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel);
4.15 + return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel);
4.16 + }
4.17 + else
4.18 + return true;
4.19 }
4.20
4.21 // Wait up to the given timeout (in microseconds) for an interrupt request,
5.1 --- a/pkg/devices/lib/dma/src/x1600.cc Thu Jun 06 23:57:07 2024 +0200
5.2 +++ b/pkg/devices/lib/dma/src/x1600.cc Fri Jun 07 16:08:15 2024 +0200
5.3 @@ -387,10 +387,15 @@
5.4 bool
5.5 Dma_x1600_channel::wait_for_irq()
5.6 {
5.7 - if (l4_error(l4_rcv_ep_bind_thread(_irq, get_current_thread(), 0)))
5.8 - return false;
5.9 + if (l4_is_valid_cap(_irq))
5.10 + {
5.11 + if (l4_error(l4_rcv_ep_bind_thread(_irq, get_current_thread(), 0)))
5.12 + return false;
5.13
5.14 - return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel);
5.15 + return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel);
5.16 + }
5.17 + else
5.18 + return true;
5.19 }
5.20
5.21 // Wait up to the given timeout (in microseconds) for an interrupt request,