diff --git a/machine/src/platform/raspberrypi/device_driver/bcm/mod.rs b/machine/src/platform/raspberrypi/device_driver/bcm/mod.rs index ec35cd2..2c30318 100644 --- a/machine/src/platform/raspberrypi/device_driver/bcm/mod.rs +++ b/machine/src/platform/raspberrypi/device_driver/bcm/mod.rs @@ -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::*; diff --git a/machine/src/platform/raspberrypi/power.rs b/machine/src/platform/raspberrypi/device_driver/bcm/power.rs similarity index 93% rename from machine/src/platform/raspberrypi/power.rs rename to machine/src/platform/raspberrypi/device_driver/bcm/power.rs index 05f4fe8..e2fbded 100644 --- a/machine/src/platform/raspberrypi/power.rs +++ b/machine/src/platform/raspberrypi/device_driver/bcm/power.rs @@ -59,20 +59,11 @@ pub type Result = ::core::result::Result; type Registers = MMIODerefWrapper; -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 /// diff --git a/machine/src/platform/raspberrypi/memory/mod.rs b/machine/src/platform/raspberrypi/memory/mod.rs index b3295e0..6ae8c8f 100644 --- a/machine/src/platform/raspberrypi/memory/mod.rs +++ b/machine/src/platform/raspberrypi/memory/mod.rs @@ -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 = Address::new(MMIO_BASE + VIDEOCORE_MBOX_OFFSET); + /// Board power control. + pub const POWER_BASE: Address = Address::new(MMIO_BASE + POWER_OFFSET); + /// Base address of GPIO registers. pub const GPIO_BASE: Address = Address::new(MMIO_BASE + GPIO_OFFSET); pub const GPIO_SIZE: usize = 0xA0; diff --git a/machine/src/platform/raspberrypi/mod.rs b/machine/src/platform/raspberrypi/mod.rs index fe59a17..fbbcbf9 100644 --- a/machine/src/platform/raspberrypi/mod.rs +++ b/machine/src/platform/raspberrypi/mod.rs @@ -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