forked from M-Labs/nac3
firmware: support 64-bit moninj probes
This commit is contained in:
parent
ebdb08180d
commit
426500d2f9
|
@ -34,7 +34,7 @@ pub enum Packet {
|
|||
RoutingAck,
|
||||
|
||||
MonitorRequest { destination: u8, channel: u16, probe: u8 },
|
||||
MonitorReply { value: u32 },
|
||||
MonitorReply { value: u64 },
|
||||
InjectionRequest { destination: u8, channel: u16, overrd: u8, value: u8 },
|
||||
InjectionStatusRequest { destination: u8, channel: u16, overrd: u8 },
|
||||
InjectionStatusReply { value: u8 },
|
||||
|
@ -103,7 +103,7 @@ impl Packet {
|
|||
probe: reader.read_u8()?
|
||||
},
|
||||
0x41 => Packet::MonitorReply {
|
||||
value: reader.read_u32()?
|
||||
value: reader.read_u64()?
|
||||
},
|
||||
0x50 => Packet::InjectionRequest {
|
||||
destination: reader.read_u8()?,
|
||||
|
@ -247,7 +247,7 @@ impl Packet {
|
|||
},
|
||||
Packet::MonitorReply { value } => {
|
||||
writer.write_u8(0x41)?;
|
||||
writer.write_u32(value)?;
|
||||
writer.write_u64(value)?;
|
||||
},
|
||||
Packet::InjectionRequest { destination, channel, overrd, value } => {
|
||||
writer.write_u8(0x50)?;
|
||||
|
|
|
@ -62,14 +62,14 @@ mod remote_moninj {
|
|||
use crate::rtio_mgt::drtio;
|
||||
use log::error;
|
||||
|
||||
pub fn read_probe(aux_mutex: &Rc<Mutex<bool>>, timer: GlobalTimer, linkno: u8, destination: u8, channel: i32, probe: i8) -> i32 {
|
||||
pub fn read_probe(aux_mutex: &Rc<Mutex<bool>>, timer: GlobalTimer, linkno: u8, destination: u8, channel: i32, probe: i8) -> i64 {
|
||||
let reply = task::block_on(drtio::aux_transact(aux_mutex, linkno, &drtioaux::Packet::MonitorRequest {
|
||||
destination: destination,
|
||||
channel: channel as _,
|
||||
probe: probe as _},
|
||||
timer));
|
||||
match reply {
|
||||
Ok(drtioaux::Packet::MonitorReply { value }) => return value as i32,
|
||||
Ok(drtioaux::Packet::MonitorReply { value }) => return value as i64,
|
||||
Ok(packet) => error!("received unexpected aux packet: {:?}", packet),
|
||||
Err(e) => error!("aux packet error ({})", e)
|
||||
}
|
||||
|
@ -106,12 +106,12 @@ mod remote_moninj {
|
|||
mod local_moninj {
|
||||
use libboard_artiq::pl::csr;
|
||||
|
||||
pub fn read_probe(channel: i32, probe: i8) -> i32 {
|
||||
pub fn read_probe(channel: i32, probe: i8) -> i64 {
|
||||
unsafe {
|
||||
csr::rtio_moninj::mon_chan_sel_write(channel as _);
|
||||
csr::rtio_moninj::mon_probe_sel_write(probe as _);
|
||||
csr::rtio_moninj::mon_value_update_write(1);
|
||||
csr::rtio_moninj::mon_value_read() as i32
|
||||
csr::rtio_moninj::mon_value_read() as i64
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ async fn handle_connection(stream: &TcpStream, timer: GlobalTimer,
|
|||
}
|
||||
stream.send_slice("e".as_bytes()).await?;
|
||||
|
||||
let mut probe_watch_list: BTreeMap<(i32, i8), Option<i32>> = BTreeMap::new();
|
||||
let mut probe_watch_list: BTreeMap<(i32, i8), Option<i64>> = BTreeMap::new();
|
||||
let mut inject_watch_list: BTreeMap<(i32, i8), Option<i8>> = BTreeMap::new();
|
||||
let mut next_check = Milliseconds(0);
|
||||
loop {
|
||||
|
@ -233,7 +233,7 @@ async fn handle_connection(stream: &TcpStream, timer: GlobalTimer,
|
|||
write_i8(&stream, DeviceMessage::MonitorStatus.to_i8().unwrap()).await?;
|
||||
write_i32(&stream, channel).await?;
|
||||
write_i8(&stream, probe).await?;
|
||||
write_i32(&stream, current).await?;
|
||||
write_i64(&stream, current).await?;
|
||||
*previous = Some(current);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,13 +212,13 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater],
|
|||
csr::rtio_moninj::mon_chan_sel_write(channel as _);
|
||||
csr::rtio_moninj::mon_probe_sel_write(probe);
|
||||
csr::rtio_moninj::mon_value_update_write(1);
|
||||
value = csr::rtio_moninj::mon_value_read();
|
||||
value = csr::rtio_moninj::mon_value_read() as u64;
|
||||
}
|
||||
#[cfg(not(has_rtio_moninj))]
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
let reply = drtioaux::Packet::MonitorReply { value: value as u32 };
|
||||
let reply = drtioaux::Packet::MonitorReply { value: value };
|
||||
drtioaux::send(0, &reply)
|
||||
},
|
||||
drtioaux::Packet::InjectionRequest { destination: _destination, channel: _channel,
|
||||
|
|
Loading…
Reference in New Issue