forked from M-Labs/artiq
firmware: support 64-bit moninj probes
This commit is contained in:
parent
a159ef642d
commit
aff569b2c3
|
@ -84,9 +84,8 @@ class CommMonInj:
|
||||||
if not ty:
|
if not ty:
|
||||||
return
|
return
|
||||||
if ty == b"\x00":
|
if ty == b"\x00":
|
||||||
payload = await self._reader.readexactly(9)
|
payload = await self._reader.readexactly(13)
|
||||||
channel, probe, value = struct.unpack(
|
channel, probe, value = struct.unpack(self.endian + "lbq", payload)
|
||||||
self.endian + "lbl", payload)
|
|
||||||
self.monitor_cb(channel, probe, value)
|
self.monitor_cb(channel, probe, value)
|
||||||
elif ty == b"\x01":
|
elif ty == b"\x01":
|
||||||
payload = await self._reader.readexactly(6)
|
payload = await self._reader.readexactly(6)
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub enum Packet {
|
||||||
RoutingAck,
|
RoutingAck,
|
||||||
|
|
||||||
MonitorRequest { destination: u8, channel: u16, probe: u8 },
|
MonitorRequest { destination: u8, channel: u16, probe: u8 },
|
||||||
MonitorReply { value: u32 },
|
MonitorReply { value: u64 },
|
||||||
InjectionRequest { destination: u8, channel: u16, overrd: u8, value: u8 },
|
InjectionRequest { destination: u8, channel: u16, overrd: u8, value: u8 },
|
||||||
InjectionStatusRequest { destination: u8, channel: u16, overrd: u8 },
|
InjectionStatusRequest { destination: u8, channel: u16, overrd: u8 },
|
||||||
InjectionStatusReply { value: u8 },
|
InjectionStatusReply { value: u8 },
|
||||||
|
@ -105,7 +105,7 @@ impl Packet {
|
||||||
probe: reader.read_u8()?
|
probe: reader.read_u8()?
|
||||||
},
|
},
|
||||||
0x41 => Packet::MonitorReply {
|
0x41 => Packet::MonitorReply {
|
||||||
value: reader.read_u32()?
|
value: reader.read_u64()?
|
||||||
},
|
},
|
||||||
0x50 => Packet::InjectionRequest {
|
0x50 => Packet::InjectionRequest {
|
||||||
destination: reader.read_u8()?,
|
destination: reader.read_u8()?,
|
||||||
|
@ -259,7 +259,7 @@ impl Packet {
|
||||||
},
|
},
|
||||||
Packet::MonitorReply { value } => {
|
Packet::MonitorReply { value } => {
|
||||||
writer.write_u8(0x41)?;
|
writer.write_u8(0x41)?;
|
||||||
writer.write_u32(value)?;
|
writer.write_u64(value)?;
|
||||||
},
|
},
|
||||||
Packet::InjectionRequest { destination, channel, overrd, value } => {
|
Packet::InjectionRequest { destination, channel, overrd, value } => {
|
||||||
writer.write_u8(0x50)?;
|
writer.write_u8(0x50)?;
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub enum HostMessage {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum DeviceMessage {
|
pub enum DeviceMessage {
|
||||||
MonitorStatus { channel: u32, probe: u8, value: u32 },
|
MonitorStatus { channel: u32, probe: u8, value: u64 },
|
||||||
InjectionStatus { channel: u32, overrd: u8, value: u8 }
|
InjectionStatus { channel: u32, overrd: u8, value: u8 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ impl DeviceMessage {
|
||||||
writer.write_u8(0)?;
|
writer.write_u8(0)?;
|
||||||
writer.write_u32(channel)?;
|
writer.write_u32(channel)?;
|
||||||
writer.write_u8(probe)?;
|
writer.write_u8(probe)?;
|
||||||
writer.write_u32(value)?;
|
writer.write_u64(value)?;
|
||||||
},
|
},
|
||||||
DeviceMessage::InjectionStatus { channel, overrd, value } => {
|
DeviceMessage::InjectionStatus { channel, overrd, value } => {
|
||||||
writer.write_u8(1)?;
|
writer.write_u8(1)?;
|
||||||
|
|
|
@ -13,12 +13,12 @@ use board_artiq::drtio_routing;
|
||||||
mod local_moninj {
|
mod local_moninj {
|
||||||
use board_misoc::csr;
|
use board_misoc::csr;
|
||||||
|
|
||||||
pub fn read_probe(channel: u16, probe: u8) -> u32 {
|
pub fn read_probe(channel: u16, probe: u8) -> u64 {
|
||||||
unsafe {
|
unsafe {
|
||||||
csr::rtio_moninj::mon_chan_sel_write(channel as _);
|
csr::rtio_moninj::mon_chan_sel_write(channel as _);
|
||||||
csr::rtio_moninj::mon_probe_sel_write(probe);
|
csr::rtio_moninj::mon_probe_sel_write(probe);
|
||||||
csr::rtio_moninj::mon_value_update_write(1);
|
csr::rtio_moninj::mon_value_update_write(1);
|
||||||
csr::rtio_moninj::mon_value_read() as u32
|
csr::rtio_moninj::mon_value_read() as u64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ mod local_moninj {
|
||||||
|
|
||||||
#[cfg(not(has_rtio_moninj))]
|
#[cfg(not(has_rtio_moninj))]
|
||||||
mod local_moninj {
|
mod local_moninj {
|
||||||
pub fn read_probe(_channel: u16, _probe: u8) -> u32 { 0 }
|
pub fn read_probe(_channel: u16, _probe: u8) -> u64 { 0 }
|
||||||
|
|
||||||
pub fn inject(_channel: u16, _overrd: u8, _value: u8) { }
|
pub fn inject(_channel: u16, _overrd: u8, _value: u8) { }
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ mod remote_moninj {
|
||||||
use rtio_mgt::drtio;
|
use rtio_mgt::drtio;
|
||||||
use sched::{Io, Mutex};
|
use sched::{Io, Mutex};
|
||||||
|
|
||||||
pub fn read_probe(io: &Io, aux_mutex: &Mutex, linkno: u8, destination: u8, channel: u16, probe: u8) -> u32 {
|
pub fn read_probe(io: &Io, aux_mutex: &Mutex, linkno: u8, destination: u8, channel: u16, probe: u8) -> u64 {
|
||||||
let reply = drtio::aux_transact(io, aux_mutex, linkno, &drtioaux::Packet::MonitorRequest {
|
let reply = drtio::aux_transact(io, aux_mutex, linkno, &drtioaux::Packet::MonitorRequest {
|
||||||
destination: destination,
|
destination: destination,
|
||||||
channel: channel,
|
channel: channel,
|
||||||
|
|
|
@ -207,13 +207,13 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater],
|
||||||
csr::rtio_moninj::mon_chan_sel_write(channel as _);
|
csr::rtio_moninj::mon_chan_sel_write(channel as _);
|
||||||
csr::rtio_moninj::mon_probe_sel_write(probe);
|
csr::rtio_moninj::mon_probe_sel_write(probe);
|
||||||
csr::rtio_moninj::mon_value_update_write(1);
|
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))]
|
#[cfg(not(has_rtio_moninj))]
|
||||||
{
|
{
|
||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
let reply = drtioaux::Packet::MonitorReply { value: value as u32 };
|
let reply = drtioaux::Packet::MonitorReply { value: value };
|
||||||
drtioaux::send(0, &reply)
|
drtioaux::send(0, &reply)
|
||||||
},
|
},
|
||||||
drtioaux::Packet::InjectionRequest { destination: _destination, channel, overrd, value } => {
|
drtioaux::Packet::InjectionRequest { destination: _destination, channel, overrd, value } => {
|
||||||
|
|
Loading…
Reference in New Issue