From 9410166822a20600f5d2a982b18b03adcf45c334 Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 08:52:03 -0800 Subject: [PATCH 01/10] Remove trailing whitespaces --- src/smurf/core/transmitters/BaseTransmitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smurf/core/transmitters/BaseTransmitter.cpp b/src/smurf/core/transmitters/BaseTransmitter.cpp index 23df01e72..af0c274cc 100644 --- a/src/smurf/core/transmitters/BaseTransmitter.cpp +++ b/src/smurf/core/transmitters/BaseTransmitter.cpp @@ -138,7 +138,7 @@ void sct::BaseTransmitter::acceptMetaFrame(ris::FramePtr frame) ris::FrameLockPtr fLock = frame->lock(); if ( frame->bufferCount() != 1 ) return; - + std::string cfg(reinterpret_cast(frame->beginRead().ptr()), frame->getPayload()); fLock->unlock(); From 55c6c39f008a56f171a355871d8f811250a0807b Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 08:52:18 -0800 Subject: [PATCH 02/10] Fix typo --- src/smurf/core/transmitters/BaseTransmitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smurf/core/transmitters/BaseTransmitter.cpp b/src/smurf/core/transmitters/BaseTransmitter.cpp index af0c274cc..c1604cd2f 100644 --- a/src/smurf/core/transmitters/BaseTransmitter.cpp +++ b/src/smurf/core/transmitters/BaseTransmitter.cpp @@ -72,7 +72,7 @@ sct::BaseTransmitterChannelPtr sct::BaseTransmitter::getDataChannel() { // Get meta data channel sct::BaseTransmitterChannelPtr sct::BaseTransmitter::getMetaChannel() { - return dataChannel; + return metaChannel; } void sct::BaseTransmitter::setDisable(bool d) From 930b80ba8117fd115c4388608a4a451b0daf8a8a Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 08:56:55 -0800 Subject: [PATCH 03/10] Crete the dataChannel and metaChannel object when the getDataChannel and getMetaChannel methods are call respectively, instead of in the class constructor. As they use 'shared_from_this', and that should not being call in the constructor as a shared_ptr doesn't exist yet. --- .../core/transmitters/BaseTransmitter.cpp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/smurf/core/transmitters/BaseTransmitter.cpp b/src/smurf/core/transmitters/BaseTransmitter.cpp index c1604cd2f..14c087ae3 100644 --- a/src/smurf/core/transmitters/BaseTransmitter.cpp +++ b/src/smurf/core/transmitters/BaseTransmitter.cpp @@ -40,9 +40,6 @@ sct::BaseTransmitter::BaseTransmitter() { if( pthread_setname_np( pktTransmitterThread.native_handle(), "SmurfPacketTx" ) ) perror( "pthread_setname_np failed for the SmurfPacketTx thread" ); - - dataChannel = sct::BaseTransmitterChannel::create(shared_from_this(),0); - metaChannel = sct::BaseTransmitterChannel::create(shared_from_this(),1); } sct::BaseTransmitterPtr sct::BaseTransmitter::create() @@ -66,13 +63,23 @@ void sct::BaseTransmitter::setup_python() } // Get data channel -sct::BaseTransmitterChannelPtr sct::BaseTransmitter::getDataChannel() { - return dataChannel; +sct::BaseTransmitterChannelPtr sct::BaseTransmitter::getDataChannel() +{ + // Create the dataChanenl object the first time this is called + if (!dataChannel) + dataChannel = sct::BaseTransmitterChannel::create(shared_from_this(),0); + + return dataChannel; } // Get meta data channel -sct::BaseTransmitterChannelPtr sct::BaseTransmitter::getMetaChannel() { - return metaChannel; +sct::BaseTransmitterChannelPtr sct::BaseTransmitter::getMetaChannel() +{ + // Create the metaChanenl object the first time this is called + if (!metaChannel) + metaChannel = sct::BaseTransmitterChannel::create(shared_from_this(),1); + + return metaChannel; } void sct::BaseTransmitter::setDisable(bool d) From 8112770365e2874dfb2b9aa9e1bfef97454a9c57 Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 08:58:33 -0800 Subject: [PATCH 04/10] Fix typos --- include/smurf/core/transmitters/BaseTransmitter.h | 7 ++++--- src/smurf/core/transmitters/BaseTransmitter.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/smurf/core/transmitters/BaseTransmitter.h b/include/smurf/core/transmitters/BaseTransmitter.h index d23580f6f..7f3a09582 100644 --- a/include/smurf/core/transmitters/BaseTransmitter.h +++ b/include/smurf/core/transmitters/BaseTransmitter.h @@ -44,7 +44,8 @@ namespace smurf class BaseTransmitterChannel; - class BaseTransmitter: public std::enable_shared_from_this { + class BaseTransmitter: public std::enable_shared_from_this + { public: BaseTransmitter(); virtual ~BaseTransmitter() {}; @@ -60,7 +61,7 @@ namespace smurf // Get data channel std::shared_ptr getDataChannel(); - + // Get meta data channel std::shared_ptr getMetaChannel(); @@ -101,7 +102,7 @@ namespace smurf std::condition_variable txCV; // Variable to notify the thread new data is ready std::mutex txMutex; // Mutex used for accessing the conditional variable - // Inteface channels + // Interface channels std::shared_ptr dataChannel; std::shared_ptr metaChannel; diff --git a/src/smurf/core/transmitters/BaseTransmitter.cpp b/src/smurf/core/transmitters/BaseTransmitter.cpp index 14c087ae3..2bf473262 100644 --- a/src/smurf/core/transmitters/BaseTransmitter.cpp +++ b/src/smurf/core/transmitters/BaseTransmitter.cpp @@ -110,12 +110,12 @@ void sct::BaseTransmitter::acceptDataFrame(ris::FramePtr frame) if (disable) return; - // When a new packet is recived, add it to the dual buffer. This will + // When a new packet is received, add it to the dual buffer. This will // allow to prepare a new packet while the previous one is still being // transmitted. The packet will be transmitted in a different thread. // Check if the buffer is not full. - // If the buffer is full, the packet will be droped + // If the buffer is full, the packet will be dropped if (pktCount < 2) { // Add a new packet into the buffer From ca521ced003599c6ab7db860b539533ecf609f0d Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 08:59:56 -0800 Subject: [PATCH 05/10] Remove trailing whitespaces --- .DS_Store | Bin 0 -> 6148 bytes .../core/transmitters/BaseTransmitterChannel.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0b38bd820ae288a9c2cac120422563c16a17fcb4 GIT binary patch literal 6148 zcmeH~I}XA?3`A|9K%z-WxeW*41}g+7-~xzWg`hx)c8|{Z(-5dpgvOHn*4|i2rpU%3 zqN~SoDbk6^6mFD-g`O$$v0UXO&-3wq*xzm!E4hu5R)BZX+s|!+3Qz$mKn17(6&R2L zd5}+M19~Pt3KgIN!%)D!4+UJ-(}U-4G#L{2yZ_DNbD${!`-l7Yys9}3!(z!kATa-Km~rPzzg+- B5qJOq literal 0 HcmV?d00001 diff --git a/src/smurf/core/transmitters/BaseTransmitterChannel.cpp b/src/smurf/core/transmitters/BaseTransmitterChannel.cpp index f5bc29d80..0f2097306 100644 --- a/src/smurf/core/transmitters/BaseTransmitterChannel.cpp +++ b/src/smurf/core/transmitters/BaseTransmitterChannel.cpp @@ -25,7 +25,7 @@ namespace bp = boost::python; namespace sct = smurf::core::transmitters; -sct::BaseTransmitterChannel::BaseTransmitterChannel(sct::BaseTransmitterPtr bt, uint32_t channel) +sct::BaseTransmitterChannel::BaseTransmitterChannel(sct::BaseTransmitterPtr bt, uint32_t channel) { channel_ = channel; bt_ = bt; From e23a3498594515202142cb186042d255c6f6926d Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 09:09:23 -0800 Subject: [PATCH 06/10] Move the inclusion of BaseTransmitterChannel to the BaseTransmitter header, and use the typedef for convenience --- include/smurf/core/transmitters/BaseTransmitter.h | 11 +++++------ src/smurf/core/transmitters/BaseTransmitter.cpp | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/smurf/core/transmitters/BaseTransmitter.h b/include/smurf/core/transmitters/BaseTransmitter.h index 7f3a09582..ebf171bc2 100644 --- a/include/smurf/core/transmitters/BaseTransmitter.h +++ b/include/smurf/core/transmitters/BaseTransmitter.h @@ -29,6 +29,7 @@ #include #include "smurf/core/common/SmurfHeader.h" #include "smurf/core/common/SmurfPacket.h" +#include "smurf/core/transmitters/BaseTransmitterChannel.h" namespace bp = boost::python; namespace ris = rogue::interfaces::stream; @@ -42,8 +43,6 @@ namespace smurf class BaseTransmitter; typedef std::shared_ptr BaseTransmitterPtr; - class BaseTransmitterChannel; - class BaseTransmitter: public std::enable_shared_from_this { public: @@ -60,10 +59,10 @@ namespace smurf const bool getDisable() const; // Get data channel - std::shared_ptr getDataChannel(); + BaseTransmitterChannelPtr getDataChannel(); // Get meta data channel - std::shared_ptr getMetaChannel(); + BaseTransmitterChannelPtr getMetaChannel(); // Clear all counter. void clearCnt(); @@ -103,8 +102,8 @@ namespace smurf std::mutex txMutex; // Mutex used for accessing the conditional variable // Interface channels - std::shared_ptr dataChannel; - std::shared_ptr metaChannel; + BaseTransmitterChannelPtr dataChannel; + BaseTransmitterChannelPtr metaChannel; // Transmit method. Will run in the pktTransmitterThread thread. // Here is where the method 'transmit' is called. diff --git a/src/smurf/core/transmitters/BaseTransmitter.cpp b/src/smurf/core/transmitters/BaseTransmitter.cpp index 2bf473262..7233d3d8f 100644 --- a/src/smurf/core/transmitters/BaseTransmitter.cpp +++ b/src/smurf/core/transmitters/BaseTransmitter.cpp @@ -21,7 +21,6 @@ #include #include "smurf/core/common/Timer.h" #include "smurf/core/transmitters/BaseTransmitter.h" -#include "smurf/core/transmitters/BaseTransmitterChannel.h" namespace bp = boost::python; namespace sct = smurf::core::transmitters; From a300f0dec05a2c327757e5366f0d3d4b0f5e42a1 Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 09:16:59 -0800 Subject: [PATCH 07/10] Remove unused header --- src/smurf/core/transmitters/BaseTransmitter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/smurf/core/transmitters/BaseTransmitter.cpp b/src/smurf/core/transmitters/BaseTransmitter.cpp index 7233d3d8f..c20fea183 100644 --- a/src/smurf/core/transmitters/BaseTransmitter.cpp +++ b/src/smurf/core/transmitters/BaseTransmitter.cpp @@ -19,7 +19,6 @@ **/ #include -#include "smurf/core/common/Timer.h" #include "smurf/core/transmitters/BaseTransmitter.h" namespace bp = boost::python; From 6b2b8e7afe70801c499d1203b2056c6be8e73468 Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 09:36:05 -0800 Subject: [PATCH 08/10] Connect the dataChannel of the transmitter to the FIFO --- python/pysmurf/core/devices/_SmurfProcessor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/pysmurf/core/devices/_SmurfProcessor.py b/python/pysmurf/core/devices/_SmurfProcessor.py index 5660b72df..ce220ef03 100644 --- a/python/pysmurf/core/devices/_SmurfProcessor.py +++ b/python/pysmurf/core/devices/_SmurfProcessor.py @@ -262,7 +262,8 @@ def __init__(self, name, description, root=None, txDevice=None, **kwargs): if txDevice: self.transmitter = txDevice self.add(self.transmitter) - pyrogue.streamConnect(self.fifo, self.transmitter) + # Connect the data channel to the FIFO. + pyrogue.streamConnect(self.fifo, self.transmitter.getDataChannel()) def setTesBias(self, index, val): pass From 8a45a1cea76ded7f37c030b22d96e39cdb6b80c7 Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 10:01:37 -0800 Subject: [PATCH 09/10] Connect the root to the meta channel --- python/pysmurf/core/devices/_SmurfProcessor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/pysmurf/core/devices/_SmurfProcessor.py b/python/pysmurf/core/devices/_SmurfProcessor.py index ce220ef03..bba3b994c 100644 --- a/python/pysmurf/core/devices/_SmurfProcessor.py +++ b/python/pysmurf/core/devices/_SmurfProcessor.py @@ -264,6 +264,10 @@ def __init__(self, name, description, root=None, txDevice=None, **kwargs): self.add(self.transmitter) # Connect the data channel to the FIFO. pyrogue.streamConnect(self.fifo, self.transmitter.getDataChannel()) + # If a root was defined, connect it to the meta channel. + # Use streamTap as it was already connected to the file writer. + if root: + pyrogue.streamTap(root, self.transmitter.getMetaChannel()) def setTesBias(self, index, val): pass From 37a2062050a77c2e6233743c74811f1352c4b47f Mon Sep 17 00:00:00 2001 From: Jesus Vasquez Date: Sat, 9 Nov 2019 10:02:51 -0800 Subject: [PATCH 10/10] Add missing header --- src/smurf/core/transmitters/BaseTransmitter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/smurf/core/transmitters/BaseTransmitter.cpp b/src/smurf/core/transmitters/BaseTransmitter.cpp index c20fea183..b8f3a14f6 100644 --- a/src/smurf/core/transmitters/BaseTransmitter.cpp +++ b/src/smurf/core/transmitters/BaseTransmitter.cpp @@ -18,6 +18,7 @@ *----------------------------------------------------------------------------- **/ +#include #include #include "smurf/core/transmitters/BaseTransmitter.h"