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
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
2017-01-13 13:58:21 +01:00
|
|
|
#include <base/component.h>
|
2015-01-06 21:37:58 +01:00
|
|
|
#include <base/env.h>
|
2017-01-13 13:58:21 +01:00
|
|
|
#include <base/log.h>
|
2015-01-06 21:37:58 +01:00
|
|
|
#include <base/printf.h>
|
|
|
|
#include <rtc_session/connection.h>
|
|
|
|
#include <timer_session/connection.h>
|
|
|
|
|
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-13 13:58:21 +01:00
|
|
|
Genode::printf("RTC: %u-%02u-%02u %02u:%02u:%02u\n",
|
|
|
|
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); }
|