RTC - Real-Time Clock

RTC - Real-Time Clock#

In this use-case we will run the rtc service on x86 hardware.

The rtc service provides access to the real-time clock of the system. Consequently it needs access to the rtc device of the platform and io needs to be configured accordingly.

 1-- vim:ft=lua
 2local L4 = require("L4");
 3local ld = L4.default_loader;
 4
 5local io_vbus_rtc = ld:new_channel();
 6ld:start({
 7            caps = {
 8              icu       = L4.Env.icu,
 9              sigma0    = L4.Env.sigma0,
10              vbus_rtc  = io_vbus_rtc:svr(),
11            },
12         }, "rom/io rom/x86-legacy.devs rom/vbus.io");
13
14 local rtc = ld:new_channel();
15
16 ld:start({
17            caps = {
18              vbus = io_vbus_rtc,
19              rtc  = rtc:svr(),
20            },
21          },
22          "rom/rtc");
23
24 ld:start({
25            caps = {
26              rtc = rtc,
27            },
28          },
29          "rom/rtc-client");

The script references two files for configuring the io component. x86-legacy.devs describes some of the always existing devices in an x86-based system and can be found here.

vbus.io creates a virtual bus for the rtc service, using this content:

1-- vim:ft=lua
2local hw = Io.system_bus();
3
4Io.add_vbusses
5{
6  vbus_rtc = Io.Vi.System_bus(function()
7    rtc = wrap(hw.RTC);
8  end);
9}