Skip to content

Commit

Permalink
Merge pull request #809 from slaclab/v4.11.9_candidate
Browse files Browse the repository at this point in the history
Add hub test files, update for new GCC, Fix Python Buffer issue
  • Loading branch information
slacrherbst authored Oct 7, 2021
2 parents 3b10c8f + 7afe110 commit 4df9726
Show file tree
Hide file tree
Showing 15 changed files with 535 additions and 187 deletions.
176 changes: 104 additions & 72 deletions CMakeLists.txt

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions include/rogue/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
* Description:
* Logging interface for pyrogue
* ----------------------------------------------------------------------------
* 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
* 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.
* ----------------------------------------------------------------------------
**/
Expand All @@ -25,6 +25,7 @@
#include <mutex>
#include <vector>
#include <string>
#include <memory>

namespace rogue {

Expand All @@ -43,9 +44,9 @@ namespace rogue {

//! Logging
class Logging {
//! Global Logging level
static uint32_t gblLevel_;

//! Global Logging level
static uint32_t gblLevel_;

//! Logging level lock
static std::mutex levelMtx_;
Expand Down
1 change: 1 addition & 0 deletions include/rogue/interfaces/memory/Transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <condition_variable>
#include <rogue/EnableSharedFromThis.h>
#include <rogue/Logging.h>
#include <memory>

#ifndef NO_PYTHON
#include <boost/python.hpp>
Expand Down
19 changes: 10 additions & 9 deletions include/rogue/interfaces/memory/TransactionLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@
* Description:
* Memory Transaction lock
* ----------------------------------------------------------------------------
* 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
* 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_INTERFACES_MEMORY_TRANSACTION_LOCK_H__
#define __ROGUE_INTERFACES_MEMORY_TRANSACTION_LOCK_H__
#include <stdint.h>
#include <thread>
#include <memory>

namespace rogue {
namespace interfaces {
Expand All @@ -30,7 +31,7 @@ namespace rogue {

//! Transaction Lock
/**
* The TransactionLock is a container for holding a lock on Transaction data while accessing
* The TransactionLock is a container for holding a lock on Transaction data while accessing
* that data. This lock ensures that Transaction is not destroyed when the Slave is updating
* its data and result. This object is created by calling Transaction::lock().
*/
Expand Down Expand Up @@ -65,15 +66,15 @@ namespace rogue {
void unlock();

//! Enter method for python, does nothing
/** This exists only to support the
/** This exists only to support the
* with call in python.
*
* Exposed as __enter__() to Python
*/
void enter();

//! Exit method for python, does nothing
/** This exists only to support the
/** This exists only to support the
* with call in python.
*
* Exposed as __exit__() to Python
Expand Down
17 changes: 9 additions & 8 deletions include/rogue/interfaces/stream/FrameLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@
* Description:
* Memory Frame lock
* ----------------------------------------------------------------------------
* 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
* 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_INTERFACES_MEMORY_FRAME_LOCK_H__
#define __ROGUE_INTERFACES_MEMORY_FRAME_LOCK_H__
#include <stdint.h>
#include <thread>
#include <memory>

namespace rogue {
namespace interfaces {
Expand Down Expand Up @@ -71,15 +72,15 @@ namespace rogue {
void unlock();

//! Enter method for python, does nothing
/** This exists only to support the
/** This exists only to support the
* with call in python.
*
* Exposed as __enter__() to Python
*/
void enter();

//! Exit method for python, does nothing
/** This exists only to support the
/** This exists only to support the
* with call in python.
*
* Exposed as __exit__() to Python
Expand Down
13 changes: 7 additions & 6 deletions include/rogue/protocols/packetizer/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
* Description:
* Packetizer Core
* ----------------------------------------------------------------------------
* 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
* 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_PACKETIZER_CORE_H__
#define __ROGUE_PROTOCOLS_PACKETIZER_CORE_H__
#include <thread>
#include <stdint.h>
#include <memory>

namespace rogue {
namespace protocols {
Expand Down
13 changes: 7 additions & 6 deletions include/rogue/protocols/packetizer/CoreV2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@
* Description:
* Packetizer Core, Version 2
* ----------------------------------------------------------------------------
* 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
* 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_PACKETIZER_CORE_V2_H__
#define __ROGUE_PROTOCOLS_PACKETIZER_CORE_V2_H__
#include <thread>
#include <stdint.h>
#include <memory>

namespace rogue {
namespace protocols {
Expand Down
15 changes: 8 additions & 7 deletions include/rogue/protocols/rssi/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
* Description:
* UDP Client
* ----------------------------------------------------------------------------
* 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
* 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_RSSI_CLIENT_H__
#define __ROGUE_PROTOCOLS_RSSI_CLIENT_H__
#include <thread>
#include <stdint.h>
#include <memory>

namespace rogue {
namespace protocols {
Expand Down Expand Up @@ -70,7 +71,7 @@ namespace rogue {

//! Get Retransmit Count
uint32_t getRetranCount();

//! Get locBusy
bool getLocBusy();

Expand Down
13 changes: 7 additions & 6 deletions include/rogue/protocols/rssi/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
* File : Server.h
* Created : 2017-06-13
* ----------------------------------------------------------------------------
* 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
* 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_RSSI_SERVER_H__
#define __ROGUE_PROTOCOLS_RSSI_SERVER_H__
#include <thread>
#include <stdint.h>
#include <memory>

namespace rogue {
namespace protocols {
Expand Down
13 changes: 9 additions & 4 deletions src/rogue/interfaces/memory/Master.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,13 @@ uint32_t rim::Master::reqTransaction(uint64_t address, uint32_t size, void *data
uint32_t rim::Master::reqTransactionPy(uint64_t address, boost::python::object p, uint32_t size, uint32_t offset, uint32_t type) {
rim::TransactionPtr tran = rim::Transaction::create(sumTime_);

if ( PyObject_GetBuffer(p.ptr(),&(tran->pyBuf_),PyBUF_SIMPLE) < 0 )
throw(rogue::GeneralError("Master::reqTransactionPy","Python Buffer Error"));
if ( (type == rim::Read) || (type == rim::Verify) ) {
if ( PyObject_GetBuffer(p.ptr(),&(tran->pyBuf_),PyBUF_CONTIG) < 0 )
throw(rogue::GeneralError("Master::reqTransactionPy","Python Buffer Contig Error"));
} else {
if ( PyObject_GetBuffer(p.ptr(),&(tran->pyBuf_),PyBUF_SIMPLE) < 0 )
throw(rogue::GeneralError("Master::reqTransactionPy","Python Buffer SImple Error"));
}

if ( size == 0 ) tran->size_ = tran->pyBuf_.len;
else tran->size_ = size;
Expand Down Expand Up @@ -238,7 +243,7 @@ void rim::Master::copyBits(boost::python::object dst, uint32_t dstLsb, boost::py
uint32_t rem;
uint32_t bytes;

if ( PyObject_GetBuffer(dst.ptr(),&dstBuf,PyBUF_SIMPLE) < 0 )
if ( PyObject_GetBuffer(dst.ptr(),&dstBuf,PyBUF_CONTIG) < 0 )
throw(rogue::GeneralError("Master::copyBits","Python Buffer Error"));

if ( (dstLsb + size) > (dstBuf.len*8) ) {
Expand Down Expand Up @@ -305,7 +310,7 @@ void rim::Master::setBits(boost::python::object dst, uint32_t lsb, uint32_t size
uint32_t rem;
uint32_t bytes;

if ( PyObject_GetBuffer(dst.ptr(),&dstBuf,PyBUF_SIMPLE) < 0 )
if ( PyObject_GetBuffer(dst.ptr(),&dstBuf,PyBUF_CONTIG) < 0 )
throw(rogue::GeneralError("Master::setBits","Python Buffer Error"));

if ( (lsb + size) > (dstBuf.len*8) ) {
Expand Down
8 changes: 4 additions & 4 deletions src/rogue/interfaces/memory/Transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ rim::Transaction::iterator rim::Transaction::end() {
void rim::Transaction::setData ( boost::python::object p, uint32_t offset ) {
Py_buffer pyBuf;

if ( PyObject_GetBuffer(p.ptr(),&pyBuf,PyBUF_CONTIG) < 0 )
throw(rogue::GeneralError("Transaction::writePy","Python Buffer Error In Frame"));
if ( PyObject_GetBuffer(p.ptr(),&pyBuf,PyBUF_SIMPLE) < 0 )
throw(rogue::GeneralError("Transaction::setData","Python Buffer Error In Frame"));

uint32_t count = pyBuf.len;

Expand All @@ -252,8 +252,8 @@ void rim::Transaction::setData ( boost::python::object p, uint32_t offset ) {
void rim::Transaction::getData ( boost::python::object p, uint32_t offset ) {
Py_buffer pyBuf;

if ( PyObject_GetBuffer(p.ptr(),&pyBuf,PyBUF_SIMPLE) < 0 )
throw(rogue::GeneralError("Transaction::readPy","Python Buffer Error In Frame"));
if ( PyObject_GetBuffer(p.ptr(),&pyBuf,PyBUF_CONTIG) < 0 )
throw(rogue::GeneralError("Transaction::getData","Python Buffer Error In Frame"));

uint32_t count = pyBuf.len;

Expand Down
Loading

0 comments on commit 4df9726

Please sign in to comment.