mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-18 16:06:30 +08:00
drtio: add FIFO space request count debug API
This commit is contained in:
parent
c25186fae1
commit
7c699e2f80
@ -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")
|
||||
|
@ -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),
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -227,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))]
|
||||
@ -238,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 }
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -24,6 +24,7 @@ class _CSRs(AutoCSR):
|
||||
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 @@ class RTController(Module):
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user