#real-time-clock #risc-v #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

#529 in Hardware support

Download history 245/week @ 2024-07-29 97/week @ 2024-08-05 117/week @ 2024-08-12 56/week @ 2024-08-19 80/week @ 2024-08-26 167/week @ 2024-09-02 166/week @ 2024-09-09 160/week @ 2024-09-16 220/week @ 2024-09-23 80/week @ 2024-09-30 265/week @ 2024-10-07 354/week @ 2024-10-14 251/week @ 2024-10-21 105/week @ 2024-10-28 4/week @ 2024-11-04 87/week @ 2024-11-11

471 downloads per month

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

5KB

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";
    };

    ...
}

lib.rs:

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

No runtime deps