#rtc #arm64 #arceos #pl031

no-std arm_pl031

System Real Time Clock (RTC) Drivers for aarch64 based on PL031

4 releases

0.2.1 Jul 24, 2024
0.2.0 Jul 22, 2024
0.1.1 Jul 15, 2024
0.1.0 Jul 15, 2024

#301 in Operating systems

Download history 264/week @ 2024-12-25 251/week @ 2025-01-01 136/week @ 2025-01-08 97/week @ 2025-01-15 130/week @ 2025-01-22 52/week @ 2025-01-29 268/week @ 2025-02-05 359/week @ 2025-02-12 192/week @ 2025-02-19 185/week @ 2025-02-26 187/week @ 2025-03-05 279/week @ 2025-03-12 237/week @ 2025-03-19 381/week @ 2025-03-26 323/week @ 2025-04-02 267/week @ 2025-04-09

1,222 downloads per month
Used in 3 crates (via osdemo)

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

9KB
100 lines

arm_pl031

Crates.io

System Real Time Clock (RTC) Drivers for aarch64 based on PL031.

Examples

use arm_pl031::Rtc;

let rtc = unsafe { Rtc::new(0x901_0000 as _) };
let epoch_time = rtc.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:

/ {
	interrupt-parent = <0x8002>;
	model = "linux,dummy-virt";
	#size-cells = <0x02>;
	#address-cells = <0x02>;
	compatible = "linux,dummy-virt";

	pl031@9010000 {
		clock-names = "apb_pclk";
		clocks = <0x8000>;
		interrupts = <0x00 0x02 0x04>;
		reg = <0x00 0x9010000 0x00 0x1000>;
		compatible = "arm,pl031\0arm,primecell";
	};

    ...
}

Dependencies

~1MB
~18K SLoC