#rtc #driver #arceos

no-std riscv_goldfish

System Real Time Clock (RTC) Drivers for riscv based on goldfish

2 releases

0.1.1 Jul 15, 2024
0.1.0 Jul 15, 2024

#25 in #rtc

Download history 303/week @ 2025-09-22 122/week @ 2025-09-29 239/week @ 2025-10-06 181/week @ 2025-10-13 215/week @ 2025-10-20 224/week @ 2025-10-27 232/week @ 2025-11-03 403/week @ 2025-11-10 571/week @ 2025-11-17 567/week @ 2025-11-24 497/week @ 2025-12-01 629/week @ 2025-12-08 713/week @ 2025-12-15 259/week @ 2025-12-22 277/week @ 2025-12-29 235/week @ 2026-01-05

1,502 downloads per month
Used in axplat-riscv64-qemu-virt

GPL-3.0-or-later OR Apache-2…

5KB

System Real Time Clock (RTC) Drivers for riscv based on goldfish. Ref: https://github.com/torvalds/linux/blob/master/drivers/rtc/rtc-goldfish.c


riscv_goldfish

Crates.io

System Real Time Clock (RTC) Drivers for riscv based on goldfish.

Examples

use riscv_goldfish::Rtc;

let epoch_time = Rtc::new(0x10_1000).get_unix_timestamp();

base_addr needs to be the device virtual address available for mmio, which can be obtained from the device tree, for example:

soc {
    #address-cells = <0x02>;
    #size-cells = <0x02>;
    compatible = "simple-bus";
    ranges;

    rtc@101000 {
        interrupts = <0x0b>;
        interrupt-parent = <0x03>;
        reg = <0x00 0x101000 0x00 0x1000>;
        compatible = "google,goldfish-rtc";
    };

    ...
}

No runtime deps