forked from M-Labs/artiq-zynq
send RPC requests to host
This commit is contained in:
parent
1f23a1b86c
commit
4b8bbdc3dc
|
@ -147,7 +147,9 @@ async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Contr
|
||||||
break;
|
break;
|
||||||
},
|
},
|
||||||
kernel::Message::RpcSend { is_async, data } => {
|
kernel::Message::RpcSend { is_async, data } => {
|
||||||
debug!("RPC: is_async={} data={:?}", is_async, data);
|
write_header(&stream, Reply::RPCRequest).await?;
|
||||||
|
write_bool(&stream, is_async).await?;
|
||||||
|
stream.send(data.iter().copied()).await?;
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
error!("received unexpected message from core1 while kernel was running: {:?}", reply);
|
error!("received unexpected message from core1 while kernel was running: {:?}", reply);
|
||||||
|
|
|
@ -84,6 +84,11 @@ pub async fn write_i8(stream: &TcpStream, value: i8) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn write_bool(stream: &TcpStream, value: bool) -> Result<()> {
|
||||||
|
stream.send([value as u8].iter().copied()).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn write_i32(stream: &TcpStream, value: i32) -> Result<()> {
|
pub async fn write_i32(stream: &TcpStream, value: i32) -> Result<()> {
|
||||||
stream.send([
|
stream.send([
|
||||||
(value >> 24) as u8,
|
(value >> 24) as u8,
|
||||||
|
|
Loading…
Reference in New Issue