forked from M-Labs/zynq-rs
1
0
Fork 0

libboard_zc706:👢 don't leave core1 stopped

Fixes Gitea issue #7.
This commit is contained in:
Astro 2020-01-09 22:13:04 +01:00
parent 2e8d291ee7
commit 688e3b4432
2 changed files with 11 additions and 4 deletions

View File

@ -96,7 +96,7 @@ pub fn main_core0() {
let x = { *SHARED.lock() };
println!("done shared: {:08X}", x);
core1.stop();
core1.reset();
libcortex_a9::asm::dsb();
print!("Core1 stack [{:08X}..{:08X}]:", &core1.stack[0] as *const _ as u32, &core1.stack[core1.stack.len() - 1] as *const _ as u32);

View File

@ -109,10 +109,13 @@ pub struct Core1<S: AsMut<[u32]>> {
}
impl<S: AsMut<[u32]>> Core1<S> {
pub fn stop(&self) {
pub fn reset(&self) {
unsafe {
CORE1_STACK.set(0);
}
slcr::RegisterBlock::unlocked(|slcr| {
slcr.a9_cpu_rst_ctrl.modify(|_, w| w.a9_rst1(true));
slcr.a9_cpu_rst_ctrl.modify(|_, w| w.a9_clkstop1(true));
slcr.a9_cpu_rst_ctrl.modify(|_, w| w.a9_rst1(false));
});
}
@ -125,7 +128,11 @@ impl<S: AsMut<[u32]>> Core1<S> {
let mut core = Core1 { stack };
// reset and stop (safe to repeat)
core.stop();
slcr::RegisterBlock::unlocked(|slcr| {
slcr.a9_cpu_rst_ctrl.modify(|_, w| w.a9_rst1(true));
slcr.a9_cpu_rst_ctrl.modify(|_, w| w.a9_clkstop1(true));
slcr.a9_cpu_rst_ctrl.modify(|_, w| w.a9_rst1(false));
});
let stack = core.stack.as_mut();
let stack_start = &mut stack[stack.len() - 1];