2015-01-06 21:37:58 +01:00
|
|
|
/*
|
|
|
|
* \brief Test for RTC driver
|
|
|
|
* \author Christian Helmuth
|
|
|
|
* \date 2015-01-06
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-01-13 13:58:21 +01:00
|
|
|
* Copyright (C) 2015-2017 Genode Labs GmbH
|
2015-01-06 21:37:58 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2015-01-06 21:37:58 +01:00
|
|
|
*/
|
|
|
|
|
2017-01-13 13:58:21 +01:00
|
|
|
#include <base/component.h>
|
2015-01-06 21:37:58 +01:00
|
|
|
#include <base/env.h>
|
|
|
|
#include <rtc_session/connection.h>
|
|
|
|
#include <timer_session/connection.h>
|
|
|
|
|
2017-01-17 12:58:00 +01:00
|
|
|
using namespace Genode;
|
|
|
|
|
2017-01-13 13:58:21 +01:00
|
|
|
struct Main
|
2015-01-06 21:37:58 +01:00
|
|
|
{
|
2017-01-13 13:58:21 +01:00
|
|
|
Main(Genode::Env &env)
|
|
|
|
{
|
|
|
|
Genode::log("--- RTC test started ---");
|
2015-01-06 21:37:58 +01:00
|
|
|
|
2017-01-13 13:58:21 +01:00
|
|
|
/* open sessions */
|
|
|
|
Rtc::Connection rtc(env);
|
|
|
|
Timer::Connection timer(env);
|
2015-01-06 21:37:58 +01:00
|
|
|
|
2017-01-13 13:58:21 +01:00
|
|
|
for (unsigned i = 0; i < 4; ++i) {
|
|
|
|
Rtc::Timestamp now = rtc.current_time();
|
2015-01-06 21:37:58 +01:00
|
|
|
|
2017-01-17 12:58:00 +01:00
|
|
|
log("RTC: ", now.year, "-", now.month, "-", now.day, " ",
|
|
|
|
now.hour, ":", now.minute, ":", now.second);
|
2015-01-06 21:37:58 +01:00
|
|
|
|
2017-01-13 13:58:21 +01:00
|
|
|
timer.msleep(1000);
|
|
|
|
}
|
2015-01-06 21:37:58 +01:00
|
|
|
|
2017-01-13 13:58:21 +01:00
|
|
|
Genode::log("--- RTC test finished ---");
|
|
|
|
|
|
|
|
env.parent().exit(0);
|
|
|
|
}
|
|
|
|
};
|
2015-01-06 21:37:58 +01:00
|
|
|
|
2017-01-13 13:58:21 +01:00
|
|
|
void Component::construct(Genode::Env &env) { static Main main(env); }
|