1.1 --- a/pkg/devices/lib/dma/src/jz4730.cc Wed Feb 21 00:33:55 2024 +0100
1.2 +++ b/pkg/devices/lib/dma/src/jz4730.cc Fri Feb 23 22:52:35 2024 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * DMA support for the JZ4730.
1.6 *
1.7 - * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2021, 2024 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -22,11 +22,14 @@
1.13 #include <l4/devices/dma-jz4730.h>
1.14 #include <l4/devices/hw_mmio_register_block.h>
1.15
1.16 -#include <l4/sys/icu.h>
1.17 #include <l4/sys/ipc.h>
1.18 #include <l4/sys/irq.h>
1.19 +#include <l4/sys/rcv_endpoint.h>
1.20 #include <l4/util/util.h>
1.21
1.22 +#include <pthread.h>
1.23 +#include <pthread-l4.h>
1.24 +
1.25 #include <stdio.h>
1.26
1.27
1.28 @@ -336,6 +339,9 @@
1.29 bool
1.30 Dma_jz4730_channel::wait_for_irq()
1.31 {
1.32 + if (l4_error(l4_rcv_ep_bind_thread(_irq, pthread_l4_cap(pthread_self()), 0)))
1.33 + return false;
1.34 +
1.35 return !l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)) && _chip->have_interrupt(_channel);
1.36 }
1.37
1.38 @@ -345,6 +351,9 @@
1.39 bool
1.40 Dma_jz4730_channel::wait_for_irq(unsigned int timeout)
1.41 {
1.42 + if (l4_error(l4_rcv_ep_bind_thread(_irq, pthread_l4_cap(pthread_self()), 0)))
1.43 + return false;
1.44 +
1.45 return !l4_error(l4_irq_receive(_irq, l4_timeout(L4_IPC_TIMEOUT_NEVER, l4util_micros2l4to(timeout)))) && _chip->have_interrupt(_channel);
1.46 }
1.47