Skip to content

Commit

Permalink
Reexport tock-registers interfaces
Browse files Browse the repository at this point in the history
Closes #19.

Signed-off-by: Klimenty Tsoutsman <[email protected]>
  • Loading branch information
tsoutsman committed Sep 1, 2023
1 parent c27c137 commit b8c554b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 40 deletions.
22 changes: 2 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,8 @@ It might compile with older versions but that may change in any new patch releas
## Usage

Please note that for using this crate's [register definitions](src/registers) (as provided by
`aarch64_cpu::registers::*`), you need to also include
[`tock-registers`](https://crates.io/crates/tock-registers) in your project. This is because the
`interface` traits provided by `tock-registers` are implemented by this crate. You should include
the same version of `tock-registers` as is being used by this crate to ensure sane
interoperatbility.

For example, in the following snippet, `X.Y.Z` should be the same version of `tock-registers` that
is mentioned in `aarch64-cpu`'s [`Cargo.toml`](Cargo.toml#L23).

```toml
[package]
name = "Your embedded project"

# Some parts omitted for brevity.

[dependencies]
tock-registers = "X.Y.Z"
aarch64-cpu = "A.B.C" # <-- Includes tock-registers itself.
```
`aarch64_cpu::registers::*`), you need to also import
`aarch64_cpu::registers::{Readable, Writeable}`.

### Example

Expand All @@ -44,7 +27,6 @@ below is a snippet of `rust-raspberrypi-OS-tutorials`'s early boot code.

```rust
use aarch64_cpu::{asm, registers::*};
use tock_registers::interfaces::Writeable; // <-- Trait needed to use `write()` and `set()`.

// Some parts omitted for brevity.

Expand Down
22 changes: 2 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,8 @@
//! ## Usage
//!
//! Please note that for using this crate's [register definitions](src/registers) (as provided by
//! `aarch64_cpu::registers::*`), you need to also include
//! [`tock-registers`](https://crates.io/crates/tock-registers) in your project. This is because the
//! `interface` traits provided by `tock-registers` are implemented by this crate. You should
//! include the same version of `tock-registers` as is being used by this crate to ensure sane
//! interoperatbility.
//!
//! For example, in the following snippet, `X.Y.Z` should be the same version of `tock-registers`
//! that is mentioned in `aarch64-cpu`'s [`Cargo.toml`](Cargo.toml#L27).
//!
//! ```toml
//! [package]
//! name = "Your embedded project"
//!
//! # Some parts omitted for brevity.
//!
//! [dependencies]
//! tock-registers = "X.Y.Z"
//! aarch64-cpu = "A.B.C" # <-- Includes tock-registers itself.
//! ```
//! `aarch64_cpu::registers::*`), you need to also import [`Readable`](registers::Readable) and
//! [`Writeable`](registers::Writeable).
//!
//! ### Example
//!
Expand All @@ -37,7 +20,6 @@
//!
//! ```rust
//! use aarch64_cpu::{asm, registers::*};
//! use tock_registers::interfaces::Writeable; // <-- Trait needed to use `write()` and `set()`.
//!
//! // Some parts omitted for brevity.
//!
Expand Down
3 changes: 3 additions & 0 deletions src/registers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,6 @@ pub use vbar_el2::VBAR_EL2;
pub use vbar_el3::VBAR_EL3;
pub use vtcr_el2::VTCR_EL2;
pub use vttbr_el2::VTTBR_EL2;

#[doc(inline)]
pub use tock_registers::interfaces::{Readable, Writeable};

0 comments on commit b8c554b

Please sign in to comment.