genode/repos/os/src/drivers/input/ps2/pl050/main.cc
Josef Söntgen 85599c072f os: use async IRQ and server lib in drivers
Use the new asynchronous IRQ interface in the mostly used drivers, e.g.:

* ahci_drv: x86/exynos5
* gpio_drv: imx53/omap4
* input_drv: imx53/dummy
* ps2_drv: x86/pl050
* timer_drv

Now, the Irq_session is requested from Gpio::Session:

From now on we use an asynchronous IRQ interface. To prevent triggering
another GPIO IRQ while currently handling the former one, IRQs must
now by acknowledged explicitly. While here, we also changed the GPIO
session interface regarding IRQ management. The generic GPIO component
now wraps the Irq_session managed by the backend instead of using the
GPIO backend methods directly. A client using the GPIO session may
request the Irq_session_capability by calling
'Gpio::Session::irq_session()' and can use this capability when using
a local Irq_session_client.

Issue #1456.
2015-04-23 16:47:59 +02:00

67 lines
1.5 KiB
C++

/*
* \brief PS/2 driver for PL050
* \author Norman Feske
* \date 2007-09-21
*/
/*
* Copyright (C) 2007-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <base/env.h>
#include <base/printf.h>
#include <base/sleep.h>
#include <input/component.h>
#include <input/root.h>
#include <cap_session/connection.h>
#include <os/server.h>
/* local includes */
#include "ps2_keyboard.h"
#include "ps2_mouse.h"
#include "irq_handler.h"
#include "pl050.h"
using namespace Genode;
struct Main
{
Server::Entrypoint &ep;
Pl050 pl050;
Input::Session_component session;
Input::Root_component root;
Ps2_mouse ps2_mouse;
Ps2_keyboard ps2_keybd;
Irq_handler ps2_mouse_irq;
Irq_handler ps2_keybd_irq;
Main(Server::Entrypoint &ep)
: ep(ep), root(ep.rpc_ep(), session),
ps2_mouse(*pl050.aux_interface(), session.event_queue()),
ps2_keybd(*pl050.kbd_interface(), session.event_queue(), true),
ps2_mouse_irq(ep, PL050_MOUSE_IRQ, pl050.aux_interface(), ps2_mouse),
ps2_keybd_irq(ep, PL050_KEYBD_IRQ, pl050.kbd_interface(), ps2_keybd)
{
env()->parent()->announce(ep.manage(root));
}
};
/************
** Server **
************/
namespace Server {
char const *name() { return "ps2_drv_ep"; }
size_t stack_size() { return 1024*sizeof(long); }
void construct(Entrypoint &ep) { static Main server(ep); }
}