genode/repos/os/src/drivers/input/ps2/irq_handler.h

57 lines
1.1 KiB
C
Raw Normal View History

2011-12-22 16:19:25 +01:00
/*
* \brief Input-interrupt handler
* \author Norman Feske
* \date 2007-10-08
*/
/*
2013-01-10 21:44:47 +01:00
* Copyright (C) 2007-2013 Genode Labs GmbH
2011-12-22 16:19:25 +01: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_
/* Genode includes */
2011-12-22 16:19:25 +01:00
#include <base/thread.h>
#include <irq_session/connection.h>
#include <os/server.h>
2011-12-22 16:19:25 +01:00
/* local includes */
2011-12-22 16:19:25 +01:00
#include "input_driver.h"
class Irq_handler
2011-12-22 16:19:25 +01:00
{
private:
Genode::Irq_connection _irq;
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 16:19:25 +01:00
public:
Irq_handler(Server::Entrypoint &ep,
int irq_number, Input_driver &input_driver)
2011-12-22 16:19:25 +01:00
:
_irq(irq_number),
_dispatcher(ep, *this, &Irq_handler::_handle),
2011-12-22 16:19:25 +01:00
_input_driver(input_driver)
{
_irq.sigh(_dispatcher);
_irq.ack_irq();
2011-12-22 16:19:25 +01:00
}
};
#endif /* _IRQ_HANDLER_H_ */