2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Timer session interface
|
|
|
|
* \author Norman Feske
|
2012-11-05 15:48:40 +00:00
|
|
|
* \author Markus Partheymueller
|
2011-12-22 15:19:25 +00:00
|
|
|
* \date 2006-08-15
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 20:44:47 +00:00
|
|
|
* Copyright (C) 2006-2013 Genode Labs GmbH
|
2012-11-05 15:48:40 +00:00
|
|
|
* Copyright (C) 2012 Intel Corporation
|
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 General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__TIMER_SESSION__TIMER_SESSION_H_
|
|
|
|
#define _INCLUDE__TIMER_SESSION__TIMER_SESSION_H_
|
|
|
|
|
2012-10-29 20:05:32 +00:00
|
|
|
#include <base/signal.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
#include <session/session.h>
|
|
|
|
|
|
|
|
namespace Timer {
|
|
|
|
|
2012-10-29 20:05:32 +00:00
|
|
|
using namespace Genode;
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
struct Session : Genode::Session
|
|
|
|
{
|
|
|
|
static const char *service_name() { return "Timer"; }
|
|
|
|
|
|
|
|
virtual ~Session() { }
|
|
|
|
|
|
|
|
/**
|
2012-10-29 20:05:32 +00:00
|
|
|
* Program single timeout (in microseconds)
|
2011-12-22 15:19:25 +00:00
|
|
|
*/
|
2012-10-29 20:05:32 +00:00
|
|
|
virtual void trigger_once(unsigned us) = 0;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-11-05 15:48:40 +00:00
|
|
|
/**
|
2012-10-29 20:05:32 +00:00
|
|
|
* Program periodic timeout (in microseconds)
|
2012-11-05 15:48:40 +00:00
|
|
|
*/
|
2012-10-29 20:05:32 +00:00
|
|
|
virtual void trigger_periodic(unsigned us) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register timeout signal handler
|
|
|
|
*/
|
|
|
|
virtual void sigh(Signal_context_capability sigh) = 0;
|
2012-11-05 15:48:40 +00:00
|
|
|
|
2012-07-25 11:59:50 +00:00
|
|
|
/**
|
|
|
|
* Return number of elapsed milliseconds since session creation
|
|
|
|
*/
|
2012-10-29 20:05:32 +00:00
|
|
|
virtual unsigned long elapsed_ms() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Client-side convenience function for sleeping the specified number
|
|
|
|
* of milliseconds
|
|
|
|
*/
|
|
|
|
virtual void msleep(unsigned ms) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Client-side convenience function for sleeping the specified number
|
|
|
|
* of microseconds
|
|
|
|
*/
|
|
|
|
virtual void usleep(unsigned us) = 0;
|
2012-07-25 11:59:50 +00:00
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
|
|
|
|
2012-10-29 20:05:32 +00:00
|
|
|
GENODE_RPC(Rpc_trigger_once, void, trigger_once, unsigned);
|
|
|
|
GENODE_RPC(Rpc_trigger_periodic, void, trigger_periodic, unsigned);
|
|
|
|
GENODE_RPC(Rpc_sigh, void, sigh, Genode::Signal_context_capability);
|
2012-07-25 11:59:50 +00:00
|
|
|
GENODE_RPC(Rpc_elapsed_ms, unsigned long, elapsed_ms);
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-10-29 20:05:32 +00:00
|
|
|
GENODE_RPC_INTERFACE(Rpc_trigger_once, Rpc_trigger_periodic,
|
|
|
|
Rpc_sigh, Rpc_elapsed_ms);
|
2011-12-22 15:19:25 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__TIMER_SESSION__TIMER_SESSION_H_ */
|