| Crates.io | riscv_goldfish |
| lib.rs | riscv_goldfish |
| version | 0.1.1 |
| created_at | 2024-07-15 15:27:13.373868+00 |
| updated_at | 2024-07-15 15:44:25.12792+00 |
| description | System Real Time Clock (RTC) Drivers for riscv based on goldfish. |
| homepage | https://github.com/arceos-org/arceos |
| repository | https://github.com/arceos-org/riscv_goldfish |
| max_upload_size | |
| id | 1303970 |
| size | 6,044 |
System Real Time Clock (RTC) Drivers for riscv based on goldfish.
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";
};
...
}