mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-21 17:42:40 +00:00
parent
923fbc9e86
commit
16be05e530
repos/os
@ -26,9 +26,10 @@ struct Rtc::Connection : Genode::Connection<Session>, Session_client
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env)
|
||||
Connection(Genode::Env &env, char const *label = "")
|
||||
:
|
||||
Genode::Connection<Rtc::Session>(env, session(env.parent(), "ram_quota=8K")),
|
||||
Genode::Connection<Rtc::Session>(
|
||||
env, session(env.parent(), "ram_quota=8K, label=\"%s\"", label)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
|
@ -20,6 +20,7 @@ install_config {
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<default caps="100"/>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Timer"/> </provides>
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <rtc_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
struct Main
|
||||
@ -25,14 +26,16 @@ struct Main
|
||||
Genode::log("--- RTC test started ---");
|
||||
|
||||
/* open sessions */
|
||||
Rtc::Connection rtc(env);
|
||||
Rtc::Connection rtc[] = { { env }, { env, "with_label" } };
|
||||
Timer::Connection timer(env);
|
||||
|
||||
for (unsigned i = 0; i < 4; ++i) {
|
||||
Rtc::Timestamp now = rtc.current_time();
|
||||
Rtc::Timestamp now[] = { rtc[0].current_time(), rtc[1].current_time() };
|
||||
|
||||
log("RTC: ", now.year, "-", now.month, "-", now.day, " ",
|
||||
now.hour, ":", now.minute, ":", now.second);
|
||||
for (unsigned j = 0; j < sizeof(rtc)/sizeof(*rtc); ++j)
|
||||
log("RTC[", j, "]: ",
|
||||
now[j].year, "-", now[j].month, "-", now[j].day, " ",
|
||||
now[j].hour, ":", now[j].minute, ":", now[j].second);
|
||||
|
||||
timer.msleep(1000);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user