kernel/bsp/raspberrypi/
memory.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! BSP Memory Management.

//----------------------------------------------------------------------------
// Public Definitions
//----------------------------------------------------------------------------

/// The board's physical memory map.
#[rustfmt::skip]
pub(super) mod map {

  pub const GPIO_OFFSET:        usize = 0x0020_0000;
  pub const UART_OFFSET:        usize = 0x0020_1000;

  /// Phsyical devices.
  #[cfg(feature = "bsp_rpi3")]
  pub mod mmio {
    use super::*;

    pub const START:            usize =         0x3F00_0000;
    pub const GPIO_START:       usize = START + GPIO_OFFSET;
    pub const PL011_UART_START: usize = START + UART_OFFSET;
  }

  /// Phsyical devices.
  #[cfg(feature = "bsp_rpi4")]
  pub mod mmio {
    use super::*;

    pub const START:            usize =         0xFE00_0000;
    pub const GPIO_START:       usize = START + GPIO_OFFSET;
    pub const PL011_UART_START: usize = START + UART_OFFSET;
  }

  /// Phsyical devices.
  #[cfg(feature = "bsp_rpi5")]
  pub mod mmio {
    use super::*;

    // pub const START:            usize =         0xFC00_0000;
    // pub const GPIO_START:       usize = START + GPIO_OFFSET;
    // pub const PL011_UART_START: usize = START + UART_OFFSET;

    pub const START:            usize =         0x40000000;
    pub const GPIO_START:       usize =         0x400d0000;
    pub const PL011_UART_START: usize =         0x40030000;
  }
}