cargo fmt

This commit is contained in:
occheung 2024-08-23 11:54:37 +08:00
parent 1fc3ea40f7
commit f7e2089b5b
4 changed files with 8 additions and 22 deletions

View File

@ -691,7 +691,7 @@ impl Packet {
length: length, length: length,
data: data, data: data,
} }
}, }
0xdc => { 0xdc => {
let last = reader.read_bool()?; let last = reader.read_bool()?;
let length = reader.read_u16()?; let length = reader.read_u16()?;
@ -702,7 +702,7 @@ impl Packet {
length: length, length: length,
value: value, value: value,
} }
}, }
0xdd => Packet::CoreMgmtAck, 0xdd => Packet::CoreMgmtAck,
0xde => Packet::CoreMgmtNack, 0xde => Packet::CoreMgmtNack,
@ -1155,11 +1155,7 @@ impl Packet {
writer.write_u16(length)?; writer.write_u16(length)?;
writer.write_all(&data[0..length as usize])?; writer.write_all(&data[0..length as usize])?;
} }
Packet::CoreMgmtConfigReadReply { Packet::CoreMgmtConfigReadReply { last, length, value } => {
last,
length,
value,
} => {
writer.write_u8(0xdc)?; writer.write_u8(0xdc)?;
writer.write_bool(last)?; writer.write_bool(last)?;
writer.write_u16(length)?; writer.write_u16(length)?;

View File

@ -139,7 +139,7 @@ async fn read_key(stream: &mut TcpStream) -> Result<String> {
#[cfg(has_drtio)] #[cfg(has_drtio)]
mod remote_coremgmt { mod remote_coremgmt {
use io::{Cursor, ProtoWrite}; use io::{Cursor, ProtoWrite};
use libboard_artiq::drtioaux_proto::{MASTER_PAYLOAD_MAX_SIZE, Packet}; use libboard_artiq::drtioaux_proto::{Packet, MASTER_PAYLOAD_MAX_SIZE};
use super::*; use super::*;
use crate::rtio_mgt::drtio; use crate::rtio_mgt::drtio;
@ -351,11 +351,7 @@ mod remote_coremgmt {
let mut buffer = Vec::<u8>::new(); let mut buffer = Vec::<u8>::new();
loop { loop {
match reply { match reply {
Packet::CoreMgmtConfigReadReply { Packet::CoreMgmtConfigReadReply { length, last, value } => {
length,
last,
value,
} => {
buffer.extend(&value[..length as usize]); buffer.extend(&value[..length as usize]);
if last { if last {

View File

@ -1132,10 +1132,7 @@ fn process_aux_packet(
let key_slice = &key[..length as usize]; let key_slice = &key[..length as usize];
if !key_slice.is_ascii() { if !key_slice.is_ascii() {
error!("invalid key"); error!("invalid key");
drtioaux::send( drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
0,
&drtioaux::Packet::CoreMgmtNack,
)
} else { } else {
let key = core::str::from_utf8(key_slice).unwrap(); let key = core::str::from_utf8(key_slice).unwrap();
if core_manager.fetch_config_value(key).is_ok() { if core_manager.fetch_config_value(key).is_ok() {
@ -1149,10 +1146,7 @@ fn process_aux_packet(
}, },
) )
} else { } else {
drtioaux::send( drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
0,
&drtioaux::Packet::CoreMgmtNack,
)
} }
} }
} }

View File

@ -4,7 +4,7 @@ use core::cmp::min;
#[cfg(has_drtio_routing)] #[cfg(has_drtio_routing)]
use libboard_artiq::pl::csr; use libboard_artiq::pl::csr;
use libboard_artiq::{drtio_routing, drtioaux, use libboard_artiq::{drtio_routing, drtioaux,
drtioaux_proto::{PayloadStatus, SAT_PAYLOAD_MAX_SIZE, MASTER_PAYLOAD_MAX_SIZE}}; drtioaux_proto::{PayloadStatus, MASTER_PAYLOAD_MAX_SIZE, SAT_PAYLOAD_MAX_SIZE}};
pub struct SliceMeta { pub struct SliceMeta {
pub destination: u8, pub destination: u8,