2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Input-interrupt handler
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2007-10-08
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 20:44:47 +00:00
|
|
|
* Copyright (C) 2007-2013 Genode Labs GmbH
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _IRQ_HANDLER_H_
|
|
|
|
#define _IRQ_HANDLER_H_
|
|
|
|
|
2015-04-14 11:56:26 +00:00
|
|
|
/* Genode includes */
|
2011-12-22 15:19:25 +00:00
|
|
|
#include <base/thread.h>
|
|
|
|
#include <irq_session/connection.h>
|
2015-04-14 11:56:26 +00:00
|
|
|
#include <os/server.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-04-14 11:56:26 +00:00
|
|
|
/* local includes */
|
2011-12-22 15:19:25 +00:00
|
|
|
#include "input_driver.h"
|
|
|
|
|
2015-04-14 11:56:26 +00:00
|
|
|
class Irq_handler
|
2011-12-22 15:19:25 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2015-03-30 09:37:08 +00:00
|
|
|
Genode::Irq_session_client _irq;
|
2015-04-14 11:56:26 +00:00
|
|
|
Genode::Signal_rpc_member<Irq_handler> _dispatcher;
|
|
|
|
Input_driver &_input_driver;
|
|
|
|
|
|
|
|
void _handle(unsigned)
|
|
|
|
{
|
|
|
|
_irq.ack_irq();
|
|
|
|
|
|
|
|
while (_input_driver.event_pending())
|
|
|
|
_input_driver.handle_event();
|
|
|
|
}
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-03-30 09:37:08 +00:00
|
|
|
Irq_handler(Server::Entrypoint &ep, Input_driver &input_driver,
|
|
|
|
Genode::Irq_session_capability irq_cap)
|
2011-12-22 15:19:25 +00:00
|
|
|
:
|
2015-03-30 09:37:08 +00:00
|
|
|
_irq(irq_cap),
|
2015-04-14 11:56:26 +00:00
|
|
|
_dispatcher(ep, *this, &Irq_handler::_handle),
|
2011-12-22 15:19:25 +00:00
|
|
|
_input_driver(input_driver)
|
|
|
|
{
|
2015-04-14 11:56:26 +00:00
|
|
|
_irq.sigh(_dispatcher);
|
|
|
|
_irq.ack_irq();
|
2011-12-22 15:19:25 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _IRQ_HANDLER_H_ */
|