Fix all boards and move diff to directory
This commit is contained in:
committed by
Julien Cretin
parent
ad0605c2fa
commit
69f1b672f1
@@ -50,6 +50,11 @@ const NUM_PROCS: usize = 8;
|
||||
static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROCS] =
|
||||
[None; NUM_PROCS];
|
||||
|
||||
static mut STORAGE_LOCATIONS: [kernel::StorageLocation; 1] = [kernel::StorageLocation {
|
||||
address: 0xC0000,
|
||||
size: 0x40000,
|
||||
}];
|
||||
|
||||
// Static reference to chip for panic dumps
|
||||
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
||||
|
||||
@@ -78,6 +83,7 @@ pub struct Platform {
|
||||
'static,
|
||||
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||
>,
|
||||
nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
||||
}
|
||||
|
||||
impl kernel::Platform for Platform {
|
||||
@@ -93,10 +99,30 @@ impl kernel::Platform for Platform {
|
||||
capsules::button::DRIVER_NUM => f(Some(self.button)),
|
||||
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
||||
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||
_ => f(None),
|
||||
}
|
||||
}
|
||||
|
||||
fn filter_syscall(
|
||||
&self,
|
||||
process: &dyn kernel::procs::ProcessType,
|
||||
syscall: &kernel::syscall::Syscall,
|
||||
) -> Result<(), kernel::ReturnCode> {
|
||||
use kernel::syscall::Syscall;
|
||||
match *syscall {
|
||||
Syscall::COMMAND {
|
||||
driver_number: nrf52840::nvmc::DRIVER_NUM,
|
||||
subdriver_number: cmd,
|
||||
arg0: ptr,
|
||||
arg1: len,
|
||||
} if (cmd == 2 || cmd == 3) && !process.fits_in_storage_location(ptr, len) => {
|
||||
Err(kernel::ReturnCode::EINVAL)
|
||||
}
|
||||
_ => Ok(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Entry point in the vector table called on hard reset.
|
||||
@@ -105,7 +131,10 @@ pub unsafe fn reset_handler() {
|
||||
// Loads relocations and clears BSS
|
||||
nrf52840::init();
|
||||
|
||||
let board_kernel = static_init!(kernel::Kernel, kernel::Kernel::new(&PROCESSES));
|
||||
let board_kernel = static_init!(
|
||||
kernel::Kernel,
|
||||
kernel::Kernel::new_with_storage(&PROCESSES, &STORAGE_LOCATIONS)
|
||||
);
|
||||
|
||||
// GPIOs
|
||||
let gpio = components::gpio::GpioComponent::new(
|
||||
@@ -249,6 +278,20 @@ pub unsafe fn reset_handler() {
|
||||
nrf52840::acomp::Comparator
|
||||
));
|
||||
|
||||
let nvmc = static_init!(
|
||||
nrf52840::nvmc::SyscallDriver,
|
||||
nrf52840::nvmc::SyscallDriver::new(
|
||||
&nrf52840::nvmc::NVMC,
|
||||
board_kernel.create_grant(&memory_allocation_capability),
|
||||
dynamic_deferred_caller,
|
||||
)
|
||||
);
|
||||
nvmc.set_deferred_handle(
|
||||
dynamic_deferred_caller
|
||||
.register(nvmc)
|
||||
.expect("no deferred call slot available for nvmc"),
|
||||
);
|
||||
|
||||
nrf52_components::NrfClockComponent::new().finalize(());
|
||||
|
||||
let platform = Platform {
|
||||
@@ -260,6 +303,7 @@ pub unsafe fn reset_handler() {
|
||||
rng,
|
||||
alarm,
|
||||
analog_comparator,
|
||||
nvmc,
|
||||
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user