Commit 7ae0157a authored by Georg Auzinger's avatar Georg Auzinger
Browse files

Merge branch 'Dev' into 'Dev'

Dev



See merge request !38
parents 73ee7e12 e522187a
......@@ -17,7 +17,7 @@ before_script:
- yum -y -q groupinstall uhal
- yum -y -q install root
- yum -y -q install root-net-http root-montecarlo-eg root-graf3d-eve root-geom root-physics root-graf3d-gl
- yum -y -q install zeromq
build_Ph2_ACF:
script:
- source setup.sh
......
......@@ -148,8 +148,9 @@ namespace Ph2_HwInterface {
* \brief Write register blocks of a Cbc
* \param pFeId : FrontEnd to work with
* \param pVecReq : Block of words to write
* \param pWriteAttempt : number of tries write was attempted
*/
virtual bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, bool pReadback ) = 0;
virtual bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, uint8_t& pWriteAttempts , bool pReadback ) = 0;
//r/w the Cbc registers
/*!
* \brief Write register blocks of a Cbc
......
......@@ -78,7 +78,9 @@ namespace Ph2_HwInterface {
}
// write the registers, the answer will be in the same cVec
bool cSuccess = fBoardFW->WriteCbcBlockReg ( cVec, pVerifLoop);
// the number of times the write operation has been attempted is given by cWriteAttempts
uint8_t cWriteAttempts = 0 ;
bool cSuccess = fBoardFW->WriteCbcBlockReg ( cVec, cWriteAttempts , pVerifLoop);
#ifdef COUNT_FLAG
fTransactionCount++;
......@@ -160,17 +162,19 @@ namespace Ph2_HwInterface {
// encode the reg specific to the FW, pVerifLoop decides if it should be read back, true means to write it
fBoardFW->EncodeReg ( cRegItem, pCbc->getCbcId(), cVec, pVerifLoop, true );
// write the register, the answer is in the same cVec
bool cSuccess = fBoardFW->WriteCbcBlockReg ( cVec, pVerifLoop );
// write the registers, the answer will be in the same cVec
// the number of times the write operation has been attempted is given by cWriteAttempts
uint8_t cWriteAttempts = 0 ;
bool cSuccess = fBoardFW->WriteCbcBlockReg ( cVec, cWriteAttempts, pVerifLoop );
//update the HWDescription object
if (cSuccess)
pCbc->setReg ( pRegNode, pValue );
#ifdef COUNT_FLAG
fRegisterCount++;
fTransactionCount++;
#endif
#ifdef COUNT_FLAG
fRegisterCount++;
fTransactionCount++;
#endif
return cSuccess;
}
......@@ -196,8 +200,10 @@ namespace Ph2_HwInterface {
#endif
}
// write the registerss, the answer will be in the same cVec
bool cSuccess = fBoardFW->WriteCbcBlockReg ( cVec, pVerifLoop);
// write the registers, the answer will be in the same cVec
// the number of times the write operation has been attempted is given by cWriteAttempts
uint8_t cWriteAttempts = 0 ;
bool cSuccess = fBoardFW->WriteCbcBlockReg ( cVec, cWriteAttempts, pVerifLoop );
#ifdef COUNT_FLAG
fTransactionCount++;
......
......@@ -698,8 +698,9 @@ namespace Ph2_HwInterface {
}
bool CtaFWInterface::WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, bool pReadback)
bool CtaFWInterface::WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, uint8_t& pWriteAttempts , bool pReadback)
{
int cMaxWriteAttempts = 5;
bool cSuccess = false;
std::vector<uint32_t> cWriteVec = pVecReq;
......@@ -737,18 +738,28 @@ namespace Ph2_HwInterface {
// now I need to make sure that the written and the read-back vector are the same
std::vector<uint32_t> cWriteAgain = get_mismatches (cWriteVec.begin(), cWriteVec.end(), pVecReq.begin(), CtaFWInterface::cmd_reply_comp);
// now check the size of the WriteAgain vector and assert Success or not
// also check that the number of write attempts does not exceed cMaxWriteAttempts
if (cWriteAgain.empty() ) cSuccess = true;
else
{
cSuccess = false;
// if the number of errors is greater than 100, give up
if (cWriteAgain.size() < 120)
if (cWriteAgain.size() < 100 && pWriteAttempts < cMaxWriteAttempts )
{
LOG (INFO) << "There were " << cWriteAgain.size() << " Readback Errors while ckecking I2C writing - trying again!" ;
this->WriteCbcBlockReg ( cWriteAgain, true);
if (pReadback) LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(pWriteAttempts) << ") There were " << cWriteAgain.size() << " Readback Errors -trying again!" << RESET ;
pWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, pWriteAttempts, true);
}
//else LOG(INFO) << "There were too many errors " << cWriteAgain.size() << " (>120 Registers). Something is wrong - aborting!" ;
else if ( pWriteAttempts >= cMaxWriteAttempts )
{
cSuccess = false;
pWriteAttempts = 0 ;
}
//else std::cout << "There were too many errors " << cWriteAgain.size() << " (>120 Registers). Something is wrong - aborting!" << std::endl;
else throw Exception ( "Too many CBC readback errors - no functional I2C communication. Check the Setup" );
}
}
......
......@@ -21,8 +21,6 @@
#include "../HWDescription/Module.h"
#include "../Utils/Visitor.h"
using namespace Ph2_HwDescription;
/*!
......@@ -49,7 +47,7 @@ namespace Ph2_HwInterface {
FileHandler* fFileHandler ;
uint32_t fNthAcq, fNpackets;
bool fJustPaused;
private:
/*!
* \brief SRAM selection for DAQ
......@@ -263,7 +261,7 @@ namespace Ph2_HwInterface {
* \param pFeId : FrontEnd to work with
* \param pVecReq : Vector to stack the read words
*/
bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, bool pReadback ) override;
bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, uint8_t& pWriteAttempts, bool pReadback ) override;
/*!
* \brief Read register blocks of a Cbc
* \param pFeId : FrontEnd to work with
......
......@@ -22,7 +22,7 @@ namespace Ph2_HwInterface {
BeBoardFWInterface ( puHalConfigFileName, pBoardId ),
fpgaConfig ( nullptr ),
fData ( nullptr ),
fNthAcq (0)
fNthAcq (0)
{
}
......@@ -611,8 +611,9 @@ namespace Ph2_HwInterface {
}
bool GlibFWInterface::WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, bool pReadback)
bool GlibFWInterface::WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, uint8_t& pWriteAttempts , bool pReadback)
{
int cMaxWriteAttempts = 5;
bool cSuccess = false;
std::vector<uint32_t> cWriteVec = pVecReq;
......@@ -653,18 +654,27 @@ namespace Ph2_HwInterface {
// now I need to make sure that the written and the read-back vector are the same
std::vector<uint32_t> cWriteAgain = get_mismatches (cWriteVec.begin(), cWriteVec.end(), pVecReq.begin(), GlibFWInterface::cmd_reply_comp);
// now check the size of the WriteAgain vector and assert Success or not
// also check that the number of write attempts does not exceed cMaxWriteAttempts
if (cWriteAgain.empty() ) cSuccess = true;
else
{
cSuccess = false;
// if the number of errors is greater than 100, give up
if (cWriteAgain.size() < 120)
if (cWriteAgain.size() < 100 && pWriteAttempts < cMaxWriteAttempts )
{
if (pReadback) LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(pWriteAttempts) << ") There were " << cWriteAgain.size() << " Readback Errors -trying again!" << RESET ;
pWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, pWriteAttempts, true);
}
else if ( pWriteAttempts >= cMaxWriteAttempts )
{
LOG (INFO) << "There were " << cWriteAgain.size() << " Readback Errors -trying again!" ;
this->WriteCbcBlockReg ( cWriteAgain, true);
cSuccess = false;
pWriteAttempts = 0 ;
}
//else LOG(INFO) << "There were too many errors " << cWriteAgain.size() << " (>120 Registers). Something is wrong - aborting!" ;
//else std::cout << "There were too many errors " << cWriteAgain.size() << " (>120 Registers). Something is wrong - aborting!" << std::endl;
else throw Exception ( "Too many CBC readback errors - no functional I2C communication. Check the Setup" );
}
}
......
......@@ -252,7 +252,7 @@ namespace Ph2_HwInterface {
* \param pFeId : FrontEnd to work with
* \param pVecReq : Vector to stack the read words
*/
bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, bool pReadback ) override;
bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReq, uint8_t& pWriteAttempts , bool pReadback ) override;
/*!
* \brief Read register blocks of a Cbc
* \param pFeId : FrontEnd to work with
......
......@@ -26,7 +26,7 @@ namespace Ph2_HwInterface {
fData ( nullptr ),
fBroadcastCbcId (0),
fReplyBufferSize (1024),
fFMCId (1)
fFMCId (1)
{}
......@@ -524,8 +524,10 @@ namespace Ph2_HwInterface {
bool ICFc7FWInterface::WriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, bool pReadback)
bool ICFc7FWInterface::WriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, uint8_t& pWriteAttempts , bool pReadback)
{
uint8_t cMaxWriteAttempts = 5;
// the actual write & readback command is in the vector
std::vector<uint32_t> cReplies;
bool cSuccess = !WriteI2C ( pVecReg, cReplies, pReadback, false );
......@@ -571,23 +573,30 @@ namespace Ph2_HwInterface {
}
// now check the size of the WriteAgain vector and assert Success or not
// also check that the number of write attempts does not exceed cMaxWriteAttempts
if (cWriteAgain.empty() ) cSuccess = true;
else
{
cSuccess = false;
// if the number of errors is greater than 100, give up
if (cWriteAgain.size() < 100)
if (cWriteAgain.size() < 100 && pWriteAttempts < cMaxWriteAttempts )
{
if (pReadback) LOG (INFO) << "There were " << cWriteAgain.size() << " Readback Errors -trying again!" ;
else LOG (INFO) << "There were " << cWriteAgain.size() << " CBC CMD acknowledge bits missing -trying again!" ;
this->WriteCbcBlockReg ( cWriteAgain, true);
if (pReadback) LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(pWriteAttempts) << ") There were " << cWriteAgain.size() << " Readback Errors -trying again!" << RESET ;
else LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(pWriteAttempts) << ") There were " << cWriteAgain.size() << " CBC CMD acknowledge bits missing -trying again!" << RESET ;
pWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, pWriteAttempts, true);
}
else if ( pWriteAttempts >= cMaxWriteAttempts )
{
cSuccess = false;
pWriteAttempts = 0 ;
}
//else LOG(INFO) << "There were too many errors (>100 Registers). Something is wrong - aborting!" ;
else throw Exception ( "Too many CBC readback errors - no functional I2C communication. Check the Setup" );
}
return cSuccess;
}
......
......@@ -49,7 +49,7 @@ namespace Ph2_HwInterface {
uint32_t fNEventsperAcquistion;
uint32_t fDataSizeperEvent32;
uint32_t fFMCId;
const uint32_t SINGLE_I2C_WAIT = 70; //usec for 1MHz I2C
// const uint32_t SINGLE_I2C_WAIT = 700; //usec for 100 kHz I2C
static const int RESET_ALL = 0x1;
......@@ -231,7 +231,7 @@ namespace Ph2_HwInterface {
void DecodeReg ( CbcRegItem& pRegItem, uint8_t& pCbcId, uint32_t pWord, bool& pRead, bool& pFailed ) override;
bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, bool pReadback) override;
bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, uint8_t& pWriteAttempts, bool pReadback) override;
bool BCWriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, bool pReadback) override;
void ReadCbcBlockReg ( std::vector<uint32_t>& pVecReg );
......
......@@ -522,8 +522,9 @@ namespace Ph2_HwInterface {
bool ICGlibFWInterface::WriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, bool pReadback)
bool ICGlibFWInterface::WriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, uint8_t& pWriteAttempts , bool pReadback)
{
uint8_t cMaxWriteAttempts = 5;
// the actual write & readback command is in the vector
std::vector<uint32_t> cReplies;
bool cSuccess = !WriteI2C ( pVecReg, cReplies, pReadback, false );
......@@ -569,20 +570,26 @@ namespace Ph2_HwInterface {
}
// now check the size of the WriteAgain vector and assert Success or not
// also check that the number of write attempts does not exceed cMaxWriteAttempts
if (cWriteAgain.empty() ) cSuccess = true;
else
{
cSuccess = false;
// if the number of errors is greater than 100, give up
if (cWriteAgain.size() < 100)
if (cWriteAgain.size() < 100 && pWriteAttempts < cMaxWriteAttempts )
{
if (pReadback) LOG (INFO) << "There were " << cWriteAgain.size() << " Readback Errors -trying again!" ;
else LOG (INFO) << "There were " << cWriteAgain.size() << " CBC CMD acknowledge bits missing -trying again!" ;
this->WriteCbcBlockReg ( cWriteAgain, true);
if (pReadback) LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(pWriteAttempts) << ") There were " << cWriteAgain.size() << " Readback Errors -trying again!" << RESET ;
else LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(pWriteAttempts) << ") There were " << cWriteAgain.size() << " CBC CMD acknowledge bits missing -trying again!" << RESET ;
pWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, pWriteAttempts, true);
}
else if ( pWriteAttempts >= cMaxWriteAttempts )
{
cSuccess = false;
pWriteAttempts = 0 ;
}
//else LOG(INFO) << "There were too many errors (>100 Registers). Something is wrong - aborting!" ;
else throw Exception ( "Too many CBC readback errors - no functional I2C communication. Check the Setup" );
}
......
......@@ -231,7 +231,7 @@ namespace Ph2_HwInterface {
void DecodeReg ( CbcRegItem& pRegItem, uint8_t& pCbcId, uint32_t pWord, bool& pRead, bool& pFailed ) override;
bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, bool pReadback) override;
bool WriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, uint8_t& pWriteAttempts , bool pReadback) override;
bool BCWriteCbcBlockReg ( std::vector<uint32_t>& pVecReg, bool pReadback) override;
void ReadCbcBlockReg ( std::vector<uint32_t>& pVecReg );
......
ANTENNADIR=CMSPh2_AntennaDriver
AMC13DIR=/opt/cactus/include/amc13
USBINSTDIR=../Ph2_USBInstDriver
#DEPENDENCIES := Utils HWDescription HWInterface System tools RootWeb Tracker src miniDAQ
DEPENDENCIES := Utils HWDescription HWInterface RootWeb Tracker
ANTENNAINSTALLED = no
AMC13INSTALLED = no
USBINSTINSTALLED = no
ifneq ("$(wildcard $(ANTENNADIR))","")
DEPENDENCIES := CMSPh2_AntennaDriver $(DEPENDENCIES)
......@@ -20,6 +22,14 @@ else
AMC13INSTRUCTIONS = This feature can only be built if the AMC13 libraries are installed with cactus!
endif
ifneq ("$(wildcard $(USBINSTDIR))","")
DEPENDENCIES := ../Ph2_USBInstDriver $(DEPENDENCIES)
USBINSTINSTALLED = yes
USBINSTINSTRUCTIONS = HMP4040 instrument driver found.
else
USBINSTINSTRUCTIONS = To use the HMP4040 Instrument driver, please download the Driver from 'https://gitlab.cern.ch/cms_tk_ph2/Ph2_USBInstDriver.git'.
endif
.PHONY: print dependencies $(DEPENDENCIES) clean src miniDAQ tools
all: src miniDAQ
......@@ -53,6 +63,9 @@ print:
@echo 'Antenna Driver installed:' $(ANTENNAINSTALLED)
@echo $(ANTENNAINSTRUCTIONS)
@echo '*****************************'
@echo 'Ph2 USB Inst Driver installed:' $(USBINSTINSTALLED)
@echo $(USBINSTINSTRUCTIONS)
@echo '*****************************'
clean:
......@@ -66,6 +79,5 @@ clean:
(cd miniDAQ; make clean)
(cd Tracker; make clean)
(cd AMC13; make clean)
#(cd doc; make clean)
(rm -f lib/* bin/*)
#(cd doc; make clean)
(rm -f lib/* bin/*)
\ No newline at end of file
......@@ -66,7 +66,8 @@ namespace Ph2_System {
else pVec = fFileHandler->readFileChunks (pNWords32);
}
void SystemController::InitializeHw ( const std::string& pFilename, std::ostream& os )
void SystemController::InitializeHw ( const std::string& pFilename, std::ostream& os )
{
this->fParser.parseHW (pFilename, fBeBoardFWMap, fBoardVector, os );
......@@ -76,7 +77,7 @@ namespace Ph2_System {
if (fWriteHandlerEnabled)
this->initializeFileHandler();
}
void SystemController::InitializeSettings ( const std::string& pFilename, std::ostream& os )
{
this->fParser.parseSettings (pFilename, fSettingsMap, os );
......
......@@ -135,8 +135,10 @@ namespace Ph2_System {
*\param os : ostream to dump output
*/
void InitializeHw ( const std::string& pFilename, std::ostream& os = std::cout );
/*!
* \brief Initialize the settings
* \Added to allow the reconfiguation of the settings during a test procedure.
* \param pFilename : settings file
*\param os : ostream to dump output
*/
......
......@@ -26,6 +26,7 @@ public:
<< " finished at: " << tnow
<< "\telapsed time: " << time_span.count() << " seconds" << std::endl;
}
double getElapsedTime(){ duration<double> time_span = duration_cast<duration<double>>(end_ - start_); return time_span.count();}
void reset() {start_ = end_;}
private:
......
......@@ -2,12 +2,12 @@
<HwDescription>
<BeBoard Id="0" boardType="GLIB">
<!-- <connection id="board" uri="ipbusudp-2.0://192.168.000.175:50001" address_table="file://settings/address_table_2CBC.xml" /> -->
<connection id="board" uri="chtcp-2.0://cmsuptracker008:10203?target=192.168.0.175:50001" address_table="file://settings/address_table_2CBC.xml" />
<connection id="board" uri="chtcp-2.0://localhost:10203?target=192.168.0.175:50001" address_table="file://settings/address_table_2CBC.xml" />
<FW_Version NCbcDataSize="4" />
<Module FeId="0" FMCId="0" ModuleId="0" Status="1">
<Global_CBC_Register name="MiscTestPulseCtrl&amp;AnalogMux">0x21</Global_CBC_Register>
<CBC Id="0" configfile="./settings/Cbc_default_electron.txt" />
<CBC Id="1" configfile="./settings/Cbc_default_electron.txt" />
<CBC Id="0" configfile="./settings/Cbc_default_hole.txt" />
<CBC Id="1" configfile="./settings/Cbc_default_hole.txt" />
</Module>
<!-- Commissioning Mode -->
<!-- set to 1 to enable commissioning mode -->
......@@ -50,8 +50,8 @@
<Settings>
<Setting name="TargetVcth">0x78</Setting>
<Setting name="TargetOffset">0x50</Setting>
<Setting name="Nevents">200</Setting>
<Setting name="Nevents">100</Setting>
<Setting name="TestPulsePotentiometer">0x00</Setting>
<Setting name="HoleMode">0</Setting>
<Setting name="HoleMode">1</Setting>
<Setting name="VerificationLoop">1</Setting>
</Settings>
<?xml version='1.0' encoding='utf-8'?>
<HwDescription>
<BeBoard Id="0" boardType="GLIB">
<!--<connection id="board" uri="ipbusudp-2.0://192.168.000.163:50001" address_table="file://settings/address_table_2CBC.xml" /> -->
<connection id="board" uri="chtcp-2.0://cmsuptracker002:10203?target=192.168.0.175:50001" address_table="file://settings/address_table_2CBC.xml" />
<FW_Version NCbcDataSize="4" />
<!-- <connection id="board" uri="ipbusudp-2.0://192.168.000.163:50001" address_table="file://settings/address_table_2CBC.xml" /> -->
<!-- <connection id="board" uri="chtcp-2.0://cmsuptracker002:10203?target=192.168.0.175:50001" address_table="file://settings/address_table_2CBC.xml" /> -->
<connection id="board" uri="chtcp-2.0://localhost:10203?target=192.168.0.175:50001" address_table="file://settings/address_table_2CBC.xml" />
<FW_Version NCbcDataSize="4" />
<Module FeId="0" FMCId="0" ModuleId="0" Status="1">
<Global_CBC_Register name="VCth"> 0x76 </Global_CBC_Register>
<!--<Global_CBC_Register name="TriggerLatency"> 0x0F </Global_CBC_Register>-->
......@@ -12,13 +14,13 @@
<!--<Global_CBC_Register name="TestPulsePot">0xE0</Global_CBC_Register>-->
<!--<Global_CBC_Register name="SelTestPulseDel&ChanGroup">0x00</Global_CBC_Register>-->
<CBC_Files path="./settings/" />
<CBC Id="0" configfile="Cbc_default_hole.txt" />
<CBC Id="1" configfile="Cbc_default_hole.txt" />
<CBC_Files path="./settings/" />
<!-- <CBC Id="0" configfile="Cbc_default_hole.txt" />
<CBC Id="1" configfile="Cbc_default_hole.txt" /> -->
<!--<CBC_Files path="./Results/Calibration_Hole_27-04-16_17:55/" />-->
<!--<CBC Id="0" configfile="FE0CBC0.txt" />-->
<!--<CBC Id="1" configfile="FE0CBC1.txt" />-->
<CBC_Files path="./Results/IntegratedTester_Hole_26-10-16_18:00/" />
<CBC Id="0" configfile="FE0CBC0.txt" />
<CBC Id="1" configfile="FE0CBC1.txt" />
</Module>
<!-- Commissioning Mode -->
<!-- set to 1 to enable commissioning mode -->
......@@ -58,7 +60,7 @@
</BeBoard>
</HwDescription>
<Settings>
<Setting name="Nevents">10</Setting>
<Setting name="Nevents">1000</Setting>
<Setting name="RunNumber">1</Setting>
<Setting name="HoleMode">0</Setting>
</Settings>
......@@ -2,7 +2,8 @@
<HwDescription>
<BeBoard Id="0" boardType="GLIB">
<connection id="board" uri="ipbusudp-2.0://192.168.000.175:50001" address_table="file://settings/address_table_2CBC.xml" />
<!-- <connection id="board" uri="ipbusudp-2.0://192.168.000.175:50001" address_table="file://settings/address_table_2CBC.xml" /> -->
<connection id="board" uri="chtcp-2.0://localhost:10203?target=192.168.0.175:50001" address_table="file://settings/address_table_2CBC.xml" />
<FW_Version NCbcDataSize="4"/>
......@@ -11,7 +12,7 @@
<Global_CBC_Register name="VCth"> 0x78 </Global_CBC_Register>
<!--Global_CBC_Register name="TriggerLatency"> 0x0C </Global_CBC_Register-->
<CBC_Files path="./settings/"/>
<CBC_Files path="./Results/IntegratedTester_Hole_26-10-16_18:00/" />
<CBC Id="0" configfile="FE0CBC0.txt"/>
<CBC Id="1" configfile="FE0CBC1.txt"/>
......
......@@ -17,6 +17,9 @@ export BASE_DIR=$(pwd)
#ANTENNA
export ANTENNALIB=CMSPh2_AntennaDriver/lib
#HMP4040
export USBINSTLIB=../Ph2_USBInstDriver/lib
export PATH=$BASE_DIR/bin:$PATH
export LD_LIBRARY_PATH=$BASE_DIR/$ANTENNALIB:$BASE_DIR/RootWeb/lib:/opt/cactus/lib:$BASE_DIR/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=$BASE_DIR/$HMP4040LIB:$BASE_DIR/$ANTENNALIB:$BASE_DIR/RootWeb/lib:/opt/cactus/lib:$BASE_DIR/lib:${LD_LIBRARY_PATH}
......@@ -4,6 +4,7 @@ CCFlags = -g -O0 -w -Wall -pedantic -pthread -std=c++0x -fPIC
CCFlagsRoot = `root-config --cflags --glibs`
ROOTVERSION := $(shell root-config --has-http)
HttpFlag = -D__HTTP__
ZmqFlag = -D__ZMQ__
DevFlags =
......@@ -11,11 +12,13 @@ ANTENNADIR=../CMSPh2_AntennaDriver
AntennaFlag = -D__ANTENNA__
AMC13DIR=/opt/cactus/include/amc13
Amc13Flag = -D__AMC13__
USBINSTDIR=../../Ph2_USBInstDriver
USBINSTFlag = -D__USBINST__
ZMQ_HEADER_PATH = /usr/include/zmq.hpp
LibraryDirs = /opt/cactus/lib ../lib
IncludeDirs = /opt/cactus/include ../
ExternalObjects= $(LibraryPaths) -lpthread -lcactus_extern_pugixml -lcactus_uhal_log -lcactus_uhal_grammars -lcactus_uhal_uhal -lboost_system -lPh2_Interface -lPh2_Description -lPh2_System -lPh2_Utils -lPh2_Tracker -lPh2_Tools
ExternalObjects= $(LibraryPaths) -lcactus_extern_pugixml -lcactus_uhal_log -lcactus_uhal_grammars -lcactus_uhal_uhal -lboost_system -lPh2_Interface -lPh2_Description -lPh2_System -lPh2_Utils -lPh2_Tracker -lPh2_Tools
##################################################
## check if the Root has THttp
......@@ -32,7 +35,7 @@ endif
ifneq ("$(wildcard $(ANTENNADIR))","")
IncludeDirs += $(ANTENNADIR)
LibraryDirs += $(ANTENNADIR)/lib /usr/lib64/
ExternalObjects += -lPh2_Antenna $(AntennaFlag)
ExternalObjects += -lboost_thread -lPh2_Antenna $(AntennaFlag)
ANTENNAINSTALLED = yes
else
ANTENNAINSTALLED = no
......@@ -48,7 +51,27 @@ else
AMC13INSTALLED = no
endif
#################################################
# check if ZMQ library is available on this machine
#################################################
ifneq ("$(wildcard $(ZMQ_HEADER_PATH))","")
ExternalObjects += -lzmq $(ZmqFlag)
ZMQINSTALLED = yes
else
ZMQINSTALLED = no
ZMQINSTRUCTIONS = ZeroMQ library is required to build the lvSupervisor with the server option - get it with \'sudo yum install zeromq-devel\'
endif
##################################################
## check if the HMP4040 drivers are installed
##################################################
ifneq ("$(wildcard $(USBINSTDIR))","")
LibraryDirs += $(USBINSTDIR)/lib $(USBINSTDIR)/Utils $(USBINSTDIR)/HMP4040
IncludeDirs += $(BOOST_INCLUDE) $(USBINSTDIR)/HMP4040 $(USBINSTDIR)/Utils $(USBINSTDIR)/Drivers
ExternalObjects += -lpthread -lboost_thread -lPh2_HMP4040 -lPh2_USBUtils -lPh2_Drivers $(USBINSTFlag)
HMP4040INSTALLED = yes
else
HMP4040INSTALLED = no
endif
IncludePaths = $(IncludeDirs:%=-I%)
RootLibraryDirs = /usr/local/lib/root
......@@ -57,7 +80,7 @@ LibraryPaths = $(LibraryDirs:%=-L%)
RootLibraryPaths = $(RootLibraryDirs:%=-L%)
binaries=print systemtest datatest hybridtest cmtest calibrate commission fpgaconfig pulseshape configure #test
binaries=print systemtest datatest hybridtest cmtest calibrate commission fpgaconfig pulseshape configure integratedtester
binariesNoRoot=systemtest datatest fpgaconfig configure
.PHONY: clean $(binaries)
......@@ -74,8 +97,14 @@ print:
@echo 'Root Has Http:' $(ROOTVERSION)
@echo 'Amc13 SW installed:' $(AMC13INSTALLED)
@echo 'Antenna installed:' $(ANTENNAINSTALLED)
@echo 'HMP4040 installed:' $(HMP4040INSTALLED)
@echo 'ZXMQ installed:' $(ZMQINSTALLED)
@echo '****************************'
integratedtester: integratedtester.cc
$(CXX) $(CCFlags) -o $@ $< $(IncludePaths) $(ExternalObjects)
cp $@ ../bin
systemtest: systemtest.cc
$(CXX) $(CCFlags) -o $@ $< $(IncludePaths) $(ExternalObjects)
cp $@ ../bin
......@@ -112,9 +141,5 @@ pulseshape: pulseshape.cc
$(CXX) $(CCFlags) -o $@ $< $(IncludePaths) $(ExternalObjects)
cp $@ ../bin
#test: test.cc