jungfrauserver: bug fix: settings read correctly, forceswitchg2 mainly

This commit is contained in:
2018-04-26 15:49:09 +02:00
parent c9675d111a
commit 9f24bb0a98
5 changed files with 38 additions and 36 deletions

View File

@ -302,6 +302,8 @@
#define DAQ_SETTINGS_MSK (DAQ_HIGH_GAIN_MSK | DAQ_FIX_GAIN_MSK | DAQ_FRCE_SWTCH_GAIN_MSK) #define DAQ_SETTINGS_MSK (DAQ_HIGH_GAIN_MSK | DAQ_FIX_GAIN_MSK | DAQ_FRCE_SWTCH_GAIN_MSK)
#define DAQ_HIGH_GAIN_OFST (0) #define DAQ_HIGH_GAIN_OFST (0)
#define DAQ_HIGH_GAIN_MSK (0x00000001 << DAQ_HIGH_GAIN_OFST) #define DAQ_HIGH_GAIN_MSK (0x00000001 << DAQ_HIGH_GAIN_OFST)
#define DAQ_FIX_GAIN_DYNMC_VAL ((0x0 << DAQ_HIGH_GAIN_OFST) & DAQ_HIGH_GAIN_MSK)
#define DAQ_FIX_GAIN_HIGHGAIN_VAL ((0x1 << DAQ_HIGH_GAIN_OFST) & DAQ_HIGH_GAIN_MSK)
#define DAQ_FIX_GAIN_OFST (1) #define DAQ_FIX_GAIN_OFST (1)
#define DAQ_FIX_GAIN_MSK (0x00000003 << DAQ_FIX_GAIN_OFST) #define DAQ_FIX_GAIN_MSK (0x00000003 << DAQ_FIX_GAIN_OFST)
#define DAQ_FIX_GAIN_STG_1_VAL ((0x1 << DAQ_FIX_GAIN_OFST) & DAQ_FIX_GAIN_MSK) #define DAQ_FIX_GAIN_STG_1_VAL ((0x1 << DAQ_FIX_GAIN_OFST) & DAQ_FIX_GAIN_MSK)

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 03e781a0ac53cb73af5d00003a131383125ab40f Repsitory UUID: c9675d111a61075ebe4031ec6bdf285a76be0fce
Revision: 141 Revision: 142
Branch: jungfraunew Branch: jungfraunew
Last Changed Author: Dhanya_Thattil Last Changed Author: Dhanya_Thattil
Last Changed Rev: 3776 Last Changed Rev: 3777
Last Changed Date: 2018-04-23 16:06:57.000000002 +0200 ./RegisterDefs.h Last Changed Date: 2018-04-26 15:44:15.000000002 +0200 ./RegisterDefs.h

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git" #define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "03e781a0ac53cb73af5d00003a131383125ab40f" #define GITREPUUID "c9675d111a61075ebe4031ec6bdf285a76be0fce"
#define GITAUTH "Dhanya_Thattil" #define GITAUTH "Dhanya_Thattil"
#define GITREV 0x3776 #define GITREV 0x3777
#define GITDATE 0x20180423 #define GITDATE 0x20180426
#define GITBRANCH "jungfraunew" #define GITBRANCH "jungfraunew"

View File

@ -824,7 +824,7 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
break; break;
case DYNAMICHG0: case DYNAMICHG0:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_HIGH_GAIN_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
printf("\nConfigured settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)); printf("\nConfigured settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n", bus_r(DAQ_REG));
break; break;
case FIXGAIN1: case FIXGAIN1:
@ -862,37 +862,37 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
enum detectorSettings getSettings(){ enum detectorSettings getSettings(){
uint32_t val = bus_r(DAQ_REG); uint32_t val = bus_r(DAQ_REG) & DAQ_SETTINGS_MSK;
printf("\nGetting Settings\n Reading DAQ Register :0x%x\n", val); printf("\nGetting Settings\n Reading DAQ Register :0x%x\n", val);
if (val & DAQ_FRCE_GAIN_STG_2_VAL) { switch(val) {
thisSettings = FORCESWITCHG2; case DAQ_FIX_GAIN_DYNMC_VAL:
printf("Settings read: FORCESWITCHG2\n"); thisSettings = DYNAMICGAIN;
}
else if (val & DAQ_FRCE_GAIN_STG_1_VAL) {
thisSettings = FORCESWITCHG1;
printf("Settings read: FORCESWITCHG1\n");
}
else if (val & DAQ_FIX_GAIN_STG_2_VAL) {
thisSettings = FIXGAIN2;
printf("Settings read: FIXGAIN2\n");
}
else if (val & DAQ_FIX_GAIN_STG_1_VAL) {
thisSettings = FIXGAIN1;
printf("Settings read: FIXGAIN1\n");
}
else if (val & DAQ_HIGH_GAIN_MSK) {
thisSettings = DYNAMICHG0;
printf("Settings read: DYNAMICHG0\n");
}
else {
thisSettings = DYNAMICGAIN;
printf("Settings read: DYNAMICGAIN\n"); printf("Settings read: DYNAMICGAIN\n");
break;
case DAQ_FIX_GAIN_HIGHGAIN_VAL:
thisSettings = DYNAMICHG0;
printf("Settings read: DYNAMICHG0\n");
break;
case DAQ_FIX_GAIN_STG_1_VAL:
thisSettings = FIXGAIN1;
printf("Settings read: FIXGAIN1\n");
break;
case DAQ_FIX_GAIN_STG_2_VAL:
thisSettings = FIXGAIN2;
printf("Settings read: FIXGAIN2\n");
break;
case DAQ_FRCE_GAIN_STG_1_VAL:
thisSettings = FORCESWITCHG1;
printf("Settings read: FORCESWITCHG1\n");
break;
case DAQ_FRCE_GAIN_STG_2_VAL:
thisSettings = FORCESWITCHG2;
printf("Settings read: FORCESWITCHG2\n");
break;
default:
thisSettings = UNDEFINED;
printf("Settings read: Undefined. Value read:0x%x\n", val);
} }
return thisSettings; return thisSettings;