Expand description
Real-time clock device contract (/devices/time/real_time_clock, kind b'r').
A real-time clock (RTC) stores wall-clock time (UTC) across resets and, on
chips with a battery-backed domain, across power-off. Like Linux, Xila keeps
RTC drivers separate from clocksource drivers: the RTC only supplies and
stores UTC; timers, deadlines and uptime stay on the monotonic clock of the
time subsystem and never read this device.
The upper half (drivers_peripherals::real_time_clock) adapts a
peripherals::real_time_clock::RealTimeClockController lower half to this
contract. Plain read and write on the node fail with Unsupported:
the clock is only reachable through the control commands below.
§Control commands (kind b'r')
| Number | Command | Direction | Input | Output | Effect |
|---|---|---|---|---|---|
0x00 | GET_TIME | Read | RealTimeClockTimeAbi | RealTimeClockTimeAbi | Returns the time the clock holds and its validity. |
0x01 | SET_TIME | Write | RealTimeClockTimeAbi | RealTimeClockTimeAbi | Sets the clock, then returns the time it now holds. |
Both commands carry the same versioned payload. In a GET_TIME input only
version and reserved are checked; the time fields are ignored. A wrong
version, a non-zero reserved or, for SET_TIME, valid != 1 or
nanoseconds >= 1_000_000_000 fails with InvalidArgument. In a GET_TIME
output valid is 1 when the clock holds a valid time and 0 when it does
not (for example after power-off on a chip without a battery-backed domain);
then seconds and nanoseconds are zero. A clock that cannot be read or
written fails with InputOutput.
Structs§
- GET_
TIME - Real
Time Clock Time Abi - UTC wall-clock time held by a real-time clock, plus its ABI version and validity. Field order keeps the struct free of padding on 32-bit and 64-bit targets: 16 bytes everywhere.
- SET_
TIME
Constants§
- ABI_
VERSION - Version of the real-time clock control ABI payload.
- MAX_
NANOSECONDS - Largest accepted value of
nanoseconds(exclusive). - NOT_
VALID validvalue of a clock that holds no valid time.- REAL_
TIME_ CLOCK_ PATH - Path of the real-time clock device node in the virtual file system.
- VALID
validvalue of a clock that holds a valid time.