mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-07 11:50:24 +00:00
dde_kit: use async IRQ session interface
Up to now, dde_kit used the synchronous IRQ session interface. This interface is going to get deprectated very soon. Issue #1456.
This commit is contained in:
parent
faa25e1df6
commit
09e96dfdcd
@ -54,6 +54,9 @@ class Irq_handler : Dde_kit::Thread, public Avl_node<Irq_handler>
|
|||||||
int _handle_irq; /* nested irq disable counter */
|
int _handle_irq; /* nested irq disable counter */
|
||||||
Lock _lock; /* synchronize access to counter */
|
Lock _lock; /* synchronize access to counter */
|
||||||
|
|
||||||
|
Genode::Signal_receiver _sig_rec;
|
||||||
|
Genode::Signal_dispatcher<Irq_handler> _irq_dispatcher;
|
||||||
|
|
||||||
|
|
||||||
const char * _compose_thread_name(unsigned irq)
|
const char * _compose_thread_name(unsigned irq)
|
||||||
{
|
{
|
||||||
@ -61,6 +64,16 @@ class Irq_handler : Dde_kit::Thread, public Avl_node<Irq_handler>
|
|||||||
return _thread_name;
|
return _thread_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handle(unsigned)
|
||||||
|
{
|
||||||
|
_irq.ack_irq();
|
||||||
|
|
||||||
|
/* only call registered handler function, if IRQ is not disabled */
|
||||||
|
_lock.lock();
|
||||||
|
if (_handle_irq) _handler(_priv);
|
||||||
|
_lock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Irq_handler(unsigned irq, void (*handler)(void *), void *priv,
|
Irq_handler(unsigned irq, void (*handler)(void *), void *priv,
|
||||||
@ -68,12 +81,18 @@ class Irq_handler : Dde_kit::Thread, public Avl_node<Irq_handler>
|
|||||||
:
|
:
|
||||||
Dde_kit::Thread(_compose_thread_name(irq)), _irq_number(irq),
|
Dde_kit::Thread(_compose_thread_name(irq)), _irq_number(irq),
|
||||||
_irq(irq), _handler(handler), _init(init), _priv(priv),
|
_irq(irq), _handler(handler), _init(init), _priv(priv),
|
||||||
_shared(shared), _handle_irq(1), _lock(Lock::LOCKED)
|
_shared(shared), _handle_irq(1), _lock(Lock::LOCKED),
|
||||||
|
_irq_dispatcher(_sig_rec, *this, &Irq_handler::_handle)
|
||||||
{
|
{
|
||||||
|
_irq.sigh(_irq_dispatcher);
|
||||||
|
|
||||||
start();
|
start();
|
||||||
|
|
||||||
/* wait until thread is started */
|
/* wait until thread is started */
|
||||||
Lock::Guard guard(_lock);
|
Lock::Guard guard(_lock);
|
||||||
|
|
||||||
|
/* initial ack so that we will receive further interrupts */
|
||||||
|
_irq.ack_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enable IRQ handling */
|
/** Enable IRQ handling */
|
||||||
@ -102,12 +121,14 @@ class Irq_handler : Dde_kit::Thread, public Avl_node<Irq_handler>
|
|||||||
_lock.unlock();
|
_lock.unlock();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
_irq.wait_for_irq();
|
using namespace Genode;
|
||||||
|
|
||||||
/* only call registered handler function, if IRQ is not disabled */
|
Signal sig = _sig_rec.wait_for_signal();
|
||||||
_lock.lock();
|
int num = sig.num();
|
||||||
if (_handle_irq) _handler(_priv);
|
|
||||||
_lock.unlock();
|
Signal_dispatcher_base *dispatcher;
|
||||||
|
dispatcher = dynamic_cast<Signal_dispatcher_base *>(sig.context());
|
||||||
|
dispatcher->dispatch(num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user