Commit f0c948b3 authored by Suvankar Roy Chowdhury's avatar Suvankar Roy Chowdhury
Browse files

Shelve removal

parent bd44efdc
......@@ -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 =
DevFlags =
IncludeDirs = /opt/cactus/include ../
IncludePaths = $(IncludeDirs:%=-I%)
IncludePaths = $(IncludeDirs:%=-I%)
%.o: %.cc %.h
$(CXX) -std=c++11 $(DevFlags) $(CCFlags) $(UserCCFlags) $(CCDefines) $(IncludePaths) -c -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();
......
......@@ -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
......
This diff is collapsed.
/*!
\file SystemController.h
\brief Controller of the System, overall wrapper of the framework
\author Nicolas PIERRE
\brief Controller of the System, overall wrapper of the framework
\author Nicolas PIERRE
\version 1.0
\date 10/08/14
Support : mail to : lorenzo.bidegain@cern.ch, nico.pierre@icloud.com
\date 10/08/14
Support : mail to : lorenzo.bidegain@cern.ch, nico.pierre@icloud.com
*/
*/
#ifndef __SYSTEMCONTROLLER_H__
#define __SYSTEMCONTROLLER_H__
#include "../HWInterface/BeBoardFWInterface.h"
#include "../HWDescription/Shelve.h"
#include "../HWInterface/CbcInterface.h"
#include "../HWInterface/BeBoardInterface.h"
#include "../HWDescription/Definition.h"
......@@ -28,7 +27,7 @@
#include <vector>
#include <map>
#include <stdlib.h>
# include <string.h>
#include <string.h>
using namespace Ph2_HwDescription;
......@@ -41,8 +40,8 @@ using namespace Ph2_HwInterface;
namespace Ph2_System
{
typedef std::vector<Shelve*> ShelveVec; /*!< Vector of Shelve pointers */
typedef std::map<std::string, uint32_t> SettingsMap; /*!< Maps the settings */
using BeBoardVec = std::vector<BeBoard*>; /*!< Vector of Board pointers */
using SettingsMap = std::map<std::string, uint32_t>; /*!< Maps the settings */
/*!
* \class SystemController
......@@ -52,12 +51,11 @@ namespace Ph2_System
{
public:
BeBoardInterface* fBeBoardInterface; /*!< Interface to the BeBoard */
CbcInterface* fCbcInterface; /*!< Interface to the Cbc */
ShelveVec fShelveVector; /*!< Vector of Shelve pointers */
BeBoardFWMap fBeBoardFWMap;
SettingsMap fSettingsMap; /*!< Maps the settings */
FileHandler* fFileHandler;
CbcInterface* fCbcInterface; /*!< Interface to the Cbc */
BeBoardVec fBoardVector; /*!< Vector of Board pointers */
BeBoardFWMap fBeBoardFWMap;
SettingsMap fSettingsMap; /*!< Maps the settings */
FileHandler* fFileHandler;
public:
/*!
......@@ -72,29 +70,23 @@ namespace Ph2_System
* \brief create a FileHandler object with
* \param pFilename : the filename of the binary file
*/
void addFileHandler( std::string pFilename, char pOption );
void addFileHandler( const std::string& pFilename, char pOption );
/*!
* \brief read file in the a FileHandler object
* \param pVec : the data vector
*/
void readFile(std::vector<uint32_t>& pVec );
void readFile( std::vector<uint32_t>& pVec );
/*!
* \brief acceptor method for HwDescriptionVisitor
* \param pVisitor
*/
void accept( HwDescriptionVisitor& pVisitor ) {
pVisitor.visit( *this );
for ( Shelve* cShelve : fShelveVector )
cShelve->accept( pVisitor );
for ( BeBoard* cBoard : fBoardVector )
cBoard->accept( pVisitor );
}
// void accept( HwDescriptionVisitor& pVisitor ) const {
// pVisitor.visit( *this );
// for ( auto& cShelve : fShelveVector )
// cShelve->accept( pVisitor );
// }
/*!
* \brief Initialize the Hardware via a config file
* \param pFilename : HW Description file
......@@ -110,7 +102,7 @@ namespace Ph2_System
/*!
* \brief Configure the Hardware with XML file indicated values
*/
void ConfigureHw( std::ostream& os = std::cout , bool bIgnoreI2c = false );
void ConfigureHw( std::ostream& os = std::cout, bool bIgnoreI2c = false );
/*!
* \brief Run a DAQ
* \param pBeBoard
......@@ -129,6 +121,7 @@ namespace Ph2_System
}
const BeBoard* getBoard(int index) const {(index < fBoardVector.size()) ? fBoardVector.at(index) : nullptr;}
/*!
* \brief Get next event from data buffer
* \param pBoard
......@@ -167,19 +160,19 @@ namespace Ph2_System
* \param pFilename : HW Description file
*\param os : ostream to dump output
*/
void parseSettingsxml( const std::string& pFilename, std::ostream& os );
void parseSettingsxml( const std::string& pFilename, std::ostream& os = std::cout);
/*!
* \brief Initialize the settins via XML file
* \param pFilename : settings Description file
*\param os : ostream to dump output
*/
void parseHWjson( const std::string& pFilename, std::ostream& os );
void parseHWjson( const std::string& pFilename, std::ostream& os = std::cout);
/*!
* \brief Initialize the settins via JSON file
* \param pFilename : settings Description file
*\param os : ostream to dump output
*/
void parseSettingsjson( const std::string& pFilename, std::ostream& os );
void parseSettingsjson( const std::string& pFilename, std::ostream& os = std::cout);
/*! \brief Expand environment variables in string
* \param s input string
* \return Result with variables expanded */
......
......@@ -3,7 +3,6 @@
#include "../HWInterface/BeBoardFWInterface.h"
#include "../HWDescription/Shelve.h"
#include "../HWInterface/CbcInterface.h"
#include "../HWInterface/BeBoardInterface.h"
#include "../HWDescription/Definition.h"
......@@ -81,9 +80,8 @@ class Counter : public HwDescriptionVisitor
uint32_t fNCbc;
uint32_t fNFe;
uint32_t fNBe;
uint32_t fNShelve;
public:
Counter() : fNCbc( 0 ), fNFe( 0 ), fNBe( 0 ), fNShelve( 0 ) {}
Counter() : fNCbc( 0 ), fNFe( 0 ), fNBe( 0 ) {}
void visit( Ph2_HwDescription::Cbc& pCbc ) {
fNCbc++;
}
......@@ -93,9 +91,6 @@ class Counter : public HwDescriptionVisitor
void visit( Ph2_HwDescription::BeBoard& pBoard ) {
fNBe++;
}
void visit( Ph2_HwDescription::Shelve& pShelve ) {
fNShelve++;
}
uint32_t getNCbc() const {
return fNCbc;
}
......@@ -105,9 +100,6 @@ class Counter : public HwDescriptionVisitor
uint32_t getNBe() const {
return fNBe;
}
uint32_t getNShelves() const {
return fNShelve;
};
};
// Configurator
......
......@@ -34,8 +34,8 @@ namespace Ph2_HwInterface
private:
uint32_t fNevents; /*! Number of Events<*/
uint32_t fCurrentEvent; /*! Current EventNumber in use <*/
uint32_t fNCbc ; /*! Number of CBCs in the setup <*/
uint32_t fEventSize ; /*! Size of 1 Event <*/
uint32_t fNCbc; /*! Number of CBCs in the setup <*/
uint32_t fEventSize; /*! Size of 1 Event <*/
std::vector<Event*> fEventList;
......
......@@ -27,8 +27,8 @@ using namespace Ph2_HwDescription;
namespace Ph2_HwInterface
{
typedef std::map<uint32_t, std::pair<uint32_t, uint32_t>> FeEventMap; /*!< Event Map of Cbc */
typedef std::map<uint32_t, FeEventMap> EventMap; /*!< Event Map of FE */
using FeEventMap = std::map<uint32_t, std::pair<uint32_t, uint32_t>>; /*!< Event Map of Cbc */
using EventMap = std::map<uint32_t, FeEventMap>; /*!< Event Map of FE */
/*!
* \class Event
......
#include "FileHandler.h"
//Constructor
FileHandler::FileHandler( std::string pBinaryFileName, char pOption ):
FileHandler::FileHandler( const std::string& pBinaryFileName, char pOption ):
fBinaryFileName( pBinaryFileName ),
fOption( pOption ),
fFileIsOpened( false ) ,
......@@ -89,4 +89,4 @@ void FileHandler::writeFile()
}
}
}
\ No newline at end of file
}
......@@ -38,7 +38,7 @@ class FileHandler
* \param pBinaryFileName: set the fbinaryFileName to pbinaryFileName
* \param pOption: set fOption to pOption
*/
FileHandler( std::string pBinaryFileName, char pOption );
FileHandler( const std::string& pBinaryFileName, char pOption );
/*!
* \brief destructor
......@@ -56,7 +56,7 @@ class FileHandler
* \brief get the name of the binary file
* \param return the name of the file
*/
std::string getFilename() {
std::string getFilename() const {
return fBinaryFileName;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment