Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #112 from bdorney/revert-110-feature/link-reset-wait
Browse files Browse the repository at this point in the history
Bug Fix: Bad Node Names & Hard Coded LMDB Size Limit
partially revert #110
  • Loading branch information
jsturdy authored Apr 1, 2019
2 parents 46ffbbe + 2dc2a2b commit db7ef30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef struct localArgs {
*/
LocalArgs getLocalArgs(RPCMsg *response);

static constexpr uint32_t LMDB_SIZE = 1UL * 1024UL * 1024UL * 40UL; ///< Maximum size of the LMDB object, currently 40 MiB
static constexpr uint32_t LMDB_SIZE = 1UL * 1024UL * 1024UL * 50UL; ///< Maximum size of the LMDB object, currently 50 MiB

// FIXME: to be replaced with the above function when the struct is properly implemented
#define GETLOCALARGS(response) \
Expand Down
23 changes: 10 additions & 13 deletions src/daq_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
* \author Brian Dorney <[email protected]>
*/

#include "daq_monitor.h"

#include "amc.h"
#include <chrono>
#include <thread>
#include "daq_monitor.h"
#include "hw_constants.h"
#include <string>

#include "utils.h"
#include "amc.h"
#include "hw_constants.h"

void getmonTTCmainLocal(localArgs * la)
{
Expand Down Expand Up @@ -240,30 +238,29 @@ void getmonGBTLinkLocal(localArgs * la, int NOH, bool doReset)
//Reset Requested?
if (doReset) {
writeReg(la, "GEM_AMC.GEM_SYSTEM.CTRL.LINK_RESET", 0x1);
std::this_thread::sleep_for(std::chrono::microseconds(92)); // FIXME sleep for N orbits
}

std::string regName, respName; //regName used for read/write, respName sets word in RPC response
for (int ohN=0; ohN < NOH; ++ohN) {
for (unsigned int gbtN=0; gbtN < gbt::GBTS_PER_OH; ++gbtN) {
//Ready
respName = stdsprintf("OH%i.GBT%i.READY",ohN,gbtN);
regName = stdsprintf("GEM_AMC.OH_LINKS.%s",respName.c_str());
regName = stdsprintf("GEM_AMC.OH_LINKS.OH%i.GBT%i_READY",ohN,gbtN);
la->response->set_word(respName,readReg(la, regName));

//Was not ready
respName = stdsprintf("OH%i.GBT%i.WAS_NOT_READY",ohN,gbtN);
regName = stdsprintf("GEM_AMC.OH_LINKS.%s",respName.c_str());
regName = stdsprintf("GEM_AMC.OH_LINKS.OH%i.GBT%i_WAS_NOT_READY",ohN,gbtN);
la->response->set_word(respName,readReg(la, regName));

//Rx had overflow
respName = stdsprintf("OH%i.GBT%i.RX_HAD_OVERFLOW",ohN,gbtN);
regName = stdsprintf("GEM_AMC.OH_LINKS.%s",respName.c_str());
regName = stdsprintf("GEM_AMC.OH_LINKS.OH%i.GBT%i_RX_HAD_OVERFLOW",ohN,gbtN);
la->response->set_word(respName,readReg(la, regName));

//Rx had underflow
respName = stdsprintf("OH%i.GBT%i.RX_HAD_UNDERFLOW",ohN,gbtN);
regName = stdsprintf("GEM_AMC.OH_LINKS.%s",respName.c_str());
regName = stdsprintf("GEM_AMC.OH_LINKS.OH%i.GBT%i_RX_HAD_UNDERFLOW",ohN,gbtN);
la->response->set_word(respName,readReg(la, regName));
} //End Loop Over GBT's
} //End Loop Over All OH's
Expand Down Expand Up @@ -763,7 +760,7 @@ void getmonVFATLinkLocal(localArgs * la, int NOH, bool doReset)
for (unsigned int vfatN=0; vfatN < oh::VFATS_PER_OH; ++vfatN) {
//Sync Error Counters
respName = stdsprintf("OH%i.VFAT%i.SYNC_ERR_CNT",ohN,vfatN);
regName = stdsprintf("GEM_AMC.OH_LINKS.%s",respName.c_str());
regName = stdsprintf("GEM_AMC.OH_LINKS.OH%i.VFAT%i.SYNC_ERR_CNT",ohN,vfatN);
int nSyncErrs = readReg(la,regName);
la->response->set_word(respName,nSyncErrs);
if ( nSyncErrs > 0 ) {
Expand All @@ -772,12 +769,12 @@ void getmonVFATLinkLocal(localArgs * la, int NOH, bool doReset)

//DAQ Event Counters
respName = stdsprintf("OH%i.VFAT%i.DAQ_EVENT_CNT",ohN,vfatN);
regName = stdsprintf("GEM_AMC.OH_LINKS.%s",respName.c_str());
regName = stdsprintf("GEM_AMC.OH_LINKS.OH%i.VFAT%i.DAQ_EVENT_CNT",ohN,vfatN);
la->response->set_word(respName,readReg(la,regName));

//DAQ CRC Error Counters
respName = stdsprintf("OH%i.VFAT%i.DAQ_CRC_ERROR_CNT",ohN,vfatN);
regName = stdsprintf("GEM_AMC.OH_LINKS.%s",respName.c_str());
regName = stdsprintf("GEM_AMC.OH_LINKS.OH%i.VFAT%i.DAQ_CRC_ERROR_CNT",ohN,vfatN);
la->response->set_word(respName,readReg(la,regName));
} //End Loop Over VFAT's
} //End Loop Over All OH's
Expand Down

0 comments on commit db7ef30

Please sign in to comment.