Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7af152ed229a
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7c699e2f801c
Choose a head ref
  • 2 commits
  • 8 files changed
  • 1 contributor

Commits on Jan 11, 2017

  1. Verified

    This commit was signed with the committer’s verified signature.
    bagder Daniel Stenberg
    Copy the full SHA
    c25186f View commit details
  2. Copy the full SHA
    7c699e2 View commit details
4 changes: 4 additions & 0 deletions artiq/coredevice/drtio_dbg.py
Original file line number Diff line number Diff line change
@@ -20,3 +20,7 @@ def drtio_get_fifo_space(channel: TInt32) -> TNone:
@syscall(flags={"nounwind", "nowrite"})
def drtio_get_packet_counts() -> TTuple([TInt32, TInt32]):
raise NotImplementedError("syscall not simulated")

@syscall(flags={"nounwind", "nowrite"})
def drtio_get_fifo_space_req_count() -> TInt32:
raise NotImplementedError("syscall not simulated")
1 change: 1 addition & 0 deletions artiq/firmware/libksupport/api.rs
Original file line number Diff line number Diff line change
@@ -110,6 +110,7 @@ static mut API: &'static [(&'static str, *const ())] = &[
api!(drtio_reset_channel_state = ::rtio::drtio_dbg::reset_channel_state),
api!(drtio_get_fifo_space = ::rtio::drtio_dbg::get_fifo_space),
api!(drtio_get_packet_counts = ::rtio::drtio_dbg::get_packet_counts),
api!(drtio_get_fifo_space_req_count = ::rtio::drtio_dbg::get_fifo_space_req_count),

api!(i2c_start = ::i2c_start),
api!(i2c_stop = ::i2c_stop),
6 changes: 6 additions & 0 deletions artiq/firmware/libksupport/rtio.rs
Original file line number Diff line number Diff line change
@@ -215,4 +215,10 @@ pub mod drtio_dbg {
recv!(&DRTIOPacketCountReply { tx_cnt, rx_cnt }
=> PacketCounts(tx_cnt as i32, rx_cnt as i32))
}

pub extern fn get_fifo_space_req_count() -> i32 {
send(&DRTIOFIFOSpaceReqCountRequest);
recv!(&DRTIOFIFOSpaceReqCountReply { cnt }
=> cnt as i32)
}
}
2 changes: 2 additions & 0 deletions artiq/firmware/runtime/kernel_proto.rs
Original file line number Diff line number Diff line change
@@ -38,6 +38,8 @@ pub enum Message<'a> {
DRTIOGetFIFOSpaceRequest { channel: u32 },
DRTIOPacketCountRequest,
DRTIOPacketCountReply { tx_cnt: u32, rx_cnt: u32 },
DRTIOFIFOSpaceReqCountRequest,
DRTIOFIFOSpaceReqCountReply { cnt: u32 },

RunFinished,
RunException {
22 changes: 21 additions & 1 deletion artiq/firmware/runtime/rtio_mgt.rs
Original file line number Diff line number Diff line change
@@ -110,10 +110,22 @@ mod drtio {
}
}

// keep this in sync with error_codes in rt_packets.py
fn str_packet_error(err_code: u8) -> &'static str {
match err_code {
0 => "Received packet of an unknown type",
1 => "Satellite reported reception of a packet of an unknown type",
2 => "Satellite reported write overflow",
3 => "Satellite reported write underflow",
_ => "Unknown error code"
}
}

fn poll_errors() -> bool {
unsafe {
if csr::drtio::packet_err_present_read() != 0 {
error!("packet error {}", csr::drtio::packet_err_code_read());
let err_code = csr::drtio::packet_err_code_read();
error!("packet error {} ({})", err_code, str_packet_error(err_code));
csr::drtio::packet_err_present_write(1)
}
if csr::drtio::o_fifo_space_timeout_read() != 0 {
@@ -215,6 +227,12 @@ pub mod drtio_dbg {
(csr::drtio::packet_cnt_tx_read(), csr::drtio::packet_cnt_rx_read())
}
}

pub fn get_fifo_space_req_count() -> u32 {
unsafe {
csr::drtio::o_dbg_fifo_space_req_cnt_read()
}
}
}

#[cfg(not(has_drtio))]
@@ -226,4 +244,6 @@ pub mod drtio_dbg {
pub fn get_fifo_space(_channel: u32) {}

pub fn get_packet_counts() -> (u32, u32) { (0, 0) }

pub fn get_fifo_space_req_count() -> u32 { 0 }
}
4 changes: 4 additions & 0 deletions artiq/firmware/runtime/session.rs
Original file line number Diff line number Diff line change
@@ -401,6 +401,10 @@ fn process_kern_message(waiter: Waiter,
let (tx_cnt, rx_cnt) = rtio_mgt::drtio_dbg::get_packet_counts();
kern_send(waiter, &kern::DRTIOPacketCountReply { tx_cnt: tx_cnt, rx_cnt: rx_cnt })
}
&kern::DRTIOFIFOSpaceReqCountRequest => {
let cnt = rtio_mgt::drtio_dbg::get_fifo_space_req_count();
kern_send(waiter, &kern::DRTIOFIFOSpaceReqCountReply { cnt: cnt })
}

&kern::WatchdogSetRequest { ms } => {
let id = try!(session.watchdog_set.set_ms(ms)
6 changes: 6 additions & 0 deletions artiq/gateware/drtio/rt_controller.py
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ def __init__(self):
self.o_get_fifo_space = CSR()
self.o_dbg_fifo_space = CSRStatus(16)
self.o_dbg_last_timestamp = CSRStatus(64)
self.o_dbg_fifo_space_req_cnt = CSRStatus(32)
self.o_reset_channel_status = CSR()
self.o_wait = CSRStatus()
self.o_fifo_space_timeout = CSR()
@@ -207,6 +208,11 @@ def __init__(self, rt_packets, channel_count, fine_ts_width):
last_timestamps.we.eq(1)
)
]
self.sync += \
If((rt_packets.write_stb & rt_packets.write_ack & rt_packets_fifo_request),
self.csrs.o_dbg_fifo_space_req_cnt.status.eq(
self.csrs.o_dbg_fifo_space_req_cnt.status + 1)
)

def get_csrs(self):
return self.csrs.get_csrs()
1 change: 1 addition & 0 deletions artiq/gateware/drtio/rt_packets.py
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@ def get_s2m_layouts(alignment):
return plm


# keep this in sync with str_packet_error in rtio_mgt.rs
error_codes = {
"unknown_type_local": 0,
"unknown_type_remote": 1,