From 0383c68bf6699d5a2b28c2b376d6e412a7edfa2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 9 Apr 2015 12:02:00 +0200 Subject: [PATCH] os: use async IRQ interface in Irq_activation Issue #1456. --- repos/os/include/os/irq_activation.h | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/repos/os/include/os/irq_activation.h b/repos/os/include/os/irq_activation.h index 3939ac240e..896f1b72aa 100644 --- a/repos/os/include/os/irq_activation.h +++ b/repos/os/include/os/irq_activation.h @@ -46,12 +46,21 @@ class Genode::Irq_activation : Thread_base Irq_handler &_handler; char _thread_name[8]; + Genode::Signal_receiver _sig_rec; + Genode::Signal_dispatcher _dispatcher; + char const *_create_thread_name(unsigned irq_number) { snprintf(_thread_name, sizeof(_thread_name), "irq.%02x", irq_number); return _thread_name; } + void _handle(unsigned) + { + _connection.ack_irq(); + _handler.handle_irq(_number); + } + public: /** @@ -64,22 +73,30 @@ class Genode::Irq_activation : Thread_base Irq_activation(int irq_number, Irq_handler &handler, size_t stack_size) : Thread_base(0, _create_thread_name(irq_number), stack_size), - _number(irq_number), _connection(irq_number), _handler(handler) + _number(irq_number), _connection(irq_number), _handler(handler), + _dispatcher(_sig_rec, *this, &Irq_activation::_handle) { start(); + + _connection.sigh(_dispatcher); + _connection.ack_irq(); } /** * Thread entry * - * The interrupt thread infinitely waits for interrupts and calls - * the handler on occurrence. + * The interrupt thread infinitely waits for interrupts signals and + * dispatches the handler on occurrence. */ void entry() { while (true) { - _connection.wait_for_irq(); - _handler.handle_irq(_number); + Genode::Signal sig = _sig_rec.wait_for_signal(); + int num = sig.num(); + + Genode::Signal_dispatcher_base *dispatcher; + dispatcher = dynamic_cast(sig.context()); + dispatcher->dispatch(num); } } };