refactor: 📦 Prepare for future Power mod
Power mod is disabled for now. Needs to become a driver.
This commit is contained in:
parent
cfa9b61429
commit
c40797ed19
|
@ -9,6 +9,7 @@ pub mod gpio;
|
|||
pub mod interrupt_controller;
|
||||
pub mod mini_uart;
|
||||
pub mod pl011_uart;
|
||||
// pub mod power;
|
||||
|
||||
#[cfg(feature = "rpi3")]
|
||||
pub use interrupt_controller::*;
|
||||
|
|
|
@ -59,20 +59,11 @@ pub type Result<T> = ::core::result::Result<T, PowerError>;
|
|||
|
||||
type Registers = MMIODerefWrapper<RegisterBlock>;
|
||||
|
||||
const POWER_START: usize = 0x0010_0000;
|
||||
|
||||
/// Public interface to the Power subsystem
|
||||
pub struct Power {
|
||||
registers: Registers,
|
||||
}
|
||||
|
||||
impl Default for Power {
|
||||
fn default() -> Power {
|
||||
const POWER_BASE: usize = BcmHost::get_peripheral_address() + POWER_START;
|
||||
unsafe { Power::new(POWER_BASE) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Power {
|
||||
/// # Safety
|
||||
///
|
|
@ -143,6 +143,7 @@ pub(super) mod map {
|
|||
}
|
||||
|
||||
pub const VIDEOCORE_MBOX_OFFSET: usize = 0x0000_B880;
|
||||
pub const POWER_OFFSET: usize = 0x0010_0000;
|
||||
pub const GPIO_OFFSET: usize = 0x0020_0000;
|
||||
pub const UART_OFFSET: usize = 0x0020_1000;
|
||||
pub const MINIUART_OFFSET: usize = 0x0021_5000;
|
||||
|
@ -162,6 +163,9 @@ pub(super) mod map {
|
|||
/// Base address of ARM<->VC mailbox area.
|
||||
pub const VIDEOCORE_MBOX_BASE: Address<Physical> = Address::new(MMIO_BASE + VIDEOCORE_MBOX_OFFSET);
|
||||
|
||||
/// Board power control.
|
||||
pub const POWER_BASE: Address<Physical> = Address::new(MMIO_BASE + POWER_OFFSET);
|
||||
|
||||
/// Base address of GPIO registers.
|
||||
pub const GPIO_BASE: Address<Physical> = Address::new(MMIO_BASE + GPIO_OFFSET);
|
||||
pub const GPIO_SIZE: usize = 0xA0;
|
||||
|
|
|
@ -12,7 +12,6 @@ pub mod exception;
|
|||
pub mod fb;
|
||||
pub mod mailbox;
|
||||
pub mod memory;
|
||||
pub mod power;
|
||||
pub mod vc;
|
||||
|
||||
/// See BCM2835-ARM-Peripherals.pdf
|
||||
|
|
Loading…
Reference in New Issue