Commit bfa3d93b authored by Georg Auzinger's avatar Georg Auzinger
Browse files

merging Dev on v1-32

parents 55cdda0f e221fb73
......@@ -14,3 +14,4 @@ Results
Calibrations
.run_number.txt
settings/connections_186.xml
.ycm_extra_conf.py
......@@ -21,17 +21,14 @@ namespace Ph2_HwDescription
// Constructors
BeBoard::BeBoard() :
fShelveId( 0 ),
fBeId( 0 ) {}
BeBoard::BeBoard( uint8_t pShelveId, uint8_t pBeId ) :
fShelveId( pShelveId ),
BeBoard::BeBoard( uint8_t pBeId ) :
fBeId( pBeId )
{
}
BeBoard::BeBoard( uint8_t pShelveId, uint8_t pBeId, const std::string& filename ) :
fShelveId( pShelveId ),
BeBoard::BeBoard( uint8_t pBeId, const std::string& filename ) :
fBeId( pBeId )
{
loadConfigFile( filename );
......
/*!
\file BeBoard.h
\brief BeBoard Description class, configs of the BeBoard
\author Lorenzo BIDEGAIN
\date 14/07/14
\version 1.0
Support : mail to : lorenzo.bidegain@gmail.com
\brief BeBoard Description class, configs of the BeBoard
\author Lorenzo BIDEGAIN
\date 14/07/14
\version 1.0
Support : mail to : lorenzo.bidegain@gmail.com
*/
......@@ -27,7 +27,7 @@
namespace Ph2_HwDescription
{
typedef std::map< std::string, uint32_t > BeBoardRegMap; /*!< Map containing the registers of a board */
using BeBoardRegMap = std::map< std::string, uint32_t >; /*!< Map containing the registers of a board */
/*!
* \class BeBoard
......@@ -38,7 +38,7 @@ namespace Ph2_HwDescription
public:
// C'tors: the BeBoard only needs to know about it's shelf and which BE it is
// C'tors: the BeBoard only needs to know about which BE it is
/*!
* \brief Default C'tor
*/
......@@ -46,18 +46,16 @@ namespace Ph2_HwDescription
/*!
* \brief Standard C'tor
* \param pShelveId
* \param pBeId
*/
BeBoard( uint8_t pShelveId, uint8_t pBeId );
BeBoard( uint8_t pBeId );
/*!
* \brief C'tor for a standard BeBoard reading a config file
* \param pShelveId
* \param pBeId
* \param filename of the configuration file
*/
BeBoard( uint8_t pShelveId, uint8_t pBeId, const std::string& filename );
BeBoard( uint8_t pBeId, const std::string& filename );
/*!
* \brief Destructor
......@@ -145,18 +143,11 @@ namespace Ph2_HwDescription
return fBeId;
}
/*!
* \brief Get the Shelve Id of the BeBoard
* \return the ShelveId
*/
uint8_t getShelveId() const {
return fShelveId;
}
/*!
* \brief Get the BeBoardIdentifier
* \return The BeBoardIdentifier
*/
uint32_t getBeBoardIdentifier() const {
return fBeId << 8 | fShelveId;
return fBeId << 8;
}
/*!
* \brief Set the Be Id of the BeBoard
......@@ -166,13 +157,6 @@ namespace Ph2_HwDescription
fBeId = pBeId;
};
/*!
* \brief Set the Shelve Id of the BeBoard
* \param pShelveId
*/
void setShelveId( uint8_t pShelveId ) {
fShelveId = pShelveId;
};
/*!
* \brief Set the Number of CBCs that are used to compute the data blob size of the BeBoard (according to FW version)
* \param pNCbcDataSize
*/
......@@ -191,7 +175,6 @@ namespace Ph2_HwDescription
protected:
//Connection Members
uint8_t fShelveId;
uint8_t fBeId;
uint16_t fNCbcDataSize;
......
/*!
Filename : Cbc.cc
Content : Cbc Description class, config of the Cbcs
Filename : Cbc.cc
Content : Cbc Description class, config of the Cbcs
Programmer : Lorenzo BIDEGAIN
Version : 1.0
Version : 1.0
Date of Creation : 25/06/14
Support : mail to : lorenzo.bidegain@gmail.com
Support : mail to : lorenzo.bidegain@gmail.com
*/
......@@ -30,9 +30,9 @@ namespace Ph2_HwDescription
loadfRegMap( filename );
}
// C'tors which take ShelveID, BeId, FMCId, FeID, CbcId
// C'tors which take BeId, FMCId, FeID, CbcId
Cbc::Cbc( uint8_t pShelveId, uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pCbcId, const std::string& filename ) : FrontEndDescription( pShelveId, pBeId, pFMCId, pFeId ), fCbcId( pCbcId )
Cbc::Cbc( uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pCbcId, const std::string& filename ) : FrontEndDescription( pBeId, pFMCId, pFeId ), fCbcId( pCbcId )
{
loadfRegMap( filename );
......@@ -168,8 +168,7 @@ namespace Ph2_HwDescription
bool CbcComparer::operator()( const Cbc& cbc1, const Cbc& cbc2 ) const
{
if ( cbc1.getShelveId() != cbc2.getShelveId() ) return cbc1.getShelveId() < cbc2.getShelveId();
else if ( cbc1.getBeId() != cbc2.getBeId() ) return cbc1.getBeId() < cbc2.getBeId();
if ( cbc1.getBeId() != cbc2.getBeId() ) return cbc1.getBeId() < cbc2.getBeId();
else if ( cbc1.getFMCId() != cbc2.getFMCId() ) return cbc1.getFMCId() < cbc2.getFMCId();
else if ( cbc1.getFeId() != cbc2.getFeId() ) return cbc1.getFeId() < cbc2.getFeId();
else return cbc1.getCbcId() < cbc2.getCbcId();
......
......@@ -34,8 +34,8 @@
namespace Ph2_HwDescription
{
typedef std::map < std::string, CbcRegItem > CbcRegMap;
typedef std::pair <std::string, CbcRegItem> CbcRegPair;
using CbcRegMap = std::map < std::string, CbcRegItem >;
using CbcRegPair = std::pair <std::string, CbcRegItem>;
/*!
* \class Cbc
......@@ -46,12 +46,12 @@ namespace Ph2_HwDescription
public:
// C'tors which take BeId, FMCId, FeID, CbcId
Cbc( uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pCbcId, const std::string& filename );
// C'tors with object FE Description
Cbc( const FrontEndDescription& pFeDesc, uint8_t pCbcId, const std::string& filename );
// C'tors which take ShelveID, BeId, FeID, CbcId
Cbc( uint8_t pShelveId, uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pCbcId, const std::string& filename );
// Default C'tor
Cbc();
......
......@@ -16,8 +16,7 @@
namespace Ph2_HwDescription
{
FrontEndDescription::FrontEndDescription( uint8_t pShelveId, uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, bool pStatus ) :
fShelveId( pShelveId ),
FrontEndDescription::FrontEndDescription( uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, bool pStatus ) :
fBeId( pBeId ),
fFMCId( pFMCId ),
fFeId( pFeId ),
......@@ -25,17 +24,7 @@ namespace Ph2_HwDescription
{
}
FrontEndDescription::FrontEndDescription( uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId ) :
fShelveId( 0 ),
fBeId( pBeId ),
fFMCId( pFMCId ),
fFeId( pFeId ),
fStatus( true )
{
}
FrontEndDescription::FrontEndDescription( ) :
fShelveId( 0 ),
fBeId( 0 ),
fFMCId( 0 ),
fFeId( 0 ),
......@@ -44,7 +33,6 @@ namespace Ph2_HwDescription
}
FrontEndDescription::FrontEndDescription( const FrontEndDescription& pFeDesc ) :
fShelveId( pFeDesc.fShelveId ),
fBeId( pFeDesc.fBeId ),
fFMCId( pFeDesc.fFMCId ),
fFeId( pFeDesc.fFeId ),
......
......@@ -34,8 +34,7 @@ namespace Ph2_HwDescription
// METHODS
// 3 C'tors with different parameter sets
FrontEndDescription( uint8_t pShelveId, uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, bool pStatus = true );
FrontEndDescription( uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId );
FrontEndDescription( uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, bool pStatus = true );
FrontEndDescription( );
//Copy C'tors
......@@ -46,14 +45,6 @@ namespace Ph2_HwDescription
// Getter methods
/*!
* \brief Get the Shelve ID
* \return The Shelve ID
*/
uint8_t getShelveId() const {
return fShelveId;
}
/*!
* \brief Get the Be ID
* \return The Be ID
......@@ -83,7 +74,7 @@ namespace Ph2_HwDescription
* \return The BeBoardIdentifier
*/
uint16_t getBeBoardIdentifier() const {
return fBeId << 8 | fShelveId;
return fBeId << 8;
}
/*!
......@@ -96,13 +87,6 @@ namespace Ph2_HwDescription
// Setter methods
/*!
* \brief Set the Shelve ID
* \param pShelveId
*/
void setShelveId( uint8_t pShelveId ) {
fShelveId = pShelveId;
}
/*!
* \brief Set the Be ID
* \param pBeId
......@@ -135,8 +119,6 @@ namespace Ph2_HwDescription
protected:
// MEMBERS
// Crate (uTCA) that the FE is connected to
uint8_t fShelveId;
// BIO Board Id that the FE is connected to
uint8_t fBeId;
// Id of the FMC Slot on the BIO Board, all FEs need to know so the right FW registers can be written
......
Objs = FrontEndDescription.o BeBoard.o Cbc.o Module.o Shelve.o
Objs = FrontEndDescription.o BeBoard.o Cbc.o Module.o
CC = gcc
CXX = g++
CCFlags = -g -O1 -Wall -fPIC
# -fPIC `root-config --cflags --glibs --evelibs`
#DevFlags = -D__CBCDAQ_DEV__
DevFlags =
.PHONY: clean print
IncludeDirs = /opt/cactus/include ../
IncludePaths = $(IncludeDirs:%=-I%)
......@@ -14,9 +15,13 @@ IncludePaths = $(IncludeDirs:%=-I%)
$(CXX) -std=c++11 $(DevFlags) $(CCFlags) $(UserCCFlags) $(CCDefines) $(IncludePaths) -c -o $@ $<
all: $(Objs)
all: print $(Objs)
$(CC) -shared -o libPh2_Description.so $(Objs)
mv libPh2_Description.so ../lib
print:
@echo '****************************'
@echo 'Building HWDescription objects'
@echo '****************************'
clean:
rm -f *.o
......@@ -23,7 +23,7 @@ namespace Ph2_HwDescription
{
}
Module::Module( uint8_t pShelveId, uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pModuleId ) : FrontEndDescription( pShelveId, pBeId, pFMCId, pFeId ), fModuleId( pModuleId )
Module::Module( uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pModuleId ) : FrontEndDescription( pBeId, pFMCId, pFeId ), fModuleId( pModuleId )
{
}
......
......@@ -39,7 +39,7 @@ namespace Ph2_HwDescription
// C'tors take FrontEndDescription or hierachy of connection
Module( const FrontEndDescription& pFeDesc, uint8_t pModuleId );
Module( uint8_t pShelveId, uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pModuleId );
Module( uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pModuleId );
// Default C'tor
Module();
......
/*!
Filename : Shelve.cc
Content : Shelve Description class, handles a vector of Board
Programmer : Lorenzo BIDEGAIN
Version : 1.0
Date of Creation : 11/08/14
Support : mail to : lorenzo.bidegain@gmail.com
*/
#include "Shelve.h"
namespace Ph2_HwDescription
{
Shelve::Shelve( uint8_t pShelveId ) : fShelveId( pShelveId )
{
}
Shelve::Shelve(): fShelveId( 0 )
{
}
bool Shelve::removeBoard( uint8_t pBeId )
{
std::vector < BeBoard* > :: iterator i;
bool found = false;
for ( i = fBoardVector.begin(); i != fBoardVector.end(); ++i )
{
if ( (*i)->getBeId() == pBeId )
{
found = true;
break;
}
}
if ( found ) {
fBoardVector.erase( i );
return true;
}
else
{
std::cout << "Error:The Shelve :" << +fShelveId
<< " doesn't have the Board " << +pBeId << std::endl;
return false;
}
}
BeBoard* Shelve::getBoard( uint8_t pBeId ) const
{
for ( BeBoard* b : fBoardVector )
{
if ( b->getBeId() == pBeId )
return b;
}
return nullptr;
}
}
/*!
\file Shelve.h
\brief Shelve Description class, handles a vector of Board
\author Lorenzo BIDEGAIN
\version 1.0
\date 11/08/14
Support : mail to : lorenzo.bidegain@gmail.com
*/
#ifndef Shelve_h__
#define Shelve_h__
#include "BeBoard.h"
#include "../Utils/Visitor.h"
/*!
* \namespace Ph2_HwDescription
* \brief Namespace regrouping all the hardware description
*/
namespace Ph2_HwDescription
{
/*!
* \class Shelve
* \brief handles a vector of Board which are connected to the Shelve
*/
class Shelve
{
public:
//C'tor which takes the ShelveId
Shelve( uint8_t pShelveId );
// Default C'tor
Shelve();
// D'tor
~Shelve() {
for ( auto& pBoard: fBoardVector )
delete pBoard;
fBoardVector.clear();
}
/*!
* \brief acceptor method for HwDescriptionVisitor
* \param pVisitor
*/
void accept( HwDescriptionVisitor& pVisitor ) {
pVisitor.visit( *this );
for ( auto& cBoard : fBoardVector )
cBoard->accept( pVisitor );
}
// void accept( HwDescriptionVisitor& pVisitor ) const {
// pVisitor.visit( *this );
// for ( auto& cBoard : fBoardVector )
// cBoard.accept( pVisitor );
// }
/*!
* \brief Get the number of Board connected to the Shelve
* \return The size of the vector
*/
uint8_t getNBoard() const {
return fBoardVector.size();
}
/*!
* \brief Adding a Board to the vector
* \param pBoard
*/
void addBoard( BeBoard& pBoard ) {
fBoardVector.push_back( &pBoard );
}
void addBoard( BeBoard* pBoard ) {
fBoardVector.push_back( pBoard );
}
/*!
* \brief Remove a Board from the vector
* \param pBeId
* \return a bool which indicate if the removing was successful
*/
bool removeBoard( uint8_t pBeId );
/*!
* \brief Get a Board from the vector
* \param pBeId
* \return a pointer of Board, so we can manipulate directly the Board contained in the vector
*/
BeBoard* getBoard( uint8_t pBeId ) const;
/*!
* \brief Get the Shelve Id
* \return The Shelve ID
*/
uint8_t getShelveId() const {
return fShelveId;
}
/*!
* \brief Set the Shelve Id
* \param pShelveId
*/
void setShelveId( uint8_t pShelveId ) {
fShelveId = pShelveId;
};
// Vector of Boards
std::vector< BeBoard* > fBoardVector;
protected:
uint8_t fShelveId;
};
}
#endif
......@@ -14,8 +14,6 @@
#include "BeBoardFWInterface.h"
#include "FpgaConfig.h"
#define DEV_FLAG 0
namespace Ph2_HwInterface
{
......
......@@ -35,7 +35,7 @@ namespace Ph2_HwInterface
{
BeBoardFWMap::iterator i = fBoardMap.find( pBoardIdentifier );
if ( i == fBoardMap.end() )
std::cout << "The Board: " << +( pBoardIdentifier >> 8 ) << " in Shelve " << +( static_cast<uint8_t>( pBoardIdentifier ) ) << " doesn't exist" << std::endl;
std::cout << "The Board: " << +( pBoardIdentifier >> 8 ) << " doesn't exist" << std::endl;
else
{
fBoardFW = i->second;
......
......@@ -18,9 +18,9 @@
* The project compiles into the 5 following dynamic libraries
*
* \subsection lib1 HWDescription
* Hardware description of the shelves containing the boards, containing the modules, containing the CBC chips.\n
* Hardware description of the boards, containing the modules, containing the CBC chips.\n
* The objects are:
FrontEndDescription, BeBoard, Cbc, Module, Shelve
FrontEndDescription, BeBoard, Cbc, Module
* \subsection lib2 HWInterface
* Hardware interface seen by the ACF middleware users. \n
......@@ -56,7 +56,7 @@ using namespace Ph2_HwDescription;
namespace Ph2_HwInterface
{
typedef std::map<uint16_t, BeBoardFWInterface*> BeBoardFWMap; /*!< Map of Board connected */
using BeBoardFWMap = std::map<uint16_t, BeBoardFWInterface*>; /*!< Map of Board connected */
/*!
* \class BeBoardInterface
......
......@@ -47,7 +47,7 @@ void CbcInterface::setBoard( uint16_t pBoardIdentifier )
{
BeBoardFWMap::iterator i = fBoardMap.find( pBoardIdentifier );
if ( i == fBoardMap.end() )
std::cout << "The Board: " << +( pBoardIdentifier >> 8 ) << " in Shelve " << +( static_cast<uint8_t>( pBoardIdentifier ) ) << " doesn't exist" << std::endl;
std::cout << "The Board: " << +( pBoardIdentifier >> 8 ) << " doesn't exist" << std::endl;
else
{
fBoardFW = i->second;
......
......@@ -25,7 +25,7 @@ using namespace Ph2_HwDescription;
namespace Ph2_HwInterface
{
typedef std::map<uint16_t, BeBoardFWInterface*> BeBoardFWMap; /*!< Map of Board connected */
using BeBoardFWMap = std::map<uint16_t, BeBoardFWInterface*>; /*!< Map of Board connected */
/*!
* \class CbcInterface
......
......@@ -209,8 +209,10 @@ namespace Ph2_HwInterface
// set the vector<uint32_t> as event buffer and let him know how many packets it contains
fData->Set( pBoard, cData , cNPackets, true );
if ( fSaveToFile )
if ( fSaveToFile ){
fFileHandler->set( cData );
fFileHandler->writeFile();
}
return cNPackets;
}
......@@ -294,7 +296,7 @@ namespace Ph2_HwInterface
cBlockSize = computeBlockSize( pBoard );
while ( runningAcquisition && ( nbMaxAcq == 0 || numAcq < nbMaxAcq ) )
{
ReadData( nullptr, numAcq, true );
ReadData( pBoard, numAcq, true );
for ( const Ph2_HwInterface::Event* cEvent = GetNextEvent( pBoard ); cEvent; cEvent = GetNextEvent( pBoard ) )
visitor->visit( *cEvent );
......
Objs = RegManager.o BeBoardFWInterface.o GlibFWInterface.o CtaFWInterface.o BeBoardInterface.o FpgaConfig.o GlibFpgaConfig.o CtaFpgaConfig.o CbcInterface.o MmcPipeInterface.o Firmware.o
CC = gcc
CXX = g++
CCFlags = -g -O1 -w -Wall -pedantic -fPIC -Wcpp
CCFlags = -g -O1 -w -Wall -pedantic -fPIC
#DevFlags = -D__CBCDAQ_DEV__
DevFlags =
.PHONY: clean print
IncludeDirs = /opt/cactus/include ../ .
IncludePaths = $(IncludeDirs:%=-I%)
%.o: %.cc %.h
$(CXX) -std=c++11 $(DevFlags) $(CCFlags) $(UserCCFlags) $(CCDefines) $(IncludePaths) -c -o $@ $<
$(CXX) -std=c++0x $(DevFlags) $(CCFlags) $(UserCCFlags) $(CCDefines) $(IncludePaths) -c -o $@ $<
all: $(Objs) ../HWDescription/Definition.h
$(CC) -std=c++11 -shared -o libPh2_Interface.so $(Objs) -pthread
all: print $(Objs) ../HWDescription/Definition.h
$(CC) -std=c++0x -shared -o libPh2_Interface.so $(Objs) -pthread
mv libPh2_Interface.so ../lib
print:
@echo '****************************'
@echo 'Building HWInterfaces '
@echo '****************************'