mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 15:56:41 +00:00
vancouver: RTC support
This commit is contained in:
parent
5b1156a3e2
commit
3a533779e4
@ -49,6 +49,7 @@
|
|||||||
#include <os/alarm.h>
|
#include <os/alarm.h>
|
||||||
#include <timer_session/connection.h>
|
#include <timer_session/connection.h>
|
||||||
#include <nova_cpu_session/connection.h>
|
#include <nova_cpu_session/connection.h>
|
||||||
|
#include <rtc_session/connection.h>
|
||||||
|
|
||||||
/* NOVA includes that come with Genode */
|
/* NOVA includes that come with Genode */
|
||||||
#include <nova/syscalls.h>
|
#include <nova/syscalls.h>
|
||||||
@ -56,6 +57,7 @@
|
|||||||
/* NOVA userland includes */
|
/* NOVA userland includes */
|
||||||
#include <nul/vcpu.h>
|
#include <nul/vcpu.h>
|
||||||
#include <nul/motherboard.h>
|
#include <nul/motherboard.h>
|
||||||
|
#include <nul/service_timer.h>
|
||||||
#include <sys/hip.h>
|
#include <sys/hip.h>
|
||||||
|
|
||||||
/* local includes */
|
/* local includes */
|
||||||
@ -1012,6 +1014,7 @@ class Machine : public StaticReceiver<Machine>
|
|||||||
bool _alloc_fb_mem; /* For detecting FB alloc message */
|
bool _alloc_fb_mem; /* For detecting FB alloc message */
|
||||||
|
|
||||||
Nic::Session *_nic;
|
Nic::Session *_nic;
|
||||||
|
Rtc::Session *_rtc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -1269,9 +1272,26 @@ class Machine : public StaticReceiver<Machine>
|
|||||||
|
|
||||||
bool receive(MessageTime &msg)
|
bool receive(MessageTime &msg)
|
||||||
{
|
{
|
||||||
// XXX: Use RTC time
|
Genode::Lock::Guard guard(*utcb_lock());
|
||||||
msg.wallclocktime = 0;
|
utcb_backup = *Genode::Thread_base::myself()->utcb();
|
||||||
msg.timestamp = 0;
|
|
||||||
|
if (!_rtc) {
|
||||||
|
try {
|
||||||
|
_rtc = new Rtc::Connection;
|
||||||
|
} catch (...) {
|
||||||
|
Logging::printf("No RTC present, returning dummy time.\n");
|
||||||
|
msg.wallclocktime = msg.timestamp = 0;
|
||||||
|
|
||||||
|
*Genode::Thread_base::myself()->utcb() = utcb_backup;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
msg.wallclocktime = _rtc->get_current_time();
|
||||||
|
Logging::printf("Got time %llx\n", msg.wallclocktime);
|
||||||
|
msg.timestamp = _motherboard.clock()->clock(TimerProtocol::WALLCLOCK_FREQUENCY);
|
||||||
|
|
||||||
|
*Genode::Thread_base::myself()->utcb() = utcb_backup;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user