2012-11-02 10:08:57 +00:00
|
|
|
/*
|
|
|
|
* \brief Rtc session interface
|
|
|
|
* \author Markus Partheymueller
|
2015-01-27 12:56:16 +00:00
|
|
|
* \author Josef Soentgen
|
2012-11-02 10:08:57 +00:00
|
|
|
* \date 2012-11-15
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Intel Corporation
|
2019-07-15 11:24:04 +00:00
|
|
|
* Copyright (C) 2013-2019 Genode Labs GmbH
|
2012-11-02 10:08:57 +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.
|
2012-11-02 10:08:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__RTC_SESSION__RTC_SESSION_H_
|
|
|
|
#define _INCLUDE__RTC_SESSION__RTC_SESSION_H_
|
|
|
|
|
|
|
|
#include <session/session.h>
|
|
|
|
#include <base/rpc.h>
|
|
|
|
#include <base/stdint.h>
|
2019-07-15 11:33:25 +00:00
|
|
|
#include <base/signal.h>
|
2012-11-02 10:08:57 +00:00
|
|
|
|
|
|
|
namespace Rtc {
|
2015-03-04 20:12:14 +00:00
|
|
|
struct Timestamp;
|
|
|
|
struct Session;
|
|
|
|
}
|
2012-11-02 10:08:57 +00:00
|
|
|
|
2015-01-27 12:56:16 +00:00
|
|
|
|
2019-07-15 11:24:04 +00:00
|
|
|
/*
|
|
|
|
* RTC value
|
|
|
|
*/
|
2015-03-04 20:12:14 +00:00
|
|
|
struct Rtc::Timestamp
|
|
|
|
{
|
|
|
|
unsigned microsecond;
|
|
|
|
unsigned second;
|
|
|
|
unsigned minute;
|
|
|
|
unsigned hour;
|
|
|
|
unsigned day;
|
|
|
|
unsigned month;
|
|
|
|
unsigned year;
|
2019-03-10 20:17:32 +00:00
|
|
|
|
|
|
|
void print(Genode::Output &out) const
|
|
|
|
{
|
|
|
|
Genode::print(out, year, "-", month, "-", day, " ",
|
|
|
|
hour, ":", minute, ":", second);
|
|
|
|
}
|
2015-03-04 20:12:14 +00:00
|
|
|
};
|
2015-01-27 12:56:16 +00:00
|
|
|
|
2012-11-02 10:08:57 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
struct Rtc::Session : Genode::Session
|
|
|
|
{
|
2017-05-24 12:41:19 +00:00
|
|
|
/**
|
|
|
|
* \noapi
|
|
|
|
*/
|
2015-03-04 20:12:14 +00:00
|
|
|
static const char *service_name() { return "Rtc"; }
|
2012-11-02 10:08:57 +00:00
|
|
|
|
2017-05-07 20:03:25 +00:00
|
|
|
enum { CAP_QUOTA = 2 };
|
|
|
|
|
2023-03-03 11:07:28 +00:00
|
|
|
|
2019-07-15 11:24:04 +00:00
|
|
|
/***********************
|
|
|
|
** Session interface **
|
|
|
|
***********************/
|
|
|
|
|
2019-07-15 11:33:25 +00:00
|
|
|
/**
|
|
|
|
* Register set signal handler
|
|
|
|
*
|
|
|
|
* \param sigh signal handler that is called when the RTC has
|
|
|
|
* been set
|
|
|
|
*/
|
|
|
|
virtual void set_sigh(Genode::Signal_context_capability sigh) = 0;
|
|
|
|
|
2019-07-15 11:24:04 +00:00
|
|
|
/**
|
|
|
|
* Query current time
|
|
|
|
*
|
|
|
|
* \return RTC value as structed timestamp
|
|
|
|
*/
|
2015-03-04 20:12:14 +00:00
|
|
|
virtual Timestamp current_time() = 0;
|
|
|
|
|
2019-07-15 11:24:04 +00:00
|
|
|
/*******************
|
|
|
|
** RPC interface **
|
|
|
|
*******************/
|
|
|
|
|
2019-07-15 11:33:25 +00:00
|
|
|
GENODE_RPC(Rpc_set_sigh, void, set_sigh,
|
|
|
|
Genode::Signal_context_capability);
|
2015-03-04 20:12:14 +00:00
|
|
|
GENODE_RPC(Rpc_current_time, Timestamp, current_time);
|
2019-07-15 11:33:25 +00:00
|
|
|
GENODE_RPC_INTERFACE(Rpc_set_sigh, Rpc_current_time);
|
2015-03-04 20:12:14 +00:00
|
|
|
};
|
2012-11-02 10:08:57 +00:00
|
|
|
|
|
|
|
#endif /* _INCLUDE__RTC_SESSION__RTC_SESSION_H_ */
|