2020-07-09 04:32:45 +08:00
|
|
|
use libcortex_a9::sync_channel::{self, sync_channel};
|
|
|
|
use libsupport_zynq::boot::Core1;
|
|
|
|
|
|
|
|
use super::{CHANNEL_0TO1, CHANNEL_1TO0, Message};
|
|
|
|
|
|
|
|
pub struct Control {
|
|
|
|
pub tx: sync_channel::Sender<Message>,
|
|
|
|
pub rx: sync_channel::Receiver<Message>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Control {
|
|
|
|
pub fn start() -> Self {
|
2020-07-10 17:17:37 +08:00
|
|
|
Core1::start(true);
|
2020-07-09 04:32:45 +08:00
|
|
|
|
|
|
|
let (core0_tx, core1_rx) = sync_channel(4);
|
|
|
|
let (core1_tx, core0_rx) = sync_channel(4);
|
|
|
|
*CHANNEL_0TO1.lock() = Some(core1_rx);
|
|
|
|
*CHANNEL_1TO0.lock() = Some(core1_tx);
|
|
|
|
|
|
|
|
Control {
|
|
|
|
tx: core0_tx,
|
|
|
|
rx: core0_rx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|