From bc323432eb403e65c06c5945be877fe0aa8e678f Mon Sep 17 00:00:00 2001 From: CyrilGrignon Date: Sun, 24 Jul 2016 16:29:33 +0200 Subject: [PATCH 1/2] Added possibility to load VME options for unique boards only, once baselines are loaded in Initialize function --- src/slave/CBV1724.cc | 16 +++++++++++++--- src/slave/CBV1724.hh | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/slave/CBV1724.cc b/src/slave/CBV1724.cc index 95d17e6..1b5b071 100644 --- a/src/slave/CBV1724.cc +++ b/src/slave/CBV1724.cc @@ -108,7 +108,7 @@ int CBV1724::Initialize(koOptions *options) // Reload VME options int tries = 0; - while( LoadVMEOptions( options ) != 0 && tries < 5) { + while( LoadVMEOptions( options, false ) != 0 && tries < 5) { tries ++; usleep(100); if( tries == 5 ) @@ -125,6 +125,16 @@ int CBV1724::Initialize(koOptions *options) fBufferOccCount = 0; fReadoutReports.clear(); + // Load user registers for boards with a unique ID only + // this is to avoid user settings to be overwritten + tries = 0; + while( LoadVMEOptions( options,true ) != 0 && tries < 5) { + tries ++; + usleep(100); + if( tries == 5 ) + retVal = -1; + } + // Report whether we succeeded or not stringstream messstr; if( retVal == 0 ){ @@ -722,12 +732,12 @@ int CBV1724::LoadDAC(vector baselines){ return 0; } - int CBV1724::LoadVMEOptions( koOptions *options ) + int CBV1724::LoadVMEOptions( koOptions *options, bool unique ) { int retVal = 0; // Reload VME options for(int x=0;xGetVMEOptions();x++) { - if((options->GetVMEOption(x).board==-1 || + if( ( (options->GetVMEOption(x).board==-1 && unique == false) || options->GetVMEOption(x).board==fBID.id)){ int success = WriteReg32(options->GetVMEOption(x).address, options->GetVMEOption(x).value); diff --git a/src/slave/CBV1724.hh b/src/slave/CBV1724.hh index ba62eae..17bba48 100644 --- a/src/slave/CBV1724.hh +++ b/src/slave/CBV1724.hh @@ -74,7 +74,7 @@ class CBV1724 : public VMEBoard { int LoadDAC(vector baselines); int LoadBaselines(); //Load baselines to boards int GetBaselines(vector &baselines, bool bQuiet=false); //Get baselines from file - int LoadVMEOptions( koOptions *options ); + int LoadVMEOptions( koOptions *options, bool unique ); unsigned int fReadoutThresh; pthread_mutex_t fDataLock; From 70f14243cf5f9b745b279e33d8472b062a4a9166 Mon Sep 17 00:00:00 2001 From: CyrilGrignon Date: Fri, 30 Sep 2016 11:49:02 +0200 Subject: [PATCH 2/2] Reload DAC values for unique boards after baseline estimation --- src/slave/CBV1724.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/slave/CBV1724.cc b/src/slave/CBV1724.cc index f4d7a42..cae8df1 100644 --- a/src/slave/CBV1724.cc +++ b/src/slave/CBV1724.cc @@ -940,6 +940,10 @@ int CBV1724::LoadDAC(vector baselines){ for(int x=0;xGetVMEOptions();x++) { if( ( (options->GetVMEOption(x).board==-1 && unique == false) || options->GetVMEOption(x).board==fBID.id)){ + + // only reload registers for DAC + if( (options->GetVMEOption(x).address & 0x98)!=0x98) + continue; int success = WriteReg32(options->GetVMEOption(x).address, options->GetVMEOption(x).value); if( options->GetVMEOption(x).address == 0xEF24 ) // give time to reset