Big restructuring for more modularity
- Make architecture code separate from BSP code - Make BSPs pull in drivers from a generic folder - Enables reuse of drivers between different BSPs.pull/35/head
parent
be787f967c
commit
038c558ac8
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! Conditional exporting of processor architecture code.
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
mod aarch64;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
pub use aarch64::*;
|
@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! AArch64.
|
||||
|
||||
global_asm!(include_str!("aarch64/start.S"));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of the kernel's architecture abstraction code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Pause execution on the calling CPU core.
|
||||
#[inline(always)]
|
||||
pub fn wait_forever() -> ! {
|
||||
unsafe {
|
||||
loop {
|
||||
asm!("wfe" :::: "volatile")
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! Conditional exporting of processor architecture code.
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
mod aarch64;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
pub use aarch64::*;
|
@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! AArch64.
|
||||
|
||||
global_asm!(include_str!("aarch64/start.S"));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of the kernel's architecture abstraction code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Pause execution on the calling CPU core.
|
||||
#[inline(always)]
|
||||
pub fn wait_forever() -> ! {
|
||||
unsafe {
|
||||
loop {
|
||||
asm!("wfe" :::: "volatile")
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! Conditional exporting of processor architecture code.
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
mod aarch64;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
pub use aarch64::*;
|
@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! AArch64.
|
||||
|
||||
global_asm!(include_str!("aarch64/start.S"));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of the kernel's architecture abstraction code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Pause execution on the calling CPU core.
|
||||
#[inline(always)]
|
||||
pub fn wait_forever() -> ! {
|
||||
unsafe {
|
||||
loop {
|
||||
asm!("wfe" :::: "volatile")
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! Conditional exporting of processor architecture code.
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
mod aarch64;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
pub use aarch64::*;
|
@ -0,0 +1,41 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! AArch64.
|
||||
|
||||
use crate::bsp;
|
||||
use cortex_a::{asm, regs::*};
|
||||
|
||||
/// The entry of the `kernel` binary.
|
||||
///
|
||||
/// The function must be named `_start`, because the linker is looking for this
|
||||
/// exact name.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// - Linker script must ensure to place this function at `0x80_000`.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn _start() -> ! {
|
||||
const CORE_MASK: u64 = 0x3;
|
||||
|
||||
if bsp::BOOT_CORE_ID == MPIDR_EL1.get() & CORE_MASK {
|
||||
SP.set(bsp::BOOT_CORE_STACK_START);
|
||||
crate::runtime_init::init()
|
||||
} else {
|
||||
// if not core0, infinitely wait for events
|
||||
wait_forever()
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of the kernel's architecture abstraction code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Pause execution on the calling CPU core.
|
||||
#[inline(always)]
|
||||
pub fn wait_forever() -> ! {
|
||||
loop {
|
||||
asm::wfe()
|
||||
}
|
||||
}
|
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! Conditional exporting of processor architecture code.
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
mod aarch64;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
pub use aarch64::*;
|
@ -0,0 +1,43 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! AArch64.
|
||||
|
||||
pub mod sync;
|
||||
|
||||
use crate::bsp;
|
||||
use cortex_a::{asm, regs::*};
|
||||
|
||||
/// The entry of the `kernel` binary.
|
||||
///
|
||||
/// The function must be named `_start`, because the linker is looking for this
|
||||
/// exact name.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// - Linker script must ensure to place this function at `0x80_000`.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn _start() -> ! {
|
||||
const CORE_MASK: u64 = 0x3;
|
||||
|
||||
if bsp::BOOT_CORE_ID == MPIDR_EL1.get() & CORE_MASK {
|
||||
SP.set(bsp::BOOT_CORE_STACK_START);
|
||||
crate::runtime_init::init()
|
||||
} else {
|
||||
// if not core0, infinitely wait for events
|
||||
wait_forever()
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of the kernel's architecture abstraction code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Pause execution on the calling CPU core.
|
||||
#[inline(always)]
|
||||
pub fn wait_forever() -> ! {
|
||||
loop {
|
||||
asm::wfe()
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! Conditional exporting of processor architecture code.
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
mod aarch64;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
pub use aarch64::*;
|
@ -0,0 +1,45 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! AArch64.
|
||||
|
||||
pub mod sync;
|
||||
|
||||
use crate::bsp;
|
||||
use cortex_a::{asm, regs::*};
|
||||
|
||||
/// The entry of the `kernel` binary.
|
||||
///
|
||||
/// The function must be named `_start`, because the linker is looking for this
|
||||
/// exact name.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// - Linker script must ensure to place this function at `0x80_000`.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn _start() -> ! {
|
||||
const CORE_MASK: u64 = 0x3;
|
||||
|
||||
if bsp::BOOT_CORE_ID == MPIDR_EL1.get() & CORE_MASK {
|
||||
SP.set(bsp::BOOT_CORE_STACK_START);
|
||||
crate::runtime_init::init()
|
||||
} else {
|
||||
// if not core0, infinitely wait for events
|
||||
wait_forever()
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of the kernel's architecture abstraction code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pub use asm::nop;
|
||||
|
||||
/// Pause execution on the calling CPU core.
|
||||
#[inline(always)]
|
||||
pub fn wait_forever() -> ! {
|
||||
loop {
|
||||
asm::wfe()
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! Drivers.
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
mod bcm2837_gpio;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
mod bcm2xxx_mini_uart;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
pub use bcm2837_gpio::GPIO;
|
||||
|
||||
#[cfg(feature = "bsp_rpi3")]
|
||||
pub use bcm2xxx_mini_uart::MiniUart;
|
@ -1,11 +0,0 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||||
|
||||
//! Collection of device drivers.
|
||||
|
||||
mod gpio;
|
||||
mod mini_uart;
|
||||
|
||||
pub use gpio::GPIO;
|
||||
pub use mini_uart::MiniUart;
|
Loading…
Reference in New Issue