diff --git a/.github/workflows/rogue_ci.yml b/.github/workflows/rogue_ci.yml index c96a50fed..aaba62dd1 100644 --- a/.github/workflows/rogue_ci.yml +++ b/.github/workflows/rogue_ci.yml @@ -34,20 +34,26 @@ jobs: cache: 'pip' cache-dependency-path: 'pip_requirements.txt' + # Install dependencies - name: Install dependencies run: | sudo apt-get update sudo apt-get install doxygen doxygen-doc libzmq3-dev libboost-all-dev pip install -r pip_requirements.txt - # Flake 8 check - - name: Flake8 Tests + # Python Linter + - name: Python Linter run: | python -m compileall -f ./python/ flake8 --count ./python/ python -m compileall -f ./tests flake8 --count ./tests/ + # C++ Linter + - name: C++ Linter + run: | + find . -name '*.h' -o -name '*.cpp' | xargs cpplint + # Rogue - name: Build Rogue run: | diff --git a/= b/= new file mode 100644 index 000000000..e69de29bb diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 000000000..6ae4030a8 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,34 @@ +####################################################### +# CPPLINT.cfg +####################################################### + +# Increase the max number of characters on a given line +linelength=250 + +# List of filters to apply +filter=-legal/copyright + +# Suppress the warning for unapproved C++11 headers +# Required for " is an unapproved C++11 header" +filter=-build/c++11 + +# Disable the build/include_order check +# Required for #include "rogue/Directives.h" to be at start +filter=-build/include_order + +# Disable the build/header_guard check +# Note changing header guard has wrong style +# E.g. from __ROGUE_UTILITIES_FILEIO_MODULE_H__ to INCLUDE_ROGUE_UTILITIES_MODULE_H_ +filter=-build/header_guard + +# Disable whitespace/indent check +# private/public: indent will be based on .clang-format format" +filter=-whitespace/indent + +# Disable runtime/arrays +# TODO: We should fix in the future +filter=-runtime/arrays + +# Disable runtime/references +# TODO: We should fix in the future +filter=-runtime/references diff --git a/include/rogue/Directives.h b/include/rogue/Directives.h index f0c7218f8..3f4f5cf65 100644 --- a/include/rogue/Directives.h +++ b/include/rogue/Directives.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Common Directives * ---------------------------------------------------------------------------- - * File : Directives.h - * Created : 2023-02-13 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Common Directives For Rogue diff --git a/include/rogue/EnableSharedFromThis.h b/include/rogue/EnableSharedFromThis.h index 6c54897a7..7113e97ed 100644 --- a/include/rogue/EnableSharedFromThis.h +++ b/include/rogue/EnableSharedFromThis.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Common virtual class to enable shared_from_this() calls. * ---------------------------------------------------------------------------- - * File : EnableSharedFromThis.h - * Created : 2019-11-15 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * This is a common parent class that must be used instead of std::enable_shared_from_this diff --git a/include/rogue/GeneralError.h b/include/rogue/GeneralError.h index 3a54dc259..c24a5a2fb 100644 --- a/include/rogue/GeneralError.h +++ b/include/rogue/GeneralError.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : General Error * ---------------------------------------------------------------------------- - * File : GeneralError.h - * Created : 2017-12-05 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * General exception for Rogue diff --git a/include/rogue/GilRelease.h b/include/rogue/GilRelease.h index 6892288dd..fe4e53764 100644 --- a/include/rogue/GilRelease.h +++ b/include/rogue/GilRelease.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Release GIL within scope. * ---------------------------------------------------------------------------- - * File : GilRelease.h - * Created : 2017-02-28 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Release GIL for the scope of this class. diff --git a/include/rogue/Helpers.h b/include/rogue/Helpers.h index 5cfcc476a..eb66c093b 100644 --- a/include/rogue/Helpers.h +++ b/include/rogue/Helpers.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Helpful Functions * ---------------------------------------------------------------------------- - * File : Helpers.h - * Created : 2018-11-28 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Helper functions for Rogue diff --git a/include/rogue/Logging.h b/include/rogue/Logging.h index aeed6efa2..e7a55b6c1 100644 --- a/include/rogue/Logging.h +++ b/include/rogue/Logging.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Logging interface * ---------------------------------------------------------------------------- - * File : Logging.h - * Created : 2017-02-28 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Logging interface for pyrogue @@ -73,7 +70,7 @@ class Logging { static std::shared_ptr create(std::string name, bool quiet = false); - Logging(std::string name, bool quiet = false); + explicit Logging(std::string name, bool quiet = false); ~Logging(); static void setLevel(uint32_t level); diff --git a/include/rogue/Queue.h b/include/rogue/Queue.h index 4b26a468a..27680b51d 100644 --- a/include/rogue/Queue.h +++ b/include/rogue/Queue.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : General Queue * ---------------------------------------------------------------------------- - * File : Queue.h - * Created : 2017-01-18 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * General queue for Rogue diff --git a/include/rogue/ScopedGil.h b/include/rogue/ScopedGil.h index bdc40525e..371400de2 100644 --- a/include/rogue/ScopedGil.h +++ b/include/rogue/ScopedGil.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Scoped GIL * ---------------------------------------------------------------------------- - * File : ScopedGil.h - * Created : 2017-02-28 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Acquire the GIL for the scope of this class. diff --git a/include/rogue/Version.h b/include/rogue/Version.h index 383b4ad71..be2fde8b3 100644 --- a/include/rogue/Version.h +++ b/include/rogue/Version.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue Version * ---------------------------------------------------------------------------- - * File : Version.h - * Created : 2017-05-17 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Version helpers for Rogue diff --git a/include/rogue/hardware/MemMap.h b/include/rogue/hardware/MemMap.h index dfbd1775d..661d9d7cf 100644 --- a/include/rogue/hardware/MemMap.h +++ b/include/rogue/hardware/MemMap.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Raw Memory Mapped Access * ---------------------------------------------------------------------------- - * File : MemMap.h - * Created : 2019-11-18 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * Raw Memory Mapped Access * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/hardware/axi/AxiMemMap.h b/include/rogue/hardware/axi/AxiMemMap.h index 3374a531e..02a8df38f 100644 --- a/include/rogue/hardware/axi/AxiMemMap.h +++ b/include/rogue/hardware/axi/AxiMemMap.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : AXI Memory Mapped Access * ---------------------------------------------------------------------------- - * File : AxiMemMap.h - * Created : 2017-03-21 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * AXI Memory Mapped Access * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -22,6 +22,7 @@ #include #include +#include #include #include "rogue/Logging.h" @@ -69,7 +70,7 @@ class AxiMemMap : public rogue::interfaces::memory::Slave { static void setup_python(); // Class Creator - AxiMemMap(std::string path); + explicit AxiMemMap(std::string path); // Destructor ~AxiMemMap(); diff --git a/include/rogue/hardware/axi/AxiStreamDma.h b/include/rogue/hardware/axi/AxiStreamDma.h index 73359b7b4..4031dedbc 100644 --- a/include/rogue/hardware/axi/AxiStreamDma.h +++ b/include/rogue/hardware/axi/AxiStreamDma.h @@ -1,6 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : AxiStreamDma Interface Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * AxiStreamDma Interface Class * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -19,6 +22,7 @@ #include #include +#include #include #include "rogue/Logging.h" @@ -32,7 +36,7 @@ namespace axi { //! Storage class for shared memory buffers class AxiStreamDmaShared { public: - AxiStreamDmaShared(std::string path); + explicit AxiStreamDmaShared(std::string path); //! Shared FD int32_t fd; diff --git a/include/rogue/hardware/axi/module.h b/include/rogue/hardware/axi/module.h index d4be7c5b2..893a83370 100644 --- a/include/rogue/hardware/axi/module.h +++ b/include/rogue/hardware/axi/module.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.h - * Created : 2017-03-21 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/hardware/drivers/DmaDriver.h b/include/rogue/hardware/drivers/DmaDriver.h index e1da0b910..71fd6cc26 100644 --- a/include/rogue/hardware/drivers/DmaDriver.h +++ b/include/rogue/hardware/drivers/DmaDriver.h @@ -26,6 +26,7 @@ #include #else #include + #include #endif @@ -634,7 +635,6 @@ static inline ssize_t dmaGetBuffCount(int32_t fd) { return (ioctl(fd, DMA_Get_Buff_Count, 0)); } - /** * dmaGetGitVersion - Get the DMA Driver's Git Version * @fd: File descriptor to use. @@ -644,12 +644,12 @@ static inline ssize_t dmaGetBuffCount(int32_t fd) { * Returns: The DMA Driver's Git Version string */ static inline std::string dmaGetGitVersion(int32_t fd) { - char gitv[32] = {0}; // Initialize with zeros to ensure null-termination - if (ioctl(fd, DMA_Get_GITV, gitv) < 0) { - return ""; - } - gitv[32 - 1] = '\0'; // Ensure null-termination - return std::string(gitv); + char gitv[32] = {0}; // Initialize with zeros to ensure null-termination + if (ioctl(fd, DMA_Get_GITV, gitv) < 0) { + return ""; + } + gitv[32 - 1] = '\0'; // Ensure null-termination + return std::string(gitv); } /** @@ -676,7 +676,7 @@ static inline void** dmaMapDma(int32_t fd, uint32_t* count, uint32_t* size) { if (count != NULL) *count = bCount; if (size != NULL) *size = bSize; - if ((ret = (void**)malloc(sizeof(void*) * bCount)) == 0) return (NULL); + if ((ret = reinterpret_cast(malloc(sizeof(void*) * bCount))) == 0) return (NULL); // Attempt to map gCount = 0; diff --git a/include/rogue/hardware/module.h b/include/rogue/hardware/module.h index 7e8ece178..7995233f1 100644 --- a/include/rogue/hardware/module.h +++ b/include/rogue/hardware/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/interfaces/ZmqClient.h b/include/rogue/interfaces/ZmqClient.h index 46af6ca2c..02e9ab673 100644 --- a/include/rogue/interfaces/ZmqClient.h +++ b/include/rogue/interfaces/ZmqClient.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue ZMQ Control Interface * ---------------------------------------------------------------------------- - * File : ZmqClient.h - * Created : 2019-05-02 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * Rogue ZMQ Control Interface * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -19,6 +19,7 @@ #include "rogue/Directives.h" #include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/interfaces/ZmqServer.h b/include/rogue/interfaces/ZmqServer.h index 75e68dbed..bae9d432d 100644 --- a/include/rogue/interfaces/ZmqServer.h +++ b/include/rogue/interfaces/ZmqServer.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue ZMQ Control Interface * ---------------------------------------------------------------------------- - * File : ZmqServer.h - * Created : 2019-05-02 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * Rogue ZMQ Control Interface * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -19,6 +19,7 @@ #include "rogue/Directives.h" #include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/interfaces/api/Bsp.h b/include/rogue/interfaces/api/Bsp.h index e945e3554..39296788e 100644 --- a/include/rogue/interfaces/api/Bsp.h +++ b/include/rogue/interfaces/api/Bsp.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : C++ API Bsp * ---------------------------------------------------------------------------- - * File : Bsp.h - * Created : 2023-04-17 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * C++ API BSP (Board Support Package) * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -16,7 +16,10 @@ **/ #ifndef __ROGUE_INTERFACE_API_BSP_H__ #define __ROGUE_INTERFACE_API_BSP_H__ + #include +#include +#include #include namespace rogue { @@ -36,7 +39,7 @@ class Bsp { static std::shared_ptr create(std::string modName, std::string rootClass); //! Create the object - Bsp(boost::python::object obj); + explicit Bsp(boost::python::object obj); Bsp(std::string modName, std::string rootClass); ~Bsp(); diff --git a/include/rogue/interfaces/memory/Block.h b/include/rogue/interfaces/memory/Block.h index 37b6b2ad4..5943bcef4 100644 --- a/include/rogue/interfaces/memory/Block.h +++ b/include/rogue/interfaces/memory/Block.h @@ -1,8 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Block * ---------------------------------------------------------------------------- - * File : Block.h + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Interface between RemoteVariables and lower level memory transactions. @@ -23,6 +21,7 @@ #include #include +#include #include #include @@ -49,7 +48,9 @@ template inline boost::python::list std_vector_to_py_list(std::vector vector) { typename std::vector::iterator iter; boost::python::list list; - for (iter = vector.begin(); iter != vector.end(); ++iter) { list.append(*iter); } + for (iter = vector.begin(); iter != vector.end(); ++iter) { + list.append(*iter); + } return list; } diff --git a/include/rogue/interfaces/memory/Constants.h b/include/rogue/interfaces/memory/Constants.h index 3017cf786..d54013c3e 100644 --- a/include/rogue/interfaces/memory/Constants.h +++ b/include/rogue/interfaces/memory/Constants.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Master * ---------------------------------------------------------------------------- - * File : Constants.h - * Created : 2016-12-05 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory error and transaction constants. diff --git a/include/rogue/interfaces/memory/Emulate.h b/include/rogue/interfaces/memory/Emulate.h index f3d67d6ce..3b1907c81 100644 --- a/include/rogue/interfaces/memory/Emulate.h +++ b/include/rogue/interfaces/memory/Emulate.h @@ -1,8 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory slave emulator * ---------------------------------------------------------------------------- - * File : Emulator.h + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * A memory space emulator. Allows user to test a Rogue tree without real hardware. @@ -44,7 +42,6 @@ namespace memory { * and write transactions. */ class Emulate : public Slave { - // Map to store 4K address space chunks MAP_TYPE memMap_; diff --git a/include/rogue/interfaces/memory/Hub.h b/include/rogue/interfaces/memory/Hub.h index 41ea84e51..ea027543c 100644 --- a/include/rogue/interfaces/memory/Hub.h +++ b/include/rogue/interfaces/memory/Hub.h @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Hub Hub * ---------------------------------------------------------------------------- - * File : Hub.h - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-09-20 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * A memory interface hub. Accepts requests from multiple masters and forwards @@ -26,6 +22,8 @@ #include +#include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/interfaces/memory/Master.h b/include/rogue/interfaces/memory/Master.h index 98c8cbdaf..fd65c3357 100644 --- a/include/rogue/interfaces/memory/Master.h +++ b/include/rogue/interfaces/memory/Master.h @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Master * ---------------------------------------------------------------------------- - * File : Master.h - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-09-20 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory master interface. @@ -26,6 +22,7 @@ #include #include +#include #include #include diff --git a/include/rogue/interfaces/memory/Slave.h b/include/rogue/interfaces/memory/Slave.h index 7444904b1..111e22d47 100644 --- a/include/rogue/interfaces/memory/Slave.h +++ b/include/rogue/interfaces/memory/Slave.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Slave * ---------------------------------------------------------------------------- - * File : Slave.h - * Created : 2016-09-20 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory slave interface. @@ -25,6 +22,7 @@ #include #include +#include #include #include "rogue/EnableSharedFromThis.h" diff --git a/include/rogue/interfaces/memory/TcpClient.h b/include/rogue/interfaces/memory/TcpClient.h index 702bc2bb8..1870c7cb9 100644 --- a/include/rogue/interfaces/memory/TcpClient.h +++ b/include/rogue/interfaces/memory/TcpClient.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Client Network Bridge * ---------------------------------------------------------------------------- - * File : TcpClient.h - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory Client Network Bridge @@ -24,6 +21,7 @@ #include #include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/interfaces/memory/TcpServer.h b/include/rogue/interfaces/memory/TcpServer.h index b011dcbdb..d2194d05f 100644 --- a/include/rogue/interfaces/memory/TcpServer.h +++ b/include/rogue/interfaces/memory/TcpServer.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Server Network Bridge * ---------------------------------------------------------------------------- - * File : TcpServer.h - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory Server Network Bridge @@ -24,6 +21,7 @@ #include #include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/interfaces/memory/Transaction.h b/include/rogue/interfaces/memory/Transaction.h index fc641f067..a8f5c8634 100644 --- a/include/rogue/interfaces/memory/Transaction.h +++ b/include/rogue/interfaces/memory/Transaction.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Transaction * ---------------------------------------------------------------------------- - * File : Transaction.h - * Created : 2019-03-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory Transaction @@ -27,6 +24,7 @@ #include #include #include +#include #include #include "rogue/EnableSharedFromThis.h" @@ -146,7 +144,7 @@ class Transaction : public rogue::EnableSharedFromThis transaction); // Transaction lock constructor - TransactionLock(std::shared_ptr transaction); + explicit TransactionLock(std::shared_ptr transaction); // Setup class for use in python static void setup_python(); diff --git a/include/rogue/interfaces/memory/Variable.h b/include/rogue/interfaces/memory/Variable.h index aea597961..cd335e39a 100644 --- a/include/rogue/interfaces/memory/Variable.h +++ b/include/rogue/interfaces/memory/Variable.h @@ -1,8 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Variable * ---------------------------------------------------------------------------- - * File : Variable.h + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Base class for RemoteVariable as well as direct C++ access diff --git a/include/rogue/interfaces/memory/module.h b/include/rogue/interfaces/memory/module.h index a1bf9fb73..ac37a9ab5 100644 --- a/include/rogue/interfaces/memory/module.h +++ b/include/rogue/interfaces/memory/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module For Memory Interface + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/interfaces/module.h b/include/rogue/interfaces/module.h index 34b7ba318..6fecddb0c 100644 --- a/include/rogue/interfaces/module.h +++ b/include/rogue/interfaces/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/interfaces/stream/Buffer.h b/include/rogue/interfaces/stream/Buffer.h index 6b357e29f..0ebe0d823 100644 --- a/include/rogue/interfaces/stream/Buffer.h +++ b/include/rogue/interfaces/stream/Buffer.h @@ -1,13 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream Buffer Container * ---------------------------------------------------------------------------- - * File : Buffer.h - * Author : Ryan Herbst, rherbst@slac.stanford.edu + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream frame container - * Some concepts borrowed from CPSW by Till Straumann * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/interfaces/stream/Fifo.h b/include/rogue/interfaces/stream/Fifo.h index 7c0f71bd8..cc19038a5 100644 --- a/include/rogue/interfaces/stream/Fifo.h +++ b/include/rogue/interfaces/stream/Fifo.h @@ -1,11 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : AXI Stream FIFO * ---------------------------------------------------------------------------- - * File : Fifo.h - * Author : Ryan Herbst - * Created : 02/02/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * AXI Stream FIFO *----------------------------------------------------------------------------- diff --git a/include/rogue/interfaces/stream/Filter.h b/include/rogue/interfaces/stream/Filter.h index 98762bb5d..5e883236b 100644 --- a/include/rogue/interfaces/stream/Filter.h +++ b/include/rogue/interfaces/stream/Filter.h @@ -1,11 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Stream Filter * ---------------------------------------------------------------------------- - * File : Filter.h - * Author : Ryan Herbst - * Created : 11/01/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * AXI Stream Filter *----------------------------------------------------------------------------- diff --git a/include/rogue/interfaces/stream/Frame.h b/include/rogue/interfaces/stream/Frame.h index 2291cfb01..a1598a7d6 100644 --- a/include/rogue/interfaces/stream/Frame.h +++ b/include/rogue/interfaces/stream/Frame.h @@ -1,14 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream frame container * ---------------------------------------------------------------------------- - * File : Frame.h - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream frame container - * Some concepts borrowed from CPSW by Till Straumann * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/interfaces/stream/FrameAccessor.h b/include/rogue/interfaces/stream/FrameAccessor.h index 22acf9eb8..e457bb638 100644 --- a/include/rogue/interfaces/stream/FrameAccessor.h +++ b/include/rogue/interfaces/stream/FrameAccessor.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream frame accessor * ---------------------------------------------------------------------------- - * File : FrameAccessor.h - * Created : 2018-03-06 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream frame iterator @@ -46,7 +43,7 @@ class FrameAccessor { public: //! Creator FrameAccessor(rogue::interfaces::stream::FrameIterator& iter, uint32_t size) { - data_ = (T*)iter.ptr(); + data_ = reinterpret_cast(iter.ptr()); size_ = size; if (size * sizeof(T) > iter.remBuffer()) diff --git a/include/rogue/interfaces/stream/FrameIterator.h b/include/rogue/interfaces/stream/FrameIterator.h index ef34d6e78..896e3af32 100644 --- a/include/rogue/interfaces/stream/FrameIterator.h +++ b/include/rogue/interfaces/stream/FrameIterator.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream frame iterator * ---------------------------------------------------------------------------- - * File : FrameIterator.h - * Created : 2018-03-06 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream frame iterator diff --git a/include/rogue/interfaces/stream/FrameLock.h b/include/rogue/interfaces/stream/FrameLock.h index a248668c4..677f1d52d 100644 --- a/include/rogue/interfaces/stream/FrameLock.h +++ b/include/rogue/interfaces/stream/FrameLock.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Frame Lock * ---------------------------------------------------------------------------- - * File : FrameLock.h - * Created : 2018-03-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory Frame lock @@ -54,7 +51,7 @@ class FrameLock { std::shared_ptr frame); // Frame lock constructor - FrameLock(std::shared_ptr frame); + explicit FrameLock(std::shared_ptr frame); // Setup class for use in python static void setup_python(); diff --git a/include/rogue/interfaces/stream/Master.h b/include/rogue/interfaces/stream/Master.h index 04e8226b3..f64316074 100644 --- a/include/rogue/interfaces/stream/Master.h +++ b/include/rogue/interfaces/stream/Master.h @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream interface master * ---------------------------------------------------------------------------- - * File : Master.h - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream interface master diff --git a/include/rogue/interfaces/stream/Pool.h b/include/rogue/interfaces/stream/Pool.h index f3772949a..0f037ea3b 100644 --- a/include/rogue/interfaces/stream/Pool.h +++ b/include/rogue/interfaces/stream/Pool.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream memory pool * ---------------------------------------------------------------------------- - * File : Pool.h - * Created : 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream memory pool @@ -24,6 +21,7 @@ #include #include +#include #include #include "rogue/EnableSharedFromThis.h" diff --git a/include/rogue/interfaces/stream/RateDrop.h b/include/rogue/interfaces/stream/RateDrop.h index e423d3360..b3c5d42dc 100644 --- a/include/rogue/interfaces/stream/RateDrop.h +++ b/include/rogue/interfaces/stream/RateDrop.h @@ -1,11 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Stream Interface Rate Drop * ---------------------------------------------------------------------------- - * File : RateDrop.h - * Author : Ryan Herbst - * Created : 08/25/2020 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Drops frames at a specified rate. *----------------------------------------------------------------------------- diff --git a/include/rogue/interfaces/stream/Slave.h b/include/rogue/interfaces/stream/Slave.h index 35955348b..09ecd55b0 100644 --- a/include/rogue/interfaces/stream/Slave.h +++ b/include/rogue/interfaces/stream/Slave.h @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream interface slave * ---------------------------------------------------------------------------- - * File : Slave.h - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream interface slave @@ -25,6 +21,7 @@ #include #include +#include #include #include "rogue/EnableSharedFromThis.h" diff --git a/include/rogue/interfaces/stream/TcpClient.h b/include/rogue/interfaces/stream/TcpClient.h index a3a67313e..69056134d 100644 --- a/include/rogue/interfaces/stream/TcpClient.h +++ b/include/rogue/interfaces/stream/TcpClient.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream Network Client * ---------------------------------------------------------------------------- - * File : TcpClient.h - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream Network Client @@ -24,6 +21,7 @@ #include #include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/interfaces/stream/TcpCore.h b/include/rogue/interfaces/stream/TcpCore.h index c2adbcb2d..53a89e4a0 100644 --- a/include/rogue/interfaces/stream/TcpCore.h +++ b/include/rogue/interfaces/stream/TcpCore.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream Network Core * ---------------------------------------------------------------------------- - * File : TcpCore.h - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream Network Core @@ -24,6 +21,7 @@ #include #include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/interfaces/stream/TcpServer.h b/include/rogue/interfaces/stream/TcpServer.h index f6813d980..06fc498b3 100644 --- a/include/rogue/interfaces/stream/TcpServer.h +++ b/include/rogue/interfaces/stream/TcpServer.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream Network Server * ---------------------------------------------------------------------------- - * File : TcpServer.h - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream Network Server @@ -24,6 +21,7 @@ #include #include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/interfaces/stream/module.h b/include/rogue/interfaces/stream/module.h index b49708bc4..cd07f3221 100644 --- a/include/rogue/interfaces/stream/module.h +++ b/include/rogue/interfaces/stream/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module For Stream Interface + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/module.h b/include/rogue/module.h index 8daddb871..ac45ffa45 100644 --- a/include/rogue/module.h +++ b/include/rogue/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/protocols/batcher/CoreV1.h b/include/rogue/protocols/batcher/CoreV1.h index fbae38d76..d75b46e63 100644 --- a/include/rogue/protocols/batcher/CoreV1.h +++ b/include/rogue/protocols/batcher/CoreV1.h @@ -1,13 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Batcher Version 1, Core * ---------------------------------------------------------------------------- - * File : Core.h - * Author : Ryan Herbst - * Created : 10/26/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : - * AXI Batcher V1 + * SLAC AXI Batcher V1 *----------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -26,6 +22,7 @@ #include #include +#include #include "rogue/Logging.h" #include "rogue/interfaces/stream/Frame.h" diff --git a/include/rogue/protocols/batcher/Data.h b/include/rogue/protocols/batcher/Data.h index e5b8c6b16..630576479 100644 --- a/include/rogue/protocols/batcher/Data.h +++ b/include/rogue/protocols/batcher/Data.h @@ -1,11 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Batcher Data Container * ---------------------------------------------------------------------------- - * File : Data.h - * Author : Ryan Herbst - * Created : 02/08/2019 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * AXI Batcher Data *----------------------------------------------------------------------------- diff --git a/include/rogue/protocols/batcher/InverterV1.h b/include/rogue/protocols/batcher/InverterV1.h index d10b8372a..ddeff44df 100644 --- a/include/rogue/protocols/batcher/InverterV1.h +++ b/include/rogue/protocols/batcher/InverterV1.h @@ -1,13 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Inverter Version 1 * ---------------------------------------------------------------------------- - * File : InverterV1.h - * Author : Ryan Herbst - * Created : 10/26/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : - * AXI Inverter V1 + * SLAC AXI Inverter V1 *----------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/protocols/batcher/SplitterV1.h b/include/rogue/protocols/batcher/SplitterV1.h index 6c521de3a..41d1f063d 100644 --- a/include/rogue/protocols/batcher/SplitterV1.h +++ b/include/rogue/protocols/batcher/SplitterV1.h @@ -1,13 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Splitter Version 1 * ---------------------------------------------------------------------------- - * File : SplitterV1.h - * Author : Ryan Herbst - * Created : 10/26/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : - * AXI Splitter V1 + * SLAC AXI Splitter V1 *----------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/protocols/batcher/module.h b/include/rogue/protocols/batcher/module.h index a9a8a7aca..3e5bc4f77 100644 --- a/include/rogue/protocols/batcher/module.h +++ b/include/rogue/protocols/batcher/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/protocols/module.h b/include/rogue/protocols/module.h index 3604bf99f..62235fec9 100644 --- a/include/rogue/protocols/module.h +++ b/include/rogue/protocols/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/protocols/packetizer/Application.h b/include/rogue/protocols/packetizer/Application.h index b054cc6b6..ad80ea2a8 100644 --- a/include/rogue/protocols/packetizer/Application.h +++ b/include/rogue/protocols/packetizer/Application.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Application Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Application Interface @@ -58,7 +58,7 @@ class Application : public rogue::interfaces::stream::Master, public rogue::inte static void setup_python(); //! Creator - Application(uint8_t id); + explicit Application(uint8_t id); //! Destructor ~Application(); diff --git a/include/rogue/protocols/packetizer/CRC.h b/include/rogue/protocols/packetizer/CRC.h index de4cb73e0..e9862039d 100644 --- a/include/rogue/protocols/packetizer/CRC.h +++ b/include/rogue/protocols/packetizer/CRC.h @@ -165,10 +165,10 @@ class CRC { template struct Table { // Constructors are intentionally NOT marked explicit. - Table(const Parameters& parameters); + Table(const Parameters& parameters); // NOLINT #ifdef CRCPP_USE_CPP11 - Table(Parameters&& parameters); + Table(Parameters&& parameters); // NOLINT #endif const Parameters& GetParameters() const; @@ -273,11 +273,11 @@ class CRC { #endif #ifdef CRCPP_USE_CPP11 - CRC() = delete; - CRC(const CRC& other) = delete; + CRC() = delete; + CRC(const CRC& other) = delete; CRC& operator=(const CRC& other) = delete; CRC(CRC&& other) = delete; - CRC& operator=(CRC&& other) = delete; + CRC& operator=(CRC&& other) = delete; #endif private: @@ -553,7 +553,9 @@ inline CRCType CRC::Finalize(CRCType remainder, CRCType finalXOR, bool reflectOu static crcpp_constexpr CRCType BIT_MASK = (CRCType(1) << (CRCWidth - CRCType(1))) | ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1)); - if (reflectOutput) { remainder = Reflect(remainder, CRCWidth); } + if (reflectOutput) { + remainder = Reflect(remainder, CRCWidth); + } return (remainder ^ finalXOR) & BIT_MASK; } @@ -583,7 +585,9 @@ inline CRCType CRC::UndoFinalize(CRCType crc, CRCType finalXOR, bool reflectOutp crc = (crc & BIT_MASK) ^ finalXOR; - if (reflectOutput) { crc = Reflect(crc, CRCWidth); } + if (reflectOutput) { + crc = Reflect(crc, CRCWidth); + } return crc; } @@ -1658,7 +1662,7 @@ inline const CRC::Parameters& CRC::CRC_64() { #endif // CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS #ifdef CRCPP_USE_NAMESPACE -} +} // NOLINT #endif #endif // CRCPP_CRC_H_ diff --git a/include/rogue/protocols/packetizer/Controller.h b/include/rogue/protocols/packetizer/Controller.h index b3e331cc3..780ab098c 100644 --- a/include/rogue/protocols/packetizer/Controller.h +++ b/include/rogue/protocols/packetizer/Controller.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Controller Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Controller diff --git a/include/rogue/protocols/packetizer/ControllerV1.h b/include/rogue/protocols/packetizer/ControllerV1.h index 367e4db16..334d123f7 100644 --- a/include/rogue/protocols/packetizer/ControllerV1.h +++ b/include/rogue/protocols/packetizer/ControllerV1.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Controller V1 Class * ---------------------------------------------------------------------------- - * File : ControllerV1.h - * Created : 2018-02-02 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Controller, Version 1 diff --git a/include/rogue/protocols/packetizer/ControllerV2.h b/include/rogue/protocols/packetizer/ControllerV2.h index f0c5db841..7fc158774 100644 --- a/include/rogue/protocols/packetizer/ControllerV2.h +++ b/include/rogue/protocols/packetizer/ControllerV2.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Controller V2 Class * ---------------------------------------------------------------------------- - * File : ControllerV2.h - * Created : 2018-02-02 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Controller, Version 2 diff --git a/include/rogue/protocols/packetizer/Core.h b/include/rogue/protocols/packetizer/Core.h index e1403430b..a75cb1465 100644 --- a/include/rogue/protocols/packetizer/Core.h +++ b/include/rogue/protocols/packetizer/Core.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Core Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Core @@ -50,7 +50,7 @@ class Core { static void setup_python(); //! Creator - Core(bool enSsi); + explicit Core(bool enSsi); //! Destructor ~Core(); diff --git a/include/rogue/protocols/packetizer/CoreV2.h b/include/rogue/protocols/packetizer/CoreV2.h index 3e322b2a9..04d3f1aad 100644 --- a/include/rogue/protocols/packetizer/CoreV2.h +++ b/include/rogue/protocols/packetizer/CoreV2.h @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Core Class * ---------------------------------------------------------------------------- - * File : CoreV2.h - * Created : 2018-02-02 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Core, Version 2 diff --git a/include/rogue/protocols/packetizer/Transport.h b/include/rogue/protocols/packetizer/Transport.h index 4ade68780..a771bfaaf 100644 --- a/include/rogue/protocols/packetizer/Transport.h +++ b/include/rogue/protocols/packetizer/Transport.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Transport Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Transport diff --git a/include/rogue/protocols/packetizer/module.h b/include/rogue/protocols/packetizer/module.h index a50ea6067..6dcc0485e 100644 --- a/include/rogue/protocols/packetizer/module.h +++ b/include/rogue/protocols/packetizer/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/protocols/rssi/Application.h b/include/rogue/protocols/rssi/Application.h index 4b13e7cd1..8253c6666 100644 --- a/include/rogue/protocols/rssi/Application.h +++ b/include/rogue/protocols/rssi/Application.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Application Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * RSSI Application diff --git a/include/rogue/protocols/rssi/Client.h b/include/rogue/protocols/rssi/Client.h index 17eac4c65..f84185e8d 100644 --- a/include/rogue/protocols/rssi/Client.h +++ b/include/rogue/protocols/rssi/Client.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Client Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: - * UDP Client + * RSSI Client Class * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -50,7 +50,7 @@ class Client { static void setup_python(); //! Creator - Client(uint32_t segSize); + explicit Client(uint32_t segSize); //! Destructor ~Client(); diff --git a/include/rogue/protocols/rssi/Controller.h b/include/rogue/protocols/rssi/Controller.h index 0e877e188..5c50a9114 100644 --- a/include/rogue/protocols/rssi/Controller.h +++ b/include/rogue/protocols/rssi/Controller.h @@ -1,12 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Controller Class * ---------------------------------------------------------------------------- - * File : Controller.h - * Created : 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: - * RSSI Controller + * RSSI Controller Class * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/protocols/rssi/Header.h b/include/rogue/protocols/rssi/Header.h index 9c4c905fd..5421d062c 100644 --- a/include/rogue/protocols/rssi/Header.h +++ b/include/rogue/protocols/rssi/Header.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Header Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * RSSI header @@ -21,6 +21,7 @@ #include #include +#include #include "rogue/interfaces/stream/Frame.h" @@ -66,7 +67,7 @@ class Header { std::shared_ptr frame); //! Creator - Header(std::shared_ptr frame); + explicit Header(std::shared_ptr frame); //! Destructor ~Header(); diff --git a/include/rogue/protocols/rssi/Server.h b/include/rogue/protocols/rssi/Server.h index dee2837eb..f2236ab70 100644 --- a/include/rogue/protocols/rssi/Server.h +++ b/include/rogue/protocols/rssi/Server.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Server Class * ---------------------------------------------------------------------------- - * File : Server.h - * Created : 2017-06-13 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * RSSI Server Class * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -50,7 +50,7 @@ class Server { static void setup_python(); //! Creator - Server(uint32_t segSize); + explicit Server(uint32_t segSize); //! Destructor ~Server(); diff --git a/include/rogue/protocols/rssi/Transport.h b/include/rogue/protocols/rssi/Transport.h index ee6a78bff..2e477f545 100644 --- a/include/rogue/protocols/rssi/Transport.h +++ b/include/rogue/protocols/rssi/Transport.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Transport Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * RSSI Transport diff --git a/include/rogue/protocols/rssi/module.h b/include/rogue/protocols/rssi/module.h index 884b5f703..c04318224 100644 --- a/include/rogue/protocols/rssi/module.h +++ b/include/rogue/protocols/rssi/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/protocols/srp/Cmd.h b/include/rogue/protocols/srp/Cmd.h index 7a12f3472..1b7618e03 100644 --- a/include/rogue/protocols/srp/Cmd.h +++ b/include/rogue/protocols/srp/Cmd.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Command Protocol - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : - * CMD Version 0 + * SLAC Command Protocol, Version 0 *----------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/protocols/srp/SrpV0.h b/include/rogue/protocols/srp/SrpV0.h index 58d1b5932..63783b3b3 100644 --- a/include/rogue/protocols/srp/SrpV0.h +++ b/include/rogue/protocols/srp/SrpV0.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Register Protocol (SRP) SrpV0 - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : - * SRP Version 0 + * SLAC Register Protocol (SRP) SrpV0 *----------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/protocols/srp/SrpV3.h b/include/rogue/protocols/srp/SrpV3.h index 90959acf2..ce5fc4045 100644 --- a/include/rogue/protocols/srp/SrpV3.h +++ b/include/rogue/protocols/srp/SrpV3.h @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Register Protocol (SRP) SrpV3 - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : - * SRP Version 3 + * SLAC Register Protocol (SRP) SrpV3 *----------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/include/rogue/protocols/srp/module.h b/include/rogue/protocols/srp/module.h index 869a1ba7a..b5c3aa524 100644 --- a/include/rogue/protocols/srp/module.h +++ b/include/rogue/protocols/srp/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/protocols/udp/Client.h b/include/rogue/protocols/udp/Client.h index af2e3d665..c4715abae 100644 --- a/include/rogue/protocols/udp/Client.h +++ b/include/rogue/protocols/udp/Client.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : UDP Client Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * UDP Client @@ -25,6 +25,7 @@ #include #include +#include #include #include "rogue/Logging.h" diff --git a/include/rogue/protocols/udp/Core.h b/include/rogue/protocols/udp/Core.h index 8f0291a78..edce206ad 100644 --- a/include/rogue/protocols/udp/Core.h +++ b/include/rogue/protocols/udp/Core.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : UDP Common Functions + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * UDP Common @@ -69,7 +69,7 @@ class Core { static void setup_python(); //! Creator - Core(bool jumbo); + explicit Core(bool jumbo); //! Destructor ~Core(); diff --git a/include/rogue/protocols/udp/Server.h b/include/rogue/protocols/udp/Server.h index a1f4c1c58..4371f97fe 100644 --- a/include/rogue/protocols/udp/Server.h +++ b/include/rogue/protocols/udp/Server.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : UDP Server Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * UDP Server diff --git a/include/rogue/protocols/udp/module.h b/include/rogue/protocols/udp/module.h index 9ed4b0a5f..f5980d427 100644 --- a/include/rogue/protocols/udp/module.h +++ b/include/rogue/protocols/udp/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/protocols/xilinx/JtagDriver.h b/include/rogue/protocols/xilinx/JtagDriver.h index 80ccc6344..cecb8c5c6 100644 --- a/include/rogue/protocols/xilinx/JtagDriver.h +++ b/include/rogue/protocols/xilinx/JtagDriver.h @@ -1,18 +1,19 @@ -//----------------------------------------------------------------------------- -// Title : JTAG Support -//----------------------------------------------------------------------------- -// Company : SLAC National Accelerator Laboratory -//----------------------------------------------------------------------------- -// Description: JtagDriver.h -//----------------------------------------------------------------------------- -// This file is part of 'SLAC Firmware Standard Library'. -// It is subject to the license terms in the LICENSE.txt file found in the -// top-level directory of this distribution and at: -// https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -// No part of 'SLAC Firmware Standard Library', including this file, -// may be copied, modified, propagated, or distributed except according to -// the terms contained in the LICENSE.txt file. -//----------------------------------------------------------------------------- +/** + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * JTAG Support + * ---------------------------------------------------------------------------- + * This file is part of the rogue software platform. It is subject to + * the license terms in the LICENSE.txt file found in the top-level directory + * of this distribution and at: + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * No part of the rogue software platform, including this file, may be + * copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE.txt file. + * ---------------------------------------------------------------------------- + **/ #ifndef __ROGUE_PROTOCOLS_XILINX_JTAG_DRIVER_H__ #define __ROGUE_PROTOCOLS_XILINX_JTAG_DRIVER_H__ @@ -131,7 +132,7 @@ class JtagDriver { static Xid getXid(Header x); static uint32_t getCmd(Header x); static unsigned getErr(Header x); - static unsigned long getLen(Header x); + static uint64_t getLen(Header x); // returns error message or NULL (unknown error) static const char* getMsg(unsigned error); @@ -168,7 +169,7 @@ class JtagDriver { //! Setup class in python static void setup_python(); - JtagDriver(uint16_t port); + explicit JtagDriver(uint16_t port); // initialization after full construction virtual void init(); @@ -191,7 +192,7 @@ class JtagDriver { // if 0 then no the target does not have memory and if // there is reliable transport there is no limit to vector // length. - virtual unsigned long query(); + virtual uint64_t query(); // Max. vector size (in bytes) this driver supports - may be different // from what the target supports and the minimum will be used... @@ -199,7 +200,7 @@ class JtagDriver { // must handle typically contains two vectors and a header, so // the driver must consider this when computing the max. supported // vector size) - virtual unsigned long getMaxVectorSize() { + virtual uint64_t getMaxVectorSize() { return 0; } @@ -207,7 +208,7 @@ class JtagDriver { // send tms and tdi vectors of length numBits (each) and receive tdo // little-endian (first send/received at lowest offset) - virtual void sendVectors(unsigned long numBits, uint8_t* tms, uint8_t* tdi, uint8_t* tdo); + virtual void sendVectors(uint64_t numBits, uint8_t* tms, uint8_t* tdi, uint8_t* tdo); virtual void dumpInfo(FILE* f = stdout); diff --git a/include/rogue/protocols/xilinx/Xvc.h b/include/rogue/protocols/xilinx/Xvc.h index 1d2454c43..f87649205 100644 --- a/include/rogue/protocols/xilinx/Xvc.h +++ b/include/rogue/protocols/xilinx/Xvc.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : XVC Server Class + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Rogue implementation of the XVC Server @@ -71,7 +71,7 @@ class Xvc : public rogue::interfaces::stream::Master, static void setup_python(); //! Creator - Xvc(uint16_t port); + explicit Xvc(uint16_t port); //! Destructor ~Xvc(); @@ -85,14 +85,14 @@ class Xvc : public rogue::interfaces::stream::Master, // Receive frame void acceptFrame(std::shared_ptr frame); - virtual unsigned long getMaxVectorSize() final; + uint64_t getMaxVectorSize() final; - virtual int xfer(uint8_t* txBuffer, - unsigned txBytes, - uint8_t* hdBuffer, - unsigned hdBytes, - uint8_t* rxBuffer, - unsigned rxBytes) final; + int xfer(uint8_t* txBuffer, + unsigned txBytes, + uint8_t* hdBuffer, + unsigned hdBytes, + uint8_t* rxBuffer, + unsigned rxBytes) final; }; // Convenience diff --git a/include/rogue/protocols/xilinx/XvcConnection.h b/include/rogue/protocols/xilinx/XvcConnection.h index 7055267c9..831410083 100644 --- a/include/rogue/protocols/xilinx/XvcConnection.h +++ b/include/rogue/protocols/xilinx/XvcConnection.h @@ -1,18 +1,19 @@ -//----------------------------------------------------------------------------- -// Title : JTAG Support -//----------------------------------------------------------------------------- -// Company : SLAC National Accelerator Laboratory -//----------------------------------------------------------------------------- -// Description: XvcConnection.h -//----------------------------------------------------------------------------- -// This file is part of 'SLAC Firmware Standard Library'. -// It is subject to the license terms in the LICENSE.txt file found in the -// top-level directory of this distribution and at: -// https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -// No part of 'SLAC Firmware Standard Library', including this file, -// may be copied, modified, propagated, or distributed except according to -// the terms contained in the LICENSE.txt file. -//----------------------------------------------------------------------------- +/** + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * JTAG Support + * ---------------------------------------------------------------------------- + * This file is part of the rogue software platform. It is subject to + * the license terms in the LICENSE.txt file found in the top-level directory + * of this distribution and at: + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * No part of the rogue software platform, including this file, may be + * copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE.txt file. + * ---------------------------------------------------------------------------- + **/ #ifndef __ROGUE_PROTOCOLS_XILINX_XVC_CONNECTION_H__ #define __ROGUE_PROTOCOLS_XILINX_XVC_CONNECTION_H__ @@ -21,6 +22,8 @@ #include #include +#include + #include "rogue/GeneralError.h" #include "rogue/protocols/xilinx/JtagDriver.h" @@ -39,25 +42,25 @@ class XvcConnection { uint8_t* rp_; vector rxb_; - unsigned long rl_; - unsigned long tl_; + uint64_t rl_; + uint64_t tl_; vector txb_; - unsigned long maxVecLen_; - unsigned long supVecLen_; - unsigned long chunk_; + uint64_t maxVecLen_; + uint64_t supVecLen_; + uint64_t chunk_; public: - XvcConnection(int sd, JtagDriver* drv, unsigned long maxVecLen_ = 32768); + XvcConnection(int sd, JtagDriver* drv, uint64_t maxVecLen_ = 32768); // fill rx buffer to 'n' octets (from TCP connection) - virtual void fill(unsigned long n); + virtual void fill(uint64_t n); // send tx buffer to TCP connection virtual void flush(); // discard 'n' octets from rx buffer (mark as consumed) - virtual void bump(unsigned long n); + virtual void bump(uint64_t n); // (re)allocated buffers virtual void allocBufs(); diff --git a/include/rogue/protocols/xilinx/XvcServer.h b/include/rogue/protocols/xilinx/XvcServer.h index 81bc58bb3..a14e89ad6 100644 --- a/include/rogue/protocols/xilinx/XvcServer.h +++ b/include/rogue/protocols/xilinx/XvcServer.h @@ -1,18 +1,19 @@ -//----------------------------------------------------------------------------- -// Title : JTAG Support -//----------------------------------------------------------------------------- -// Company : SLAC National Accelerator Laboratory -//----------------------------------------------------------------------------- -// Description: XvcServer.h -//----------------------------------------------------------------------------- -// This file is part of 'SLAC Firmware Standard Library'. -// It is subject to the license terms in the LICENSE.txt file found in the -// top-level directory of this distribution and at: -// https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -// No part of 'SLAC Firmware Standard Library', including this file, -// may be copied, modified, propagated, or distributed except according to -// the terms contained in the LICENSE.txt file. -//----------------------------------------------------------------------------- +/** + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * JTAG Support + * ---------------------------------------------------------------------------- + * This file is part of the rogue software platform. It is subject to + * the license terms in the LICENSE.txt file found in the top-level directory + * of this distribution and at: + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * No part of the rogue software platform, including this file, may be + * copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE.txt file. + * ---------------------------------------------------------------------------- + **/ #ifndef __ROGUE_PROTOCOLS_XILINX_XVC_SERVER_H__ #define __ROGUE_PROTOCOLS_XILINX_XVC_SERVER_H__ diff --git a/include/rogue/protocols/xilinx/module.h b/include/rogue/protocols/xilinx/module.h index 657fa35e5..0b554ee4d 100644 --- a/include/rogue/protocols/xilinx/module.h +++ b/include/rogue/protocols/xilinx/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/utilities/Prbs.h b/include/rogue/utilities/Prbs.h index d7e90be6f..b5a87d68e 100644 --- a/include/rogue/utilities/Prbs.h +++ b/include/rogue/utilities/Prbs.h @@ -1,7 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : PRBS Receive And Transmit Class - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class used to generate and receive PRBS test data. *----------------------------------------------------------------------------- @@ -36,7 +36,7 @@ namespace utilities { */ class Prbs : public rogue::interfaces::stream::Slave, public rogue::interfaces::stream::Master { //! Max size - const static uint32_t MaxBytes = 64; + static const uint32_t MaxBytes = 64; //! PRBS taps uint8_t* taps_; diff --git a/include/rogue/utilities/StreamUnZip.h b/include/rogue/utilities/StreamUnZip.h index e66195936..b6126ffc0 100644 --- a/include/rogue/utilities/StreamUnZip.h +++ b/include/rogue/utilities/StreamUnZip.h @@ -1,9 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue stream de-compressor * ---------------------------------------------------------------------------- - * File : StreamUnZip.h - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Stream modules to decompress a data stream *----------------------------------------------------------------------------- diff --git a/include/rogue/utilities/StreamZip.h b/include/rogue/utilities/StreamZip.h index e626eac2f..8774dddec 100644 --- a/include/rogue/utilities/StreamZip.h +++ b/include/rogue/utilities/StreamZip.h @@ -1,9 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue stream compressor * ---------------------------------------------------------------------------- - * File : StreamZip.h - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Stream modules to compress a data stream *----------------------------------------------------------------------------- diff --git a/include/rogue/utilities/fileio/LegacyStreamReader.h b/include/rogue/utilities/fileio/LegacyStreamReader.h index 78fca560f..46aa47a6f 100644 --- a/include/rogue/utilities/fileio/LegacyStreamReader.h +++ b/include/rogue/utilities/fileio/LegacyStreamReader.h @@ -1,7 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file reader utility. - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to read data files. *----------------------------------------------------------------------------- @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "rogue/interfaces/stream/Master.h" diff --git a/include/rogue/utilities/fileio/LegacyStreamWriter.h b/include/rogue/utilities/fileio/LegacyStreamWriter.h index 881a349a8..5a146e58e 100644 --- a/include/rogue/utilities/fileio/LegacyStreamWriter.h +++ b/include/rogue/utilities/fileio/LegacyStreamWriter.h @@ -1,7 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file writer utility. - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to coordinate data file writing. * This class writes files using the legacy data format of XmlDaq diff --git a/include/rogue/utilities/fileio/StreamReader.h b/include/rogue/utilities/fileio/StreamReader.h index b1250b096..a8653b076 100644 --- a/include/rogue/utilities/fileio/StreamReader.h +++ b/include/rogue/utilities/fileio/StreamReader.h @@ -1,7 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file reader utility. - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to read data files. *----------------------------------------------------------------------------- @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "rogue/interfaces/stream/Master.h" diff --git a/include/rogue/utilities/fileio/StreamWriter.h b/include/rogue/utilities/fileio/StreamWriter.h index 3b3ddc66e..a7680fdb1 100644 --- a/include/rogue/utilities/fileio/StreamWriter.h +++ b/include/rogue/utilities/fileio/StreamWriter.h @@ -1,7 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file writer utility. - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to coordinate data file writing. * This class supports multiple stream slaves, each with the ability to @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "rogue/EnableSharedFromThis.h" diff --git a/include/rogue/utilities/fileio/StreamWriterChannel.h b/include/rogue/utilities/fileio/StreamWriterChannel.h index 183a8d308..cd456413d 100644 --- a/include/rogue/utilities/fileio/StreamWriterChannel.h +++ b/include/rogue/utilities/fileio/StreamWriterChannel.h @@ -1,7 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file writer utility. Channel interface. - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to act as a slave interface to the StreamWriter. Each * slave is associated with a tag. The tag is included in the bank header diff --git a/include/rogue/utilities/fileio/module.h b/include/rogue/utilities/fileio/module.h index d43c8491e..cec9f63d8 100644 --- a/include/rogue/utilities/fileio/module.h +++ b/include/rogue/utilities/fileio/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/include/rogue/utilities/module.h b/include/rogue/utilities/module.h index c7d14e537..4c96b6dd6 100644 --- a/include/rogue/utilities/module.h +++ b/include/rogue/utilities/module.h @@ -1,6 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/pip_requirements.txt b/pip_requirements.txt index e3f5afab4..f771b2b90 100644 --- a/pip_requirements.txt +++ b/pip_requirements.txt @@ -15,6 +15,7 @@ sqlalchemy pyserial numpy flake8 +cpplint gitpython pygithub pydm diff --git a/python/pyrogue/_Block.py b/python/pyrogue/_Block.py index cb167c233..289894b5d 100644 --- a/python/pyrogue/_Block.py +++ b/python/pyrogue/_Block.py @@ -1,7 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Block Class +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- -# File : pyrogue/_Block.py +# Description: +# PyRogue base module - Block Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_Command.py b/python/pyrogue/_Command.py index 46cf33cc0..86bb741c5 100644 --- a/python/pyrogue/_Command.py +++ b/python/pyrogue/_Command.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Command Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Command Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_DataReceiver.py b/python/pyrogue/_DataReceiver.py index 39e284e2b..07a3ea733 100644 --- a/python/pyrogue/_DataReceiver.py +++ b/python/pyrogue/_DataReceiver.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Data Receiver Device +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Data Receiver Device #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_DataWriter.py b/python/pyrogue/_DataWriter.py index 1097c97a9..4aa8d2fb0 100644 --- a/python/pyrogue/_DataWriter.py +++ b/python/pyrogue/_DataWriter.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Data Writer Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Data Writer Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_Device.py b/python/pyrogue/_Device.py index efaab515e..cc0bde492 100644 --- a/python/pyrogue/_Device.py +++ b/python/pyrogue/_Device.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Device Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Device Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_HelperFunctions.py b/python/pyrogue/_HelperFunctions.py index 7fb2df430..631f8fd22 100644 --- a/python/pyrogue/_HelperFunctions.py +++ b/python/pyrogue/_HelperFunctions.py @@ -1,4 +1,9 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/_Model.py b/python/pyrogue/_Model.py index 73503fc9e..b85af55b1 100644 --- a/python/pyrogue/_Model.py +++ b/python/pyrogue/_Model.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Model Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Model Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_Node.py b/python/pyrogue/_Node.py index 3395656a4..4e21e9f64 100644 --- a/python/pyrogue/_Node.py +++ b/python/pyrogue/_Node.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Node Classes +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Node Classes #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_PollQueue.py b/python/pyrogue/_PollQueue.py index 0b4670127..5b95cfba5 100644 --- a/python/pyrogue/_PollQueue.py +++ b/python/pyrogue/_PollQueue.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - PollQueue Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - PollQueue Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_Process.py b/python/pyrogue/_Process.py index 66952cf3a..be211fdee 100644 --- a/python/pyrogue/_Process.py +++ b/python/pyrogue/_Process.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Process Device Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Process Device Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_Root.py b/python/pyrogue/_Root.py index 581b39c05..f13b82218 100644 --- a/python/pyrogue/_Root.py +++ b/python/pyrogue/_Root.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Root Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Root Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_RunControl.py b/python/pyrogue/_RunControl.py index 63a07d626..cc4801d97 100644 --- a/python/pyrogue/_RunControl.py +++ b/python/pyrogue/_RunControl.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Run Control Device Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Run Control Device Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/_Variable.py b/python/pyrogue/_Variable.py index aa8c08c4c..da677000b 100644 --- a/python/pyrogue/_Variable.py +++ b/python/pyrogue/_Variable.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Variable Class +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Variable Class #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/__init__.py b/python/pyrogue/__init__.py index 9180c393f..e54855d67 100644 --- a/python/pyrogue/__init__.py +++ b/python/pyrogue/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/__main__.py b/python/pyrogue/__main__.py index 438187421..cbaafa6b6 100644 --- a/python/pyrogue/__main__.py +++ b/python/pyrogue/__main__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/examples/_AxiVersion.py b/python/pyrogue/examples/_AxiVersion.py index cd30592f9..2c35c4627 100644 --- a/python/pyrogue/examples/_AxiVersion.py +++ b/python/pyrogue/examples/_AxiVersion.py @@ -1,8 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue AXI-Lite Version Module Test +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: -# PyRogue AXI-Lite Version Module +# PyRogue AXI-Lite Version Module Test #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/examples/_ExampleRoot.py b/python/pyrogue/examples/_ExampleRoot.py index 89a6cfbc3..880f428ca 100755 --- a/python/pyrogue/examples/_ExampleRoot.py +++ b/python/pyrogue/examples/_ExampleRoot.py @@ -1,12 +1,15 @@ #!/usr/bin/env python3 #----------------------------------------------------------------------------- -# Title : Example Root +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- -# This file is part of the rogue_example software. It is subject to +# Description: +# Example Root +#----------------------------------------------------------------------------- +# This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: # https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -# No part of the rogue_example software, including this file, may be +# No part of the rogue software platform, including this file, may be # copied, modified, propagated, or distributed except according to the terms # contained in the LICENSE.txt file. #----------------------------------------------------------------------------- diff --git a/python/pyrogue/examples/_LargeDevice.py b/python/pyrogue/examples/_LargeDevice.py index 366037a3f..4876a424f 100755 --- a/python/pyrogue/examples/_LargeDevice.py +++ b/python/pyrogue/examples/_LargeDevice.py @@ -1,12 +1,15 @@ #!/usr/bin/env python3 #----------------------------------------------------------------------------- -# Title : Large Device Test Group +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- -# This file is part of the rogue_example software. It is subject to +# Description: +# Large Device Test Group +#----------------------------------------------------------------------------- +# This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: # https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -# No part of the rogue_example software, including this file, may be +# No part of the rogue software platform, including this file, may be # copied, modified, propagated, or distributed except according to the terms # contained in the LICENSE.txt file. #----------------------------------------------------------------------------- diff --git a/python/pyrogue/examples/__init__.py b/python/pyrogue/examples/__init__.py index f7c1e299d..65950fb91 100644 --- a/python/pyrogue/examples/__init__.py +++ b/python/pyrogue/examples/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/examples/__main__.py b/python/pyrogue/examples/__main__.py index 5883ae339..29471d938 100755 --- a/python/pyrogue/examples/__main__.py +++ b/python/pyrogue/examples/__main__.py @@ -1,12 +1,15 @@ #!/usr/bin/env python3 #----------------------------------------------------------------------------- -# Title : Example server test script +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- -# This file is part of the rogue_example software. It is subject to +# Description: +# Example server test script +#----------------------------------------------------------------------------- +# This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: # https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -# No part of the rogue_example software, including this file, may be +# No part of the rogue software platform, including this file, may be # copied, modified, propagated, or distributed except according to the terms # contained in the LICENSE.txt file. #----------------------------------------------------------------------------- diff --git a/python/pyrogue/hardware/axi/__init__.py b/python/pyrogue/hardware/axi/__init__.py index 82b1470de..01de67d9f 100644 --- a/python/pyrogue/hardware/axi/__init__.py +++ b/python/pyrogue/hardware/axi/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/interfaces/_SimpleClient.py b/python/pyrogue/interfaces/_SimpleClient.py index 66b305600..3370c8219 100644 --- a/python/pyrogue/interfaces/_SimpleClient.py +++ b/python/pyrogue/interfaces/_SimpleClient.py @@ -1,6 +1,7 @@ #----------------------------------------------------------------------------- -# Title : PyRogue Simple ZMQ Client for Rogue +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- +# Description: # To use in Matlab first you need the zmq package in your # python installation: # diff --git a/python/pyrogue/interfaces/_SqlLogging.py b/python/pyrogue/interfaces/_SqlLogging.py index 51755afec..ba0f92c85 100644 --- a/python/pyrogue/interfaces/_SqlLogging.py +++ b/python/pyrogue/interfaces/_SqlLogging.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue - SQL Logging Module +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue - SQL Logging Module #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/interfaces/_Virtual.py b/python/pyrogue/interfaces/_Virtual.py index 6a0ccdbd1..75b702593 100644 --- a/python/pyrogue/interfaces/_Virtual.py +++ b/python/pyrogue/interfaces/_Virtual.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue base module - Virtual Classes +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue base module - Virtual Classes #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/interfaces/_ZmqServer.py b/python/pyrogue/interfaces/_ZmqServer.py index 5fcf76422..c45595801 100644 --- a/python/pyrogue/interfaces/_ZmqServer.py +++ b/python/pyrogue/interfaces/_ZmqServer.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue ZMQ Server +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue ZMQ Server #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/interfaces/__init__.py b/python/pyrogue/interfaces/__init__.py index 161d21a0d..8ee2ad179 100644 --- a/python/pyrogue/interfaces/__init__.py +++ b/python/pyrogue/interfaces/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/interfaces/simulation.py b/python/pyrogue/interfaces/simulation.py index fc1a19900..f92a07ac7 100644 --- a/python/pyrogue/interfaces/simulation.py +++ b/python/pyrogue/interfaces/simulation.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue simulation support +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Module containing simulation support classes and routines diff --git a/python/pyrogue/interfaces/stream/_Fifo.py b/python/pyrogue/interfaces/stream/_Fifo.py index bcd3a6e1b..55ad2e497 100644 --- a/python/pyrogue/interfaces/stream/_Fifo.py +++ b/python/pyrogue/interfaces/stream/_Fifo.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : AXI Stream FIFO +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Python wrapper for the AXI Stream FIFO C++ device. diff --git a/python/pyrogue/interfaces/stream/_Variable.py b/python/pyrogue/interfaces/stream/_Variable.py index a6064c294..d6cf9852d 100644 --- a/python/pyrogue/interfaces/stream/_Variable.py +++ b/python/pyrogue/interfaces/stream/_Variable.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : Variable Update Streamer +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Class to generate variable update streams diff --git a/python/pyrogue/interfaces/stream/__init__.py b/python/pyrogue/interfaces/stream/__init__.py index 25c570d90..d879b5683 100644 --- a/python/pyrogue/interfaces/stream/__init__.py +++ b/python/pyrogue/interfaces/stream/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/protocols/_Network.py b/python/pyrogue/protocols/_Network.py index a4827f719..977b40f5b 100644 --- a/python/pyrogue/protocols/_Network.py +++ b/python/pyrogue/protocols/_Network.py @@ -1,8 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue protocols / Network wrappers +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: -# Module containing protocol modules +# PyRogue protocols / Network wrappers #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/protocols/__init__.py b/python/pyrogue/protocols/__init__.py index 8a450a84c..0b26e85c0 100644 --- a/python/pyrogue/protocols/__init__.py +++ b/python/pyrogue/protocols/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/protocols/_uart.py b/python/pyrogue/protocols/_uart.py index c3d19362e..2623593b3 100644 --- a/python/pyrogue/protocols/_uart.py +++ b/python/pyrogue/protocols/_uart.py @@ -1,8 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue protocols / UART register protocol +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: -# Module containing protocol modules +# PyRogue protocols / UART register protocol #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/protocols/epicsV4.py b/python/pyrogue/protocols/epicsV4.py index c9776eddf..a70fea63a 100644 --- a/python/pyrogue/protocols/epicsV4.py +++ b/python/pyrogue/protocols/epicsV4.py @@ -1,6 +1,6 @@ -# ----------------------------------------------------------------------------- -# Title : PyRogue epics support -# ----------------------------------------------------------------------------- +#----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # Description: # Module containing epics support classes and routines # TODO: diff --git a/python/pyrogue/protocols/gpib.py b/python/pyrogue/protocols/gpib.py index 7d8d25d1d..f9f6a2a67 100644 --- a/python/pyrogue/protocols/gpib.py +++ b/python/pyrogue/protocols/gpib.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue protocols / GPIB register protocol +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Module to interface to GPIB devices diff --git a/python/pyrogue/pydm/TimePlotTop.py b/python/pyrogue/pydm/TimePlotTop.py index cb4b45d8d..628b02668 100644 --- a/python/pyrogue/pydm/TimePlotTop.py +++ b/python/pyrogue/pydm/TimePlotTop.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Top Level GUI +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Top Level GUI #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory @@ -9,7 +12,6 @@ # copied, modified, propagated, or distributed except according to the terms # contained in the LICENSE.txt file. #----------------------------------------------------------------------------- - import os from pyrogue.pydm.widgets import TimePlotter diff --git a/python/pyrogue/pydm/__init__.py b/python/pyrogue/pydm/__init__.py index e4ca62d1f..77c5d3b0d 100644 --- a/python/pyrogue/pydm/__init__.py +++ b/python/pyrogue/pydm/__init__.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Package, Function to start default Rogue PyDM GUI +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Package, Function to start default Rogue PyDM GUI #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/data_plugins/__init__.py b/python/pyrogue/pydm/data_plugins/__init__.py index c05eacec2..c361b28de 100644 --- a/python/pyrogue/pydm/data_plugins/__init__.py +++ b/python/pyrogue/pydm/data_plugins/__init__.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM data plug-in package +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/data_plugins/rogue_plugin.py b/python/pyrogue/pydm/data_plugins/rogue_plugin.py index 67efaa506..14ef8a0da 100644 --- a/python/pyrogue/pydm/data_plugins/rogue_plugin.py +++ b/python/pyrogue/pydm/data_plugins/rogue_plugin.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM data plug-in +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM data plug-in #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/pydmTop.py b/python/pyrogue/pydm/pydmTop.py index a35d6163d..61603bc52 100644 --- a/python/pyrogue/pydm/pydmTop.py +++ b/python/pyrogue/pydm/pydmTop.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Top Level GUI +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Top Level GUI #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory @@ -9,7 +12,6 @@ # copied, modified, propagated, or distributed except according to the terms # contained in the LICENSE.txt file. #----------------------------------------------------------------------------- - import os from pydm import Display from qtpy.QtWidgets import (QVBoxLayout, QTabWidget) diff --git a/python/pyrogue/pydm/rogue_plugin.py b/python/pyrogue/pydm/rogue_plugin.py index 4e14c3fb6..1ac34ae4a 100644 --- a/python/pyrogue/pydm/rogue_plugin.py +++ b/python/pyrogue/pydm/rogue_plugin.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Designer Plug-in Load +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Designer Plug-in Load #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/tools/__init__.py b/python/pyrogue/pydm/tools/__init__.py index 4884d4cd0..c361b28de 100644 --- a/python/pyrogue/pydm/tools/__init__.py +++ b/python/pyrogue/pydm/tools/__init__.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM tools directory +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/tools/generic_file_tool.py b/python/pyrogue/pydm/tools/generic_file_tool.py index 900c68315..42df13c1d 100644 --- a/python/pyrogue/pydm/tools/generic_file_tool.py +++ b/python/pyrogue/pydm/tools/generic_file_tool.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Generic File Browser +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Generic File Browser #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/tools/node_info_tool.py b/python/pyrogue/pydm/tools/node_info_tool.py index b616bab10..02ecf5e36 100644 --- a/python/pyrogue/pydm/tools/node_info_tool.py +++ b/python/pyrogue/pydm/tools/node_info_tool.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Node Info Tool +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Node Info Tool #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/tools/read_node_tool.py b/python/pyrogue/pydm/tools/read_node_tool.py index ef21fca8d..15a384794 100644 --- a/python/pyrogue/pydm/tools/read_node_tool.py +++ b/python/pyrogue/pydm/tools/read_node_tool.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Read Node Tool +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Read Node Tool #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/tools/read_recursive_tool.py b/python/pyrogue/pydm/tools/read_recursive_tool.py index 0ae2669f8..6f429d3d9 100644 --- a/python/pyrogue/pydm/tools/read_recursive_tool.py +++ b/python/pyrogue/pydm/tools/read_recursive_tool.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Read Recursive Tool +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Read Recursive Tool #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/tools/write_node_tool.py b/python/pyrogue/pydm/tools/write_node_tool.py index 438115f2a..1c828bd26 100644 --- a/python/pyrogue/pydm/tools/write_node_tool.py +++ b/python/pyrogue/pydm/tools/write_node_tool.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Write Variable Tool +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Write Variable Tool #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/tools/write_recursive_tool.py b/python/pyrogue/pydm/tools/write_recursive_tool.py index 4c4211da6..382a07896 100644 --- a/python/pyrogue/pydm/tools/write_recursive_tool.py +++ b/python/pyrogue/pydm/tools/write_recursive_tool.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Write Variable Tool +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Write Variable Tool #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory @@ -9,7 +12,6 @@ # copied, modified, propagated, or distributed except according to the terms # contained in the LICENSE.txt file. #----------------------------------------------------------------------------- - import logging from pydm.tools import ExternalTool from pydm.utilities.iconfont import IconFont diff --git a/python/pyrogue/pydm/widgets/__init__.py b/python/pyrogue/pydm/widgets/__init__.py index a4f24b290..e99c71ef1 100644 --- a/python/pyrogue/pydm/widgets/__init__.py +++ b/python/pyrogue/pydm/widgets/__init__.py @@ -1,6 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Widgets Package +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Widgets Package #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/data_writer.py b/python/pyrogue/pydm/widgets/data_writer.py index 0b2a6ae9c..a6a8f5df6 100644 --- a/python/pyrogue/pydm/widgets/data_writer.py +++ b/python/pyrogue/pydm/widgets/data_writer.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Data Writer Widget +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Data Writer Widget #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/debug_tree.py b/python/pyrogue/pydm/widgets/debug_tree.py index 72a5944d0..44bc43af8 100644 --- a/python/pyrogue/pydm/widgets/debug_tree.py +++ b/python/pyrogue/pydm/widgets/debug_tree.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Debug Tree Widget +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Debug Tree Widget #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/designer.py b/python/pyrogue/pydm/widgets/designer.py index 0747408d6..3de46ad39 100644 --- a/python/pyrogue/pydm/widgets/designer.py +++ b/python/pyrogue/pydm/widgets/designer.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Designer Setup +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Designer Setup #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/label.py b/python/pyrogue/pydm/widgets/label.py index abe13c942..cede5c79b 100644 --- a/python/pyrogue/pydm/widgets/label.py +++ b/python/pyrogue/pydm/widgets/label.py @@ -1,3 +1,17 @@ +#----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# +#----------------------------------------------------------------------------- +# This file is part of the rogue software platform. It is subject to +# the license terms in the LICENSE.txt file found in the top-level directory +# of this distribution and at: +# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. +# No part of the rogue software platform, including this file, may be +# copied, modified, propagated, or distributed except according to the terms +# contained in the LICENSE.txt file. +#----------------------------------------------------------------------------- from pydm.widgets import PyDMLabel from qtpy.QtCore import Qt from qtpy.QtWidgets import QHBoxLayout diff --git a/python/pyrogue/pydm/widgets/line_edit.py b/python/pyrogue/pydm/widgets/line_edit.py index 0e9f6a7de..023f9259a 100644 --- a/python/pyrogue/pydm/widgets/line_edit.py +++ b/python/pyrogue/pydm/widgets/line_edit.py @@ -1,3 +1,17 @@ +#----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# +#----------------------------------------------------------------------------- +# This file is part of the rogue software platform. It is subject to +# the license terms in the LICENSE.txt file found in the top-level directory +# of this distribution and at: +# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. +# No part of the rogue software platform, including this file, may be +# copied, modified, propagated, or distributed except according to the terms +# contained in the LICENSE.txt file. +#----------------------------------------------------------------------------- import locale import numpy as np import ast diff --git a/python/pyrogue/pydm/widgets/plot.py b/python/pyrogue/pydm/widgets/plot.py index 6cc30033c..222ed7e6e 100644 --- a/python/pyrogue/pydm/widgets/plot.py +++ b/python/pyrogue/pydm/widgets/plot.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Plot Window +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Plot Window #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/process.py b/python/pyrogue/pydm/widgets/process.py index 560d896b2..1556b4b9a 100644 --- a/python/pyrogue/pydm/widgets/process.py +++ b/python/pyrogue/pydm/widgets/process.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Process Widget +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Process Widget #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/root_control.py b/python/pyrogue/pydm/widgets/root_control.py index 6aba6601e..b5442cfe5 100644 --- a/python/pyrogue/pydm/widgets/root_control.py +++ b/python/pyrogue/pydm/widgets/root_control.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Root Control Widget +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Root Control Widget #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/run_control.py b/python/pyrogue/pydm/widgets/run_control.py index f050eade2..a0ebc42e2 100644 --- a/python/pyrogue/pydm/widgets/run_control.py +++ b/python/pyrogue/pydm/widgets/run_control.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Run Control Widget +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Run Control Widget #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/system_log.py b/python/pyrogue/pydm/widgets/system_log.py index 42c16a391..2db3e5e25 100644 --- a/python/pyrogue/pydm/widgets/system_log.py +++ b/python/pyrogue/pydm/widgets/system_log.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM System Log Widget +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM System Log Widget #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/system_window.py b/python/pyrogue/pydm/widgets/system_window.py index 819945e48..81b0da138 100644 --- a/python/pyrogue/pydm/widgets/system_window.py +++ b/python/pyrogue/pydm/widgets/system_window.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM System Window Widget +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM System Window Widget #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/python/pyrogue/pydm/widgets/time_plotter.py b/python/pyrogue/pydm/widgets/time_plotter.py index d795d994b..842fa496a 100644 --- a/python/pyrogue/pydm/widgets/time_plotter.py +++ b/python/pyrogue/pydm/widgets/time_plotter.py @@ -1,5 +1,8 @@ #----------------------------------------------------------------------------- -# Title : PyRogue PyDM Debug Tree Widget +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- +# Description: +# PyRogue PyDM Debug Tree Widget #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory @@ -9,7 +12,6 @@ # copied, modified, propagated, or distributed except according to the terms # contained in the LICENSE.txt file. #----------------------------------------------------------------------------- - import pyrogue from pyrogue.pydm.data_plugins.rogue_plugin import nodeFromAddress from pyrogue.pydm.widgets.debug_tree import makeVariableViewWidget diff --git a/python/pyrogue/utilities/__init__.py b/python/pyrogue/utilities/__init__.py index 9adea634f..c361b28de 100644 --- a/python/pyrogue/utilities/__init__.py +++ b/python/pyrogue/utilities/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/utilities/cpsw.py b/python/pyrogue/utilities/cpsw.py index 64df37d04..d6ef3bc97 100644 --- a/python/pyrogue/utilities/cpsw.py +++ b/python/pyrogue/utilities/cpsw.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue CPSW Export Utilities +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Tools to export Rogue modules to CPSW diff --git a/python/pyrogue/utilities/fileio/_FileReader.py b/python/pyrogue/utilities/fileio/_FileReader.py index 62c2ba822..0bb482c3c 100644 --- a/python/pyrogue/utilities/fileio/_FileReader.py +++ b/python/pyrogue/utilities/fileio/_FileReader.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue FileIO - File Reader +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Module for reading file data. diff --git a/python/pyrogue/utilities/fileio/_StreamReader.py b/python/pyrogue/utilities/fileio/_StreamReader.py index e761d837d..726bc2cd4 100644 --- a/python/pyrogue/utilities/fileio/_StreamReader.py +++ b/python/pyrogue/utilities/fileio/_StreamReader.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue FileIO - Stream Reader +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Module for reading stream data. diff --git a/python/pyrogue/utilities/fileio/_StreamWriter.py b/python/pyrogue/utilities/fileio/_StreamWriter.py index 13689667d..2282eeed3 100644 --- a/python/pyrogue/utilities/fileio/_StreamWriter.py +++ b/python/pyrogue/utilities/fileio/_StreamWriter.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue FileIO - Stream Writer +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Module for writing stream data. diff --git a/python/pyrogue/utilities/fileio/__init__.py b/python/pyrogue/utilities/fileio/__init__.py index b4a1cdb9b..dedf9920a 100644 --- a/python/pyrogue/utilities/fileio/__init__.py +++ b/python/pyrogue/utilities/fileio/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/utilities/hls/_RegInterfParser.py b/python/pyrogue/utilities/hls/_RegInterfParser.py index ab3a4769c..415c88ed4 100644 --- a/python/pyrogue/utilities/hls/_RegInterfParser.py +++ b/python/pyrogue/utilities/hls/_RegInterfParser.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue library utilities. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/utilities/hls/__init__.py b/python/pyrogue/utilities/hls/__init__.py index be5240fe4..d19c1201a 100644 --- a/python/pyrogue/utilities/hls/__init__.py +++ b/python/pyrogue/utilities/hls/__init__.py @@ -1,4 +1,6 @@ #----------------------------------------------------------------------------- +# Company : SLAC National Accelerator Laboratory +#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/python/pyrogue/utilities/prbs.py b/python/pyrogue/utilities/prbs.py index 6baebad3f..36cb78db0 100644 --- a/python/pyrogue/utilities/prbs.py +++ b/python/pyrogue/utilities/prbs.py @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# Title : PyRogue Utilities base module +# Company : SLAC National Accelerator Laboratory #----------------------------------------------------------------------------- # Description: # Module containing the utilities module class and methods diff --git a/scripts/updateDrivers.sh b/scripts/updateDrivers.sh index 8619b128a..1d94cea5a 100755 --- a/scripts/updateDrivers.sh +++ b/scripts/updateDrivers.sh @@ -1,10 +1,12 @@ #!/bin/bash # ---------------------------------------------------------------------------- -# This file is part of the rogue software platform. It is subject to +# Company : SLAC National Accelerator Laboratory +# ---------------------------------------------------------------------------- +# This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: # https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -# No part of the rogue software platform, including this file, may be +# No part of the rogue software package, including this file, may be # copied, modified, propagated, or distributed except according to the terms # contained in the LICENSE.txt file. # ---------------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 34e9952d8..7161ea2c5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,6 @@ # ---------------------------------------------------------------------------- # Title : ROGUE CMAKE Control # ---------------------------------------------------------------------------- -# File : src/CMakeLists.txt -# Created : 2018-02-27 -# ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: diff --git a/src/package.cpp b/src/package.cpp index 0dde0a8fc..2832749df 100644 --- a/src/package.cpp +++ b/src/package.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Package * ---------------------------------------------------------------------------- - * File : package.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python package setup diff --git a/src/rogue/CMakeLists.txt b/src/rogue/CMakeLists.txt index b0dcb98d4..8921a9989 100644 --- a/src/rogue/CMakeLists.txt +++ b/src/rogue/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/GeneralError.cpp b/src/rogue/GeneralError.cpp index 3bc634287..aa349c417 100644 --- a/src/rogue/GeneralError.cpp +++ b/src/rogue/GeneralError.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : General Error * ---------------------------------------------------------------------------- - * File : GeneralError.cpp - * Created : 2017-12-05 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * General exception for Rogue @@ -55,7 +52,7 @@ void rogue::GeneralError::setup_python() { bp::class_("GeneralError", bp::init()); - PyObject* typeObj = PyErr_NewException((char*)"rogue.GeneralError", PyExc_Exception, 0); + PyObject* typeObj = PyErr_NewException(const_cast("rogue.GeneralError"), PyExc_Exception, 0); bp::scope().attr("GeneralError") = bp::handle<>(bp::borrowed(typeObj)); rogue::generalErrorObj = typeObj; diff --git a/src/rogue/GilRelease.cpp b/src/rogue/GilRelease.cpp index 1d558b74d..35e3d1563 100644 --- a/src/rogue/GilRelease.cpp +++ b/src/rogue/GilRelease.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Release GIL within scope. * ---------------------------------------------------------------------------- - * File : GilRelease.cpp - * Created : 2017-02-28 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Release GIL for the scope of this class. diff --git a/src/rogue/Logging.cpp b/src/rogue/Logging.cpp index 5feac4d73..658d23395 100644 --- a/src/rogue/Logging.cpp +++ b/src/rogue/Logging.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Logging interface * ---------------------------------------------------------------------------- - * File : Logging.cpp - * Created : 2017-02-28 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Logging interface for pyrogue @@ -24,7 +21,6 @@ #include #include #include -#include #include #include @@ -105,7 +101,7 @@ void rogue::Logging::intLog(uint32_t level, const char* fmt, va_list args) { struct timeval tme; char buffer[1000]; - vsnprintf(buffer, 1000, fmt, args); + vsnprintf(buffer, sizeof(buffer), fmt, args); gettimeofday(&tme, NULL); printf("%l" PRIi32 ".%06l" PRIi32 ":%s: %s\n", tme.tv_sec, tme.tv_usec, name_.c_str(), buffer); } diff --git a/src/rogue/ScopedGil.cpp b/src/rogue/ScopedGil.cpp index f03a5da15..f5e2b83a3 100644 --- a/src/rogue/ScopedGil.cpp +++ b/src/rogue/ScopedGil.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Scoped GIL * ---------------------------------------------------------------------------- - * File : ScopedGil.h - * Created : 2017-06-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Acquire the GIL for the scope of this class. diff --git a/src/rogue/Version.cpp b/src/rogue/Version.cpp index 1f6cc82bb..92e07721d 100644 --- a/src/rogue/Version.cpp +++ b/src/rogue/Version.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue Version * ---------------------------------------------------------------------------- - * File : Version.cpp - * Created : 2017-05-17 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Version helpers for Rogue diff --git a/src/rogue/hardware/CMakeLists.txt b/src/rogue/hardware/CMakeLists.txt index e9186a15a..e7cc8aca7 100644 --- a/src/rogue/hardware/CMakeLists.txt +++ b/src/rogue/hardware/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/hardware/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/hardware/MemMap.cpp b/src/rogue/hardware/MemMap.cpp index 9279b1056..33fe8c8d1 100644 --- a/src/rogue/hardware/MemMap.cpp +++ b/src/rogue/hardware/MemMap.cpp @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Raw Memory Mapped Access * ---------------------------------------------------------------------------- - * File : MemMap.cpp - * Created : 2019-11-18 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * Raw Memory Mapped Access * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -60,7 +60,8 @@ rh::MemMap::MemMap(uint64_t base, uint32_t size) : rim::Slave(4, 0xFFFFFFFF) { if (fd_ < 0) throw(rogue::GeneralError::create("MemMap::MemMap", "Failed to open device file: %s", MAP_DEVICE)); - if ((map_ = (uint8_t*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, base)) == (void*)-1) + if ((map_ = reinterpret_cast(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, base))) == + reinterpret_cast(-1)) throw(rogue::GeneralError::create("MemMap::MemMap", "Failed to map memory to user space.")); log_->debug("Created map to 0x%" PRIx64 " with size 0x%" PRIx32, base, size); @@ -81,7 +82,7 @@ void rh::MemMap::stop() { threadEn_ = false; queue_.stop(); thread_->join(); - munmap((void*)map_, size_); + munmap(reinterpret_cast(const_cast(map_)), size_); ::close(fd_); } } @@ -129,8 +130,8 @@ void rh::MemMap::runThread() { continue; } - tPtr = (uint32_t*)tran->begin(); - mPtr = (uint32_t*)(map_ + tran->address()); + tPtr = reinterpret_cast(tran->begin()); + mPtr = const_cast(reinterpret_cast(map_ + tran->address())); while (count != tran->size()) { // Write or post diff --git a/src/rogue/hardware/axi/AxiMemMap.cpp b/src/rogue/hardware/axi/AxiMemMap.cpp index ed50c6896..2be33d6d2 100644 --- a/src/rogue/hardware/axi/AxiMemMap.cpp +++ b/src/rogue/hardware/axi/AxiMemMap.cpp @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : AXI Memory Mapped Access * ---------------------------------------------------------------------------- - * File : AxiMemMap.cpp - * Created : 2017-03-21 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * AXI Memory Mapped Access * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -61,17 +61,19 @@ rha::AxiMemMap::AxiMemMap(std::string path) : rim::Slave(4, 0xFFFFFFFF) { // Check driver version ( ApiVersion 0x05 (or less) is the 32-bit address version) if (dmaGetApiVersion(fd_) < 0x06) { throw(rogue::GeneralError("AxiMemMap::AxiMemMap", - "Bad kernel driver version detected. Please re-compile kernel driver.\n \ - Note that aes-stream-driver (v5.15.2 or earlier) and rogue (v5.11.1 or earlier) are compatible with the 32-bit address API. \ - To use later versions (64-bit address API),, you will need to upgrade both rogue and aes-stream-driver at the same time to:\n \ - \t\taes-stream-driver = v5.16.0 (or later)\n\t\trogue = v5.13.0 (or later)")); + R"(Bad kernel driver version detected. Please re-compile kernel driver. + Note that aes-stream-driver (v5.15.2 or earlier) and rogue (v5.11.1 or earlier) are compatible with the 32-bit address API. + To use later versions (64-bit address API),, you will need to upgrade both rogue and aes-stream-driver at the same time to: + \t\taes-stream-driver = v5.16.0 (or later) + \t\trogue = v5.13.0 (or later))")); } // Check for mismatch in the rogue/loaded_driver API versions if (dmaCheckVersion(fd_) < 0) { ::close(fd_); - throw(rogue::GeneralError("AxiMemMap::AxiMemMap", - "Rogue DmaDriver.h API Version (DMA_VERSION) does not match the aes-stream-driver API version")); + throw(rogue::GeneralError( + "AxiMemMap::AxiMemMap", + "Rogue DmaDriver.h API Version (DMA_VERSION) does not match the aes-stream-driver API version")); } // Start read thread @@ -113,7 +115,7 @@ void rha::AxiMemMap::runThread() { uint8_t* ptr; dataSize = sizeof(uint32_t); - ptr = (uint8_t*)(&data); + ptr = reinterpret_cast(&data); log_->logThreadId(); diff --git a/src/rogue/hardware/axi/AxiStreamDma.cpp b/src/rogue/hardware/axi/AxiStreamDma.cpp index dd8700097..40111d6a7 100644 --- a/src/rogue/hardware/axi/AxiStreamDma.cpp +++ b/src/rogue/hardware/axi/AxiStreamDma.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : AXI DMA Interface Class * ---------------------------------------------------------------------------- - * File : AxiStreamDma.h - * Created : 2017-03-21 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Class for interfacing to AxiStreamDma Driver. @@ -63,10 +60,9 @@ rha::AxiStreamDmaSharedPtr rha::AxiStreamDma::openShared(std::string path, rogue if ((it = sharedBuffers_.find(path)) != sharedBuffers_.end()) { ret = it->second; log->debug("Reusing existing shared file descriptor for %s", path.c_str()); - } - // Create new record - else { + // Create new record + } else { ret = std::make_shared(path); log->debug("Opening new shared file descriptor for %s", path.c_str()); } @@ -92,17 +88,19 @@ rha::AxiStreamDmaSharedPtr rha::AxiStreamDma::openShared(std::string path, rogue if (dmaGetApiVersion(ret->fd) < 0x06) { ::close(ret->fd); throw(rogue::GeneralError("AxiStreamDma::openShared", - "Bad kernel driver version detected. Please re-compile kernel driver.\n \ - Note that aes-stream-driver (v5.15.2 or earlier) and rogue (v5.11.1 or earlier) are compatible with the 32-bit address API. \ - To use later versions (64-bit address API),, you will need to upgrade both rogue and aes-stream-driver at the same time to:\n \ - \t\taes-stream-driver = v5.16.0 (or later)\n\t\trogue = v5.13.0 (or later)")); + R"(Bad kernel driver version detected. Please re-compile kernel driver. + Note that aes-stream-driver (v5.15.2 or earlier) and rogue (v5.11.1 or earlier) are compatible with the 32-bit address API. + To use later versions (64-bit address API),, you will need to upgrade both rogue and aes-stream-driver at the same time to: + \t\taes-stream-driver = v5.16.0 (or later) + \t\trogue = v5.13.0 (or later))")); } // Check for mismatch in the rogue/loaded_driver API versions if (dmaCheckVersion(ret->fd) < 0) { ::close(ret->fd); - throw(rogue::GeneralError("AxiStreamDma::openShared", - "Rogue DmaDriver.h API Version (DMA_VERSION) does not match the aes-stream-driver API version")); + throw(rogue::GeneralError( + "AxiStreamDma::openShared", + "Rogue DmaDriver.h API Version (DMA_VERSION) does not match the aes-stream-driver API version")); } // Result may be that rawBuff = NULL @@ -132,7 +130,9 @@ void rha::AxiStreamDma::closeShared(rha::AxiStreamDmaSharedPtr desc) { desc->openCount--; if (desc->openCount == 0) { - if (desc->rawBuff != NULL) { dmaUnMapDma(desc->fd, desc->rawBuff); } + if (desc->rawBuff != NULL) { + dmaUnMapDma(desc->fd, desc->rawBuff); + } ::close(desc->fd); desc->fd = -1; @@ -279,10 +279,9 @@ ris::FramePtr rha::AxiStreamDma::acceptReq(uint32_t size, bool zeroCopyEn) { // Zero copy is disabled. Allocate from memory. if (zeroCopyEn == false || desc_->rawBuff == NULL) { frame = reqLocalFrame(size, false); - } - // Allocate zero copy buffers from driver - else { + // Allocate zero copy buffers from driver + } else { rogue::GilRelease noGil; // Create empty frame @@ -353,17 +352,17 @@ void rha::AxiStreamDma::acceptFrame(ris::FramePtr frame) { if (it == frame->beginBuffer()) { fuser = frame->getFirstUser(); if (enSsi_) fuser |= 0x2; - } else + } else { fuser = 0; + } // Last Buffer if (it == (frame->endBuffer() - 1)) { cont = 0; luser = frame->getLastUser(); - } - // Continue flag is set if this is not the last (*it)er - else { + // Continue flag is set if this is not the last (*it)er + } else { cont = 1; luser = 0; } @@ -390,10 +389,9 @@ void rha::AxiStreamDma::acceptFrame(ris::FramePtr frame) { meta |= 0x40000000; (*it)->setMeta(meta); } - } - // Write to pgp with (*it)er copy in driver - else { + // Write to pgp with (*it)er copy in driver + } else { // Keep trying since select call can fire // but write fails because we did not win the (*it)er lock do { @@ -418,10 +416,7 @@ void rha::AxiStreamDma::acceptFrame(ris::FramePtr frame) { throw(rogue::GeneralError("AxiStreamDma::acceptFrame", "AXIS Write Call Failed!!!!")); } } - } - - // Exit out if return flag was set false - while (res == 0); + } while (res == 0); // Exit out if return flag was set false } } @@ -451,8 +446,8 @@ void rha::AxiStreamDma::retBuffer(uint8_t* data, uint32_t meta, uint32_t size) { if ( count > 100 ) count = 100; for (x=0; x < count; x++) ret[x] = retQueue_.pop() & 0x3FFFFFFF; - if ( dmaRetIndexes(fd_,count,ret) < 0 ) - throw(rogue::GeneralError("AxiStreamDma::retBuffer","AXIS Return Buffer Call Failed!!!!")); + if ( dmaRetIndexes(fd_, count, ret) < 0 ) + throw(rogue::GeneralError("AxiStreamDma::retBuffer", "AXIS Return Buffer Call Failed!!!!")); decCounter(size*count); printf("Return done\n"); @@ -465,11 +460,11 @@ void rha::AxiStreamDma::retBuffer(uint8_t* data, uint32_t meta, uint32_t size) { #endif } decCounter(size); - } - // Buffer is allocated from Pool class - else + // Buffer is allocated from Pool class + } else { Pool::retBuffer(data, meta, size); + } } //! Run thread @@ -523,10 +518,9 @@ void rha::AxiStreamDma::runThread(std::weak_ptr lockPtr) { rxCount = rxSize[0]; else rxCount = 1; - } - // Zero copy read - else { + // Zero copy read + } else { // Attempt read, dest is not needed since only one lane/vc is open rxCount = dmaReadBulkIndex(fd_, RxBufferCount, rxSize, meta, rxFlags, rxError, NULL); diff --git a/src/rogue/hardware/axi/CMakeLists.txt b/src/rogue/hardware/axi/CMakeLists.txt index 2e5a0231e..112608603 100644 --- a/src/rogue/hardware/axi/CMakeLists.txt +++ b/src/rogue/hardware/axi/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/hardware/axi/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/hardware/axi/module.cpp b/src/rogue/hardware/axi/module.cpp index 0ae5fbf9b..dc27cc1ff 100644 --- a/src/rogue/hardware/axi/module.cpp +++ b/src/rogue/hardware/axi/module.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Created : 2017-03-21 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/hardware/module.cpp b/src/rogue/hardware/module.cpp index 2ca409cda..5cc45ecc2 100644 --- a/src/rogue/hardware/module.cpp +++ b/src/rogue/hardware/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/interfaces/CMakeLists.txt b/src/rogue/interfaces/CMakeLists.txt index 0bf1155a3..8ee5c9bfa 100644 --- a/src/rogue/interfaces/CMakeLists.txt +++ b/src/rogue/interfaces/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/interfaces/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/interfaces/ZmqClient.cpp b/src/rogue/interfaces/ZmqClient.cpp index ba60f1a07..cc37bf36e 100644 --- a/src/rogue/interfaces/ZmqClient.cpp +++ b/src/rogue/interfaces/ZmqClient.cpp @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue ZMQ Control Interface * ---------------------------------------------------------------------------- - * File : ZmqClient.cpp - * Created : 2019-05-02 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * Rogue ZMQ Control Interface * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -74,7 +74,7 @@ rogue::interfaces::ZmqClient::ZmqClient(std::string addr, uint16_t port, bool do temp = "tcp://"; temp.append(addr); temp.append(":"); - temp.append(std::to_string(static_cast(port))); + temp.append(std::to_string(static_cast(port))); if (zmq_setsockopt(this->zmqSub_, ZMQ_SUBSCRIBE, "", 0) != 0) throw(rogue::GeneralError("ZmqClient::ZmqClient", "Failed to set socket subscribe")); @@ -90,14 +90,15 @@ rogue::interfaces::ZmqClient::ZmqClient(std::string addr, uint16_t port, bool do addr.c_str())); reqPort = port + 1; - } else + } else { reqPort = port + 2; + } // Setup request port temp = "tcp://"; temp.append(addr); temp.append(":"); - temp.append(std::to_string(static_cast(reqPort))); + temp.append(std::to_string(static_cast(reqPort))); waitRetry_ = false; // Don't keep waiting after timeout timeout_ = 1000; // 1 second @@ -186,16 +187,18 @@ std::string rogue::interfaces::ZmqClient::sendString(std::string path, std::stri while (1) { zmq_msg_init(&msg); if (zmq_recvmsg(this->zmqReq_, &msg, 0) <= 0) { - seconds += (float)timeout_ / 1000.0; + seconds += static_cast(timeout_) / 1000.0; if (waitRetry_) { log_->error("Timeout waiting for response after %f Seconds, server may be busy! Waiting...", seconds); zmq_msg_close(&msg); - } else + } else { throw rogue::GeneralError::create("ZmqClient::sendString", "Timeout waiting for response after %f Seconds.", seconds); - } else + } + } else { break; + } } if (seconds != 0) log_->error("Finally got response from server after %f seconds!", seconds); @@ -246,18 +249,20 @@ bp::object rogue::interfaces::ZmqClient::send(bp::object value) { while (1) { zmq_msg_init(&rxMsg); if (zmq_recvmsg(this->zmqReq_, &rxMsg, 0) <= 0) { - seconds += (float)timeout_ / 1000.0; + seconds += static_cast(timeout_) / 1000.0; if (waitRetry_) { log_->error("Timeout waiting for response after %f Seconds, server may be busy! Waiting...", seconds); zmq_msg_close(&rxMsg); - } else + } else { throw rogue::GeneralError::create( "ZmqClient::send", "Timeout waiting for response after %f Seconds, server may be busy!", seconds); - } else + } + } else { break; + } } } @@ -283,7 +288,9 @@ void rogue::interfaces::ZmqClientWrap::doUpdate(bp::object data) { if (bp::override f = this->get_override("_doUpdate")) { try { f(data); - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } rogue::interfaces::ZmqClient::doUpdate(data); } diff --git a/src/rogue/interfaces/ZmqServer.cpp b/src/rogue/interfaces/ZmqServer.cpp index 9aa15d10c..d7a967b52 100644 --- a/src/rogue/interfaces/ZmqServer.cpp +++ b/src/rogue/interfaces/ZmqServer.cpp @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue ZMQ Control Interface * ---------------------------------------------------------------------------- - * File : ZmqServer.cpp - * Created : 2019-05-02 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * Rogue ZMQ Control Interface * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -82,8 +82,9 @@ void rogue::interfaces::ZmqServer::start() { res = this->tryConnect(); if (res) break; } - } else + } else { res = this->tryConnect(); + } if (!res) { if (port == 0) @@ -162,7 +163,7 @@ bool rogue::interfaces::ZmqServer::tryConnect() { temp = "tcp://"; temp.append(this->addr_); temp.append(":"); - temp.append(std::to_string(static_cast(this->basePort_))); + temp.append(std::to_string(static_cast(this->basePort_))); if (zmq_bind(this->zmqPub_, temp.c_str()) < 0) { zmq_close(this->zmqPub_); @@ -176,7 +177,7 @@ bool rogue::interfaces::ZmqServer::tryConnect() { temp = "tcp://"; temp.append(this->addr_); temp.append(":"); - temp.append(std::to_string(static_cast(this->basePort_ + 1))); + temp.append(std::to_string(static_cast(this->basePort_ + 1))); if (zmq_bind(this->zmqRep_, temp.c_str()) < 0) { zmq_close(this->zmqPub_); @@ -190,7 +191,7 @@ bool rogue::interfaces::ZmqServer::tryConnect() { temp = "tcp://"; temp.append(this->addr_); temp.append(":"); - temp.append(std::to_string(static_cast(this->basePort_ + 2))); + temp.append(std::to_string(static_cast(this->basePort_ + 2))); if (zmq_bind(this->zmqStr_, temp.c_str()) < 0) { zmq_close(this->zmqPub_); @@ -242,7 +243,9 @@ bp::object rogue::interfaces::ZmqServerWrap::doRequest(bp::object data) { if (bp::override f = this->get_override("_doRequest")) { try { return (f(data)); - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } return (rogue::interfaces::ZmqServer::doRequest(data)); } @@ -257,7 +260,9 @@ std::string rogue::interfaces::ZmqServerWrap::doString(std::string data) { if (bp::override f = this->get_override("_doString")) { try { return (f(data)); - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } } return (rogue::interfaces::ZmqServer::doString(data)); diff --git a/src/rogue/interfaces/api/Bsp.cpp b/src/rogue/interfaces/api/Bsp.cpp index bb8a8df5d..b4b8d3066 100644 --- a/src/rogue/interfaces/api/Bsp.cpp +++ b/src/rogue/interfaces/api/Bsp.cpp @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : C++ API Bsp * ---------------------------------------------------------------------------- - * File : Bsp.cpp - * Created : 2023-04-18 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * C++ API BSP (Board Support Package) * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -55,7 +55,9 @@ ria::Bsp::Bsp(std::string modName, std::string rootClass) { } ria::Bsp::~Bsp() { - if (this->_isRoot) { this->_obj.attr("stop")(); } + if (this->_isRoot) { + this->_obj.attr("stop")(); + } } void ria::Bsp::addVarListener(void (*func)(std::string, std::string), void (*done)()) { @@ -109,14 +111,18 @@ std::shared_ptr ria::Bsp::getNode(std::string name) std::string ria::Bsp::operator()(std::string arg) { try { return (std::string(bp::extract(this->_obj.attr("callDisp")(arg)))); - } catch (...) { throw(rogue::GeneralError::create("Bsp::()", "Error executing node %s", this->_name.c_str())); } + } catch (...) { + throw(rogue::GeneralError::create("Bsp::()", "Error executing node %s", this->_name.c_str())); + } } //! Execute command operator without arg std::string ria::Bsp::operator()() { try { return (std::string(bp::extract(this->_obj.attr("callDisp")()))); - } catch (...) { throw(rogue::GeneralError::create("Bsp::()", "Error executing node %s", this->_name.c_str())); } + } catch (...) { + throw(rogue::GeneralError::create("Bsp::()", "Error executing node %s", this->_name.c_str())); + } } //! Execute command diff --git a/src/rogue/interfaces/api/CMakeLists.txt b/src/rogue/interfaces/api/CMakeLists.txt index 7f9140e1d..a5a691ee7 100644 --- a/src/rogue/interfaces/api/CMakeLists.txt +++ b/src/rogue/interfaces/api/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/interfaces/api/CMakeLists.txt -# Created : 2023-04-17 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/interfaces/memory/Block.cpp b/src/rogue/interfaces/memory/Block.cpp index 2b9bb3a56..ea1de57cd 100644 --- a/src/rogue/interfaces/memory/Block.cpp +++ b/src/rogue/interfaces/memory/Block.cpp @@ -1,11 +1,9 @@ -/* - *----------------------------------------------------------------------------- - * Title : Memory Block +/** * ---------------------------------------------------------------------------- - * File : Block.cpp + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: - * Interface between RemoteVariables and lower level memory transactions. + * Interface between RemoteVariables and lower level memory transactions. * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -99,13 +97,13 @@ rim::Block::Block(uint64_t offset, uint32_t size) { verifyBase_ = 0; // Verify Range verifySize_ = 0; // Verify Range - blockData_ = (uint8_t*)malloc(size_); + blockData_ = reinterpret_cast(malloc(size_)); memset(blockData_, 0, size_); - verifyData_ = (uint8_t*)malloc(size_); + verifyData_ = reinterpret_cast(malloc(size_)); memset(verifyData_, 0, size_); - verifyMask_ = (uint8_t*)malloc(size_); + verifyMask_ = reinterpret_cast(malloc(size_)); memset(verifyMask_, 0, size_); } @@ -174,11 +172,10 @@ void rim::Block::intStartTransaction(uint32_t type, bool forceWr, bool check, ri std::vector::iterator vit; // Check for valid combinations - if ((type == rim::Write and ((mode_ == "RO") || (!stale_ && !forceWr))) || - (type == rim::Post and (mode_ == "RO")) || (type == rim::Read and ((mode_ == "WO") || stale_)) || - (type == rim::Verify and ((mode_ == "WO") || (mode_ == "RO") || stale_ || !verifyReq_))) + if ((type == rim::Write && ((mode_ == "RO") || (!stale_ && !forceWr))) || (type == rim::Post && (mode_ == "RO")) || + (type == rim::Read && ((mode_ == "WO") || stale_)) || + (type == rim::Verify && ((mode_ == "WO") || (mode_ == "RO") || stale_ || !verifyReq_))) return; - { rogue::GilRelease noGil; std::lock_guard lock(mtx_); @@ -191,7 +188,9 @@ void rim::Block::intStartTransaction(uint32_t type, bool forceWr, bool check, ri highByte = size_ - 1; if (type == rim::Write || type == rim::Post) { stale_ = false; - for (vit = variables_.begin(); vit != variables_.end(); ++vit) { (*vit)->stale_ = false; } + for (vit = variables_.begin(); vit != variables_.end(); ++vit) { + (*vit)->stale_ = false; + } } } else { if (type == rim::Read || type == rim::Verify) { @@ -229,10 +228,9 @@ void rim::Block::intStartTransaction(uint32_t type, bool forceWr, bool check, ri tSize = verifySize_; tData = verifyData_ + verifyBase_; verifyInp_ = true; - } - // Not a verify transaction - else { + // Not a verify transaction + } else { // Derive offset and size based upon min transaction size tOff = lowByte; tSize = (highByte - lowByte) + 1; @@ -277,10 +275,7 @@ void rim::Block::startTransaction(uint32_t type, bool forceWr, bool check, rim:: try { if (check || retryCount_ > 0) checkTransaction(); - - // Success - count = retryCount_; - + count = retryCount_; // Success } catch (rogue::GeneralError err) { fWr = true; // Stale state is now lost @@ -320,10 +315,7 @@ void rim::Block::startTransactionPy(uint32_t type, bool forceWr, bool check, rim try { if (check || retryCount_ > 0) upd = checkTransaction(); - - // Success - count = retryCount_; - + count = retryCount_; // Success } catch (rogue::GeneralError err) { fWr = true; // Stale state is now lost @@ -475,21 +467,21 @@ void rim::Block::addVariables(std::vector variables) { if (mode_ != (*vit)->mode_) mode_ = "RW"; // Update variable masks for standard variable - if ((*vit)->numValues_ == 0 ) { - + if ((*vit)->numValues_ == 0) { for (x = 0; x < (*vit)->bitOffset_.size(); x++) { - // Variable allows overlaps, add to overlap enable mask - if ((*vit)->overlapEn_) setBits(oleMask, (*vit)->bitOffset_[x], (*vit)->bitSize_[x]); + if ((*vit)->overlapEn_) { + setBits(oleMask, (*vit)->bitOffset_[x], (*vit)->bitSize_[x]); - // Otherwise add to exclusive mask and check for existing mapping - else { + // Otherwise add to exclusive mask and check for existing mapping + } else { if (anyBits(excMask, (*vit)->bitOffset_[x], (*vit)->bitSize_[x])) - throw(rogue::GeneralError::create("Block::addVariables", - "Variable bit overlap detected for block %s with address 0x%.8x and variable %s", - path_.c_str(), - address(), - (*vit)->name_.c_str())); + throw(rogue::GeneralError::create( + "Block::addVariables", + "Variable bit overlap detected for block %s with address 0x%.8x and variable %s", + path_.c_str(), + address(), + (*vit)->name_.c_str())); setBits(excMask, (*vit)->bitOffset_[x], (*vit)->bitSize_[x]); } @@ -501,7 +493,8 @@ void rim::Block::addVariables(std::vector variables) { } bLog_->debug( - "Adding variable %s to block %s at offset 0x%.8x, bitIdx=%i, bitOffset %i, bitSize %i, mode %s, verifyEn " + "Adding variable %s to block %s at offset 0x%.8x, bitIdx=%i, bitOffset %i, bitSize %i, mode %s, " + "verifyEn " "%d " PRIx64, (*vit)->name_.c_str(), path_.c_str(), @@ -513,22 +506,22 @@ void rim::Block::addVariables(std::vector variables) { (*vit)->verifyEn_); } - // List variables - } else{ - + // List variables + } else { for (x = 0; x < (*vit)->numValues_; x++) { - // Variable allows overlaps, add to overlap enable mask - if ((*vit)->overlapEn_) setBits(oleMask, x * (*vit)->valueStride_ + (*vit)->bitOffset_[0], (*vit)->valueBits_); + if ((*vit)->overlapEn_) { + setBits(oleMask, x * (*vit)->valueStride_ + (*vit)->bitOffset_[0], (*vit)->valueBits_); - // Otherwise add to exclusive mask and check for existing mapping - else { + // Otherwise add to exclusive mask and check for existing mapping + } else { if (anyBits(excMask, x * (*vit)->valueStride_ + (*vit)->bitOffset_[0], (*vit)->valueBits_)) - throw(rogue::GeneralError::create("Block::addVariables", - "Variable bit overlap detected for block %s with address 0x%.8x and variable %s", - path_.c_str(), - address(), - (*vit)->name_.c_str())); + throw(rogue::GeneralError::create( + "Block::addVariables", + "Variable bit overlap detected for block %s with address 0x%.8x and variable %s", + path_.c_str(), + address(), + (*vit)->name_.c_str())); setBits(excMask, x * (*vit)->valueStride_ + (*vit)->bitOffset_[0], (*vit)->valueBits_); } @@ -540,7 +533,8 @@ void rim::Block::addVariables(std::vector variables) { } bLog_->debug( - "Adding variable %s to block %s at offset 0x%.8x, index=%i, valueOffset=%i, valueBits %i, mode %s, verifyEn %d", + "Adding variable %s to block %s at offset 0x%.8x, index=%i, valueOffset=%i, valueBits %i, mode %s, " + "verifyEn %d", (*vit)->name_.c_str(), path_.c_str(), offset_, @@ -635,15 +629,15 @@ void rim::Block::setBytes(const uint8_t* data, rim::Variable* var, uint32_t inde // Change byte order, need to make a copy if (var->byteReverse_) { - buff = (uint8_t*)malloc(var->valueBytes_); + buff = reinterpret_cast(malloc(var->valueBytes_)); memcpy(buff, data, var->valueBytes_); reverseBytes(buff, var->valueBytes_); - } else - buff = (uint8_t*)data; + } else { + buff = const_cast(reinterpret_cast(data)); + } // List variable if (var->numValues_ != 0) { - // Verify range if (index < 0 || index >= var->numValues_) throw(rogue::GeneralError::create("Block::setBytes", @@ -661,27 +655,25 @@ void rim::Block::setBytes(const uint8_t* data, rim::Variable* var, uint32_t inde if (var->stale_) { if (var->lowTranByte_[index] < var->staleLowByte_) var->staleLowByte_ = var->lowTranByte_[index]; - if (var->highTranByte_[index] > var->staleHighByte_) - var->staleHighByte_ = var->highTranByte_[index]; + if (var->highTranByte_[index] > var->staleHighByte_) var->staleHighByte_ = var->highTranByte_[index]; } else { var->staleLowByte_ = var->lowTranByte_[index]; var->staleHighByte_ = var->highTranByte_[index]; } - } - // Standard variable - else { + // Standard variable + } else { var->staleLowByte_ = var->lowTranByte_[0]; var->staleHighByte_ = var->highTranByte_[0]; // Fast copy - if (var->fastByte_ != NULL) + if (var->fastByte_ != NULL) { memcpy(blockData_ + var->fastByte_[0], buff, var->valueBytes_); - else if (var->bitOffset_.size() == 1) + } else if (var->bitOffset_.size() == 1) { copyBits(blockData_, var->bitOffset_[0], buff, 0, var->bitSize_[0]); - else { + } else { srcBit = 0; for (x = 0; x < var->bitOffset_.size(); x++) { copyBits(blockData_, var->bitOffset_[x], buff, srcBit, var->bitSize_[x]); @@ -716,17 +708,16 @@ void rim::Block::getBytes(uint8_t* data, rim::Variable* var, uint32_t index) { else copyBits(data, 0, blockData_, var->bitOffset_[0] + (index * var->valueStride_), var->valueBits_); - } - else { + } else { // Fast copy - if (var->fastByte_ != NULL) + if (var->fastByte_ != NULL) { memcpy(data, blockData_ + var->fastByte_[0], var->valueBytes_); - else if (var->bitOffset_.size() == 1) + } else if (var->bitOffset_.size() == 1) { copyBits(data, 0, blockData_, var->bitOffset_[0], var->bitSize_[0]); - else { + } else { dstBit = 0; for (x = 0; x < var->bitOffset_.size(); x++) { copyBits(data, dstBit, blockData_, var->bitOffset_[x], var->bitSize_[x]); @@ -736,7 +727,9 @@ void rim::Block::getBytes(uint8_t* data, rim::Variable* var, uint32_t index) { } // Change byte order - if (var->byteReverse_) { reverseBytes(data, var->valueBytes_); } + if (var->byteReverse_) { + reverseBytes(data, var->valueBytes_); + } } ////////////////////////////////////////// @@ -758,10 +751,9 @@ void rim::Block::setPyFunc(bp::object& value, rim::Variable* var, int32_t index) throw(rogue::GeneralError::create("Block::setPyFunc", "Passing ndarray not supported for %s", var->name_.c_str())); - } - // Is passed value a list - else if (PyList_Check(value.ptr())) { + // Is passed value a list + } else if (PyList_Check(value.ptr())) { bp::list vl = bp::extract(value); uint32_t vlen = len(vl); @@ -783,13 +775,12 @@ void rim::Block::setPyFunc(bp::object& value, rim::Variable* var, int32_t index) "Failed to extract byte array for %s", var->name_.c_str())); - setBytes((uint8_t*)valueBuf.buf, var, index + x); + setBytes(reinterpret_cast(valueBuf.buf), var, index + x); PyBuffer_Release(&valueBuf); } - } - // Single value - else { + // Single value + } else { // Call python function bp::object ret = ((rim::VariableWrap*)var)->toBytes(value); @@ -798,7 +789,7 @@ void rim::Block::setPyFunc(bp::object& value, rim::Variable* var, int32_t index) "Failed to extract byte array from pyFunc return value for %s", var->name_.c_str())); - setBytes((uint8_t*)valueBuf.buf, var, index); + setBytes(reinterpret_cast(valueBuf.buf), var, index); PyBuffer_Release(&valueBuf); } } @@ -813,10 +804,8 @@ bp::object rim::Block::getPyFunc(rim::Variable* var, int32_t index) { "Accessing unindexed value not support for %s", var->name_.c_str())); - } - - // Single value - else { + // Single value + } else { memset(getBuffer, 0, var->valueBytes_); getBytes(getBuffer, var, index); @@ -854,7 +843,7 @@ void rim::Block::setByteArrayPy(bp::object& value, rim::Variable* var, int32_t i "Failed to extract byte array for %s", var->name_.c_str())); - setBytes((uint8_t*)valueBuf.buf, var, index); + setBytes(reinterpret_cast(valueBuf.buf), var, index); PyBuffer_Release(&valueBuf); } @@ -931,15 +920,14 @@ void rim::Block::setUIntPy(bp::object& value, rim::Variable* var, int32_t index) } else if (PyArray_TYPE(arr) == NPY_UINT32) { uint32_t* src = reinterpret_cast(PyArray_DATA(arr)); for (x = 0; x < dims[0]; x++) setUInt(src[x], var, index + x); - } else + } else { throw(rogue::GeneralError::create("Block::setUIntPy", "Passed nparray is not of type (uint64 or uint32) for %s", var->name_.c_str())); + } - } - - // Is passed value a list - else if (PyList_Check(value.ptr())) { + // Is passed value a list + } else if (PyList_Check(value.ptr())) { bp::list vl = bp::extract(value); uint32_t vlen = len(vl); @@ -962,10 +950,9 @@ void rim::Block::setUIntPy(bp::object& value, rim::Variable* var, int32_t index) setUInt(tmp, var, index + x); } - } - // Passed scalar numpy value - else if (PyArray_CheckScalar(value.ptr())) { + // Passed scalar numpy value + } else if (PyArray_CheckScalar(value.ptr())) { if (PyArray_DescrFromScalar(value.ptr())->type_num == NPY_UINT64) { uint64_t val; PyArray_ScalarAsCtype(value.ptr(), &val); @@ -974,9 +961,10 @@ void rim::Block::setUIntPy(bp::object& value, rim::Variable* var, int32_t index) uint32_t val; PyArray_ScalarAsCtype(value.ptr(), &val); setUInt(val, var, index); - } else + } else { throw( rogue::GeneralError::create("Block::setUIntPy", "Failed to extract value for %s.", var->name_.c_str())); + } } else { bp::extract tmp(value); @@ -1038,14 +1026,14 @@ void rim::Block::setUInt(const uint64_t& val, rim::Variable* var, int32_t index) var->minValue_, var->maxValue_)); - setBytes((uint8_t*)&val, var, index); + setBytes(reinterpret_cast(const_cast(&val)), var, index); } // Get data using unsigned int uint64_t rim::Block::getUInt(rim::Variable* var, int32_t index) { uint64_t tmp = 0; - getBytes((uint8_t*)&tmp, var, index); + getBytes(reinterpret_cast(&tmp), var, index); return tmp; } @@ -1090,15 +1078,14 @@ void rim::Block::setIntPy(bp::object& value, rim::Variable* var, int32_t index) } else if (PyArray_TYPE(arr) == NPY_INT32) { int32_t* src = reinterpret_cast(PyArray_DATA(arr)); for (x = 0; x < dims[0]; x++) setInt(src[x], var, index + x); - } else + } else { throw(rogue::GeneralError::create("Block::setIntPy", "Passed nparray is not of type (int64 or int32) for %s", var->name_.c_str())); + } - } - - // Is passed value a list - else if (PyList_Check(value.ptr())) { + // Is passed value a list + } else if (PyList_Check(value.ptr())) { bp::list vl = bp::extract(value); uint32_t vlen = len(vl); @@ -1121,10 +1108,9 @@ void rim::Block::setIntPy(bp::object& value, rim::Variable* var, int32_t index) setInt(tmp, var, index + x); } - } - // Passed scalar numpy value - else if (PyArray_CheckScalar(value.ptr())) { + // Passed scalar numpy value + } else if (PyArray_CheckScalar(value.ptr())) { if (PyArray_DescrFromScalar(value.ptr())->type_num == NPY_INT64) { int64_t val; PyArray_ScalarAsCtype(value.ptr(), &val); @@ -1133,9 +1119,10 @@ void rim::Block::setIntPy(bp::object& value, rim::Variable* var, int32_t index) int32_t val; PyArray_ScalarAsCtype(value.ptr(), &val); setInt(val, var, index); - } else + } else { throw( rogue::GeneralError::create("Block::setIntPy", "Failed to extract value for %s.", var->name_.c_str())); + } } else { bp::extract tmp(value); @@ -1198,14 +1185,14 @@ void rim::Block::setInt(const int64_t& val, rim::Variable* var, int32_t index) { var->maxValue_)); // This works because all bits between the msb and bit 64 are set to '1' for a negative value - setBytes((uint8_t*)&val, var, index); + setBytes(reinterpret_cast(const_cast(&val)), var, index); } // Get data using int int64_t rim::Block::getInt(rim::Variable* var, int32_t index) { int64_t tmp = 0; - getBytes((uint8_t*)&tmp, var, index); + getBytes(reinterpret_cast(&tmp), var, index); if (var->valueBits_ != 64) { if (tmp >= (uint64_t)pow(2, var->valueBits_ - 1)) tmp -= (uint64_t)pow(2, var->valueBits_); @@ -1250,15 +1237,14 @@ void rim::Block::setBoolPy(bp::object& value, rim::Variable* var, int32_t index) if (PyArray_TYPE(arr) == NPY_BOOL) { bool* src = reinterpret_cast(PyArray_DATA(arr)); for (x = 0; x < dims[0]; x++) setBool(src[x], var, index + x); - } else + } else { throw(rogue::GeneralError::create("Block::setBoolPy", "Passed nparray is not of type (bool) for %s", var->name_.c_str())); + } - } - - // Is passed value a list - else if (PyList_Check(value.ptr())) { + // Is passed value a list + } else if (PyList_Check(value.ptr())) { bp::list vl = bp::extract(value); uint32_t vlen = len(vl); @@ -1281,17 +1267,17 @@ void rim::Block::setBoolPy(bp::object& value, rim::Variable* var, int32_t index) setBool(tmp, var, index + x); } - } - // Passed scalar numpy value - else if (PyArray_CheckScalar(value.ptr())) { + // Passed scalar numpy value + } else if (PyArray_CheckScalar(value.ptr())) { if (PyArray_DescrFromScalar(value.ptr())->type_num == NPY_BOOL) { bool val; PyArray_ScalarAsCtype(value.ptr(), &val); setBool(val, var, index); - } else + } else { throw( rogue::GeneralError::create("Block::setBoolPy", "Failed to extract value for %s.", var->name_.c_str())); + } } else { bp::extract tmp(value); @@ -1320,9 +1306,8 @@ bp::object rim::Block::getBoolPy(rim::Variable* var, int32_t index) { boost::python::handle<> handle(obj); ret = bp::object(handle); - } - else { + } else { bp::handle<> handle(bp::borrowed(getBool(var, index) ? Py_True : Py_False)); ret = bp::object(handle); } @@ -1334,14 +1319,14 @@ bp::object rim::Block::getBoolPy(rim::Variable* var, int32_t index) { // Set data using bool void rim::Block::setBool(const bool& value, rim::Variable* var, int32_t index) { uint8_t val = (uint8_t)value; - setBytes((uint8_t*)&val, var, index); + setBytes(reinterpret_cast(&val), var, index); } // Get data using bool bool rim::Block::getBool(rim::Variable* var, int32_t index) { uint8_t tmp = 0; - getBytes((uint8_t*)&tmp, var, index); + getBytes(reinterpret_cast(&tmp), var, index); return tmp ? true : false; } @@ -1400,7 +1385,7 @@ void rim::Block::setString(const std::string& value, rim::Variable* var, int32_t memset(getBuffer, 0, var->valueBytes_); - strncpy((char*)getBuffer, value.c_str(), var->valueBytes_ - 1); + strncpy(reinterpret_cast(getBuffer), value.c_str(), var->valueBytes_ - 1); setBytes(getBuffer, var, index); } @@ -1418,7 +1403,7 @@ void rim::Block::getString(rim::Variable* var, std::string& retString, int32_t i memset(getBuffer, 0, var->valueBytes_ + 1); - getBytes((uint8_t*)getBuffer, var, index); + getBytes(reinterpret_cast(getBuffer), var, index); retString = getBuffer; } @@ -1460,14 +1445,14 @@ void rim::Block::setFloatPy(bp::object& value, rim::Variable* var, int32_t index if (PyArray_TYPE(arr) == NPY_FLOAT32) { float* src = reinterpret_cast(PyArray_DATA(arr)); for (x = 0; x < dims[0]; x++) setFloat(src[x], var, index + x); - } else + } else { throw(rogue::GeneralError::create("Block::setFLoatPy", "Passed nparray is not of type (float32) for %s", var->name_.c_str())); - } + } - // Is passed value a list - else if (PyList_Check(value.ptr())) { + // Is passed value a list + } else if (PyList_Check(value.ptr())) { bp::list vl = bp::extract(value); uint32_t vlen = len(vl); @@ -1490,18 +1475,18 @@ void rim::Block::setFloatPy(bp::object& value, rim::Variable* var, int32_t index setFloat(tmp, var, index + x); } - } - // Passed scalar numpy value - else if (PyArray_CheckScalar(value.ptr())) { + // Passed scalar numpy value + } else if (PyArray_CheckScalar(value.ptr())) { if (PyArray_DescrFromScalar(value.ptr())->type_num == NPY_FLOAT32) { float val; PyArray_ScalarAsCtype(value.ptr(), &val); setFloat(val, var, index); - } else + } else { throw(rogue::GeneralError::create("Block::setFloatPy", "Failed to extract value for %s.", var->name_.c_str())); + } } else { bp::extract tmp(value); @@ -1531,9 +1516,8 @@ bp::object rim::Block::getFloatPy(rim::Variable* var, int32_t index) { boost::python::handle<> handle(obj); ret = bp::object(handle); - } - else { + } else { PyObject* val = Py_BuildValue("f", getFloat(var, index)); if (val == NULL) throw(rogue::GeneralError::create("Block::getFloatPy", "Failed to generate Float")); @@ -1557,14 +1541,14 @@ void rim::Block::setFloat(const float& val, rim::Variable* var, int32_t index) { var->minValue_, var->maxValue_)); - setBytes((uint8_t*)&val, var, index); + setBytes(reinterpret_cast(const_cast(&val)), var, index); } // Get data using float float rim::Block::getFloat(rim::Variable* var, int32_t index) { float tmp = 0; - getBytes((uint8_t*)&tmp, var, index); + getBytes(reinterpret_cast(&tmp), var, index); return tmp; } @@ -1606,15 +1590,14 @@ void rim::Block::setDoublePy(bp::object& value, rim::Variable* var, int32_t inde if (PyArray_TYPE(arr) == NPY_FLOAT64) { double* src = reinterpret_cast(PyArray_DATA(arr)); for (x = 0; x < dims[0]; x++) setDouble(src[x], var, index + x); - } else + } else { throw(rogue::GeneralError::create("Block::setFLoatPy", "Passed nparray is not of type (double) for %s", var->name_.c_str())); + } - } - - // Is passed value a list - else if (PyList_Check(value.ptr())) { + // Is passed value a list + } else if (PyList_Check(value.ptr())) { bp::list vl = bp::extract(value); uint32_t vlen = len(vl); @@ -1637,18 +1620,18 @@ void rim::Block::setDoublePy(bp::object& value, rim::Variable* var, int32_t inde setDouble(tmp, var, index + x); } - } - // Passed scalar numpy value - else if (PyArray_CheckScalar(value.ptr())) { + // Passed scalar numpy value + } else if (PyArray_CheckScalar(value.ptr())) { if (PyArray_DescrFromScalar(value.ptr())->type_num == NPY_FLOAT64) { double val; PyArray_ScalarAsCtype(value.ptr(), &val); setDouble(val, var, index); - } else + } else { throw(rogue::GeneralError::create("Block::setDoublePy", "Failed to extract value for %s.", var->name_.c_str())); + } } else { bp::extract tmp(value); @@ -1678,9 +1661,8 @@ bp::object rim::Block::getDoublePy(rim::Variable* var, int32_t index) { boost::python::handle<> handle(obj); ret = bp::object(handle); - } - else { + } else { PyObject* val = Py_BuildValue("d", getDouble(var, index)); if (val == NULL) throw(rogue::GeneralError::create("Block::getDoublePy", "Failed to generate Double")); @@ -1704,14 +1686,14 @@ void rim::Block::setDouble(const double& val, rim::Variable* var, int32_t index) var->minValue_, var->maxValue_)); - setBytes((uint8_t*)&val, var, index); + setBytes(reinterpret_cast(const_cast(&val)), var, index); } // Get data using double double rim::Block::getDouble(rim::Variable* var, int32_t index) { double tmp = 0; - getBytes((uint8_t*)&tmp, var, index); + getBytes(reinterpret_cast(&tmp), var, index); return tmp; } @@ -1753,15 +1735,14 @@ void rim::Block::setFixedPy(bp::object& value, rim::Variable* var, int32_t index if (PyArray_TYPE(arr) == NPY_FLOAT64) { double* src = reinterpret_cast(PyArray_DATA(arr)); for (x = 0; x < dims[0]; x++) setFixed(src[x], var, index + x); - } else + } else { throw(rogue::GeneralError::create("Block::setFixedPy", "Passed nparray is not of type (double) for %s", var->name_.c_str())); + } - } - - // Is passed value a list - else if (PyList_Check(value.ptr())) { + // Is passed value a list + } else if (PyList_Check(value.ptr())) { bp::list vl = bp::extract(value); uint32_t vlen = len(vl); @@ -1784,18 +1765,18 @@ void rim::Block::setFixedPy(bp::object& value, rim::Variable* var, int32_t index setFixed(tmp, var, index + x); } - } - // Passed scalar numpy value - else if (PyArray_CheckScalar(value.ptr())) { + // Passed scalar numpy value + } else if (PyArray_CheckScalar(value.ptr())) { if (PyArray_DescrFromScalar(value.ptr())->type_num == NPY_FLOAT64) { double val; PyArray_ScalarAsCtype(value.ptr(), &val); setFixed(val, var, index); - } else + } else { throw(rogue::GeneralError::create("Block::setFixedPy", "Failed to extract value for %s.", var->name_.c_str())); + } } else { bp::extract tmp(value); @@ -1825,9 +1806,8 @@ bp::object rim::Block::getFixedPy(rim::Variable* var, int32_t index) { boost::python::handle<> handle(obj); ret = bp::object(handle); - } - else { + } else { PyObject* val = Py_BuildValue("d", getFixed(var, index)); if (val == NULL) throw(rogue::GeneralError::create("Block::getFixedPy", "Failed to generate Fixed")); @@ -1855,8 +1835,10 @@ void rim::Block::setFixed(const double& val, rim::Variable* var, int32_t index) int64_t fPoint = (int64_t)round(val * pow(2, var->binPoint_)); // Check for positive edge case uint64_t mask = 1 << (var->valueBits_ - 1); - if (val > 0 && ((fPoint & mask) != 0)) { fPoint -= 1; } - setBytes((uint8_t*)&fPoint, var, index); + if (val > 0 && ((fPoint & mask) != 0)) { + fPoint -= 1; + } + setBytes(reinterpret_cast(&fPoint), var, index); } // Get data using fixed point @@ -1864,12 +1846,14 @@ double rim::Block::getFixed(rim::Variable* var, int32_t index) { int64_t fPoint = 0; double tmp; - getBytes((uint8_t*)&fPoint, var, index); + getBytes(reinterpret_cast(&fPoint), var, index); // Do two-complement if negative - if ((fPoint & (1 << (var->valueBits_ - 1))) != 0) { fPoint = fPoint - (1 << var->valueBits_); } + if ((fPoint & (1 << (var->valueBits_ - 1))) != 0) { + fPoint = fPoint - (1 << var->valueBits_); + } // Convert to float - tmp = (double)fPoint; + tmp = static_cast(fPoint); tmp = tmp / pow(2, var->binPoint_); return tmp; } @@ -1905,7 +1889,7 @@ void rim::Block::rateTest() { gettimeofday(&etime, NULL); timersub(&etime, &stime, &dtime); - durr = dtime.tv_sec + (float)dtime.tv_usec / 1.0e6; + durr = dtime.tv_sec + static_cast(dtime.tv_usec) / 1.0e6; rate = count / durr; printf("\nBlock c++ raw: Read %" PRIu64 " times in %f seconds. Rate = %f\n", count, durr, rate); @@ -1913,13 +1897,13 @@ void rim::Block::rateTest() { gettimeofday(&stime, NULL); waitTransaction(0); for (x = 0; x < count; ++x) { - reqTransaction(0, 4, (uint8_t*)&count, rim::Write); + reqTransaction(0, 4, reinterpret_cast(&count), rim::Write); waitTransaction(0); } gettimeofday(&etime, NULL); timersub(&etime, &stime, &dtime); - durr = dtime.tv_sec + (float)dtime.tv_usec / 1.0e6; + durr = dtime.tv_sec + static_cast(dtime.tv_usec) / 1.0e6; rate = count / durr; printf("\nBlock c++ raw: Wrote %" PRIu64 " times in %f seconds. Rate = %f\n", count, durr, rate); diff --git a/src/rogue/interfaces/memory/CMakeLists.txt b/src/rogue/interfaces/memory/CMakeLists.txt index b213e434c..d1b18961e 100644 --- a/src/rogue/interfaces/memory/CMakeLists.txt +++ b/src/rogue/interfaces/memory/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/interfaces/memory/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/interfaces/memory/Emulate.cpp b/src/rogue/interfaces/memory/Emulate.cpp index ccedad26e..0cdce91d9 100644 --- a/src/rogue/interfaces/memory/Emulate.cpp +++ b/src/rogue/interfaces/memory/Emulate.cpp @@ -1,8 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory slave emulator * ---------------------------------------------------------------------------- - * File : Emulator.pp + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * A memory space emulator. Allows user to test a Rogue tree without real hardware. @@ -47,9 +45,9 @@ rim::EmulatePtr rim::Emulate::create(uint32_t min, uint32_t max) { //! Create an block rim::Emulate::Emulate(uint32_t min, uint32_t max) : Slave(min, max) { - totAlloc_ = 0; - totSize_ = 0; - log_ = rogue::Logging::create("memory.Emulate"); + totAlloc_ = 0; + totSize_ = 0; + log_ = rogue::Logging::create("memory.Emulate"); } //! Destroy a block @@ -87,10 +85,10 @@ void rim::Emulate::doTransaction(rim::TransactionPtr tran) { addr += size4k; if (memMap_.find(addr4k) == memMap_.end()) { - memMap_.insert(std::make_pair(addr4k, (uint8_t*)malloc(0x1000))); - totSize_ += 0x1000; - totAlloc_ ++; - log_->debug("Allocating block at 0x%x. Total Blocks %i, Total Size = %i", addr4k, totAlloc_, totSize_); + memMap_.insert(std::make_pair(addr4k, reinterpret_cast(malloc(0x1000)))); + totSize_ += 0x1000; + totAlloc_++; + log_->debug("Allocating block at 0x%x. Total Blocks %i, Total Size = %i", addr4k, totAlloc_, totSize_); } // Write or post @@ -98,10 +96,9 @@ void rim::Emulate::doTransaction(rim::TransactionPtr tran) { // printf("Write data to 4k=0x%" PRIx64 ", offset=0x%" PRIx64 ", size=%" PRIu64 "\n", addr4k, off4k, // size4k); memcpy(memMap_[addr4k] + off4k, ptr, size4k); - } - // Read or verify - else { + // Read or verify + } else { // printf("Read data from 4k=0x%" PRIx64 ", offset=0x%" PRIx64 ", size=%" PRIu64 "\n", addr4k, off4k, // size4k); memcpy(ptr, memMap_[addr4k] + off4k, size4k); diff --git a/src/rogue/interfaces/memory/Hub.cpp b/src/rogue/interfaces/memory/Hub.cpp index ea4c51250..742f15cc5 100644 --- a/src/rogue/interfaces/memory/Hub.cpp +++ b/src/rogue/interfaces/memory/Hub.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Hub * ---------------------------------------------------------------------------- - * File : Hub.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-09-20 - * Last update: 2016-09-20 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * A memory interface hub. Accepts requests from multiple masters and forwards @@ -125,7 +120,7 @@ void rim::Hub::doTransaction(rim::TransactionPtr tran) { for (unsigned int i = 0; i < numberOfTransactions; ++i) { rim::TransactionPtr subTran = tran->createSubTransaction(); - subTran->iter_ = (uint8_t*)(tran->begin() + i * maxAccess); + subTran->iter_ = reinterpret_cast(tran->begin() + i * maxAccess); if (tran->size() >= ((i + 1) * maxAccess)) { subTran->size_ = maxAccess; } else { @@ -185,7 +180,9 @@ void rim::HubWrap::doTransaction(rim::TransactionPtr transaction) { try { pb(transaction); return; - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } } rim::Hub::doTransaction(transaction); diff --git a/src/rogue/interfaces/memory/Master.cpp b/src/rogue/interfaces/memory/Master.cpp index db1656152..e4c9e84ac 100644 --- a/src/rogue/interfaces/memory/Master.cpp +++ b/src/rogue/interfaces/memory/Master.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Master * ---------------------------------------------------------------------------- - * File : Master.cpp - * Created : 2016-09-20 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory master interface. @@ -155,7 +152,7 @@ void rim::Master::setTimeout(uint64_t timeout) { uint32_t rim::Master::reqTransaction(uint64_t address, uint32_t size, void* data, uint32_t type) { rim::TransactionPtr tran = rim::Transaction::create(sumTime_); - tran->iter_ = (uint8_t*)data; + tran->iter_ = reinterpret_cast(data); tran->size_ = size; tran->address_ = address; tran->type_ = type; @@ -197,7 +194,7 @@ uint32_t rim::Master::reqTransactionPy(uint64_t address, } tran->pyValid_ = true; - tran->iter_ = ((uint8_t*)tran->pyBuf_.buf) + offset; + tran->iter_ = reinterpret_cast(tran->pyBuf_.buf) + offset; tran->type_ = type; tran->address_ = address; @@ -247,8 +244,9 @@ void rim::Master::waitTransaction(uint32_t id) { if (it != tranMap_.end()) { tran = it->second; tranMap_.erase(it); - } else + } else { break; + } } // Outside of lock @@ -280,10 +278,9 @@ void rim::Master::copyBits(uint8_t* dstData, uint32_t dstLsb, uint8_t* srcData, dstByte += bytes; srcByte += bytes; rem -= (bytes * 8); - } - // Not aligned - else { + // Not aligned + } else { dstData[dstByte] &= ((0x1 << dstBit) ^ 0xFF); dstData[dstByte] |= ((srcData[srcByte] >> srcBit) & 0x1) << dstBit; srcByte += (++srcBit / 8); @@ -335,7 +332,7 @@ void rim::Master::copyBitsPy(boost::python::object dst, srcBuf.len * 8)); } - copyBits((uint8_t*)dstBuf.buf, dstLsb, (uint8_t*)srcBuf.buf, srcLsb, size); + copyBits(reinterpret_cast(dstBuf.buf), dstLsb, reinterpret_cast(srcBuf.buf), srcLsb, size); PyBuffer_Release(&srcBuf); PyBuffer_Release(&dstBuf); @@ -362,10 +359,9 @@ void rim::Master::setBits(uint8_t* dstData, uint32_t lsb, uint32_t size) { memset(&(dstData[dstByte]), 0xFF, bytes); dstByte += bytes; rem -= (bytes * 8); - } - // Not aligned - else { + // Not aligned + } else { dstData[dstByte] |= (0x1 << dstBit); dstByte += (++dstBit / 8); dstBit %= 8; @@ -393,7 +389,7 @@ void rim::Master::setBitsPy(boost::python::object dst, uint32_t lsb, uint32_t si dstBuf.len * 8)); } - setBits((uint8_t*)dstBuf.buf, lsb, size); + setBits(reinterpret_cast(dstBuf.buf), lsb, size); PyBuffer_Release(&dstBuf); } @@ -421,10 +417,9 @@ bool rim::Master::anyBits(uint8_t* dstData, uint32_t lsb, uint32_t size) { if (dstData[dstByte] != 0) ret = true; dstByte += 1; rem -= 8; - } - // Not aligned - else { + // Not aligned + } else { if ((dstData[dstByte] & (0x1 << dstBit)) != 0) ret = true; dstByte += (++dstBit / 8); dstBit %= 8; @@ -455,7 +450,7 @@ bool rim::Master::anyBitsPy(boost::python::object dst, uint32_t lsb, uint32_t si dstBuf.len * 8)); } - ret = anyBits((uint8_t*)dstBuf.buf, lsb, size); + ret = anyBits(reinterpret_cast(dstBuf.buf), lsb, size); PyBuffer_Release(&dstBuf); return ret; @@ -468,10 +463,11 @@ void rim::Master::rshiftPy(bp::object p) { boost::python::extract get_slave(p); // Test extraction - if (get_slave.check()) slv = get_slave(); + if (get_slave.check()) { + slv = get_slave(); - // Otherwise look for indirect call - else if (PyObject_HasAttrString(p.ptr(), "_getMemorySlave")) { + // Otherwise look for indirect call + } else if (PyObject_HasAttrString(p.ptr(), "_getMemorySlave")) { // Attempt to convert returned object to slave pointer boost::python::extract get_slave(p.attr("_getMemorySlave")()); diff --git a/src/rogue/interfaces/memory/Slave.cpp b/src/rogue/interfaces/memory/Slave.cpp index ca2e34327..709e7e709 100644 --- a/src/rogue/interfaces/memory/Slave.cpp +++ b/src/rogue/interfaces/memory/Slave.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Slave * ---------------------------------------------------------------------------- - * File : Slave.cpp - * Created : 2016-09-20 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory slave interface. @@ -102,7 +99,9 @@ rim::TransactionPtr rim::Slave::getTransaction(uint32_t index) { // Clean up if we found an expired transaction, overtime this will clean up // the list, even if it deletes one expired transaction per call - if (exp != tranMap_.end()) { tranMap_.erase(exp); } + if (exp != tranMap_.end()) { + tranMap_.erase(exp); + } } return ret; } @@ -190,7 +189,9 @@ uint32_t rim::SlaveWrap::doMinAccess() { if (boost::python::override pb = this->get_override("_doMinAccess")) { try { return (pb()); - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } } return (rim::Slave::doMinAccess()); @@ -209,7 +210,9 @@ uint32_t rim::SlaveWrap::doMaxAccess() { if (boost::python::override pb = this->get_override("_doMaxAccess")) { try { return (pb()); - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } } return (rim::Slave::doMaxAccess()); @@ -228,7 +231,9 @@ uint64_t rim::SlaveWrap::doAddress() { if (boost::python::override pb = this->get_override("_doAddress")) { try { return (pb()); - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } } return (rim::Slave::doAddress()); @@ -248,7 +253,9 @@ void rim::SlaveWrap::doTransaction(rim::TransactionPtr transaction) { try { pb(transaction); return; - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } } rim::Slave::doTransaction(transaction); @@ -266,10 +273,11 @@ void rim::Slave::lshiftPy(boost::python::object p) { boost::python::extract get_master(p); // Test extraction - if (get_master.check()) mst = get_master(); + if (get_master.check()) { + mst = get_master(); - // Otherwise look for indirect call - else if (PyObject_HasAttrString(p.ptr(), "_getMemoryMaster")) { + // Otherwise look for indirect call + } else if (PyObject_HasAttrString(p.ptr(), "_getMemoryMaster")) { // Attempt to convert returned object to master pointer boost::python::extract get_master(p.attr("_getMemoryMaster")()); diff --git a/src/rogue/interfaces/memory/TcpClient.cpp b/src/rogue/interfaces/memory/TcpClient.cpp index 64bdf4839..9d451024f 100644 --- a/src/rogue/interfaces/memory/TcpClient.cpp +++ b/src/rogue/interfaces/memory/TcpClient.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Client Network Bridge * ---------------------------------------------------------------------------- - * File : TcpClient.cpp - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory Client Network Bridge @@ -75,8 +72,8 @@ rim::TcpClient::TcpClient(std::string addr, uint16_t port) : rim::Slave(4, 0xFFF if (zmq_setsockopt(this->zmqReq_, ZMQ_IMMEDIATE, &opt, sizeof(int32_t)) != 0) throw(rogue::GeneralError("memory::TcpClient::TcpClient", "Failed to set socket immediate")); - this->respAddr_.append(std::to_string(static_cast(port + 1))); - this->reqAddr_.append(std::to_string(static_cast(port))); + this->respAddr_.append(std::to_string(static_cast(port + 1))); + this->reqAddr_.append(std::to_string(static_cast(port))); this->bridgeLog_->debug("Creating response client port: %s", this->respAddr_.c_str()); @@ -175,11 +172,11 @@ void rim::TcpClient::doTransaction(rim::TransactionPtr tran) { msgCnt = 5; zmq_msg_init_size(&(msg[4]), size); std::memcpy(zmq_msg_data(&(msg[4])), tran->begin(), size); - } - // Read transaction - else + // Read transaction + } else { msgCnt = 4; + } bridgeLog_->debug("Requested transaction id=%" PRIu32 ", addr=0x%" PRIx64 ", size=%" PRIu32 ", type=%" PRIu32 ", cnt=%" PRIu32 ", port: %s", @@ -237,8 +234,9 @@ void rim::TcpClient::runThread() { more = 0; moreSize = 8; zmq_getsockopt(this->zmqResp_, ZMQ_RCVMORE, &more, &moreSize); - } else + } else { more = 1; + } } while (threadEn_ && more); // Proper message received @@ -258,7 +256,7 @@ void rim::TcpClient::runThread() { std::memcpy(&type, zmq_msg_data(&(msg[3])), 4); memset(result, 0, 1000); - std::strncpy(result, (char*)zmq_msg_data(&(msg[5])), zmq_msg_size(&(msg[5]))); + std::strncpy(result, reinterpret_cast(zmq_msg_data(&(msg[5]))), zmq_msg_size(&(msg[5]))); // Find Transaction if ((tran = getTransaction(id)) == NULL) { diff --git a/src/rogue/interfaces/memory/TcpServer.cpp b/src/rogue/interfaces/memory/TcpServer.cpp index 40547802d..77eb287a7 100644 --- a/src/rogue/interfaces/memory/TcpServer.cpp +++ b/src/rogue/interfaces/memory/TcpServer.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Server Network Bridge * ---------------------------------------------------------------------------- - * File : TcpServer.cpp - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory Server Network Bridge @@ -68,8 +65,8 @@ rim::TcpServer::TcpServer(std::string addr, uint16_t port) { this->zmqResp_ = zmq_socket(this->zmqCtx_, ZMQ_PUSH); this->zmqReq_ = zmq_socket(this->zmqCtx_, ZMQ_PULL); - this->respAddr_.append(std::to_string(static_cast(port + 1))); - this->reqAddr_.append(std::to_string(static_cast(port))); + this->respAddr_.append(std::to_string(static_cast(port + 1))); + this->reqAddr_.append(std::to_string(static_cast(port))); this->bridgeLog_->debug("Creating response client port: %s", this->respAddr_.c_str()); @@ -162,8 +159,9 @@ void rim::TcpServer::runThread() { more = 0; moreSize = 8; zmq_getsockopt(this->zmqReq_, ZMQ_RCVMORE, &more, &moreSize); - } else + } else { more = 1; + } } while (threadEn_ && more); // Proper message received @@ -189,11 +187,12 @@ void rim::TcpServer::runThread() { for (x = 0; x < msgCnt; x++) zmq_msg_close(&(msg[x])); continue; // while (1) } - } else + } else { zmq_msg_init_size(&(msg[4]), size); + } // Data pointer - data = (uint8_t*)zmq_msg_data(&(msg[4])); + data = reinterpret_cast(zmq_msg_data(&(msg[4]))); bridgeLog_->debug("Starting transaction id=%" PRIu32 ", addr=0x%" PRIx64 ", size=%" PRIu32 ", type=%" PRIu32, @@ -223,8 +222,9 @@ void rim::TcpServer::runThread() { // Send message for (x = 0; x < 6; x++) zmq_sendmsg(this->zmqResp_, &(msg[x]), (x == 5) ? 0 : ZMQ_SNDMORE); - } else + } else { for (x = 0; x < msgCnt; x++) zmq_msg_close(&(msg[x])); + } } } diff --git a/src/rogue/interfaces/memory/Transaction.cpp b/src/rogue/interfaces/memory/Transaction.cpp index 55218fdd2..f5962d1b2 100644 --- a/src/rogue/interfaces/memory/Transaction.cpp +++ b/src/rogue/interfaces/memory/Transaction.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Transaction * ---------------------------------------------------------------------------- - * File : Transaction.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-09-20 - * Last update: 2016-09-20 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory master interface. @@ -112,7 +107,9 @@ rim::TransactionLockPtr rim::Transaction::lock() { //! Get expired state bool rim::Transaction::expired() { bool done = false; - if (isSubTransaction_) { done = parentTransaction_.expired(); } + if (isSubTransaction_) { + done = parentTransaction_.expired(); + } return done || (iter_ == NULL || done_); } @@ -174,7 +171,7 @@ void rim::Transaction::done() { parentTran->subTranMap_.erase(id_); // If this is the last sub-transaction, notify parent transaction it is all done - if (parentTran->subTranMap_.empty() and parentTran->doneCreatingSubTransactions_) parentTran->done(); + if (parentTran->subTranMap_.empty() && parentTran->doneCreatingSubTransactions_) parentTran->done(); } } } @@ -203,7 +200,7 @@ void rim::Transaction::errorStr(std::string error) { parentTran->subTranMap_.erase(id_); // If this is the last sub-transaction, notify parent transaction it is all done - if (parentTran->subTranMap_.empty() and parentTran->doneCreatingSubTransactions_) + if (parentTran->subTranMap_.empty() && parentTran->doneCreatingSubTransactions_) parentTran->error("Transaction error. Subtransaction %" PRIu32 " failed with error: %s.\n", id_, error.c_str()); @@ -217,7 +214,7 @@ void rim::Transaction::error(const char* fmt, ...) { char buffer[10000]; va_start(args, fmt); - vsnprintf(buffer, 10000, fmt, args); + vsnprintf(buffer, sizeof(buffer), fmt, args); va_end(args); errorStr(std::string(buffer)); @@ -241,8 +238,9 @@ std::string rim::Transaction::wait() { id_, address_, size_); - } else + } else { cond_.wait_for(lock, std::chrono::microseconds(1000)); + } } // Reset @@ -270,9 +268,9 @@ void rim::Transaction::refreshTimer(rim::TransactionPtr ref) { if (ref == NULL || timercmp(&startTime_, &(ref->startTime_), >=)) { timeradd(&currTime, &timeout_, &endTime_); - if (warnTime_.tv_sec == 0 && warnTime_.tv_usec == 0) + if (warnTime_.tv_sec == 0 && warnTime_.tv_usec == 0) { warnTime_ = endTime_; - else if (timercmp(&warnTime_, &currTime, >=)) { + } else if (timercmp(&warnTime_, &currTime, >=)) { log_->warning("Transaction timer refresh! Possible slow link! type=%" PRIu32 " id=%" PRIu32 ", address=0x%016" PRIx64 ", size=%" PRIu32, type_, @@ -317,7 +315,7 @@ void rim::Transaction::setData(boost::python::object p, uint32_t offset) { size_)); } - std::memcpy(begin() + offset, (uint8_t*)pyBuf.buf, count); + std::memcpy(begin() + offset, reinterpret_cast(pyBuf.buf), count); PyBuffer_Release(&pyBuf); } @@ -340,7 +338,7 @@ void rim::Transaction::getData(boost::python::object p, uint32_t offset) { size_)); } - std::memcpy((uint8_t*)pyBuf.buf, begin() + offset, count); + std::memcpy(reinterpret_cast(pyBuf.buf), begin() + offset, count); PyBuffer_Release(&pyBuf); } diff --git a/src/rogue/interfaces/memory/TransactionLock.cpp b/src/rogue/interfaces/memory/TransactionLock.cpp index e7fd587d5..67706fe4c 100644 --- a/src/rogue/interfaces/memory/TransactionLock.cpp +++ b/src/rogue/interfaces/memory/TransactionLock.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Transaction Lock * ---------------------------------------------------------------------------- - * File : TransactionLock.cpp - * Created : 2018-03-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Memory Transaction lock diff --git a/src/rogue/interfaces/memory/Variable.cpp b/src/rogue/interfaces/memory/Variable.cpp index 4626e11f3..4661dd20b 100644 --- a/src/rogue/interfaces/memory/Variable.cpp +++ b/src/rogue/interfaces/memory/Variable.cpp @@ -1,8 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Memory Variable * ---------------------------------------------------------------------------- - * File : Variable.cpp + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Interface between RemoteVariables and lower level memory transactions. @@ -169,53 +167,51 @@ rim::Variable::Variable(std::string name, // Not a list variable if (numValues_ == 0) { - // Compute bit total bitTotal_ = bitSize_[0]; for (x = 1; x < bitSize_.size(); x++) bitTotal_ += bitSize_[x]; // Compute rounded up byte size - byteSize_ = (int)std::ceil((float)bitTotal_ / 8.0); + byteSize_ = static_cast(std::ceil(static_cast(bitTotal_) / 8.0)); - lowTranByte_ = (uint32_t*)malloc(sizeof(uint32_t)); - highTranByte_ = (uint32_t*)malloc(sizeof(uint32_t)); + lowTranByte_ = reinterpret_cast(malloc(sizeof(uint32_t))); + highTranByte_ = reinterpret_cast(malloc(sizeof(uint32_t))); // Init remaining fields - valueBytes_ = byteSize_; - valueBits_ = bitTotal_; + valueBytes_ = byteSize_; + valueBits_ = bitTotal_; valueStride_ = bitTotal_; - } - - // List variables - else { + // List variables + } else { // Compute bit total bitTotal_ = bitSize_[0]; // Compute rounded up byte size - byteSize_ = (int)std::ceil((float)bitTotal_ / 8.0); + byteSize_ = static_cast(std::ceil(static_cast(bitTotal_) / 8.0)); // Compute total bit range of accessed bits - valueBytes_ = (uint32_t)std::ceil((float)(valueBits_) / 8.0); + valueBytes_ = static_cast(std::ceil(static_cast(valueBits_) / 8.0)); // High and low byte tracking - lowTranByte_ = (uint32_t*)malloc(numValues_ * sizeof(uint32_t)); - highTranByte_ = (uint32_t*)malloc(numValues_ * sizeof(uint32_t)); + lowTranByte_ = reinterpret_cast(malloc(numValues_ * sizeof(uint32_t))); + highTranByte_ = reinterpret_cast(malloc(numValues_ * sizeof(uint32_t))); } // Byte array for fast copies fastByte_ = NULL; // Determine if fast byte copies can be utilized - // Bit offset vector must have one entry, the offset must be byte aligned and the total number of bits must be byte aligned + // Bit offset vector must have one entry, the offset must be byte aligned and the total number of bits must be byte + // aligned if ((bitOffset_.size() == 1) && (bitOffset_[0] % 8 == 0) && (bitSize_[0] % 8 == 0)) { - // Standard variable - if (numValues_ == 0) fastByte_ = (uint32_t*)malloc(sizeof(uint32_t)); + if (numValues_ == 0) { + fastByte_ = reinterpret_cast(malloc(sizeof(uint32_t))); - // List variable - else if ((valueBits_ % 8) == 0 && (valueStride_ % 8) == 0) { - fastByte_ = (uint32_t*)malloc(numValues_ * sizeof(uint32_t)); + // List variable + } else if ((valueBits_ % 8) == 0 && (valueStride_ % 8) == 0) { + fastByte_ = reinterpret_cast(malloc(numValues_ * sizeof(uint32_t))); } } stale_ = false; @@ -458,43 +454,55 @@ void rim::Variable::shiftOffsetDown(uint32_t shift, uint32_t minSize) { } // Standard variable - if ( numValues_ == 0 ) { - + if (numValues_ == 0) { // Compute total bit range of accessed bytes - varBytes_ = (int)std::ceil((float)(bitOffset_[bitOffset_.size() - 1] + bitSize_[bitSize_.size() - 1]) / ((float)minSize * 8.0)) * minSize; + varBytes_ = static_cast(std::ceil( + static_cast(bitOffset_[bitOffset_.size() - 1] + bitSize_[bitSize_.size() - 1]) / + (static_cast(minSize) * 8.0))) * + minSize; // Compute the lowest byte, aligned to min access - lowTranByte_[0] = (int)std::floor((float)bitOffset_[0] / ((float)minSize * 8.0)) * minSize; + lowTranByte_[0] = + static_cast(std::floor(static_cast(bitOffset_[0]) / (static_cast(minSize) * 8.0))) * + minSize; // Compute the highest byte, aligned to min access highTranByte_[0] = varBytes_ - 1; - staleHighByte_ = highTranByte_[0]; - } - - // List variable - else { + staleHighByte_ = highTranByte_[0]; + // List variable + } else { for (x = 0; x < numValues_; x++) { - lowTranByte_[x] = (uint32_t)std::floor(((float)bitOffset_[0] + (float)x * (float)valueStride_) / ((float)minSize * 8.0)) * minSize; - highTranByte_[x] = (uint32_t)std::ceil(((float)bitOffset_[0] + (float)x * (float)valueStride_ + valueBits_) / ((float)minSize * 8.0)) * minSize - 1; + lowTranByte_[x] = + static_cast(std::floor( + (static_cast(bitOffset_[0]) + static_cast(x) * static_cast(valueStride_)) / + (static_cast(minSize) * 8.0))) * + minSize; + highTranByte_[x] = static_cast( + std::ceil((static_cast(bitOffset_[0]) + + static_cast(x) * static_cast(valueStride_) + valueBits_) / + (static_cast(minSize) * 8.0))) * + minSize - + 1; } // Compute total bit range of accessed bytes - varBytes_ = highTranByte_[numValues_-1] - lowTranByte_[0] + 1; - staleHighByte_ = highTranByte_[numValues_-1]; + varBytes_ = highTranByte_[numValues_ - 1] - lowTranByte_[0] + 1; + staleHighByte_ = highTranByte_[numValues_ - 1]; } // Adjust fast copy locations if (fastByte_ != NULL) { - if (numValues_ == 0) fastByte_[0] = bitOffset_[0] / 8; + if (numValues_ == 0) { + fastByte_[0] = bitOffset_[0] / 8; - // List variable - else { + // List variable + } else { for (x = 0; x < numValues_; x++) fastByte_[x] = (bitOffset_[0] + (valueStride_ * x)) / 8; } } - staleLowByte_ = lowTranByte_[0]; + staleLowByte_ = lowTranByte_[0]; } void rim::Variable::updatePath(std::string path) { @@ -612,7 +620,9 @@ void rim::VariableWrap::queueUpdate() { try { pb(); return; - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } } @@ -641,21 +651,25 @@ void rim::Variable::rateTest() { uint32_t ret; gettimeofday(&stime, NULL); - for (x = 0; x < count; ++x) { ret = getUInt(); } + for (x = 0; x < count; ++x) { + ret = getUInt(); + } gettimeofday(&etime, NULL); timersub(&etime, &stime, &dtime); - durr = dtime.tv_sec + (float)dtime.tv_usec / 1.0e6; + durr = dtime.tv_sec + static_cast(dtime.tv_usec) / 1.0e6; rate = count / durr; printf("\nVariable c++ get: Read %" PRIu64 " times in %f seconds. Rate = %f\n", count, durr, rate); gettimeofday(&stime, NULL); - for (x = 0; x < count; ++x) { setUInt(x); } + for (x = 0; x < count; ++x) { + setUInt(x); + } gettimeofday(&etime, NULL); timersub(&etime, &stime, &dtime); - durr = dtime.tv_sec + (float)dtime.tv_usec / 1.0e6; + durr = dtime.tv_sec + static_cast(dtime.tv_usec) / 1.0e6; rate = count / durr; printf("\nVariable c++ set: Wrote %" PRIu64 " times in %f seconds. Rate = %f\n", count, durr, rate); @@ -705,8 +719,9 @@ std::string rim::Variable::getDumpValue(bool read) { ret << "0x"; for (x = 0; x < valueBytes_; x++) ret << std::setfill('0') << std::setw(2) << std::hex << (uint32_t)byteData[x]; - } else + } else { ret << (block_->*getUInt_)(this, index); + } break; case rim::Int: @@ -715,8 +730,9 @@ std::string rim::Variable::getDumpValue(bool read) { ret << "0x"; for (x = 0; x < valueBytes_; x++) ret << std::setfill('0') << std::setw(2) << std::hex << (uint32_t)byteData[x]; - } else + } else { ret << (block_->*getInt_)(this, index); + } break; case rim::Bool: @@ -851,9 +867,9 @@ std::string rim::Variable::getString(int32_t index) { } void rim::Variable::getValue(std::string& retString, int32_t index) { - if (getString_ == NULL) + if (getString_ == NULL) { throw(rogue::GeneralError::create("Variable::getValue", "Wrong get type for variable %s", path_.c_str())); - else { + } else { block_->read(this, index); block_->getValue(this, retString, index); } diff --git a/src/rogue/interfaces/memory/module.cpp b/src/rogue/interfaces/memory/module.cpp index 5cb0f7d84..e83bf5027 100644 --- a/src/rogue/interfaces/memory/module.cpp +++ b/src/rogue/interfaces/memory/module.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Created : 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/interfaces/module.cpp b/src/rogue/interfaces/module.cpp index 2d9192799..42003b546 100644 --- a/src/rogue/interfaces/module.cpp +++ b/src/rogue/interfaces/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/interfaces/stream/Buffer.cpp b/src/rogue/interfaces/stream/Buffer.cpp index aec737b89..8608f8202 100644 --- a/src/rogue/interfaces/stream/Buffer.cpp +++ b/src/rogue/interfaces/stream/Buffer.cpp @@ -1,15 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream Buffer Container * ---------------------------------------------------------------------------- - * File : Buffer.h - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-09-16 - * Last update: 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream frame container - * Some concepts borrowed from CPSW by Till Straumann * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -48,7 +42,7 @@ ris::BufferPtr ris::Buffer::create(ris::PoolPtr source, void* data, uint32_t met */ ris::Buffer::Buffer(ris::PoolPtr source, void* data, uint32_t meta, uint32_t size, uint32_t alloc) { source_ = source; - data_ = (uint8_t*)data; + data_ = reinterpret_cast(data); meta_ = meta; rawSize_ = size; allocSize_ = alloc; diff --git a/src/rogue/interfaces/stream/CMakeLists.txt b/src/rogue/interfaces/stream/CMakeLists.txt index 22c5bf590..2d570e172 100644 --- a/src/rogue/interfaces/stream/CMakeLists.txt +++ b/src/rogue/interfaces/stream/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/interfaces/stream/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/interfaces/stream/Fifo.cpp b/src/rogue/interfaces/stream/Fifo.cpp index b79502943..220093cdd 100644 --- a/src/rogue/interfaces/stream/Fifo.cpp +++ b/src/rogue/interfaces/stream/Fifo.cpp @@ -1,11 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : AXI Stream FIFO * ---------------------------------------------------------------------------- - * File : Fifo.cpp - * Author : Ryan Herbst - * Created : 02/02/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * AXI Stream FIFO *----------------------------------------------------------------------------- @@ -92,7 +88,7 @@ ris::Fifo::~Fifo() { //! Return the number of elements in the Fifo std::size_t ris::Fifo::size() { return queue_.size(); -}; +} //! Return the number of dropped frames std::size_t ris::Fifo::dropCnt() const { @@ -121,9 +117,9 @@ void ris::Fifo::acceptFrame(ris::FramePtr frame) { ris::FrameLockPtr lock = frame->lock(); // Do we copy the frame? - if (noCopy_) + if (noCopy_) { nFrame = frame; - else { + } else { // Get size, adjust if trim is enabled size = frame->getPayload(); if (trimSize_ != 0 && trimSize_ < size) size = trimSize_; diff --git a/src/rogue/interfaces/stream/Filter.cpp b/src/rogue/interfaces/stream/Filter.cpp index d40482989..8755fe9a9 100644 --- a/src/rogue/interfaces/stream/Filter.cpp +++ b/src/rogue/interfaces/stream/Filter.cpp @@ -1,11 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Register Protocol (SRP) Filter * ---------------------------------------------------------------------------- - * File : Filter.cpp - * Author : Ryan Herbst - * Created : 11/01/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * AXI Stream Filter *----------------------------------------------------------------------------- diff --git a/src/rogue/interfaces/stream/Frame.cpp b/src/rogue/interfaces/stream/Frame.cpp index 5770916a3..aeaa74fad 100644 --- a/src/rogue/interfaces/stream/Frame.cpp +++ b/src/rogue/interfaces/stream/Frame.cpp @@ -1,13 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream frame container * ---------------------------------------------------------------------------- - * File : Frame.h - * Created : 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream frame container - * Some concepts borrowed from CPSW by Till Straumann * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory @@ -184,16 +180,16 @@ void ris::Frame::setPayload(uint32_t pSize) { size_ += loc; // Beyond the fill point, empty buffer - if (lSize == 0) (*it)->setPayloadEmpty(); + if (lSize == 0) { + (*it)->setPayloadEmpty(); - // Size exists in current buffer - else if (lSize <= loc) { + // Size exists in current buffer + } else if (lSize <= loc) { (*it)->setPayload(lSize); lSize = 0; - } - // Size is beyond current buffer - else { + // Size is beyond current buffer + } else { lSize -= loc; (*it)->setPayloadFull(); } @@ -370,7 +366,7 @@ void ris::Frame::readPy(boost::python::object p, uint32_t offset) { } ris::FrameIterator beg = this->begin() + offset; - ris::fromFrame(beg, count, (uint8_t*)pyBuf.buf); + ris::fromFrame(beg, count, reinterpret_cast(pyBuf.buf)); PyBuffer_Release(&pyBuf); } @@ -396,7 +392,7 @@ void ris::Frame::writePy(boost::python::object p, uint32_t offset) { minPayload(offset + count); ris::FrameIterator beg = this->begin() + offset; - ris::toFrame(beg, count, (uint8_t*)pyBuf.buf); + ris::toFrame(beg, count, reinterpret_cast(pyBuf.buf)); PyBuffer_Release(&pyBuf); } @@ -437,7 +433,9 @@ void ris::Frame::putNumpy(boost::python::object p, uint32_t offset) { PyObject* obj = p.ptr(); // Check that this is a PyArrayObject - if (!PyArray_Check(obj)) { throw(rogue::GeneralError("Frame::putNumpy", "Object is not a numpy array")); } + if (!PyArray_Check(obj)) { + throw(rogue::GeneralError("Frame::putNumpy", "Object is not a numpy array")); + } // Cast to an array object and check that the numpy array // data buffer is write-able and contiguous @@ -445,7 +443,9 @@ void ris::Frame::putNumpy(boost::python::object p, uint32_t offset) { PyArrayObject* arr = reinterpret_cast(obj); int flags = PyArray_FLAGS(arr); bool ctg = flags & (NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_F_CONTIGUOUS); - if (!ctg) { arr = PyArray_GETCONTIGUOUS(arr); } + if (!ctg) { + arr = PyArray_GETCONTIGUOUS(arr); + } // Get the number of bytes in both the source and destination buffers uint32_t size = getSize(); @@ -471,7 +471,9 @@ void ris::Frame::putNumpy(boost::python::object p, uint32_t offset) { ris::toFrame(beg, count, src); // If were forced to make a temporary copy, release it - if (!ctg) { Py_XDECREF(arr); } + if (!ctg) { + Py_XDECREF(arr); + } return; } diff --git a/src/rogue/interfaces/stream/FrameIterator.cpp b/src/rogue/interfaces/stream/FrameIterator.cpp index daa166019..bfc345178 100644 --- a/src/rogue/interfaces/stream/FrameIterator.cpp +++ b/src/rogue/interfaces/stream/FrameIterator.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream iterator container * ---------------------------------------------------------------------------- - * File : FrameIterator.h - * Created : 2018-03-06 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream frame iterator @@ -59,10 +56,9 @@ void ris::FrameIterator::increment(int32_t diff) { buffEnd_ = frameSize_; buff_ = frame_->endBuffer(); data_ = NULL; - } - // Move forward in buffer chain - else { + // Move forward in buffer chain + } else { // Increment current buffer until we find the location of the data position // Iterator always contains one extra buffer index while (framePos_ >= buffEnd_) { @@ -91,10 +87,9 @@ void ris::FrameIterator::decrement(int32_t diff) { buffEnd_ = frameSize_; buff_ = frame_->endBuffer(); data_ = NULL; - } - // Move backwards in buffer chain - else { + // Move backwards in buffer chain + } else { // Decrement current buffer until the desired frame position is greater than // the bottom of the buffer while (framePos_ < buffBeg_) { diff --git a/src/rogue/interfaces/stream/FrameLock.cpp b/src/rogue/interfaces/stream/FrameLock.cpp index f103427c9..361e37703 100644 --- a/src/rogue/interfaces/stream/FrameLock.cpp +++ b/src/rogue/interfaces/stream/FrameLock.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Frame Lock * ---------------------------------------------------------------------------- - * File : FrameLock.cpp - * Created : 2018-03-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Frame lock diff --git a/src/rogue/interfaces/stream/Master.cpp b/src/rogue/interfaces/stream/Master.cpp index 554923750..3fdb9927e 100644 --- a/src/rogue/interfaces/stream/Master.cpp +++ b/src/rogue/interfaces/stream/Master.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream interface master * ---------------------------------------------------------------------------- - * File : Master.h - * Created : 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream interface master @@ -92,20 +89,20 @@ void ris::Master::sendFrame(FramePtr frame) { // Ensure passed frame is a single buffer bool ris::Master::ensureSingleBuffer(ris::FramePtr& frame, bool reqEn) { // Frame is a single buffer - if (frame->bufferCount() == 1) + if (frame->bufferCount() == 1) { return true; - else if (!reqEn) + } else if (!reqEn) { return false; - else { + } else { uint32_t size = frame->getPayload(); ris::FramePtr nFrame = reqFrame(size, true); - if (nFrame->bufferCount() != 1) + if (nFrame->bufferCount() != 1) { return false; - else { + } else { nFrame->setPayload(size); ris::FrameIterator srcIter = frame->begin(); @@ -149,30 +146,36 @@ void ris::Master::equalsPy(boost::python::object p) { boost::python::extract get_master(p); // Test extraction - if (get_master.check()) rMst = get_master(); + if (get_master.check()) { + rMst = get_master(); - // Otherwise look for indirect call - else if (PyObject_HasAttrString(p.ptr(), "_getStreamMaster")) { + // Otherwise look for indirect call + } else if (PyObject_HasAttrString(p.ptr(), "_getStreamMaster")) { // Attempt to convert returned object to master pointer boost::python::extract get_master(p.attr("_getStreamMaster")()); // Test extraction - if (get_master.check()) rMst = get_master(); + if (get_master.check()) { + rMst = get_master(); + } } // Attempt to access object as a stream slave boost::python::extract get_slave(p); // Test extraction - if (get_slave.check()) rSlv = get_slave(); + if (get_slave.check()) { + rSlv = get_slave(); - // Otherwise look for indirect call - else if (PyObject_HasAttrString(p.ptr(), "_getStreamSlave")) { + // Otherwise look for indirect call + } else if (PyObject_HasAttrString(p.ptr(), "_getStreamSlave")) { // Attempt to convert returned object to slave pointer boost::python::extract get_slave(p.attr("_getStreamSlave")()); // Test extraction - if (get_slave.check()) rSlv = get_slave(); + if (get_slave.check()) { + rSlv = get_slave(); + } } if (rMst == NULL || rSlv == NULL || lSlv == NULL) @@ -191,15 +194,18 @@ bp::object ris::Master::rshiftPy(bp::object p) { boost::python::extract get_slave(p); // Test extraction - if (get_slave.check()) slv = get_slave(); + if (get_slave.check()) { + slv = get_slave(); - // Otherwise look for indirect call - else if (PyObject_HasAttrString(p.ptr(), "_getStreamSlave")) { + // Otherwise look for indirect call + } else if (PyObject_HasAttrString(p.ptr(), "_getStreamSlave")) { // Attempt to convert returned object to slave pointer boost::python::extract get_slave(p.attr("_getStreamSlave")()); // Test extraction - if (get_slave.check()) slv = get_slave(); + if (get_slave.check()) { + slv = get_slave(); + } } if (slv != NULL) diff --git a/src/rogue/interfaces/stream/Pool.cpp b/src/rogue/interfaces/stream/Pool.cpp index 143f401d0..e7a918a46 100644 --- a/src/rogue/interfaces/stream/Pool.cpp +++ b/src/rogue/interfaces/stream/Pool.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream memory pool * ---------------------------------------------------------------------------- - * File : Pool.cpp - * Created : 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream memory pool @@ -52,7 +49,9 @@ ris::Pool::Pool() { //! Destructor ris::Pool::~Pool() { - while (!dataQ_.empty()) { free(dataQ_.front()); } + while (!dataQ_.empty()) { + free(dataQ_.front()); + } } //! Get allocated memory @@ -159,9 +158,10 @@ ris::BufferPtr ris::Pool::allocBuffer(uint32_t size, uint32_t* total) { if (dataQ_.size() > 0) { data = dataQ_.front(); dataQ_.pop(); - } else if ((data = (uint8_t*)malloc(bAlloc)) == NULL) + } else if ((data = reinterpret_cast(malloc(bAlloc))) == NULL) { throw( rogue::GeneralError::create("Pool::allocBuffer", "Failed to allocate buffer with size = %" PRIu32, bAlloc)); + } // Only use lower 24 bits of meta. // Upper 8 bits may have special meaning to sub-class diff --git a/src/rogue/interfaces/stream/RateDrop.cpp b/src/rogue/interfaces/stream/RateDrop.cpp index d6f0dc7e8..34773d223 100644 --- a/src/rogue/interfaces/stream/RateDrop.cpp +++ b/src/rogue/interfaces/stream/RateDrop.cpp @@ -1,11 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Stream Interface Rate Drop * ---------------------------------------------------------------------------- - * File : RateDrop.cpp - * Author : Ryan Herbst - * Created : 08/25/2020 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Drops frames at a specified rate. *----------------------------------------------------------------------------- @@ -90,10 +86,9 @@ void ris::RateDrop::acceptFrame(ris::FramePtr frame) { sendFrame(frame); dropCount_ = 0; } - } - // Dropping based upon time - else { + // Dropping based upon time + } else { gettimeofday(&currTime, NULL); if (timercmp(&currTime, &(nextPeriod_), >)) { diff --git a/src/rogue/interfaces/stream/Slave.cpp b/src/rogue/interfaces/stream/Slave.cpp index f484348a6..ccbba1fe6 100644 --- a/src/rogue/interfaces/stream/Slave.cpp +++ b/src/rogue/interfaces/stream/Slave.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream interface slave * ---------------------------------------------------------------------------- - * File : Slave.cpp - * Created : 2016-09-16 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream interface slave @@ -88,7 +85,7 @@ void ris::Slave::acceptFrame(ris::FramePtr frame) { char buffer[1000]; log_->critical("Got Size=%" PRIu32 ", Error=%" PRIu8 ", Data:", frame->getPayload(), frame->getError()); - sprintf(buffer, " "); + snprintf(buffer, sizeof(buffer), " "); count = 0; for (it = frame->begin(); (count < debug_) && (it != frame->end()); ++it) { @@ -98,7 +95,7 @@ void ris::Slave::acceptFrame(ris::FramePtr frame) { snprintf(buffer + strlen(buffer), 1000 - strlen(buffer), " 0x%.2x", val); if (((count + 1) % 8) == 0) { log_->critical(buffer); - sprintf(buffer, " "); + snprintf(buffer, sizeof(buffer), " "); } } @@ -117,7 +114,9 @@ void ris::SlaveWrap::acceptFrame(ris::FramePtr frame) { try { pb(frame); return; - } catch (...) { PyErr_Print(); } + } catch (...) { + PyErr_Print(); + } } } ris::Slave::acceptFrame(frame); @@ -143,20 +142,20 @@ uint64_t ris::Slave::getByteCount() { // Ensure passed frame is a single buffer bool ris::Slave::ensureSingleBuffer(ris::FramePtr& frame, bool reqEn) { // Frame is a single buffer - if (frame->bufferCount() == 1) + if (frame->bufferCount() == 1) { return true; - else if (!reqEn) + } else if (!reqEn) { return false; - else { + } else { uint32_t size = frame->getPayload(); ris::FramePtr nFrame = reqLocalFrame(size, true); - if (nFrame->bufferCount() != 1) + if (nFrame->bufferCount() != 1) { return false; - else { + } else { nFrame->setPayload(size); ris::FrameIterator srcIter = frame->begin(); @@ -205,10 +204,11 @@ bp::object ris::Slave::lshiftPy(bp::object p) { boost::python::extract get_master(p); // Test extraction - if (get_master.check()) mst = get_master(); + if (get_master.check()) { + mst = get_master(); - // Otherwise look for indirect call - else if (PyObject_HasAttrString(p.ptr(), "_getStreamMaster")) { + // Otherwise look for indirect call + } else if (PyObject_HasAttrString(p.ptr(), "_getStreamMaster")) { // Attempt to convert returned object to master pointer boost::python::extract get_master(p.attr("_getStreamMaster")()); diff --git a/src/rogue/interfaces/stream/TcpClient.cpp b/src/rogue/interfaces/stream/TcpClient.cpp index 0c8621f63..0de7abde3 100644 --- a/src/rogue/interfaces/stream/TcpClient.cpp +++ b/src/rogue/interfaces/stream/TcpClient.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream Network Client * ---------------------------------------------------------------------------- - * File : TcpClient.h - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream Network Client diff --git a/src/rogue/interfaces/stream/TcpCore.cpp b/src/rogue/interfaces/stream/TcpCore.cpp index 181f5ca55..9e15ef204 100644 --- a/src/rogue/interfaces/stream/TcpCore.cpp +++ b/src/rogue/interfaces/stream/TcpCore.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream Network Core * ---------------------------------------------------------------------------- - * File : TcpCore.h - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream Network Core @@ -92,8 +89,8 @@ ris::TcpCore::TcpCore(std::string addr, uint16_t port, bool server) { // Server mode if (server) { - this->pullAddr_.append(std::to_string(static_cast(port))); - this->pushAddr_.append(std::to_string(static_cast(port + 1))); + this->pullAddr_.append(std::to_string(static_cast(port))); + this->pushAddr_.append(std::to_string(static_cast(port + 1))); this->bridgeLog_->debug("Creating pull server port: %s", this->pullAddr_.c_str()); @@ -112,12 +109,11 @@ ris::TcpCore::TcpCore(std::string addr, uint16_t port, bool server) { " at address %s, another process may be using this port", port + 1, addr.c_str())); - } - // Client mode - else { - this->pullAddr_.append(std::to_string(static_cast(port + 1))); - this->pushAddr_.append(std::to_string(static_cast(port))); + // Client mode + } else { + this->pullAddr_.append(std::to_string(static_cast(port + 1))); + this->pushAddr_.append(std::to_string(static_cast(port))); this->bridgeLog_->debug("Creating pull client port: %s", this->pullAddr_.c_str()); @@ -203,7 +199,7 @@ void ris::TcpCore::acceptFrame(ris::FramePtr frame) { // Copy data ris::FrameIterator iter = frame->begin(); - data = (uint8_t*)zmq_msg_data(&(msg[3])); + data = reinterpret_cast(zmq_msg_data(&(msg[3]))); ris::fromFrame(iter, frame->getPayload(), data); // Send data @@ -248,8 +244,9 @@ void ris::TcpCore::runThread() { more = 0; moreSize = 8; zmq_getsockopt(this->zmqPull_, ZMQ_RCVMORE, &more, &moreSize); - } else + } else { more = 1; + } } while (threadEn_ && more); // Proper message received @@ -267,7 +264,7 @@ void ris::TcpCore::runThread() { std::memcpy(&err, zmq_msg_data(&(msg[2])), 1); // Get message info - data = (uint8_t*)zmq_msg_data(&(msg[3])); + data = reinterpret_cast(zmq_msg_data(&(msg[3]))); size = zmq_msg_size(&(msg[3])); // Generate frame diff --git a/src/rogue/interfaces/stream/TcpServer.cpp b/src/rogue/interfaces/stream/TcpServer.cpp index 466cbe437..b680b4dd8 100644 --- a/src/rogue/interfaces/stream/TcpServer.cpp +++ b/src/rogue/interfaces/stream/TcpServer.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Stream Network Server * ---------------------------------------------------------------------------- - * File : TcpServer.h - * Created : 2019-01-30 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Stream Network Server diff --git a/src/rogue/interfaces/stream/module.cpp b/src/rogue/interfaces/stream/module.cpp index 66db30678..fb3ac84a7 100644 --- a/src/rogue/interfaces/stream/module.cpp +++ b/src/rogue/interfaces/stream/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module For Stream Interface * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/module.cpp b/src/rogue/module.cpp index 0f2d9f4ed..583a1a26d 100644 --- a/src/rogue/module.cpp +++ b/src/rogue/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/protocols/CMakeLists.txt b/src/rogue/protocols/CMakeLists.txt index ff1ad7f50..0b8ff5dcb 100644 --- a/src/rogue/protocols/CMakeLists.txt +++ b/src/rogue/protocols/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/protocols/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/batcher/CMakeLists.txt b/src/rogue/protocols/batcher/CMakeLists.txt index 2a1a3b44a..cb49f2f23 100644 --- a/src/rogue/protocols/batcher/CMakeLists.txt +++ b/src/rogue/protocols/batcher/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/protocols/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/batcher/CoreV1.cpp b/src/rogue/protocols/batcher/CoreV1.cpp index 537790bd9..fff5014f2 100644 --- a/src/rogue/protocols/batcher/CoreV1.cpp +++ b/src/rogue/protocols/batcher/CoreV1.cpp @@ -1,11 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Batcher Core, Version 1 * ---------------------------------------------------------------------------- - * File : CoreV1.h - * Author : Ryan Herbst - * Created : 10/26/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * AXI Batcher V1 (https://confluence.slac.stanford.edu/x/th1SDg) * diff --git a/src/rogue/protocols/batcher/Data.cpp b/src/rogue/protocols/batcher/Data.cpp index 555762adc..579c2d8f4 100644 --- a/src/rogue/protocols/batcher/Data.cpp +++ b/src/rogue/protocols/batcher/Data.cpp @@ -1,19 +1,18 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Batcher Data * ---------------------------------------------------------------------------- - * File : Data.h - * Author : Ryan Herbst - * Created : 02/08/2019 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * SLAC Batcher Data + * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory * of this distribution and at: - * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. * No part of the rogue software platform, including this file, may be * copied, modified, propagated, or distributed except according to the terms * contained in the LICENSE.txt file. - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- **/ #include "rogue/protocols/batcher/Data.h" diff --git a/src/rogue/protocols/batcher/InverterV1.cpp b/src/rogue/protocols/batcher/InverterV1.cpp index 995a13908..56aed6007 100644 --- a/src/rogue/protocols/batcher/InverterV1.cpp +++ b/src/rogue/protocols/batcher/InverterV1.cpp @@ -1,19 +1,18 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Inverter Version 1 * ---------------------------------------------------------------------------- - * File : InverterV1.h - * Author : Ryan Herbst - * Created : 10/26/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * SLAC Inverter Version 1 + * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory * of this distribution and at: - * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. * No part of the rogue software platform, including this file, may be * copied, modified, propagated, or distributed except according to the terms * contained in the LICENSE.txt file. - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- **/ #include "rogue/Directives.h" diff --git a/src/rogue/protocols/batcher/SplitterV1.cpp b/src/rogue/protocols/batcher/SplitterV1.cpp index 625289af7..df8a82b07 100644 --- a/src/rogue/protocols/batcher/SplitterV1.cpp +++ b/src/rogue/protocols/batcher/SplitterV1.cpp @@ -1,19 +1,18 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Splitter Version 1 * ---------------------------------------------------------------------------- - * File : SplitterV1.h - * Author : Ryan Herbst - * Created : 10/26/2018 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * SLAC Splitter Version 1 + * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory * of this distribution and at: - * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. * No part of the rogue software platform, including this file, may be * copied, modified, propagated, or distributed except according to the terms * contained in the LICENSE.txt file. - *----------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- **/ #include "rogue/Directives.h" diff --git a/src/rogue/protocols/batcher/module.cpp b/src/rogue/protocols/batcher/module.cpp index 35a804b22..f683bf45f 100644 --- a/src/rogue/protocols/batcher/module.cpp +++ b/src/rogue/protocols/batcher/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/protocols/module.cpp b/src/rogue/protocols/module.cpp index 3f4de6726..467718b09 100644 --- a/src/rogue/protocols/module.cpp +++ b/src/rogue/protocols/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/protocols/packetizer/Application.cpp b/src/rogue/protocols/packetizer/Application.cpp index c76b7ae39..5d41d19c4 100644 --- a/src/rogue/protocols/packetizer/Application.cpp +++ b/src/rogue/protocols/packetizer/Application.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Application Port * ---------------------------------------------------------------------------- - * File : Application.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Application Port diff --git a/src/rogue/protocols/packetizer/CMakeLists.txt b/src/rogue/protocols/packetizer/CMakeLists.txt index 1d6fd4974..38abd2672 100644 --- a/src/rogue/protocols/packetizer/CMakeLists.txt +++ b/src/rogue/protocols/packetizer/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/protocols/packetizer/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/packetizer/Controller.cpp b/src/rogue/protocols/packetizer/Controller.cpp index b85c272e9..a70d0d99c 100644 --- a/src/rogue/protocols/packetizer/Controller.cpp +++ b/src/rogue/protocols/packetizer/Controller.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Controller * ---------------------------------------------------------------------------- - * File : Controller.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Controller diff --git a/src/rogue/protocols/packetizer/ControllerV1.cpp b/src/rogue/protocols/packetizer/ControllerV1.cpp index 622003aec..880b29e4e 100644 --- a/src/rogue/protocols/packetizer/ControllerV1.cpp +++ b/src/rogue/protocols/packetizer/ControllerV1.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Controller Version 1 * ---------------------------------------------------------------------------- - * File : ControllerV1.cpp - * Created : 2018-02-02 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Controller V1 @@ -168,13 +165,16 @@ void rpp::ControllerV1::transportRx(ris::FramePtr frame) { if (tmpEof) { tranFrame_[0]->setLastUser(tmpLuser); tranCount_[0] = 0; - if (app_[tranDest_]) { app_[tranDest_]->pushFrame(tranFrame_[0]); } + if (app_[tranDest_]) { + app_[tranDest_]->pushFrame(tranFrame_[0]); + } tranFrame_[0].reset(); // Detect SSI error if (enSsi_ & (tmpLuser & 0x1)) tranFrame_[tmpDest]->setError(0x80); - } else + } else { tranCount_[0]++; + } } //! Frame received at application interface diff --git a/src/rogue/protocols/packetizer/ControllerV2.cpp b/src/rogue/protocols/packetizer/ControllerV2.cpp index 210f1882c..87fd38462 100644 --- a/src/rogue/protocols/packetizer/ControllerV2.cpp +++ b/src/rogue/protocols/packetizer/ControllerV2.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Controller Version 1 * ---------------------------------------------------------------------------- - * File : ControllerV2.cpp - * Created : 2018-02-02 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Controller V1 @@ -144,8 +141,9 @@ void rpp::ControllerV2::transportRx(ris::FramePtr frame) { crc_[tmpDest] = CRC::Calculate(data, size - 4, crcTable_, crc_[tmpDest]); crcErr = (tmpCrc != crc_[tmpDest]); - } else + } else { crcErr = false; + } log_->debug("transportRx: Raw header: 0x%" PRIx8 ", 0x%" PRIx8 ", 0x%" PRIx8 ", 0x%" PRIx8 ", 0x%" PRIx8 ", 0x%" PRIx8 ", 0x%" PRIx8 ", 0x%" PRIx8, @@ -235,7 +233,9 @@ void rpp::ControllerV2::transportRx(ris::FramePtr frame) { tranFrame_[tmpDest]->setLastUser(tmpLuser); transSof_[tmpDest] = true; tranCount_[tmpDest] = 0; - if (app_[tmpDest]) { app_[tmpDest]->pushFrame(tranFrame_[tmpDest]); } + if (app_[tmpDest]) { + app_[tmpDest]->pushFrame(tranFrame_[tmpDest]); + } tranFrame_[tmpDest].reset(); // Detect SSI error diff --git a/src/rogue/protocols/packetizer/Core.cpp b/src/rogue/protocols/packetizer/Core.cpp index 53a1d3fbf..2d2dd9425 100644 --- a/src/rogue/protocols/packetizer/Core.cpp +++ b/src/rogue/protocols/packetizer/Core.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Core Class * ---------------------------------------------------------------------------- - * File : Core.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Core @@ -50,9 +46,7 @@ void rpp::Core::setup_python() { bp::class_("Core", bp::init()) .def("transport", &rpp::Core::transport) .def("application", &rpp::Core::application) - .def("getDropCount", &rpp::Core::getDropCount) - - ; + .def("getDropCount", &rpp::Core::getDropCount); #endif } diff --git a/src/rogue/protocols/packetizer/CoreV2.cpp b/src/rogue/protocols/packetizer/CoreV2.cpp index 7aab1fd89..e4849cdbf 100644 --- a/src/rogue/protocols/packetizer/CoreV2.cpp +++ b/src/rogue/protocols/packetizer/CoreV2.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Core Class * ---------------------------------------------------------------------------- - * File : CoreV2.cpp - * Created : 2018-02-02 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Core V2 @@ -49,9 +46,7 @@ void rpp::CoreV2::setup_python() { bp::class_("CoreV2", bp::init()) .def("transport", &rpp::CoreV2::transport) .def("application", &rpp::CoreV2::application) - .def("getDropCount", &rpp::CoreV2::getDropCount) - - ; + .def("getDropCount", &rpp::CoreV2::getDropCount); #endif } diff --git a/src/rogue/protocols/packetizer/Transport.cpp b/src/rogue/protocols/packetizer/Transport.cpp index 76fdcc2ff..9b2c4e447 100644 --- a/src/rogue/protocols/packetizer/Transport.cpp +++ b/src/rogue/protocols/packetizer/Transport.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Packetizer Transport Port * ---------------------------------------------------------------------------- - * File : Transport.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Packetizer Transport Port diff --git a/src/rogue/protocols/packetizer/module.cpp b/src/rogue/protocols/packetizer/module.cpp index d5632105f..c4647fa7d 100644 --- a/src/rogue/protocols/packetizer/module.cpp +++ b/src/rogue/protocols/packetizer/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/protocols/rssi/Application.cpp b/src/rogue/protocols/rssi/Application.cpp index c9b798aca..48ae2e990 100644 --- a/src/rogue/protocols/rssi/Application.cpp +++ b/src/rogue/protocols/rssi/Application.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Application Port * ---------------------------------------------------------------------------- - * File : Application.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * RSSI Application Port diff --git a/src/rogue/protocols/rssi/CMakeLists.txt b/src/rogue/protocols/rssi/CMakeLists.txt index ebbcb8da3..1b5d86938 100644 --- a/src/rogue/protocols/rssi/CMakeLists.txt +++ b/src/rogue/protocols/rssi/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/protocols/rssi/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/rssi/Client.cpp b/src/rogue/protocols/rssi/Client.cpp index 65bfdfb70..dd9e41c64 100644 --- a/src/rogue/protocols/rssi/Client.cpp +++ b/src/rogue/protocols/rssi/Client.cpp @@ -1,13 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Client Class * ---------------------------------------------------------------------------- - * File : Client.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: - * UDP Client + * RSSI Client Class * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/rssi/Controller.cpp b/src/rogue/protocols/rssi/Controller.cpp index 7957d9d5e..7a8e73a1d 100644 --- a/src/rogue/protocols/rssi/Controller.cpp +++ b/src/rogue/protocols/rssi/Controller.cpp @@ -1,11 +1,6 @@ - /** - *----------------------------------------------------------------------------- - * Title : RSSI Controller * ---------------------------------------------------------------------------- - * File : Controller.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * RSSI Controller @@ -240,21 +235,21 @@ void rpr::Controller::transportRx(ris::FramePtr frame) { // Reset if (head->rst) { - if (state_ == StOpen || state_ == StWaitSyn) { stQueue_.push(head); } - } + if (state_ == StOpen || state_ == StWaitSyn) { + stQueue_.push(head); + } - // Syn frame goes to state machine if state = open - // or we are waiting for ack replay - else if (head->syn) { + // Syn frame goes to state machine if state = open + // or we are waiting for ack replay + } else if (head->syn) { if (state_ == StOpen || state_ == StWaitSyn) { lastSeqRx_ = head->sequence; nextSeqRx_ = lastSeqRx_ + 1; stQueue_.push(head); } - } - // Data or NULL in the correct sequence go to application - else if (state_ == StOpen && (head->nul || frame->getPayload() > rpr::Header::HeaderSize)) { + // Data or NULL in the correct sequence go to application + } else if (state_ == StOpen && (head->nul || frame->getPayload() > rpr::Header::HeaderSize)) { if (head->sequence == nextSeqRx_) { // log_->warning("Data or NULL in the correct sequence go to application: nextSeqRx_=0x%" PRIx8, // nextSeqRx_); @@ -293,22 +288,20 @@ void rpr::Controller::transportRx(ris::FramePtr frame) { // Notify after the last sequence update stCond_.notify_all(); - } - // Check if received frame is already in out of order queue - else if ((it = oooQueue_.find(head->sequence)) != oooQueue_.end()) { + // Check if received frame is already in out of order queue + } else if ((it = oooQueue_.find(head->sequence)) != oooQueue_.end()) { log_->warning("Dropped duplicate frame. server=%" PRIu8 ", head->sequence=%" PRIu32 ", next sequence=%" PRIu32, server_, head->sequence, nextSeqRx_); dropCount_++; - } - // Add to out of order queue in case things arrive out of order - // Make sure received sequence is in window. There may be a better way - // to do this while handling the 8 bit rollover - else { + // Add to out of order queue in case things arrive out of order + // Make sure received sequence is in window. There may be a better way + // to do this while handling the 8 bit rollover + } else { uint8_t x = nextSeqRx_; uint8_t windowEnd = (nextSeqRx_ + curMaxBuffers_ + 1); @@ -359,9 +352,9 @@ ris::FramePtr rpr::Controller::applicationTx() { if (head->nul) { head.reset(); frame.reset(); - } else + } else { (*(frame->beginBuffer()))->adjustHeader(rpr::Header::HeaderSize); - + } } while (!frame); return (frame); @@ -396,7 +389,9 @@ void rpr::Controller::applicationRx(ris::FramePtr frame) { flock->unlock(); // Connection is closed - if (state_ != StOpen) return; + if (state_ != StOpen) { + return; + } // Wait while busy either by flow control or buffer starvation while (txListCount_ >= curMaxBuffers_) { @@ -703,7 +698,7 @@ int8_t rpr::Controller::retransmit(uint8_t id) { //! Convert rssi time to microseconds void rpr::Controller::convTime(struct timeval& tme, uint32_t rssiTime) { float units = std::pow(10, -TimeoutUnit); - float value = units * (float)rssiTime; + float value = units * static_cast(rssiTime); uint32_t usec = (uint32_t)(value / 1e-6); @@ -782,10 +777,9 @@ struct timeval& rpr::Controller::stateClosedWait() { if (head->rst) { state_ = StClosed; log_->warning("Closing link. Server=%" PRIu8, server_); - } - // Syn ack - else if (head->syn && (head->ack || server_)) { + // Syn ack + } else if (head->syn && (head->ack || server_)) { curMaxBuffers_ = head->maxOutstandingSegments; curMaxSegment_ = head->maxSegmentSize; curCumAckTout_ = head->cumulativeAckTimeout; @@ -804,13 +798,13 @@ struct timeval& rpr::Controller::stateClosedWait() { if (server_) { state_ = StSendSynAck; return (zeroTme_); - } else + } else { state_ = StSendSeqAck; + } gettimeofday(&stTime_, NULL); - } - // reset counters - else { + // reset counters + } else { curMaxBuffers_ = locMaxBuffers_; curMaxSegment_ = locMaxSegment_; curCumAckTout_ = locCumAckTout_; @@ -819,10 +813,9 @@ struct timeval& rpr::Controller::stateClosedWait() { curMaxRetran_ = locMaxRetran_; curMaxCumAck_ = locMaxCumAck_; } - } - // Generate syn after try period passes - else if ((!server_) && timePassed(stTime_, tryPeriodD1_)) { + // Generate syn after try period passes + } else if ((!server_) && timePassed(stTime_, tryPeriodD1_)) { // Allocate frame head = rpr::Header::create(tran_->reqFrame(rpr::Header::SynSize, false)); @@ -845,8 +838,9 @@ struct timeval& rpr::Controller::stateClosedWait() { // Update state gettimeofday(&stTime_, NULL); state_ = StWaitSyn; - } else if (server_) + } else if (server_) { state_ = StWaitSyn; + } return (tryPeriodD4_); } diff --git a/src/rogue/protocols/rssi/Header.cpp b/src/rogue/protocols/rssi/Header.cpp index 4cb157933..1958412b9 100644 --- a/src/rogue/protocols/rssi/Header.cpp +++ b/src/rogue/protocols/rssi/Header.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : RSII Header Class * ---------------------------------------------------------------------------- - * File : Header.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * RSSI Header @@ -40,22 +36,22 @@ namespace ris = rogue::interfaces::stream; //! Set 16-bit uint value void rpr::Header::setUInt16(uint8_t* data, uint8_t byte, uint16_t value) { - *((uint16_t*)(&(data[byte]))) = htons(value); + *reinterpret_cast(&data[byte]) = htons(value); } //! Get 16-bit uint value uint16_t rpr::Header::getUInt16(uint8_t* data, uint8_t byte) { - return (ntohs(*((uint16_t*)(&(data[byte]))))); + return ntohs(*reinterpret_cast(&data[byte])); } //! Set 32-bit uint value void rpr::Header::setUInt32(uint8_t* data, uint8_t byte, uint32_t value) { - *((uint32_t*)(&(data[byte]))) = htonl(value); + *reinterpret_cast(&(data[byte])) = htonl(value); } //! Get 32-bit uint value uint32_t rpr::Header::getUInt32(uint8_t* data, uint8_t byte) { - return (ntohl(*((uint32_t*)(&(data[byte]))))); + return ntohl(*reinterpret_cast(&(data[byte]))); } //! compute checksum diff --git a/src/rogue/protocols/rssi/Server.cpp b/src/rogue/protocols/rssi/Server.cpp index 7f3dfa25a..7dead35fa 100644 --- a/src/rogue/protocols/rssi/Server.cpp +++ b/src/rogue/protocols/rssi/Server.cpp @@ -1,9 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Server Class * ---------------------------------------------------------------------------- - * File : Server.h - * Created : 2017-06-13 + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/rssi/Transport.cpp b/src/rogue/protocols/rssi/Transport.cpp index 7fbc7083b..6c026704a 100644 --- a/src/rogue/protocols/rssi/Transport.cpp +++ b/src/rogue/protocols/rssi/Transport.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : RSSI Transport Port * ---------------------------------------------------------------------------- - * File : Transport.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * RSSI Transport Port diff --git a/src/rogue/protocols/rssi/module.cpp b/src/rogue/protocols/rssi/module.cpp index e142515ba..0085be5f2 100644 --- a/src/rogue/protocols/rssi/module.cpp +++ b/src/rogue/protocols/rssi/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/protocols/srp/CMakeLists.txt b/src/rogue/protocols/srp/CMakeLists.txt index f8aba1edc..593f678d7 100644 --- a/src/rogue/protocols/srp/CMakeLists.txt +++ b/src/rogue/protocols/srp/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/protocols/srp/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/srp/Cmd.cpp b/src/rogue/protocols/srp/Cmd.cpp index 6eae0707e..870ea1881 100644 --- a/src/rogue/protocols/srp/Cmd.cpp +++ b/src/rogue/protocols/srp/Cmd.cpp @@ -1,12 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Register Protocol (SRP) SrpV0 * ---------------------------------------------------------------------------- - * File : SrpV0.cpp - * Author : Ryan Herbst - * Created : 09/17/2016 - * Last update : 09/17/2016 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * CMD protocol bridge, Version 0 *----------------------------------------------------------------------------- diff --git a/src/rogue/protocols/srp/SrpV0.cpp b/src/rogue/protocols/srp/SrpV0.cpp index ff13a27ae..ff9a71742 100644 --- a/src/rogue/protocols/srp/SrpV0.cpp +++ b/src/rogue/protocols/srp/SrpV0.cpp @@ -1,12 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Register Protocol (SRP) SrpV0 * ---------------------------------------------------------------------------- - * File : SrpV0.cpp - * Author : Ryan Herbst - * Created : 09/17/2016 - * Last update : 09/17/2016 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * SRP protocol bridge, Version 0 *----------------------------------------------------------------------------- diff --git a/src/rogue/protocols/srp/SrpV3.cpp b/src/rogue/protocols/srp/SrpV3.cpp index 3496ad9f7..754e56902 100644 --- a/src/rogue/protocols/srp/SrpV3.cpp +++ b/src/rogue/protocols/srp/SrpV3.cpp @@ -1,12 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : SLAC Register Protocol (SRP) SrpV3 * ---------------------------------------------------------------------------- - * File : SrpV3.cpp - * Author : Ryan Herbst - * Created : 09/17/2016 - * Last update : 09/17/2016 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * SRP protocol bridge, Version 3 *----------------------------------------------------------------------------- diff --git a/src/rogue/protocols/srp/module.cpp b/src/rogue/protocols/srp/module.cpp index f6a59a89d..1ea316b5b 100644 --- a/src/rogue/protocols/srp/module.cpp +++ b/src/rogue/protocols/srp/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/protocols/udp/CMakeLists.txt b/src/rogue/protocols/udp/CMakeLists.txt index 20d170194..f0fc97d7f 100644 --- a/src/rogue/protocols/udp/CMakeLists.txt +++ b/src/rogue/protocols/udp/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/protocols/udp/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/udp/Client.cpp b/src/rogue/protocols/udp/Client.cpp index 3fc436e1c..0030ac77b 100644 --- a/src/rogue/protocols/udp/Client.cpp +++ b/src/rogue/protocols/udp/Client.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : UDP Client Class * ---------------------------------------------------------------------------- - * File : Client.h - * Created : 2017-01-07 - * Last update: 2017-01-07 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * UDP Client @@ -173,12 +169,10 @@ void rpu::Client::acceptFrame(ris::FramePtr frame) { timeout_.tv_sec, timeout_.tv_usec); res = 0; - } else if ((res = sendmsg(fd_, &msg, 0)) < 0) + } else if ((res = sendmsg(fd_, &msg, 0)) < 0) { udpLog_->warning("UDP Write Call Failed"); - } - - // Continue while write result was zero - while (res == 0); + } + } while (res == 0); // Continue while write result was zero } } @@ -207,9 +201,9 @@ void rpu::Client::runThread(std::weak_ptr lockPtr) { if (res > 0) { // Message was too big - if (res > avail) + if (res > avail) { udpLog_->warning("Receive data was too large. Dropping."); - else { + } else { buff->setPayload(res); sendFrame(frame); } diff --git a/src/rogue/protocols/udp/Core.cpp b/src/rogue/protocols/udp/Core.cpp index 260dd3e57..0df6a7d6a 100644 --- a/src/rogue/protocols/udp/Core.cpp +++ b/src/rogue/protocols/udp/Core.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : UDP Core Class * ---------------------------------------------------------------------------- - * File : Core.h - * Created : 2018-03-02 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * UDP Core @@ -57,7 +54,7 @@ bool rpu::Core::setRxBufferCount(uint32_t count) { uint32_t per = (jumbo_) ? (JumboMTU) : (StdMTU); uint32_t size = count * per; - setsockopt(fd_, SOL_SOCKET, SO_RCVBUF, (char*)&size, sizeof(size)); + setsockopt(fd_, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&size), sizeof(size)); getsockopt(fd_, SOL_SOCKET, SO_RCVBUF, &rwin, &rwin_size); if (size > rwin) { diff --git a/src/rogue/protocols/udp/Server.cpp b/src/rogue/protocols/udp/Server.cpp index d27e38fce..5b201ce5d 100644 --- a/src/rogue/protocols/udp/Server.cpp +++ b/src/rogue/protocols/udp/Server.cpp @@ -1,9 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : UDP Server Class * ---------------------------------------------------------------------------- - * File : Server.h - * Created : 2018-03-02 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * UDP Server @@ -174,12 +171,10 @@ void rpu::Server::acceptFrame(ris::FramePtr frame) { timeout_.tv_sec, timeout_.tv_usec); res = 0; - } else if ((res = sendmsg(fd_, &msg, 0)) < 0) + } else if ((res = sendmsg(fd_, &msg, 0)) < 0) { udpLog_->warning("UDP Write Call Failed"); - } - - // Continue while write result was zero - while (res == 0); + } + } while (res == 0); // Continue while write result was zero } } @@ -211,9 +206,9 @@ void rpu::Server::runThread(std::weak_ptr lockPtr) { if (res > 0) { // Message was too big - if (res > avail) + if (res > avail) { udpLog_->warning("Receive data was too large. Dropping."); - else { + } else { buff->setPayload(res); sendFrame(frame); } diff --git a/src/rogue/protocols/udp/module.cpp b/src/rogue/protocols/udp/module.cpp index 97e8f8558..f9dea7081 100644 --- a/src/rogue/protocols/udp/module.cpp +++ b/src/rogue/protocols/udp/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/protocols/xilinx/CMakeLists.txt b/src/rogue/protocols/xilinx/CMakeLists.txt index 47c3a02ed..9b68ae6f0 100644 --- a/src/rogue/protocols/xilinx/CMakeLists.txt +++ b/src/rogue/protocols/xilinx/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/protocols/xilinx/JtagDriver.cpp b/src/rogue/protocols/xilinx/JtagDriver.cpp index c44bec19e..28232cca3 100644 --- a/src/rogue/protocols/xilinx/JtagDriver.cpp +++ b/src/rogue/protocols/xilinx/JtagDriver.cpp @@ -1,18 +1,19 @@ -//----------------------------------------------------------------------------- -// Title : JTAG Support -//----------------------------------------------------------------------------- -// Company : SLAC National Accelerator Laboratory -//----------------------------------------------------------------------------- -// Description: JtagDriver.cpp -//----------------------------------------------------------------------------- -// This file is part of 'SLAC Firmware Standard Library'. -// It is subject to the license terms in the LICENSE.txt file found in the -// top-level directory of this distribution and at: -// https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -// No part of 'SLAC Firmware Standard Library', including this file, -// may be copied, modified, propagated, or distributed except according to -// the terms contained in the LICENSE.txt file. -//----------------------------------------------------------------------------- +/** + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * JtagDriver.cpp + * ---------------------------------------------------------------------------- + * This file is part of the rogue software platform. It is subject to + * the license terms in the LICENSE.txt file found in the top-level directory + * of this distribution and at: + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * No part of the rogue software platform, including this file, may be + * copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE.txt file. + * ---------------------------------------------------------------------------- + **/ #include "rogue/Directives.h" @@ -82,7 +83,7 @@ unsigned rpx::JtagDriver::getErr(Header x) { return (x & ERR_MASK) >> ERR_SHIFT; } -unsigned long rpx::JtagDriver::getLen(Header x) { +uint64_t rpx::JtagDriver::getLen(Header x) { if (getCmd(x) != CMD_S) throw( rogue::GeneralError::create("JtagDriver::getLen()", "Cannot extract length from non-shift command header")); @@ -129,9 +130,11 @@ uint32_t rpx::JtagDriver::cvtPerNs(Header reply) { unsigned rawVal = (reply >> XID_SHIFT) & 0xff; double tmp; - if (0 == rawVal) { return UNKNOWN_PERIOD; } + if (0 == rawVal) { + return UNKNOWN_PERIOD; + } - tmp = ((double)rawVal) * 4.0 / 256.0; + tmp = static_cast(rawVal) * 4.0 / 256.0; return (uint32_t)round(pow(10.0, tmp) * 1.0E9 / REF_FREQ_HZ()); } @@ -147,7 +150,9 @@ unsigned rpx::JtagDriver::getMemDepth() { rpx::JtagDriver::Header rpx::JtagDriver::getHdr(uint8_t* buf) { Header hdr; memcpy(&hdr, buf, sizeof(hdr)); - if (!isLE()) { hdr = ntohl(hdr); } + if (!isLE()) { + hdr = ntohl(hdr); + } return hdr; } @@ -197,7 +202,9 @@ int rpx::JtagDriver::xferRel(uint8_t* txb, unsigned txBytes, Header* phdr, uint8 throw(rogue::GeneralError::create("JtagDriver::xferRel()", "Protocol error")); } if (xid == XID_ANY || xid == getXid(hdr)) { - if (phdr) { *phdr = hdr; } + if (phdr) { + *phdr = hdr; + } return got; } } catch (rogue::GeneralError&) {} @@ -207,7 +214,7 @@ int rpx::JtagDriver::xferRel(uint8_t* txb, unsigned txBytes, Header* phdr, uint8 return (0); } -unsigned long rpx::JtagDriver::query() { +uint64_t rpx::JtagDriver::query() { Header hdr; unsigned siz; @@ -228,7 +235,7 @@ unsigned long rpx::JtagDriver::query() { log_->debug("Query result: wordSize %" PRId32 ", memDepth %" PRId32 ", period %l" PRId32 "ns\n", wordSize_, memDepth_, - (unsigned long)periodNs_); + (uint64_t)periodNs_); if (0 == memDepth_) retry_ = 0; @@ -255,9 +262,9 @@ uint32_t rpx::JtagDriver::setPeriodNs(uint32_t requestedPeriod) { return UNKNOWN_PERIOD == currentPeriod ? requestedPeriod : currentPeriod; } -void rpx::JtagDriver::sendVectors(unsigned long bits, uint8_t* tms, uint8_t* tdi, uint8_t* tdo) { +void rpx::JtagDriver::sendVectors(uint64_t bits, uint8_t* tms, uint8_t* tdi, uint8_t* tdo) { unsigned wsz = getWordSize(); - unsigned long bytesCeil = (bits + 8 - 1) / 8; + uint64_t bytesCeil = (bits + 8 - 1) / 8; unsigned wholeWords = bytesCeil / wsz; unsigned wholeWordBytes = wholeWords * wsz; unsigned wordCeilBytes = ((bytesCeil + wsz - 1) / wsz) * wsz; @@ -292,7 +299,7 @@ void rpx::JtagDriver::dumpInfo(FILE* f) { fprintf(f, "Word size: %d\n", getWordSize()); fprintf(f, "Target Memory Depth (bytes) %d\n", getWordSize() * getMemDepth()); fprintf(f, "Max. Vector Length (bytes) %ld\n", getMaxVectorSize()); - fprintf(f, "TCK Period (ns) %ld\n", (unsigned long)getPeriodNs()); + fprintf(f, "TCK Period (ns) %ld\n", (uint64_t)getPeriodNs()); } void rpx::JtagDriver::setup_python() { diff --git a/src/rogue/protocols/xilinx/Xvc.cpp b/src/rogue/protocols/xilinx/Xvc.cpp index 3dc08e2ae..b56545f59 100644 --- a/src/rogue/protocols/xilinx/Xvc.cpp +++ b/src/rogue/protocols/xilinx/Xvc.cpp @@ -1,10 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : XVC Server Wrapper Class * ---------------------------------------------------------------------------- - * File : Xvc.h - * Created : 2022-03-23 - * Last update: 2022-03-23 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * XVC Server Wrapper Class @@ -121,9 +117,9 @@ void rpx::Xvc::acceptFrame(ris::FramePtr frame) { // All we need to do is ensure that as soon as the new frame comes in, it's stored in the queue. } -unsigned long rpx::Xvc::getMaxVectorSize() { +uint64_t rpx::Xvc::getMaxVectorSize() { // MTU lim; 2*vector size + header must fit! - unsigned long mtuLim = (mtu_ - getWordSize()) / 2; + uint64_t mtuLim = (mtu_ - getWordSize()) / 2; return mtuLim; } diff --git a/src/rogue/protocols/xilinx/XvcConnection.cpp b/src/rogue/protocols/xilinx/XvcConnection.cpp index c534bc16a..b69458794 100644 --- a/src/rogue/protocols/xilinx/XvcConnection.cpp +++ b/src/rogue/protocols/xilinx/XvcConnection.cpp @@ -1,18 +1,19 @@ -//----------------------------------------------------------------------------- -// Title : JTAG Support -//----------------------------------------------------------------------------- -// Company : SLAC National Accelerator Laboratory -//----------------------------------------------------------------------------- -// Description: -//----------------------------------------------------------------------------- -// This file is part of 'SLAC Firmware Standard Library'. -// It is subject to the license terms in the LICENSE.txt file found in the -// top-level directory of this distribution and at: -// https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -// No part of 'SLAC Firmware Standard Library', including this file, -// may be copied, modified, propagated, or distributed except according to -// the terms contained in the LICENSE.txt file. -//----------------------------------------------------------------------------- +/** + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * JTAG support + * ---------------------------------------------------------------------------- + * This file is part of the rogue software platform. It is subject to + * the license terms in the LICENSE.txt file found in the top-level directory + * of this distribution and at: + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * No part of the rogue software platform, including this file, may be + * copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE.txt file. + * ---------------------------------------------------------------------------- + **/ #include "rogue/protocols/xilinx/XvcConnection.h" @@ -22,7 +23,7 @@ namespace rpx = rogue::protocols::xilinx; -rpx::XvcConnection::XvcConnection(int sd, JtagDriver* drv, unsigned long maxVecLen) +rpx::XvcConnection::XvcConnection(int sd, JtagDriver* drv, uint64_t maxVecLen) : drv_(drv), maxVecLen_(maxVecLen), supVecLen_(0) { @@ -67,10 +68,10 @@ ssize_t rpx::XvcConnection::readTo(void* buf, size_t count) { } // fill rx buffer to 'n' octets -void rpx::XvcConnection::fill(unsigned long n) { +void rpx::XvcConnection::fill(uint64_t n) { uint8_t* p = rp_ + rl_; int got; - unsigned long k = n; + uint64_t k = n; if (n <= rl_) return; @@ -87,15 +88,17 @@ void rpx::XvcConnection::fill(unsigned long n) { } // mark 'n' octets as 'consumed' -void rpx::XvcConnection::bump(unsigned long n) { +void rpx::XvcConnection::bump(uint64_t n) { rp_ += n; rl_ -= n; - if (rl_ == 0) { rp_ = &rxb_[0]; } + if (rl_ == 0) { + rp_ = &rxb_[0]; + } } void rpx::XvcConnection::allocBufs() { - unsigned long tgtVecLen; - unsigned long overhead = 128; // headers and such; + uint64_t tgtVecLen; + uint64_t overhead = 128; // headers and such; // Determine the vector size supported by the target tgtVecLen = drv_->query(); @@ -142,9 +145,9 @@ void rpx::XvcConnection::flush() { void rpx::XvcConnection::run() { int got; uint32_t bits, bitsLeft, bitsSent; - unsigned long bytes; - unsigned long vecLen; - unsigned long off; + uint64_t bytes; + uint64_t vecLen; + uint64_t off; allocBufs(); @@ -164,7 +167,7 @@ void rpx::XvcConnection::run() { drv_->query(); // informs the driver that there is a new connection - tl_ = sprintf((char*)&txb_[0], "xvcServer_v1.0:%ld\n", maxVecLen_); + tl_ = snprintf(reinterpret_cast(&txb_[0]), sizeof(txb_), "xvcServer_v1.0:%ld\n", maxVecLen_); bump(8); } else if (0 == ::memcmp(rp_, "se", 2)) { @@ -189,7 +192,9 @@ void rpx::XvcConnection::run() { fill(10); bits = 0; - for (got = 9; got >= 6; got--) { bits = (bits << 8) | rp_[got]; } + for (got = 9; got >= 6; got--) { + bits = (bits << 8) | rp_[got]; + } bytes = (bits + 7) / 8; if (bytes > maxVecLen_) @@ -206,16 +211,18 @@ void rpx::XvcConnection::run() { // bother...). for (off = 0, bitsLeft = bits; bitsLeft > 0; bitsLeft -= bitsSent, off += vecLen) { bitsSent = 8 * vecLen; - if (bitsLeft < bitsSent) { bitsSent = bitsLeft; } + if (bitsLeft < bitsSent) { + bitsSent = bitsLeft; + } drv_->sendVectors(bitsSent, rp_ + off, rp_ + bytes + off, &txb_[0] + off); } tl_ = bytes; bump(2 * bytes); - } else + } else { throw(rogue::GeneralError::create("XvcConnection::run()", "Unsupported message received")); - + } flush(); /* Repeat until all the characters from the first chunk are exhausted* (most likely the chunk just contained diff --git a/src/rogue/protocols/xilinx/XvcServer.cpp b/src/rogue/protocols/xilinx/XvcServer.cpp index 357c80457..b7c8bca86 100644 --- a/src/rogue/protocols/xilinx/XvcServer.cpp +++ b/src/rogue/protocols/xilinx/XvcServer.cpp @@ -1,18 +1,19 @@ -//----------------------------------------------------------------------------- -// Title : JTAG Support -//----------------------------------------------------------------------------- -// Company : SLAC National Accelerator Laboratory -//----------------------------------------------------------------------------- -// Description: -//----------------------------------------------------------------------------- -// This file is part of 'SLAC Firmware Standard Library'. -// It is subject to the license terms in the LICENSE.txt file found in the -// top-level directory of this distribution and at: -// https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. -// No part of 'SLAC Firmware Standard Library', including this file, -// may be copied, modified, propagated, or distributed except according to -// the terms contained in the LICENSE.txt file. -//----------------------------------------------------------------------------- +/** + * ---------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- + * Description: + * + * ---------------------------------------------------------------------------- + * This file is part of the rogue software platform. It is subject to + * the license terms in the LICENSE.txt file found in the top-level directory + * of this distribution and at: + * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. + * No part of the rogue software platform, including this file, may be + * copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE.txt file. + * ---------------------------------------------------------------------------- + **/ #include "rogue/protocols/xilinx/XvcServer.h" @@ -74,7 +75,9 @@ void rpx::XvcServer::run(bool& threadEn, rogue::LoggingPtr log) { try { XvcConnection conn(sd_, drv_, maxMsgSize_); conn.run(); - } catch (rogue::GeneralError& e) { log->debug("Sub-connection failed"); } + } catch (rogue::GeneralError& e) { + log->debug("Sub-connection failed"); + } } } } diff --git a/src/rogue/protocols/xilinx/module.cpp b/src/rogue/protocols/xilinx/module.cpp index aecdb9701..c83741c49 100644 --- a/src/rogue/protocols/xilinx/module.cpp +++ b/src/rogue/protocols/xilinx/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/src/rogue/utilities/CMakeLists.txt b/src/rogue/utilities/CMakeLists.txt index 321bd6294..4d317906c 100644 --- a/src/rogue/utilities/CMakeLists.txt +++ b/src/rogue/utilities/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/utilities/CMakeLists.txt -# Created : 2018-02-27 +#Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/utilities/Prbs.cpp b/src/rogue/utilities/Prbs.cpp index 67acdd9da..45dceffdd 100644 --- a/src/rogue/utilities/Prbs.cpp +++ b/src/rogue/utilities/Prbs.cpp @@ -1,12 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : PRBS Receive And Transmit Class * ---------------------------------------------------------------------------- - * File : Prbs.cpp - * Author : Ryan Herbst - * Created : 09/17/2016 - * Last update : 09/17/2016 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class used to generate and receive PRBS test data. *----------------------------------------------------------------------------- @@ -81,7 +76,7 @@ ru::Prbs::Prbs() { // Init 4 taps tapCnt_ = 4; - taps_ = (uint8_t*)malloc(sizeof(uint8_t) * tapCnt_); + taps_ = reinterpret_cast(malloc(sizeof(uint8_t) * tapCnt_)); taps_[0] = 1; taps_[1] = 2; taps_[2] = 6; @@ -121,11 +116,11 @@ double ru::Prbs::updateTime(struct timeval* last) { timersub(&now, last, &per); if (timercmp(&per, &cmp, >)) { - ret = (float)per.tv_sec + (float(per.tv_usec) / 1e6); + ret = static_cast(per.tv_sec) + static_cast(per.tv_usec) / 1e6; gettimeofday(last, NULL); - } else + } else { ret = 0.0; - + } return ret; } @@ -149,7 +144,7 @@ void ru::Prbs::setTaps(uint32_t tapCnt, uint8_t* taps) { free(taps_); tapCnt_ = tapCnt; - taps_ = (uint8_t*)malloc(sizeof(uint8_t) * tapCnt); + taps_ = reinterpret_cast(malloc(sizeof(uint8_t) * tapCnt)); for (i = 0; i < tapCnt_; i++) taps_[i] = taps[i]; } @@ -163,7 +158,7 @@ void ru::Prbs::setTapsPy(boost::python::object p) { if (PyObject_GetBuffer(p.ptr(), &pyBuf, PyBUF_SIMPLE) < 0) throw(rogue::GeneralError("Prbs::setTapsPy", "Python Buffer Error")); - setTaps(pyBuf.len, (uint8_t*)pyBuf.buf); + setTaps(pyBuf.len, reinterpret_cast(pyBuf.buf)); PyBuffer_Release(&pyBuf); } @@ -202,7 +197,9 @@ void ru::Prbs::flfsr(uint8_t* data) { void ru::Prbs::runThread() { txLog_->logThreadId(); - while (threadEn_) { genFrame(txSize_); } + while (threadEn_) { + genFrame(txSize_); + } } //! Auto run data generation @@ -369,9 +366,9 @@ void ru::Prbs::genFrame(uint32_t size) { // Generate payload while (frIter != frEnd) { - if (sendCount_) + if (sendCount_) { ris::toFrame(frIter, byteWidth_, wCount); - else { + } else { flfsr(data); ris::toFrame(frIter, byteWidth_, data); } @@ -387,8 +384,8 @@ void ru::Prbs::genFrame(uint32_t size) { txBytes_ += size; if ((per = updateTime(&lastTxTime_)) > 0.0) { - txRate_ = (float)(txCount_ - lastTxCount_) / per; - txBw_ = (float)(txBytes_ - lastTxBytes_) / per; + txRate_ = static_cast(txCount_ - lastTxCount_) / per; + txBw_ = static_cast(txBytes_ - lastTxBytes_) / per; lastTxCount_ = txCount_; lastTxBytes_ = txBytes_; } @@ -412,7 +409,7 @@ void ru::Prbs::acceptFrame(ris::FramePtr frame) { rogue::GilRelease noGil; - while (not rxEnable_) usleep(10000); + while (!rxEnable_) usleep(10000); ris::FrameLockPtr fLock = frame->lock(); std::lock_guard lock(pMtx_); @@ -471,19 +468,22 @@ void ru::Prbs::acceptFrame(ris::FramePtr frame) { flfsr(expData); if (!std::equal(frIter, frIter + byteWidth_, expData)) { - sprintf(debugA, - "Bad value at index %" PRIu32 ". count=%" PRIu32 ", size=%" PRIu32, - pos, - rxCount_, - (size / byteWidth_) - 1); + snprintf(debugA, + sizeof(debugA), + "Bad value at index %" PRIu32 ". count=%" PRIu32 ", size=%" PRIu32, + pos, + rxCount_, + (size / byteWidth_) - 1); + for (x = 0; x < byteWidth_; x++) { - sprintf(debugB, - "\n %" PRIu32 ":%" PRIu32 " Got=0x%" PRIx8 " Exp=0x%" PRIx8, - pos, - x, - *(frIter + x), - *(expData + x)); - strcat(debugA, debugB); + snprintf(debugB, + sizeof(debugB), + "\n %" PRIu32 ":%" PRIu32 " Got=0x%" PRIx8 " Exp=0x%" PRIx8, + pos, + x, + *(frIter + x), + *(expData + x)); + snprintf(debugA + strlen(debugA), sizeof(debugA) - strlen(debugA), "%s", debugB); } rxLog_->warning(debugA); rxErrCount_++; @@ -498,8 +498,8 @@ void ru::Prbs::acceptFrame(ris::FramePtr frame) { rxBytes_ += size; if ((per = updateTime(&lastRxTime_)) > 0.0) { - rxRate_ = (float)(rxCount_ - lastRxCount_) / per; - rxBw_ = (float)(rxBytes_ - lastRxBytes_) / per; + rxRate_ = static_cast(rxCount_ - lastRxCount_) / per; + rxBw_ = static_cast(rxBytes_ - lastRxBytes_) / per; lastRxCount_ = rxCount_; lastRxBytes_ = rxBytes_; } diff --git a/src/rogue/utilities/StreamUnZip.cpp b/src/rogue/utilities/StreamUnZip.cpp index ac7416b81..af01e1cec 100644 --- a/src/rogue/utilities/StreamUnZip.cpp +++ b/src/rogue/utilities/StreamUnZip.cpp @@ -1,9 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue stream decompressor * ---------------------------------------------------------------------------- - * File : StreamUnZip.cpp - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Stream modules to decompress a data stream *----------------------------------------------------------------------------- @@ -80,11 +78,11 @@ void ru::StreamUnZip::acceptFrame(ris::FramePtr frame) { // Setup decompression pointers rBuff = frame->beginBuffer(); - strm.next_in = (char*)(*rBuff)->begin(); + strm.next_in = reinterpret_cast((*rBuff)->begin()); strm.avail_in = (*rBuff)->getPayload(); wBuff = newFrame->beginBuffer(); - strm.next_out = (char*)(*wBuff)->begin(); + strm.next_out = reinterpret_cast((*wBuff)->begin()); strm.avail_out = (*wBuff)->getAvailable(); // Use the iterators to move data @@ -99,7 +97,7 @@ void ru::StreamUnZip::acceptFrame(ris::FramePtr frame) { // Update read buffer if necessary if (strm.avail_in == 0) { ++rBuff; - strm.next_in = (char*)(*rBuff)->begin(); + strm.next_in = reinterpret_cast((*rBuff)->begin()); strm.avail_in = (*rBuff)->getPayload(); } @@ -109,10 +107,10 @@ void ru::StreamUnZip::acceptFrame(ris::FramePtr frame) { if ((wBuff + 1) == newFrame->endBuffer()) { ris::FramePtr tmpFrame = this->reqFrame(frame->getPayload(), true); wBuff = newFrame->appendFrame(tmpFrame); - } else + } else { ++wBuff; - - strm.next_out = (char*)(*wBuff)->begin(); + } + strm.next_out = reinterpret_cast((*wBuff)->begin()); strm.avail_out = (*wBuff)->getAvailable(); } } while (1); diff --git a/src/rogue/utilities/StreamZip.cpp b/src/rogue/utilities/StreamZip.cpp index 6d17a8df9..994709e52 100644 --- a/src/rogue/utilities/StreamZip.cpp +++ b/src/rogue/utilities/StreamZip.cpp @@ -1,9 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Rogue stream compressor * ---------------------------------------------------------------------------- - * File : StreamZip.cpp - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Stream modules to compress a data stream *----------------------------------------------------------------------------- @@ -80,11 +78,11 @@ void ru::StreamZip::acceptFrame(ris::FramePtr frame) { // Setup decompression pointers rBuff = frame->beginBuffer(); - strm.next_in = (char*)(*rBuff)->begin(); + strm.next_in = reinterpret_cast((*rBuff)->begin()); strm.avail_in = (*rBuff)->getPayload(); wBuff = newFrame->beginBuffer(); - strm.next_out = (char*)(*wBuff)->begin(); + strm.next_out = reinterpret_cast((*wBuff)->begin()); strm.avail_out = (*wBuff)->getAvailable(); // Use the iterators to move data @@ -96,10 +94,11 @@ void ru::StreamZip::acceptFrame(ris::FramePtr frame) { // Update read buffer if necessary if (strm.avail_in == 0 && (!done)) { if (++rBuff != frame->endBuffer()) { - strm.next_in = (char*)(*rBuff)->begin(); + strm.next_in = reinterpret_cast((*rBuff)->begin()); strm.avail_in = (*rBuff)->getPayload(); - } else + } else { done = true; + } } // Update write buffer if necessary @@ -108,10 +107,10 @@ void ru::StreamZip::acceptFrame(ris::FramePtr frame) { if ((wBuff + 1) == newFrame->endBuffer()) { ris::FramePtr tmpFrame = this->reqFrame(frame->getPayload(), true); wBuff = newFrame->appendFrame(tmpFrame); - } else + } else { ++wBuff; - - strm.next_out = (char*)(*wBuff)->begin(); + } + strm.next_out = reinterpret_cast((*wBuff)->begin()); strm.avail_out = (*wBuff)->getAvailable(); } } while (ret != BZ_STREAM_END); diff --git a/src/rogue/utilities/fileio/CMakeLists.txt b/src/rogue/utilities/fileio/CMakeLists.txt index 91b118690..d7dd8195f 100644 --- a/src/rogue/utilities/fileio/CMakeLists.txt +++ b/src/rogue/utilities/fileio/CMakeLists.txt @@ -1,8 +1,5 @@ # ---------------------------------------------------------------------------- -# Title : ROGUE CMAKE Control -# ---------------------------------------------------------------------------- -# File : src/rogue/utilities/fileio/CMakeLists.txt -# Created : 2018-02-27 +# Company : SLAC National Accelerator Laboratory # ---------------------------------------------------------------------------- # This file is part of the rogue software package. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/utilities/fileio/LegacyStreamReader.cpp b/src/rogue/utilities/fileio/LegacyStreamReader.cpp index 891c9f9ae..b2ed5ebff 100644 --- a/src/rogue/utilities/fileio/LegacyStreamReader.cpp +++ b/src/rogue/utilities/fileio/LegacyStreamReader.cpp @@ -1,9 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file reader utility. * ---------------------------------------------------------------------------- - * File : LegacyStreamReader.cpp - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to read data files generated using LegacyFileWriter *----------------------------------------------------------------------------- @@ -112,9 +110,9 @@ bool ruf::LegacyStreamReader::nextFile() { if (fd_ >= 0) { ::close(fd_); fd_ = -1; - } else + } else { return (false); - + } if (fdIdx_ == 0) return (false); fdIdx_++; @@ -178,7 +176,9 @@ void ruf::LegacyStreamReader::runThread() { size = header & 0x0FFFFFFF; chan = header >> 28; - if (chan == 0) { size = size * 4; } + if (chan == 0) { + size = size * 4; + } // cout << "Frame with size" << size << "and channel" << chan; log.info("Got frame with header %" PRIx32 ", size %" PRIu32 " and channel %" PRIu8, header, size, chan); diff --git a/src/rogue/utilities/fileio/LegacyStreamWriter.cpp b/src/rogue/utilities/fileio/LegacyStreamWriter.cpp index 144bb2a47..0cb59b6ed 100644 --- a/src/rogue/utilities/fileio/LegacyStreamWriter.cpp +++ b/src/rogue/utilities/fileio/LegacyStreamWriter.cpp @@ -1,12 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file writer utility. * ---------------------------------------------------------------------------- - * File : LegacyStreamWriter.cpp - * Author : Ryan Herbst - * Created : 09/28/2016 - * Last update : 09/28/2016 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to coordinate data file writing. * This class supports multiple stream slaves, each with the ability to @@ -101,7 +96,7 @@ void ruf::LegacyStreamWriter::writeFile(uint8_t channel, std::shared_ptrgetPayload() == 0) return; - if (channel != RawData and channel != YamlData) { + if (channel != RawData && channel != YamlData) { throw(rogue::GeneralError("LegacyStreamWriter::writeFile", "Invalid channel")); } diff --git a/src/rogue/utilities/fileio/StreamReader.cpp b/src/rogue/utilities/fileio/StreamReader.cpp index cf7eeef1a..40e15c1c5 100644 --- a/src/rogue/utilities/fileio/StreamReader.cpp +++ b/src/rogue/utilities/fileio/StreamReader.cpp @@ -1,12 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file reader utility. * ---------------------------------------------------------------------------- - * File : StreamReader.cpp - * Author : Ryan Herbst - * Created : 09/28/2016 - * Last update : 09/28/2016 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to read data files. *----------------------------------------------------------------------------- @@ -113,9 +108,9 @@ bool ruf::StreamReader::nextFile() { if (fd_ >= 0) { ::close(fd_); fd_ = -1; - } else + } else { return (false); - + } if (fdIdx_ == 0) return (false); fdIdx_++; diff --git a/src/rogue/utilities/fileio/StreamWriter.cpp b/src/rogue/utilities/fileio/StreamWriter.cpp index b4394143f..230c27570 100644 --- a/src/rogue/utilities/fileio/StreamWriter.cpp +++ b/src/rogue/utilities/fileio/StreamWriter.cpp @@ -1,12 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file writer utility. * ---------------------------------------------------------------------------- - * File : StreamWriter.h - * Author : Ryan Herbst - * Created : 09/28/2016 - * Last update : 09/28/2016 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to coordinate data file writing. * This class supports multiple stream slaves, each with the ability to @@ -177,7 +172,7 @@ void ruf::StreamWriter::setBufferSize(uint32_t size) { // Buffer is enabled if (size != 0) { // Create new buffer - if ((buffer_ = (uint8_t*)malloc(size)) == NULL) + if ((buffer_ = reinterpret_cast(malloc(size))) == NULL) throw(rogue::GeneralError::create("StreamWriter::setBufferSize", "Failed to allocate buffer with size = %" PRIu32, size)); @@ -311,10 +306,8 @@ void ruf::StreamWriter::intWrite(void* data, uint32_t size) { } currSize_ += size; totSize_ += size; - } - - // Append to buffer if non zero - else if (buffSize_ > 0 && size > 0) { + // Append to buffer if non zero + } else if (buffSize_ > 0 && size > 0) { std::memcpy(buffer_ + currBuffer_, data, size); currBuffer_ += size; } diff --git a/src/rogue/utilities/fileio/StreamWriterChannel.cpp b/src/rogue/utilities/fileio/StreamWriterChannel.cpp index a6235bad9..9b646bd05 100644 --- a/src/rogue/utilities/fileio/StreamWriterChannel.cpp +++ b/src/rogue/utilities/fileio/StreamWriterChannel.cpp @@ -1,12 +1,7 @@ /** - *----------------------------------------------------------------------------- - * Title : Data file writer utility. Channel interface. * ---------------------------------------------------------------------------- - * File : StreamWriterChannel.cpp - * Author : Ryan Herbst - * Created : 09/28/2016 - * Last update : 09/28/2016 - *----------------------------------------------------------------------------- + * Company : SLAC National Accelerator Laboratory + * ---------------------------------------------------------------------------- * Description : * Class to act as a slave interface to the StreamWriterChannel. Each * slave is associated with a tag. The tag is included in the bank header diff --git a/src/rogue/utilities/fileio/module.cpp b/src/rogue/utilities/fileio/module.cpp index 03655a773..9d1550874 100644 --- a/src/rogue/utilities/fileio/module.cpp +++ b/src/rogue/utilities/fileio/module.cpp @@ -1,14 +1,9 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module For Stream Interface * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: - * Python module setup + * Python Module For Stream Interface * ---------------------------------------------------------------------------- * This file is part of the rogue software platform. It is subject to * the license terms in the LICENSE.txt file found in the top-level directory diff --git a/src/rogue/utilities/module.cpp b/src/rogue/utilities/module.cpp index b962b2a54..b5efc6e16 100644 --- a/src/rogue/utilities/module.cpp +++ b/src/rogue/utilities/module.cpp @@ -1,11 +1,6 @@ /** - *----------------------------------------------------------------------------- - * Title : Python Module For Stream Interface * ---------------------------------------------------------------------------- - * File : module.cpp - * Author : Ryan Herbst, rherbst@slac.stanford.edu - * Created : 2016-08-08 - * Last update: 2016-08-08 + * Company : SLAC National Accelerator Laboratory * ---------------------------------------------------------------------------- * Description: * Python module setup diff --git a/tests/api_test/src/api_test.cpp b/tests/api_test/src/api_test.cpp index 0e1523c2a..2f1fb9f70 100644 --- a/tests/api_test/src/api_test.cpp +++ b/tests/api_test/src/api_test.cpp @@ -50,7 +50,6 @@ int main(int argc, char** argv) { Py_BEGIN_ALLOW_THREADS; sleep(60); Py_END_ALLOW_THREADS; - } catch (...) { fprintf(stderr, "Found error running API example:\n"); PyErr_Print();