|
7 | 7 |
|
8 | 8 | //! Low level access to Cortex-A processors.
|
9 | 9 | //!
|
10 |
| -//! ## Currently Supported Architectures |
| 10 | +//! ## Currently Supported Execution States |
11 | 11 | //!
|
12 | 12 | //! - [x] AArch64
|
13 | 13 | //! - [ ] AArch32
|
14 | 14 | //!
|
| 15 | +//! ## Minimum Supported Rust Version |
| 16 | +//! |
| 17 | +//! Requires a recent nightly of Rust. |
| 18 | +//! |
15 | 19 | //! ## Usage
|
16 | 20 | //!
|
17 |
| -//! Example from https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials |
| 21 | +//! Please note that for using this crate's [register definitions](src/registers) (as provided by |
| 22 | +//! `cortex_a::registers::*`), you need to also include |
| 23 | +//! [`tock-registers`](https://crates.io/crates/tock-registers) in your project. This is because the |
| 24 | +//! `interface` traits provided by `tock-registers` are implemented by this crate. You should |
| 25 | +//! include the same version of `tock-registers` as is being used by this crate to ensure sane |
| 26 | +//! interoperatbility. |
| 27 | +//! |
| 28 | +//! For example, in the following snippet, `X.Y.Z` should be the same version of `tock-registers` |
| 29 | +//! that is mentioned in `cortex-a`'s [`Cargo.toml`](Cargo.toml). |
| 30 | +//! |
| 31 | +//! ```toml |
| 32 | +//! [package] |
| 33 | +//! name = "Your embedded project" |
| 34 | +//! |
| 35 | +//! # Some parts omitted for brevity. |
| 36 | +//! |
| 37 | +//! [dependencies] |
| 38 | +//! tock-registers = "X.Y.Z" |
| 39 | +//! cortex-a = "A.B.C" # <-- Includes tock-registers itself. |
| 40 | +//! ``` |
| 41 | +//! |
| 42 | +//! ### Example |
| 43 | +//! |
| 44 | +//! Check out https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials for usage examples. |
| 45 | +//! Listed below is a snippet of `rust-raspberrypi-OS-tutorials`'s early boot code. |
18 | 46 | //!
|
19 | 47 | //! ```rust
|
20 |
| -//! unsafe fn el2_to_el1_transition() -> ! { |
| 48 | +//! use cortex_a::{asm, registers::*}; |
| 49 | +//! use tock_registers::interfaces::Writeable; // <-- Trait needed to use `write()` and `set()`. |
| 50 | +//! |
| 51 | +//! // Some parts omitted for brevity. |
| 52 | +//! |
| 53 | +//! unsafe fn prepare_el2_to_el1_transition( |
| 54 | +//! virt_boot_core_stack_end_exclusive_addr: u64, |
| 55 | +//! virt_kernel_init_addr: u64, |
| 56 | +//! ) { |
21 | 57 | //! // Enable timer counter registers for EL1.
|
22 | 58 | //! CNTHCTL_EL2.write(CNTHCTL_EL2::EL1PCEN::SET + CNTHCTL_EL2::EL1PCTEN::SET);
|
23 | 59 | //!
|
|
39 | 75 | //!
|
40 | 76 | //! ## Disclaimer
|
41 | 77 | //!
|
42 |
| -//! Descriptive comments in the source files are taken from the |
43 |
| -//! [ARM Architecture Reference Manual ARMv8, for ARMv8-A architecture profile](https://static.docs.arm.com/ddi0487/ca/DDI0487C_a_armv8_arm.pdf?_ga=2.266626254.1122218691.1534883460-1326731866.1530967873). |
| 78 | +//! Descriptive comments in the source files are taken from the [ARM Architecture Reference Manual |
| 79 | +//! ARMv8, for ARMv8-A architecture |
| 80 | +//! profile](https://static.docs.arm.com/ddi0487/ca/DDI0487C_a_armv8_arm.pdf?_ga=2.266626254.1122218691.1534883460-1326731866.1530967873). |
44 | 81 |
|
45 |
| -#![allow(clippy::clippy::upper_case_acronyms)] |
| 82 | +#![feature(asm)] |
46 | 83 | #![feature(core_intrinsics)]
|
47 | 84 | #![feature(custom_inner_attributes)]
|
48 |
| -#![feature(asm)] |
49 | 85 | #![no_std]
|
50 | 86 |
|
51 | 87 | pub mod asm;
|
52 |
| -pub mod barrier; |
53 |
| -pub mod regs; |
| 88 | +pub mod registers; |
0 commit comments