genode/repos/os/src/drivers/timer/include/timer_root.h
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

72 lines
1.6 KiB
C++

/*
* \brief Root interface to timer service
* \author Norman Feske
* \date 2006-08-15
*/
/*
* Copyright (C) 2006-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.
*/
#ifndef _TIMER_ROOT_H_
#define _TIMER_ROOT_H_
/* Genode includes */
#include <util/arg_string.h>
#include <base/printf.h>
#include <base/heap.h>
#include <root/component.h>
#include <cap_session/cap_session.h>
#include <os/server.h>
/* local includes */
#include "timer_session_component.h"
namespace Timer { class Root_component; }
class Timer::Root_component : public Genode::Root_component<Session_component>
{
private:
Platform_timer _platform_timer;
Timeout_scheduler _timeout_scheduler;
protected:
Session_component *_create_session(const char *args)
{
Genode::size_t ram_quota = Genode::Arg_string::find_arg(args, "ram_quota").ulong_value(0);
if (ram_quota < sizeof(Session_component)) {
PWRN("Insufficient donated ram_quota (%zd bytes), require %zd bytes",
ram_quota, sizeof(Session_component));
}
return new (md_alloc())
Session_component(_timeout_scheduler);
}
public:
/**
* Constructor
*
* The 'cap' argument is not used by the single-threaded server
* variant.
*/
Root_component(Server::Entrypoint &ep,
Genode::Allocator *md_alloc,
Genode::Cap_session *cap)
:
Genode::Root_component<Session_component>(&ep.rpc_ep(), md_alloc),
_timeout_scheduler(&_platform_timer, &ep.rpc_ep())
{ }
};
#endif