-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve introduction of rtc-related crates
- Loading branch information
Showing
6 changed files
with
92 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# arm_pl031 | ||
|
||
[](https://crates.io/crates/arm_pl031) | ||
|
||
System Real Time Clock (RTC) Drivers for aarch64 based on PL031. | ||
|
||
## Examples | ||
|
||
```rust | ||
use arm_pl031::Rtc; | ||
|
||
let epoch_time = Rtc::new(0x901_0000).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"; | ||
}; | ||
... | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# riscv_goldfish | ||
|
||
[](https://crates.io/crates/riscv_goldfish) | ||
|
||
System Real Time Clock (RTC) Drivers for riscv based on goldfish. | ||
|
||
## Examples | ||
|
||
```rust | ||
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"; | ||
}; | ||
... | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# x86_rtc | ||
|
||
[](https://crates.io/crates/x86_rtc) | ||
|
||
System Real Time Clock (RTC) Drivers for x86_64 based on CMOS. | ||
|
||
## Examples | ||
|
||
```rust | ||
use x86_rtc::Rtc; | ||
let epoch_time = Rtc::new().get_unix_timestamp(); | ||
``` |