comms: removed core1 restart

This commit is contained in:
pca006132 2020-07-10 17:17:37 +08:00
parent 407e18a6a0
commit 68d27ca2ee
2 changed files with 1 additions and 18 deletions

View File

@ -231,7 +231,6 @@ async fn handle_run_kernel(stream: Option<&TcpStream>, control: &Rc<RefCell<kern
async fn load_kernel(buffer: Vec<u8>, control: &Rc<RefCell<kernel::Control>>, stream: Option<&TcpStream>) -> Result<()> { async fn load_kernel(buffer: Vec<u8>, control: &Rc<RefCell<kernel::Control>>, stream: Option<&TcpStream>) -> Result<()> {
let mut control = control.borrow_mut(); let mut control = control.borrow_mut();
control.restart();
control.tx.async_send(kernel::Message::LoadRequest(Arc::new(buffer))).await; control.tx.async_send(kernel::Message::LoadRequest(Arc::new(buffer))).await;
let reply = control.rx.async_recv().await; let reply = control.rx.async_recv().await;
match *reply { match *reply {

View File

@ -4,14 +4,13 @@ use libsupport_zynq::boot::Core1;
use super::{CHANNEL_0TO1, CHANNEL_1TO0, Message}; use super::{CHANNEL_0TO1, CHANNEL_1TO0, Message};
pub struct Control { pub struct Control {
core1: Core1,
pub tx: sync_channel::Sender<Message>, pub tx: sync_channel::Sender<Message>,
pub rx: sync_channel::Receiver<Message>, pub rx: sync_channel::Receiver<Message>,
} }
impl Control { impl Control {
pub fn start() -> Self { pub fn start() -> Self {
let core1 = Core1::start(true); Core1::start(true);
let (core0_tx, core1_rx) = sync_channel(4); let (core0_tx, core1_rx) = sync_channel(4);
let (core1_tx, core0_rx) = sync_channel(4); let (core1_tx, core0_rx) = sync_channel(4);
@ -19,23 +18,8 @@ impl Control {
*CHANNEL_1TO0.lock() = Some(core1_tx); *CHANNEL_1TO0.lock() = Some(core1_tx);
Control { Control {
core1,
tx: core0_tx, tx: core0_tx,
rx: core0_rx, rx: core0_rx,
} }
} }
pub fn restart(&mut self) {
*CHANNEL_0TO1.lock() = None;
*CHANNEL_1TO0.lock() = None;
self.core1.restart();
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);
self.tx = core0_tx;
self.rx = core0_rx;
}
} }