2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Input-interrupt handler
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2007-10-08
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* 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
|
2017-02-20 12:23:52 +00:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 15:19:25 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-03 12:55:05 +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
|
|
|
|
2015-04-14 11:56:26 +00:00
|
|
|
/* Genode includes */
|
2016-11-25 15:54:49 +00:00
|
|
|
#include <base/entrypoint.h>
|
2022-04-28 13:56:02 +00:00
|
|
|
#include <platform_session/device.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:
|
|
|
|
|
2022-04-28 13:56:02 +00:00
|
|
|
Platform::Device::Irq _irq;
|
2016-11-25 15:54:49 +00:00
|
|
|
Genode::Signal_handler<Irq_handler> _handler;
|
|
|
|
Input_driver &_input_driver;
|
2020-08-13 11:39:09 +00:00
|
|
|
Event::Session_client &_event_session;
|
2015-04-14 11:56:26 +00:00
|
|
|
|
2016-11-25 15:54:49 +00:00
|
|
|
void _handle()
|
2015-04-14 11:56:26 +00:00
|
|
|
{
|
2022-04-28 13:56:02 +00:00
|
|
|
_irq.ack();
|
2015-04-14 11:56:26 +00:00
|
|
|
|
2020-08-13 11:39:09 +00:00
|
|
|
_event_session.with_batch([&] (Event::Session_client::Batch &batch) {
|
|
|
|
while (_input_driver.event_pending())
|
|
|
|
_input_driver.handle_event(batch);
|
|
|
|
});
|
2015-04-14 11:56:26 +00:00
|
|
|
}
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2022-04-28 13:56:02 +00:00
|
|
|
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
|
|
|
:
|
2022-04-28 13:56:02 +00:00
|
|
|
_irq(device, {idx}),
|
2016-11-25 15:54:49 +00:00
|
|
|
_handler(ep, *this, &Irq_handler::_handle),
|
2020-08-13 11:39:09 +00:00
|
|
|
_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
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-09-03 12:55:05 +00:00
|
|
|
#endif /* _DRIVERS__INPUT__SPEC__PS2__IRQ_HANDLER_H_ */
|