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

#296 in Hardware support

Download history 321/week @ 2024-07-28 85/week @ 2024-08-04 144/week @ 2024-08-11 68/week @ 2024-08-18 84/week @ 2024-08-25 162/week @ 2024-09-01 180/week @ 2024-09-08 134/week @ 2024-09-15 202/week @ 2024-09-22 65/week @ 2024-09-29 254/week @ 2024-10-06 369/week @ 2024-10-13 262/week @ 2024-10-20 120/week @ 2024-10-27 22/week @ 2024-11-03 95/week @ 2024-11-10

575 downloads per month
Used in 2 crates (via sparreal-rt)

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

    ...
}

lib.rs:

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

Dependencies

~1MB
~18K SLoC