genode/repos/os/src/driver/ps2/irq_handler.h

61 lines
1.4 KiB
C
Raw Normal View History

2011-12-22 15:19:25 +00:00
/*
* \brief Input-interrupt handler
* \author Norman Feske
* \date 2007-10-08
*/
/*
* Copyright (C) 2007-2017 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 Affero General Public License version 3.
2011-12-22 15:19:25 +00:00
*/
#ifndef _DRIVERS__INPUT__SPEC__PS2__IRQ_HANDLER_H_
#define _DRIVERS__INPUT__SPEC__PS2__IRQ_HANDLER_H_
2011-12-22 15:19:25 +00:00
/* Genode includes */
2016-11-25 15:54:49 +00:00
#include <base/entrypoint.h>
#include <platform_session/device.h>
2011-12-22 15:19:25 +00:00
/* local includes */
2011-12-22 15:19:25 +00:00
#include "input_driver.h"
class Irq_handler
2011-12-22 15:19:25 +00:00
{
private:
Platform::Device::Irq _irq;
2016-11-25 15:54:49 +00:00
Genode::Signal_handler<Irq_handler> _handler;
Input_driver &_input_driver;
Event::Session_client &_event_session;
2016-11-25 15:54:49 +00:00
void _handle()
{
_irq.ack();
_event_session.with_batch([&] (Event::Session_client::Batch &batch) {
while (_input_driver.event_pending())
_input_driver.handle_event(batch);
});
}
2011-12-22 15:19:25 +00:00
public:
Irq_handler(Genode::Entrypoint &ep,
Input_driver &input_driver,
Event::Session_client &event_session,
Platform::Device &device,
unsigned idx)
2011-12-22 15:19:25 +00:00
:
_irq(device, {idx}),
2016-11-25 15:54:49 +00:00
_handler(ep, *this, &Irq_handler::_handle),
_input_driver(input_driver),
_event_session(event_session)
2011-12-22 15:19:25 +00:00
{
2016-11-25 15:54:49 +00:00
_irq.sigh(_handler);
2011-12-22 15:19:25 +00:00
}
};
#endif /* _DRIVERS__INPUT__SPEC__PS2__IRQ_HANDLER_H_ */