Commit 65cb1a6a authored by Sarah Seif El Nasr's avatar Sarah Seif El Nasr
Browse files

WriteCBCBlockReg changed to locally check whether a CBC register write fails...

WriteCBCBlockReg changed to locally check whether a CBC register write fails if the write operation is attempted more than
5 times. Changes to the *FWInterface classes in the previous commit (2d746ad5) removed.
parent 2d746ad5
......@@ -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,8 +162,10 @@ 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)
......@@ -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++;
......
......@@ -29,7 +29,6 @@ namespace Ph2_HwInterface {
fpgaConfig = nullptr;
fData = nullptr;
fNthAcq = 0;
fRegWriteAttempts=0;
}
......@@ -40,7 +39,7 @@ namespace Ph2_HwInterface {
fpgaConfig ( nullptr ),
fData ( nullptr ),
fFileHandler ( pFileHandler ),
fNthAcq (0), fRegWriteAttempts(0)
fNthAcq (0)
{
if ( fFileHandler == nullptr ) fSaveToFile = false;
else fSaveToFile = true;
......@@ -52,7 +51,7 @@ namespace Ph2_HwInterface {
BeBoardFWInterface ( pId, pUri, pAddressTable ),
fpgaConfig ( nullptr ),
fData ( nullptr ),
fNthAcq (0), fRegWriteAttempts(0)
fNthAcq (0)
{
}
......@@ -65,7 +64,7 @@ namespace Ph2_HwInterface {
fpgaConfig ( nullptr ),
fData ( nullptr ),
fFileHandler ( pFileHandler ),
fNthAcq (0), fRegWriteAttempts(0)
fNthAcq (0)
{
if ( fFileHandler == nullptr ) fSaveToFile = false;
else fSaveToFile = true;
......@@ -699,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;
......@@ -740,25 +740,25 @@ 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 MAX_WRITE_ATTEMPTS
// 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 && fRegWriteAttempts < MAX_WRITE_ATTEMPTS )
if (cWriteAgain.size() < 100 && pWriteAttempts < cMaxWriteAttempts )
{
if (pReadback) LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(fRegWriteAttempts) << ") There were " << cWriteAgain.size() << " Readback Errors -trying again!" << RESET ;
else LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(fRegWriteAttempts) << ") There were " << cWriteAgain.size() << " CBC CMD acknowledge bits missing -trying again!" << RESET ;
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 ;
fRegWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, true);
pWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, pWriteAttempts, true);
}
else if ( fRegWriteAttempts >= MAX_WRITE_ATTEMPTS )
else if ( pWriteAttempts >= cMaxWriteAttempts )
{
cSuccess = false;
fRegWriteAttempts = 0 ;
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,9 +21,6 @@
#include "../HWDescription/Module.h"
#include "../Utils/Visitor.h"
// maximum number of tries allowed to attempt a write procedure to a CBC register
const uint8_t MAX_WRITE_ATTEMPTS = 5 ;
using namespace Ph2_HwDescription;
/*!
......@@ -50,9 +47,7 @@ namespace Ph2_HwInterface {
FileHandler* fFileHandler ;
uint32_t fNthAcq, fNpackets;
bool fJustPaused;
// number of tries a CBC register write operation was attempted
uint8_t fRegWriteAttempts;
private:
/*!
* \brief SRAM selection for DAQ
......@@ -266,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) , fRegWriteAttempts(0)
fNthAcq (0)
{
}
......@@ -34,7 +34,7 @@ namespace Ph2_HwInterface {
fpgaConfig ( nullptr ),
fData ( nullptr ),
fFileHandler ( pFileHandler ),
fNthAcq (0), fRegWriteAttempts(0)
fNthAcq (0)
{
if ( fFileHandler == nullptr ) fSaveToFile = false;
else fSaveToFile = true;
......@@ -46,7 +46,7 @@ namespace Ph2_HwInterface {
BeBoardFWInterface ( pId, pUri, pAddressTable ),
fpgaConfig ( nullptr ),
fData ( nullptr ),
fNthAcq (0), fRegWriteAttempts(0)
fNthAcq (0)
{
}
......@@ -59,7 +59,7 @@ namespace Ph2_HwInterface {
fpgaConfig ( nullptr ),
fData ( nullptr ),
fFileHandler ( pFileHandler ),
fNthAcq (0), fRegWriteAttempts(0)
fNthAcq (0)
{
if ( fFileHandler == nullptr ) fSaveToFile = false;
else fSaveToFile = true;
......@@ -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;
......@@ -654,25 +655,25 @@ namespace Ph2_HwInterface {
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 MAX_WRITE_ATTEMPTS
// 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 && fRegWriteAttempts < MAX_WRITE_ATTEMPTS )
if (cWriteAgain.size() < 100 && pWriteAttempts < cMaxWriteAttempts )
{
if (pReadback) LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(fRegWriteAttempts) << ") There were " << cWriteAgain.size() << " Readback Errors -trying again!" << RESET ;
else LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(fRegWriteAttempts) << ") There were " << cWriteAgain.size() << " CBC CMD acknowledge bits missing -trying again!" << RESET ;
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 ;
fRegWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, true);
pWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, pWriteAttempts, true);
}
else if ( fRegWriteAttempts >= MAX_WRITE_ATTEMPTS )
else if ( pWriteAttempts >= cMaxWriteAttempts )
{
cSuccess = false;
fRegWriteAttempts = 0 ;
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" );
......
......@@ -24,8 +24,6 @@
using namespace Ph2_HwDescription;
// maximum number of tries allowed to attempt a write procedure to a CBC register
const uint8_t MAX_WRITE_ATTEMPTS = 5 ;
/*!
* \namespace Ph2_HwInterface
* \brief Namespace regrouping all the interfaces to the hardware
......@@ -48,8 +46,6 @@ namespace Ph2_HwInterface {
FpgaConfig* fpgaConfig;
FileHandler* fFileHandler ;
uint32_t fNthAcq, fNpackets;
// number of tries a CBC register write operation was attempted
uint8_t fRegWriteAttempts;
private:
/*!
......@@ -256,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) , fRegWriteAttempts(0)
fFMCId (1)
{}
......@@ -39,7 +39,7 @@ namespace Ph2_HwInterface {
fBroadcastCbcId (0),
fReplyBufferSize (1024),
fFileHandler ( pFileHandler ),
fFMCId (1), fRegWriteAttempts(0)
fFMCId (1)
{
if ( fFileHandler == nullptr ) fSaveToFile = false;
else fSaveToFile = true;
......@@ -53,7 +53,7 @@ namespace Ph2_HwInterface {
fData ( nullptr ),
fBroadcastCbcId (0),
fReplyBufferSize (1024),
fFMCId (1), fRegWriteAttempts(0)
fFMCId (1)
{}
......@@ -67,7 +67,7 @@ namespace Ph2_HwInterface {
fBroadcastCbcId (0),
fReplyBufferSize (1024),
fFileHandler ( pFileHandler ),
fFMCId (1), fRegWriteAttempts(0)
fFMCId (1)
{
if ( fFileHandler == nullptr ) fSaveToFile = false;
else fSaveToFile = true;
......@@ -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,25 +573,25 @@ 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 MAX_WRITE_ATTEMPTS
// 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 && fRegWriteAttempts < MAX_WRITE_ATTEMPTS )
if (cWriteAgain.size() < 100 && pWriteAttempts < cMaxWriteAttempts )
{
if (pReadback) LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(fRegWriteAttempts) << ") There were " << cWriteAgain.size() << " Readback Errors -trying again!" << RESET ;
else LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(fRegWriteAttempts) << ") There were " << cWriteAgain.size() << " CBC CMD acknowledge bits missing -trying again!" << RESET ;
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 ;
fRegWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, true);
pWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, pWriteAttempts, true);
}
else if ( fRegWriteAttempts >= MAX_WRITE_ATTEMPTS )
else if ( pWriteAttempts >= cMaxWriteAttempts )
{
cSuccess = false;
fRegWriteAttempts = 0 ;
pWriteAttempts = 0 ;
}
else throw Exception ( "Too many CBC readback errors - no functional I2C communication. Check the Setup" );
}
......
......@@ -25,9 +25,6 @@
using namespace Ph2_HwDescription;
// maximum number of tries allowed to attempt a write procedure to a CBC register
const uint8_t MAX_WRITE_ATTEMPTS = 5 ;
/*!
* \namespace Ph2_HwInterface
* \brief Namespace regrouping all the interfaces to the hardware
......@@ -53,10 +50,6 @@ namespace Ph2_HwInterface {
uint32_t fDataSizeperEvent32;
uint32_t fFMCId;
// number of tries a CBC register write operation was attempted
uint8_t fRegWriteAttempts;
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;
......@@ -238,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 );
......
......@@ -26,7 +26,7 @@ namespace Ph2_HwInterface {
fData ( nullptr ),
fBroadcastCbcId (0),
fReplyBufferSize (1024),
fFMCId (1), fRegWriteAttempts(0)
fFMCId (1)
{}
......@@ -39,7 +39,7 @@ namespace Ph2_HwInterface {
fBroadcastCbcId (0),
fReplyBufferSize (1024),
fFileHandler ( pFileHandler ),
fFMCId (1), fRegWriteAttempts(0)
fFMCId (1)
{
if ( fFileHandler == nullptr ) fSaveToFile = false;
else fSaveToFile = true;
......@@ -53,7 +53,7 @@ namespace Ph2_HwInterface {
fData ( nullptr ),
fBroadcastCbcId (0),
fReplyBufferSize (1024),
fFMCId (1), fRegWriteAttempts(0)
fFMCId (1)
{}
......@@ -67,7 +67,7 @@ namespace Ph2_HwInterface {
fBroadcastCbcId (0),
fReplyBufferSize (1024),
fFileHandler ( pFileHandler ),
fFMCId (1), fRegWriteAttempts(0)
fFMCId (1)
{
if ( fFileHandler == nullptr ) fSaveToFile = false;
else fSaveToFile = true;
......@@ -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,27 +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 MAX_WRITE_ATTEMPTS
// 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 && fRegWriteAttempts < MAX_WRITE_ATTEMPTS )
if (cWriteAgain.size() < 100 && pWriteAttempts < cMaxWriteAttempts )
{
if (pReadback) LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(fRegWriteAttempts) << ") There were " << cWriteAgain.size() << " Readback Errors -trying again!" << RESET ;
else LOG (INFO) << BOLDRED << "(WRITE#" << std::to_string(fRegWriteAttempts) << ") There were " << cWriteAgain.size() << " CBC CMD acknowledge bits missing -trying again!" << RESET ;
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 ;
fRegWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, true);
pWriteAttempts++;
this->WriteCbcBlockReg ( cWriteAgain, pWriteAttempts, true);
}
else if ( fRegWriteAttempts >= MAX_WRITE_ATTEMPTS )
else if ( pWriteAttempts >= cMaxWriteAttempts )
{
cSuccess = false;
fRegWriteAttempts = 0 ;
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" );
}
......
......@@ -25,9 +25,6 @@
using namespace Ph2_HwDescription;
// maximum number of tries allowed to attempt a write procedure to a CBC register
const uint8_t MAX_WRITE_ATTEMPTS = 5 ;
/*!
* \namespace Ph2_HwInterface
* \brief Namespace regrouping all the interfaces to the hardware
......@@ -53,9 +50,6 @@ namespace Ph2_HwInterface {
uint32_t fDataSizeperEvent32;
uint32_t fFMCId;
// number of tries a CBC register write operation was attempted
uint8_t fRegWriteAttempts;
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;
......@@ -237,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 );
......
......@@ -112,6 +112,14 @@ int launch_HMP4040server( std::string pHostname = "localhost" , int pZmqPortNum
std::string currentDir = getcwd(buffer, sizeof(buffer));
std::string baseDirectory = getHomeDirectory() + "/Ph2_USBInstDriver";
// first check if process if running
//before I do anything else, try to find an existing lock and if so, terminate
// AppLock* cLock = new AppLock ("/tmp/lvSupervisor.lock", cMessage.str() );
// if (cLock->getLockDescriptor() < 0)
// {
// // server already running, might as well retreive the info before quitting!
// std::string cInfo = cLock->get_info();
// LOG (INFO) << "Retreived the following parameters from the info file: " << cInfo;
if(0 == system("pidof -x lvSupervisor > /dev/null")) //lvSupervisor is running.
{
LOG (INFO) << "HMP4040 server already running .... so do nothing!";
......@@ -211,8 +219,8 @@ bool check_CurrentConsumption(Tool pTool , int pNCBCs = 2 , std::string pHostnam
char buffer[120];
sprintf(buffer, "# Current measured on %s = %.3f mA.\n" , (srch_cMeasurements->first).c_str() , (double)(srch_cMeasurements->second) );
message += buffer;
//std::cout << srch_cLimits->first << " : " << srch_cLimits->second << std::endl ;
//std::cout << srch_cMeasurements->first << " : " << srch_cMeasurements->second << std::endl ;
//LOG (INFO) << srch_cLimits->first << " : " << srch_cLimits->second ;
//LOG (INFO) << srch_cMeasurements->first << " : " << srch_cMeasurements->second;
}
}
}
......@@ -223,7 +231,7 @@ bool check_CurrentConsumption(Tool pTool , int pNCBCs = 2 , std::string pHostnam
cCurrentsMeasured = cMeasurement.second;
if( cTimeStamp < cMeasurement.first) iterations++;
cTimeStamp = cMeasurement.first;
if( limitReached){ cNumTimes_limitReached++; std::cout << "Limit reached!!" << std::endl ; }
if( limitReached){ cNumTimes_limitReached++; LOG (INFO) << BOLDRED << "Nominal current consumption limits exceeded!!" << rst ; }
}while( iterations < cNumReads);
message += "#";
pTool.AmmendReport(message);
......@@ -285,7 +293,7 @@ bool check_Shorts(Tool pTool , std::string pHWFile , uint32_t cMaxNumShorts)
cShortFinder.AmmendReport( ( cNShorts <= cMaxNumShorts) ? ("# Shorts test passed.") : ("# Shorts test failed.") );
std::cout << GREEN << "\t\t" + std::to_string(cNShorts) + " shorts found on hybrid." << RESET << std::endl;
LOG (INFO) << GREEN << "\t\t" + std::to_string(cNShorts) + " shorts found on hybrid." << rst ;
return ( cNShorts <= cMaxNumShorts) ? true : false;
}
// measure the occupancy on the TOP/BOTTOM pads of the DUT
......@@ -349,6 +357,11 @@ void perform_AntennaOccupancyMeasurement(Tool pTool , std::string pHWFile )
int main ( int argc, char* argv[] )
{
//configure the logger
el::Configurations conf ("settings/logger.conf");
el::Loggers::reconfigureAllLoggers (conf);
ArgvParser cmd;
// init
......@@ -404,7 +417,7 @@ int main ( int argc, char* argv[] )
if ( result != ArgvParser::NoParserError )
{
std::cout << cmd.parseErrorDescription ( result );
LOG (INFO) << cmd.parseErrorDescription ( result );
exit ( 1 );
}
......@@ -512,7 +525,7 @@ int main ( int argc, char* argv[] )
if( !currentConsumptionTest_passed )
{
LOG(INFO) << BOLDRED << "Hybrid did not pass current consumption test. Stopping tester." ;
std::cout << BOLDBLUE << "Stopping DUT tester!" << rst << std::endl ;
LOG (INFO) << BOLDBLUE << "Stopping DUT tester!" << rst ;
// add cTool destroy here!
// have to destroy the tool at the end of the program
cTool.SaveResults();
......@@ -536,8 +549,8 @@ int main ( int argc, char* argv[] )
// if DUT fails register R&W test then stop here.
if( !registerReadWriteTest_passed )
{
LOG(INFO) << BOLDRED << "Hybrid did not pass register check. Stopping tester." << BLACK ;
std::cout << BOLDBLUE << "Stopping DUT tester!" << rst << std::endl ;
LOG(INFO) << BOLDRED << "Hybrid did not pass register check. Stopping tester." << rst ;
LOG (INFO) << BOLDBLUE << "Stopping DUT tester!" << rst ;
// have to destroy the tool at the end of the program
cTool.SaveResults();
cTool.CloseResultFile();
......@@ -549,7 +562,7 @@ int main ( int argc, char* argv[] )
// perform calibration of the CBCs on the DUT if --calibrate flag set in arguments passed to tester
if( cCalibrate )
{
LOG (INFO) << GREEN << "Hybrid passed register check. Moving on to calibration of the CBCs on the DUT." << BLACK ;
LOG (INFO) << GREEN << "Hybrid passed register check. Moving on to calibration of the CBCs on the DUT." << rst ;
t.start();
perform_Calibration(cTool);
LOG (INFO) << "Calibration finished." ;
......@@ -567,8 +580,7 @@ int main ( int argc, char* argv[] )
// measurement is performed!
if( !cCalibrate)
{
LOG (INFO) << GREEN << "Calibrating CBCs before starting antenna test of the CBCs on the DUT." ;
std::cout << rst ;
LOG (INFO) << GREEN << "Calibrating CBCs before starting antenna test of the CBCs on the DUT." << rst ;
t.start();
perform_Calibration(cTool);
LOG (INFO) << "Calibration finished." ;
......@@ -590,7 +602,7 @@ int main ( int argc, char* argv[] )
if( !shortFinder_passed )
{
LOG(INFO) << BOLDRED << "Hybrid did not pass shorts check. Stopping tester." ;
std::cout << BOLDBLUE << "Stopping DUT tester!" << rst << std::endl ;
LOG (INFO) << BOLDBLUE << "Stopping DUT tester!" << rst ;
cTool.SaveResults();
cTool.CloseResultFile();
......@@ -607,7 +619,7 @@ int main ( int argc, char* argv[] )
// measurement is performed!
if( !cCalibrate)
{
LOG (INFO) << GREEN << "Calibrating CBCs before starting antenna test of the CBCs on the DUT." << BLACK ;
LOG (INFO) << GREEN << "Calibrating CBCs before starting antenna test of the CBCs on the DUT." << rst ;
t.start();
perform_Calibration(cTool);
LOG (INFO) << "Calibration finished." ;
......@@ -634,7 +646,7 @@ int main ( int argc, char* argv[] )
// measurement is performed!
if( !cCalibrate)
{