arm_pl031

Crates.ioarm_pl031
lib.rsarm_pl031
version0.2.1
sourcesrc
created_at2024-07-15 15:25:00.206093
updated_at2024-07-24 16:40:55.066156
descriptionSystem Real Time Clock (RTC) Drivers for aarch64 based on PL031.
homepagehttps://github.com/arceos-org/arceos
repositoryhttps://github.com/arceos-org/arm_pl031
max_upload_size
id1303963
size11,597
core (github:arceos-org:core)

documentation

https://docs.rs/arm_pl031

README

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

    ...
}
Commit count: 0

cargo fmt