Compare commits

...

7 Commits

5 changed files with 151 additions and 183 deletions

View File

@ -8,11 +8,6 @@ const MAX_PACKET: usize = 1024;
pub const SAT_PAYLOAD_MAX_SIZE: usize = /*max size*/MAX_PACKET - /*CRC*/4 - /*packet ID*/1 - /*last*/1 - /*length*/2;
// used by DDMA, subkernel program data (need to provide extra ID and destination)
pub const MASTER_PAYLOAD_MAX_SIZE: usize = SAT_PAYLOAD_MAX_SIZE - /*source*/1 - /*destination*/1 - /*ID*/4;
// used by core device management, core_mgmt packet
// FIXME: packet size
pub const CORE_MGMT_PAYLOAD_MAX_SIZE: usize = MASTER_PAYLOAD_MAX_SIZE;
// pub const CORE_MGMT_CONFIG_MAX_SIZE: usize = /*max size*/MAX_PACKET - /*destination*/1 - /*last*/1 - /*length*/2;
pub const CORE_MGMT_CONFIG_MAX_SIZE: usize = MASTER_PAYLOAD_MAX_SIZE;
#[derive(Debug)]
pub enum Error {
@ -297,11 +292,6 @@ pub enum Packet {
destination: u8,
clear: bool,
},
CoreMgmtGetLogReply {
last: bool,
length: u16,
data: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE],
},
CoreMgmtClearLogRequest {
destination: u8,
},
@ -316,27 +306,21 @@ pub enum Packet {
CoreMgmtConfigReadRequest {
destination: u8,
length: u16,
key: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE],
key: [u8; MASTER_PAYLOAD_MAX_SIZE],
},
CoreMgmtConfigReadContinue {
destination: u8,
},
CoreMgmtConfigReadReply {
succeeded: bool,
length: u16,
last: bool,
value: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE],
},
CoreMgmtConfigWriteRequest {
destination: u8,
length: u16,
last: bool,
data: [u8; CORE_MGMT_CONFIG_MAX_SIZE],
length: u16,
data: [u8; MASTER_PAYLOAD_MAX_SIZE],
},
CoreMgmtConfigRemoveRequest {
destination: u8,
length: u16,
key: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE],
key: [u8; MASTER_PAYLOAD_MAX_SIZE],
},
CoreMgmtConfigEraseRequest {
destination: u8,
@ -347,9 +331,18 @@ pub enum Packet {
CoreMgmtAllocatorDebugRequest {
destination: u8,
},
CoreMgmtAck {
succeeded: bool,
CoreMgmtGetLogReply {
last: bool,
length: u16,
data: [u8; SAT_PAYLOAD_MAX_SIZE],
},
CoreMgmtConfigReadReply {
last: bool,
length: u16,
value: [u8; SAT_PAYLOAD_MAX_SIZE],
},
CoreMgmtAck,
CoreMgmtNack,
}
impl Packet {
@ -630,32 +623,21 @@ impl Packet {
destination: reader.read_u8()?,
clear: reader.read_bool()?,
},
0xd1 => {
let last = reader.read_bool()?;
let length = reader.read_u16()?;
let mut data: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut data[0..length as usize])?;
Packet::CoreMgmtGetLogReply {
last: last,
length: length,
data: data,
}
}
0xd2 => Packet::CoreMgmtClearLogRequest {
0xd1 => Packet::CoreMgmtClearLogRequest {
destination: reader.read_u8()?,
},
0xd5 => Packet::CoreMgmtSetLogLevelRequest {
0xd2 => Packet::CoreMgmtSetLogLevelRequest {
destination: reader.read_u8()?,
log_level: reader.read_u8()?,
},
0xd6 => Packet::CoreMgmtSetUartLogLevelRequest {
0xd3 => Packet::CoreMgmtSetUartLogLevelRequest {
destination: reader.read_u8()?,
log_level: reader.read_u8()?,
},
0xd7 => {
0xd4 => {
let destination = reader.read_u8()?;
let length = reader.read_u16()?;
let mut key: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
let mut key: [u8; MASTER_PAYLOAD_MAX_SIZE] = [0; MASTER_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut key[0..length as usize])?;
Packet::CoreMgmtConfigReadRequest {
destination: destination,
@ -663,36 +645,26 @@ impl Packet {
key: key,
}
}
0xd8 => {
let succeeded = reader.read_bool()?;
let length = reader.read_u16()?;
let last = reader.read_bool()?;
let mut value: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut value[0..length as usize])?;
Packet::CoreMgmtConfigReadReply {
succeeded: succeeded,
length: length,
last: last,
value: value,
}
}
0xd9 => {
0xd5 => Packet::CoreMgmtConfigReadContinue {
destination: reader.read_u8()?,
},
0xd6 => {
let destination = reader.read_u8()?;
let length = reader.read_u16()?;
let last = reader.read_bool()?;
let mut data: [u8; CORE_MGMT_CONFIG_MAX_SIZE] = [0; CORE_MGMT_CONFIG_MAX_SIZE];
let length = reader.read_u16()?;
let mut data: [u8; MASTER_PAYLOAD_MAX_SIZE] = [0; MASTER_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut data[0..length as usize])?;
Packet::CoreMgmtConfigWriteRequest {
destination: destination,
length: length,
last: last,
length: length,
data: data,
}
}
0xda => {
0xd7 => {
let destination = reader.read_u8()?;
let length = reader.read_u16()?;
let mut key: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
let mut key: [u8; MASTER_PAYLOAD_MAX_SIZE] = [0; MASTER_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut key[0..length as usize])?;
Packet::CoreMgmtConfigRemoveRequest {
destination: destination,
@ -700,21 +672,39 @@ impl Packet {
key: key,
}
}
0xdb => Packet::CoreMgmtConfigEraseRequest {
0xd8 => Packet::CoreMgmtConfigEraseRequest {
destination: reader.read_u8()?,
},
0xdc => Packet::CoreMgmtRebootRequest {
0xd9 => Packet::CoreMgmtRebootRequest {
destination: reader.read_u8()?,
},
0xdd => Packet::CoreMgmtAllocatorDebugRequest {
destination: reader.read_u8()?,
},
0xde => Packet::CoreMgmtAck {
succeeded: reader.read_bool()?,
},
0xdf => Packet::CoreMgmtConfigReadContinue {
0xda => Packet::CoreMgmtAllocatorDebugRequest {
destination: reader.read_u8()?,
},
0xdb => {
let last = reader.read_bool()?;
let length = reader.read_u16()?;
let mut data: [u8; SAT_PAYLOAD_MAX_SIZE] = [0; SAT_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut data[0..length as usize])?;
Packet::CoreMgmtGetLogReply {
last: last,
length: length,
data: data,
}
}
0xdc => {
let last = reader.read_bool()?;
let length = reader.read_u16()?;
let mut value: [u8; SAT_PAYLOAD_MAX_SIZE] = [0; SAT_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut value[0..length as usize])?;
Packet::CoreMgmtConfigReadReply {
last: last,
length: length,
value: value,
}
}
0xdd => Packet::CoreMgmtAck,
0xde => Packet::CoreMgmtNack,
ty => return Err(Error::UnknownPacket(ty)),
})
@ -1091,28 +1081,23 @@ impl Packet {
writer.write_u8(0xcc)?;
writer.write_u8(destination)?;
}
Packet::CoreMgmtGetLogRequest { destination, clear } => {
writer.write_u8(0xd0)?;
writer.write_u8(destination)?;
writer.write_bool(clear)?;
}
Packet::CoreMgmtGetLogReply { last, length, data } => {
writer.write_u8(0xd1)?;
writer.write_bool(last)?;
writer.write_u16(length)?;
writer.write_all(&data[0..length as usize])?;
}
Packet::CoreMgmtClearLogRequest { destination } => {
writer.write_u8(0xd2)?;
writer.write_u8(0xd1)?;
writer.write_u8(destination)?;
}
Packet::CoreMgmtSetLogLevelRequest { destination, log_level } => {
writer.write_u8(0xd5)?;
writer.write_u8(0xd2)?;
writer.write_u8(destination)?;
writer.write_u8(log_level)?;
}
Packet::CoreMgmtSetUartLogLevelRequest { destination, log_level } => {
writer.write_u8(0xd6)?;
writer.write_u8(0xd3)?;
writer.write_u8(destination)?;
writer.write_u8(log_level)?;
}
@ -1120,66 +1105,64 @@ impl Packet {
destination,
length,
key,
} => {
writer.write_u8(0xd4)?;
writer.write_u8(destination)?;
writer.write_u16(length)?;
writer.write_all(&key[0..length as usize])?;
}
Packet::CoreMgmtConfigReadContinue { destination } => {
writer.write_u8(0xd5)?;
writer.write_u8(destination)?;
}
Packet::CoreMgmtConfigWriteRequest {
destination,
last,
length,
data,
} => {
writer.write_u8(0xd6)?;
writer.write_u8(destination)?;
writer.write_bool(last)?;
writer.write_u16(length)?;
writer.write_all(&data[0..length as usize])?;
}
Packet::CoreMgmtConfigRemoveRequest {
destination,
length,
key,
} => {
writer.write_u8(0xd7)?;
writer.write_u8(destination)?;
writer.write_u16(length)?;
writer.write_all(&key[0..length as usize])?;
}
Packet::CoreMgmtConfigReadReply {
succeeded,
length,
last,
value,
} => {
writer.write_u8(0xd8)?;
writer.write_bool(succeeded)?;
writer.write_u16(length)?;
writer.write_bool(last)?;
writer.write_all(&value[0..length as usize])?;
}
Packet::CoreMgmtConfigWriteRequest {
destination,
length,
last,
data,
} => {
writer.write_u8(0xd9)?;
writer.write_u8(destination)?;
writer.write_u16(length)?;
writer.write_bool(last)?;
writer.write_all(&data[0..length as usize])?;
}
Packet::CoreMgmtConfigRemoveRequest {
destination,
length,
key,
} => {
writer.write_u8(0xda)?;
writer.write_u8(destination)?;
writer.write_u16(length)?;
writer.write_all(&key[0..length as usize])?;
}
Packet::CoreMgmtConfigEraseRequest { destination } => {
writer.write_u8(0xdb)?;
writer.write_u8(0xd8)?;
writer.write_u8(destination)?;
}
Packet::CoreMgmtRebootRequest { destination } => {
writer.write_u8(0xdc)?;
writer.write_u8(0xd9)?;
writer.write_u8(destination)?;
}
Packet::CoreMgmtAllocatorDebugRequest { destination } => {
writer.write_u8(0xdd)?;
writer.write_u8(0xda)?;
writer.write_u8(destination)?;
}
Packet::CoreMgmtAck { succeeded } => {
writer.write_u8(0xde)?;
writer.write_bool(succeeded)?;
Packet::CoreMgmtGetLogReply { last, length, data } => {
writer.write_u8(0xdb)?;
writer.write_bool(last)?;
writer.write_u16(length)?;
writer.write_all(&data[0..length as usize])?;
}
Packet::CoreMgmtConfigReadContinue { destination } => {
writer.write_u8(0xdf)?;
writer.write_u8(destination)?;
Packet::CoreMgmtConfigReadReply { last, length, value } => {
writer.write_u8(0xdc)?;
writer.write_bool(last)?;
writer.write_u16(length)?;
writer.write_all(&value[0..length as usize])?;
}
Packet::CoreMgmtAck => writer.write_u8(0xdd)?,
Packet::CoreMgmtNack => writer.write_u8(0xde)?,
}
Ok(())
}

View File

@ -139,7 +139,7 @@ async fn read_key(stream: &mut TcpStream) -> Result<String> {
#[cfg(has_drtio)]
mod remote_coremgmt {
use io::{Cursor, ProtoWrite};
use libboard_artiq::drtioaux_proto::{Packet, CORE_MGMT_PAYLOAD_MAX_SIZE};
use libboard_artiq::drtioaux_proto::{Packet, MASTER_PAYLOAD_MAX_SIZE};
use super::*;
use crate::rtio_mgt::drtio;
@ -200,7 +200,7 @@ mod remote_coremgmt {
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
Packet::CoreMgmtAck => {
write_i8(stream, Reply::Success as i8).await?;
Ok(())
}
@ -277,7 +277,7 @@ mod remote_coremgmt {
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
Packet::CoreMgmtAck => {
write_i8(stream, Reply::Success as i8).await?;
Ok(())
}
@ -310,7 +310,7 @@ mod remote_coremgmt {
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
Packet::CoreMgmtAck => {
write_i8(stream, Reply::Success as i8).await?;
Ok(())
}
@ -331,7 +331,7 @@ mod remote_coremgmt {
_cfg: &Rc<Config>,
key: &String,
) -> Result<()> {
let mut config_key: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
let mut config_key: [u8; MASTER_PAYLOAD_MAX_SIZE] = [0; MASTER_PAYLOAD_MAX_SIZE];
let len = key.len();
config_key[..len].clone_from_slice(key.as_bytes());
@ -351,17 +351,12 @@ mod remote_coremgmt {
let mut buffer = Vec::<u8>::new();
loop {
match reply {
Packet::CoreMgmtConfigReadReply {
succeeded: true,
length,
last,
value,
} => {
Packet::CoreMgmtConfigReadReply { last, length, value } => {
buffer.extend(&value[..length as usize]);
if last {
write_i8(stream, Reply::ConfigData as i8).await?;
write_chunk(stream, &value).await?;
write_chunk(stream, &buffer).await?;
return Ok(());
}
@ -408,12 +403,12 @@ mod remote_coremgmt {
message.get_ref(),
|slice, status, len: usize| Packet::CoreMgmtConfigWriteRequest {
destination: destination,
length: len as u16,
last: status.is_last(),
length: len as u16,
data: *slice,
},
|reply| match reply {
Packet::CoreMgmtAck { succeeded: true } => Ok(()),
Packet::CoreMgmtAck => Ok(()),
_ => {
error!("received unknown packet");
Err(drtio::Error::UnexpectedReply.into())
@ -443,7 +438,7 @@ mod remote_coremgmt {
_cfg: &Rc<Config>,
key: &String,
) -> Result<()> {
let mut config_key: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
let mut config_key: [u8; MASTER_PAYLOAD_MAX_SIZE] = [0; MASTER_PAYLOAD_MAX_SIZE];
let len = key.len();
config_key[..len].clone_from_slice(key.as_bytes());
@ -461,7 +456,7 @@ mod remote_coremgmt {
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
Packet::CoreMgmtAck => {
write_i8(stream, Reply::Success as i8).await?;
Ok(())
}
@ -492,7 +487,7 @@ mod remote_coremgmt {
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
Packet::CoreMgmtAck => {
write_i8(stream, Reply::Success as i8).await?;
Ok(())
}
@ -524,7 +519,7 @@ mod remote_coremgmt {
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
Packet::CoreMgmtAck => {
write_i8(stream, Reply::RebootImminent as i8).await?;
Ok(())
}
@ -556,7 +551,7 @@ mod remote_coremgmt {
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
Packet::CoreMgmtAck => {
write_i8(stream, Reply::Success as i8).await?;
Ok(())
}

View File

@ -36,7 +36,7 @@ use libboard_artiq::si5324;
#[cfg(has_si549)]
use libboard_artiq::si549;
use libboard_artiq::{drtio_routing, drtioaux,
drtioaux_proto::{CORE_MGMT_PAYLOAD_MAX_SIZE, MASTER_PAYLOAD_MAX_SIZE, SAT_PAYLOAD_MAX_SIZE},
drtioaux_proto::{MASTER_PAYLOAD_MAX_SIZE, SAT_PAYLOAD_MAX_SIZE},
identifier_read, logger,
pl::csr};
#[cfg(feature = "target_kasli_soc")]
@ -1030,7 +1030,7 @@ fn process_aux_packet(
&packet,
timer
);
let mut data_slice: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
let mut data_slice = [0; SAT_PAYLOAD_MAX_SIZE];
let meta = core_manager.log_get_slice(&mut data_slice);
if clear && meta.status.is_first() {
mgmt::clear_log();
@ -1058,7 +1058,7 @@ fn process_aux_packet(
timer
);
mgmt::clear_log();
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: true })
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck)
}
drtioaux::Packet::CoreMgmtSetLogLevelRequest {
destination: _destination,
@ -1076,11 +1076,11 @@ fn process_aux_packet(
);
if let Ok(level_filter) = mgmt::byte_to_level_filter(log_level) {
info!("Changing log level to {}", log_level);
info!("Changing log level to {}", level_filter);
log::set_max_level(level_filter);
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: true })
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck)
} else {
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: false })
drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
}
}
drtioaux::Packet::CoreMgmtSetUartLogLevelRequest {
@ -1099,16 +1099,16 @@ fn process_aux_packet(
);
if let Ok(level_filter) = mgmt::byte_to_level_filter(log_level) {
info!("Changing log level to {}", log_level);
info!("Changing log level to {}", level_filter);
unsafe {
logger::BufferLogger::get_logger()
.as_ref()
.unwrap()
.set_uart_log_level(level_filter);
}
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: true })
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck)
} else {
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: false })
drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
}
}
drtioaux::Packet::CoreMgmtConfigReadRequest {
@ -1127,20 +1127,12 @@ fn process_aux_packet(
timer
);
let mut value_slice = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
let mut value_slice = [0; SAT_PAYLOAD_MAX_SIZE];
let key_slice = &key[..length as usize];
if !key_slice.is_ascii() {
error!("invalid key");
drtioaux::send(
0,
&drtioaux::Packet::CoreMgmtConfigReadReply {
succeeded: false,
length: 0,
last: true,
value: value_slice,
},
)
drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
} else {
let key = core::str::from_utf8(key_slice).unwrap();
if core_manager.fetch_config_value(key).is_ok() {
@ -1148,22 +1140,13 @@ fn process_aux_packet(
drtioaux::send(
0,
&drtioaux::Packet::CoreMgmtConfigReadReply {
succeeded: true,
length: meta.len as u16,
last: meta.status.is_last(),
length: meta.len as u16,
value: value_slice,
},
)
} else {
drtioaux::send(
0,
&drtioaux::Packet::CoreMgmtConfigReadReply {
succeeded: false,
length: 0,
last: true,
value: value_slice,
},
)
drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
}
}
}
@ -1181,22 +1164,21 @@ fn process_aux_packet(
timer
);
let mut value_slice = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
let mut value_slice = [0; SAT_PAYLOAD_MAX_SIZE];
let meta = core_manager.get_config_value_slice(&mut value_slice);
drtioaux::send(
0,
&drtioaux::Packet::CoreMgmtConfigReadReply {
succeeded: true,
length: meta.len as u16,
last: meta.status.is_last(),
length: meta.len as u16,
value: value_slice,
},
)
}
drtioaux::Packet::CoreMgmtConfigWriteRequest {
destination: _destination,
length,
last,
length,
data,
} => {
forward!(
@ -1218,7 +1200,11 @@ fn process_aux_packet(
core_manager.clear_data();
}
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: succeeded })
if succeeded {
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck)
} else {
drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
}
}
drtioaux::Packet::CoreMgmtConfigRemoveRequest {
destination: _destination,
@ -1239,11 +1225,14 @@ fn process_aux_packet(
let key_slice = &key[..length as usize];
if !key_slice.is_ascii() {
error!("invalid key");
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: false })
drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
} else {
let key = core::str::from_utf8(key_slice).unwrap();
let succeeded = core_manager.remove_config(key).is_ok();
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded })
if core_manager.remove_config(key).is_ok() {
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck)
} else {
drtioaux::send(0, &drtioaux::Packet::CoreMgmtNack)
}
}
}
drtioaux::Packet::CoreMgmtConfigEraseRequest {
@ -1278,7 +1267,7 @@ fn process_aux_packet(
timer
);
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: true })?;
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck)?;
info!("reboot imminent");
slcr::reboot();
Ok(())

View File

@ -1,7 +1,7 @@
use alloc::vec::Vec;
use io::{Cursor, ProtoRead, ProtoWrite};
use libboard_artiq::{drtioaux_proto::CORE_MGMT_PAYLOAD_MAX_SIZE,
use libboard_artiq::{drtioaux_proto::SAT_PAYLOAD_MAX_SIZE,
logger::{BufferLogger, LogBufferRef}};
use libconfig::Config;
use log::{self, debug, error, info, warn, LevelFilter};
@ -60,13 +60,13 @@ impl<'a> Manager<'_> {
}
}
pub fn log_get_slice(&mut self, data_slice: &mut [u8; CORE_MGMT_PAYLOAD_MAX_SIZE]) -> SliceMeta {
pub fn log_get_slice(&mut self, data_slice: &mut [u8; SAT_PAYLOAD_MAX_SIZE]) -> SliceMeta {
// Populate buffer if depleted
if self.last_log.at_end() {
self.last_log.extend(get_logger_buffer().extract().as_bytes());
}
self.last_log.get_slice_core_mgmt(data_slice)
self.last_log.get_slice_satellite(data_slice)
}
pub fn fetch_config_value(&mut self, key: &str) -> Result<()> {
@ -79,8 +79,8 @@ impl<'a> Manager<'_> {
.map_err(|_| warn!("read error: no such key"))
}
pub fn get_config_value_slice(&mut self, data_slice: &mut [u8; CORE_MGMT_PAYLOAD_MAX_SIZE]) -> SliceMeta {
self.last_value.get_slice_core_mgmt(data_slice)
pub fn get_config_value_slice(&mut self, data_slice: &mut [u8; SAT_PAYLOAD_MAX_SIZE]) -> SliceMeta {
self.last_value.get_slice_satellite(data_slice)
}
pub fn add_data(&mut self, data: &[u8], data_len: usize) {
@ -97,6 +97,7 @@ impl<'a> Manager<'_> {
.current_payload
.read_string()
.map_err(|_err| error!("error on reading key"))?;
debug!("write key: {}", key);
let value = self.current_payload.read_bytes().unwrap();
self.cfg

View File

@ -4,7 +4,7 @@ use core::cmp::min;
#[cfg(has_drtio_routing)]
use libboard_artiq::pl::csr;
use libboard_artiq::{drtio_routing, drtioaux,
drtioaux_proto::{PayloadStatus, CORE_MGMT_PAYLOAD_MAX_SIZE, MASTER_PAYLOAD_MAX_SIZE}};
drtioaux_proto::{PayloadStatus, MASTER_PAYLOAD_MAX_SIZE, SAT_PAYLOAD_MAX_SIZE}};
pub struct SliceMeta {
pub destination: u8,
@ -58,7 +58,7 @@ impl Sliceable {
}
get_slice_fn!(get_slice_master, MASTER_PAYLOAD_MAX_SIZE);
get_slice_fn!(get_slice_core_mgmt, CORE_MGMT_PAYLOAD_MAX_SIZE);
get_slice_fn!(get_slice_satellite, SAT_PAYLOAD_MAX_SIZE);
}
// Packets from downstream (further satellites) are received and routed appropriately.