diff options
author | Samuel O'Brien <sam.obrien@ni.com> | 2020-07-24 16:14:08 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-10-28 15:25:48 -0500 |
commit | e4517deef3f0ed18112c08ecbbd7baef9dedaa74 (patch) | |
tree | 91fef5d714104715f9a0db530597a748a0ae9f93 | |
parent | 00c306d5c441e60e7dfd2516e05e4e433977ecee (diff) | |
download | uhd-e4517deef3f0ed18112c08ecbbd7baef9dedaa74.tar.gz uhd-e4517deef3f0ed18112c08ecbbd7baef9dedaa74.tar.bz2 uhd-e4517deef3f0ed18112c08ecbbd7baef9dedaa74.zip |
sim: Support Timed Streams
The only difference between a standard and timed stream is that the
first data packet of a timed stream contains a timestamp. This commit
adds the necessary fields to StreamSpec to accomplish this.
Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
-rw-r--r-- | mpm/python/usrp_mpm/simulator/chdr_stream.py | 3 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/simulator/noc_block_regs.py | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/mpm/python/usrp_mpm/simulator/chdr_stream.py b/mpm/python/usrp_mpm/simulator/chdr_stream.py index f63fba050..7147a98b5 100644 --- a/mpm/python/usrp_mpm/simulator/chdr_stream.py +++ b/mpm/python/usrp_mpm/simulator/chdr_stream.py @@ -195,6 +195,9 @@ class ChdrOutputStream: if num_samps_left == 0: break header.seq_num = seq_num + timestamp = self.stream_spec.init_timestamp \ + if seq_num == 0 and self.stream_spec.is_timed \ + else None packet = ChdrPacket(self.chdr_w, header, bytes(0)) packet_samples = self.stream_spec.packet_samples if num_samps_left is not None: diff --git a/mpm/python/usrp_mpm/simulator/noc_block_regs.py b/mpm/python/usrp_mpm/simulator/noc_block_regs.py index b488ed43f..de6bd22a0 100644 --- a/mpm/python/usrp_mpm/simulator/noc_block_regs.py +++ b/mpm/python/usrp_mpm/simulator/noc_block_regs.py @@ -26,6 +26,8 @@ REGS_PER_PORT = 16 REG_RX_MAX_WORDS_PER_PKT = 0x28 REG_RX_CMD_NUM_WORDS_HI = 0x1C REG_RX_CMD_NUM_WORDS_LO = 0x18 +REG_RX_CMD_TIME_LO = 0x20 +REG_RX_CMD_TIME_HI = 0x24 REG_RX_CMD = 0x14 RX_CMD_CONTINUOUS = 0x2 @@ -207,10 +209,14 @@ class NocBlockRegs: self.get_stream_spec().set_num_words_hi(value) elif reg == REG_RX_CMD_NUM_WORDS_LO: self.get_stream_spec().set_num_words_lo(value) + elif reg == REG_RX_CMD_TIME_HI: + self.get_stream_spec().set_timestamp_hi(value) + elif reg == REG_RX_CMD_TIME_LO: + self.get_stream_spec().set_timestamp_lo(value) elif reg == REG_RX_CMD: if value & (1 << 31) != 0: - self.log.warn("Timed Streams are not supported. Starting immediately") value = value & ~(1 << 31) # Clear the flag + self.get_stream_spec().is_timed = True if value == RX_CMD_STOP: sep_block_id = self.resolve_ep_towards_outputs((self.get_radio_port(), chan)) self.stop_tx_stream(sep_block_id) |