runtime: support for targets without RTIO log channel

This commit is contained in:
Sebastien Bourdeauducq 2016-11-23 10:48:26 +08:00
parent 3c5a62243d
commit 0c49679984
3 changed files with 7 additions and 0 deletions

View File

@ -226,6 +226,7 @@ class NIST_CLOCK(_NIST_Ions):
ofifo_depth=512, ofifo_depth=512,
ififo_depth=4)) ififo_depth=4))
self.config["HAS_RTIO_LOG"] = None
self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels) self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)
rtio_channels.append(rtio.LogChannel()) rtio_channels.append(rtio.LogChannel())
@ -304,6 +305,7 @@ class NIST_QC2(_NIST_Ions):
ofifo_depth=512, ofifo_depth=512,
ififo_depth=4)) ififo_depth=4))
self.config["HAS_RTIO_LOG"] = None
self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels) self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)
rtio_channels.append(rtio.LogChannel()) rtio_channels.append(rtio.LogChannel())

View File

@ -212,6 +212,7 @@ trce -v 12 -fastpaths -tsi {build_name}.tsi -o {build_name}.twr {build_name}.ncd
rtio_channels.append(rtio.Channel.from_phy( rtio_channels.append(rtio.Channel.from_phy(
phy, ofifo_depth=64, ififo_depth=64)) phy, ofifo_depth=64, ififo_depth=64))
self.config["HAS_RTIO_LOG"] = None
self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels) self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)
rtio_channels.append(rtio.LogChannel()) rtio_channels.append(rtio.LogChannel())

View File

@ -123,6 +123,7 @@ pub extern fn input_data(channel: u32) -> u32 {
} }
} }
#[cfg(has_rtio_log)]
pub fn log(timestamp: i64, data: &[u8]) { pub fn log(timestamp: i64, data: &[u8]) {
unsafe { unsafe {
csr::rtio::chan_sel_write(csr::CONFIG_RTIO_LOG_CHANNEL); csr::rtio::chan_sel_write(csr::CONFIG_RTIO_LOG_CHANNEL);
@ -144,3 +145,6 @@ pub fn log(timestamp: i64, data: &[u8]) {
csr::rtio::o_we_write(1); csr::rtio::o_we_write(1);
} }
} }
#[cfg(not(has_rtio_log))]
pub fn log(timestamp: i64, data: &[u8]) {}