2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief PS/2 driver for x86
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2007-09-21
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
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.
|
|
|
|
*/
|
|
|
|
|
2015-03-30 11:37:08 +02:00
|
|
|
/* base includes */
|
2011-12-22 16:19:25 +01:00
|
|
|
#include <base/env.h>
|
|
|
|
#include <base/printf.h>
|
|
|
|
#include <base/sleep.h>
|
2015-03-30 11:37:08 +02:00
|
|
|
|
|
|
|
/* os includes */
|
2011-12-22 16:19:25 +01:00
|
|
|
#include <input/component.h>
|
2014-05-07 10:33:20 +02:00
|
|
|
#include <input/root.h>
|
2015-04-14 13:56:26 +02:00
|
|
|
#include <os/server.h>
|
2015-03-30 11:37:08 +02:00
|
|
|
#include <pci_session/connection.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-04-14 13:56:26 +02:00
|
|
|
/* local includes */
|
2011-12-22 16:19:25 +01:00
|
|
|
#include "i8042.h"
|
|
|
|
#include "ps2_keyboard.h"
|
|
|
|
#include "ps2_mouse.h"
|
|
|
|
#include "irq_handler.h"
|
|
|
|
|
|
|
|
using namespace Genode;
|
|
|
|
|
|
|
|
|
2015-04-14 13:56:26 +02:00
|
|
|
struct Main
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
2015-04-14 13:56:26 +02:00
|
|
|
Server::Entrypoint &ep;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-04-14 13:56:26 +02:00
|
|
|
I8042 i8042;
|
|
|
|
Input::Session_component session;
|
|
|
|
Input::Root_component root;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-04-14 13:56:26 +02:00
|
|
|
Ps2_mouse ps2_mouse;
|
|
|
|
Ps2_keyboard ps2_keybd;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-03-30 11:37:08 +02:00
|
|
|
Pci::Connection platform;
|
|
|
|
Pci::Device_client device_ps2;
|
|
|
|
|
2015-04-14 13:56:26 +02:00
|
|
|
Irq_handler ps2_keybd_irq;
|
2015-03-30 11:37:08 +02:00
|
|
|
Irq_handler ps2_mouse_irq;
|
2014-05-07 10:33:20 +02:00
|
|
|
|
2015-04-14 13:56:26 +02:00
|
|
|
Main(Server::Entrypoint &ep)
|
|
|
|
: ep(ep), root(ep.rpc_ep(), session),
|
|
|
|
ps2_mouse(*i8042.aux_interface(), session.event_queue()),
|
|
|
|
ps2_keybd(*i8042.kbd_interface(), session.event_queue(),
|
|
|
|
i8042.kbd_xlate()),
|
2015-03-30 11:37:08 +02:00
|
|
|
device_ps2(platform.device("PS2")),
|
|
|
|
ps2_keybd_irq(ep, ps2_keybd, device_ps2.irq(0)),
|
|
|
|
ps2_mouse_irq(ep, ps2_mouse, device_ps2.irq(1))
|
2015-04-14 13:56:26 +02:00
|
|
|
{
|
|
|
|
env()->parent()->announce(ep.manage(root));
|
|
|
|
}
|
|
|
|
};
|
2014-05-07 10:33:20 +02:00
|
|
|
|
|
|
|
|
2015-04-14 13:56:26 +02:00
|
|
|
/************
|
|
|
|
** Server **
|
|
|
|
************/
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-04-14 13:56:26 +02:00
|
|
|
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); }
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|