exposing receiver thread ids to client (#102)

* exposing receiver thread ids to client

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
Dhanya Thattil
2020-06-09 16:18:37 +02:00
committed by GitHub
parent 2a2bb5f63a
commit f5160b0978
48 changed files with 1151 additions and 580 deletions

View File

@@ -15,10 +15,10 @@
// GetDAQStatusRegister(512,current_mode_bits_from_fpga)) {
unsigned int Module_ndacs = 16;
char Module_dac_names[16][10] = {"SvP", "Vtr", "Vrf", "Vrs",
"SvN", "Vtgstv", "Vcmp_ll", "Vcmp_lr",
"cal", "Vcmp_rl", "rxb_rb", "rxb_lb",
"Vcmp_rr", "Vcp", "Vcn", "Vis"};
char Module_dac_names[16][10] = {"VSvP", "Vtrim", "Vrpreamp", "Vrshaper",
"VSvN", "Vtgstv", "Vcmp_ll", "Vcmp_lr",
"Vcal", "Vcmp_rl", "rxb_rb", "rxb_lb",
"Vcmp_rr", "Vcp", "Vcn", "Vishaper"};
struct Module modules[10];
int moduleSize = 0;

View File

@@ -12,42 +12,42 @@
/* Enums */
enum DACINDEX {
E_SVP,
E_VTR,
E_VRF,
E_VRS,
E_SVN,
E_VSVP,
E_VTRIM,
E_VRPREAMP,
E_VRSHAPER,
E_VSVN,
E_VTGSTV,
E_VCMP_LL,
E_VCMP_LR,
E_CAL,
E_VCAL,
E_VCMP_RL,
E_RXB_RB,
E_RXB_LB,
E_VCMP_RR,
E_VCP,
E_VCN,
E_VIS,
E_VISHAPER,
E_VTHRESHOLD
};
#define DEFAULT_DAC_VALS \
{ \
0, /* SvP */ \
2480, /* Vtr */ \
3300, /* Vrf */ \
1400, /* Vrs */ \
4000, /* SvN */ \
0, /* VSvP */ \
2480, /* Vtrim */ \
3300, /* Vrpreamp */ \
1400, /* Vrshaper */ \
4000, /* VSvN */ \
2556, /* Vtgstv */ \
1000, /* Vcmp_ll */ \
1000, /* Vcmp_lr */ \
0, /* cal */ \
0, /* Vcal */ \
1000, /* Vcmp_rl */ \
1100, /* rxb_rb */ \
1100, /* rxb_lb */ \
1000, /* Vcmp_rr */ \
1000, /* Vcp */ \
2000, /* Vcn */ \
1550 /* Vis */ \
1550 /* Vishaper */ \
};
enum ADCINDEX {
TEMP_FPGAEXT,

View File

@@ -852,7 +852,7 @@ void updateGatePeriod() {
uint32_t countermask = getCounterMask();
for (int i = 0; i != 3; ++i) {
// only if counter enabled
if ((1 << i) & countermask) {
if (countermask & (1 << i)) {
uint64_t sum = getExpTime(i) + getGateDelay(i);
if (sum > max) {
max = sum;
@@ -1082,6 +1082,15 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
return;
}
if (ind == M_VTHRESHOLD) {
LOG(logINFO,
("Setting Threshold voltages to %d %s\n", val, (mV ? "mv" : "")));
setDAC(M_VTH1, val, mV);
setDAC(M_VTH2, val, mV);
setDAC(M_VTH3, val, mV);
return;
}
char *dac_names[] = {DAC_NAMES};
LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
val, (mV ? "mV" : "dac units")));
@@ -1106,6 +1115,23 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
}
int getDAC(enum DACINDEX ind, int mV) {
if (ind == M_VTHRESHOLD) {
int ret[3] = {0};
ret[0] = getDAC(M_VTH1, mV);
ret[1] = getDAC(M_VTH2, mV);
ret[2] = getDAC(M_VTH3, mV);
if ((ret[0] == ret[1]) && (ret[1] == ret[2])) {
LOG(logINFO, ("\tvthreshold match\n"));
return ret[0];
} else {
LOG(logERROR, ("\tvthreshold mismatch vth1:%d vth2:%d "
"vth3:%d\n",
ret[0], ret[1], ret[2]));
return -1;
}
}
if (!mV) {
LOG(logDEBUG1, ("Getting DAC %d : %d dac\n", ind, detectorDacs[ind]));
return detectorDacs[ind];

View File

@@ -56,43 +56,44 @@
/* Enums */
enum DACINDEX {
M_CASSH,
M_VCASSH,
M_VTH2,
M_VRFSH,
M_VRFSHNPOL,
M_VRSHAPER,
M_VRSHAPER_N,
M_VIPRE_OUT,
M_VTH3,
M_VTH1,
M_VICIN,
M_CAS,
M_VRF,
M_VPL,
M_VCAS,
M_VRPREAMP,
M_VCAL_N,
M_VIPRE,
M_VIINSH,
M_VPH,
M_VISHAPER,
M_VCAL_P,
M_VTRIM,
M_VDCSH
M_VDCSH,
M_VTHRESHOLD
};
#define DAC_NAMES \
"vcassh", "vth2", "vshaper", "vshaperneg", "vipre_out", "vth3", "vth1", \
"vicin", "vcas", "vpreamp", "vpl", "vipre", "viinsh", "vph", "vtrim", \
"vdcsh"
"vcassh", "vth2", "vrshaper", "vrshaper_n", "vipre_out", "vth3", "vth1", \
"vicin", "vcas", "vrpreamp", "vcal_n", "vipre", "vishaper", "vcal_p", \
"vtrim", "vdcsh"
#define DEFAULT_DAC_VALS \
{ \
1200, /* casSh */ \
2800, /* Vth2 */ \
1280, /* VrfSh */ \
2800, /* VrfShNpol */ \
1280, /* Vrshaper */ \
2800, /* Vrshaper_n */ \
1220, /* vIpreOut */ \
2800, /* Vth3 */ \
2800, /* Vth1 */ \
1708, /* vIcin */ \
1800, /* cas */ \
1100, /* Vrf */ \
1100, /* VPL */ \
1100, /* Vrpreamp */ \
1100, /* Vcal_n */ \
2624, /* vIpre */ \
1708, /* vIinSh */ \
1712, /* VPH */ \
1708, /* vishaper */ \
1712, /* Vcal_p */ \
2800, /* vTrim */ \
800 /* VdcSh */ \
};

View File

@@ -751,23 +751,23 @@ int set_dac(int file_des) {
case HIGH_VOLTAGE:
break;
#elif EIGERD
case THRESHOLD:
case VTHRESHOLD:
serverDacIndex = E_VTHRESHOLD;
break;
case SVP:
serverDacIndex = E_SVP;
case VSVP:
serverDacIndex = E_VSVP;
break;
case SVN:
serverDacIndex = E_SVN;
case VSVN:
serverDacIndex = E_VSVN;
break;
case VTR:
serverDacIndex = E_VTR;
case VTRIM:
serverDacIndex = E_VTRIM;
break;
case VRF:
serverDacIndex = E_VRF;
case VRPREAMP:
serverDacIndex = E_VRPREAMP;
break;
case VRS:
serverDacIndex = E_VRS;
case VRSHAPER:
serverDacIndex = E_VRSHAPER;
break;
case VTGSTV:
serverDacIndex = E_VTGSTV;
@@ -778,8 +778,8 @@ int set_dac(int file_des) {
case VCMP_LR:
serverDacIndex = E_VCMP_LR;
break;
case CAL:
serverDacIndex = E_CAL;
case VCAL:
serverDacIndex = E_VCAL;
break;
case VCMP_RL:
serverDacIndex = E_VCMP_RL;
@@ -799,8 +799,8 @@ int set_dac(int file_des) {
case VCN:
serverDacIndex = E_VCN;
break;
case VIS:
serverDacIndex = E_VIS;
case VISHAPER:
serverDacIndex = E_VISHAPER;
break;
case HIGH_VOLTAGE:
case IO_DELAY:
@@ -862,17 +862,17 @@ int set_dac(int file_des) {
#elif MYTHEN3D
case HIGH_VOLTAGE:
break;
case CASSH:
serverDacIndex = M_CASSH;
case VCASSH:
serverDacIndex = M_VCASSH;
break;
case VTH2:
serverDacIndex = M_VTH2;
break;
case SHAPER1:
serverDacIndex = M_VRFSH;
case VRSHAPER:
serverDacIndex = M_VRSHAPER;
break;
case SHAPER2:
serverDacIndex = M_VRFSHNPOL;
case VRSHAPER_N:
serverDacIndex = M_VRSHAPER_N;
break;
case VIPRE_OUT:
serverDacIndex = M_VIPRE_OUT;
@@ -880,36 +880,39 @@ int set_dac(int file_des) {
case VTH3:
serverDacIndex = M_VTH3;
break;
case THRESHOLD:
case VTH1:
serverDacIndex = M_VTH1;
break;
case VICIN:
serverDacIndex = M_VICIN;
break;
case CAS:
serverDacIndex = M_CAS;
case VCAS:
serverDacIndex = M_VCAS;
break;
case PREAMP:
serverDacIndex = M_VRF;
case VRPREAMP:
serverDacIndex = M_VRPREAMP;
break;
case CALIBRATION_PULSE:
serverDacIndex = M_VPH;
case VCAL_P:
serverDacIndex = M_VCAL_P;
break;
case VIPRE:
serverDacIndex = M_VIPRE;
break;
case VIINSH:
serverDacIndex = M_VIINSH;
case VISHAPER:
serverDacIndex = M_VISHAPER;
break;
case VPL:
serverDacIndex = M_VPL;
case VCAL_N:
serverDacIndex = M_VCAL_N;
break;
case TRIMBIT_SIZE:
case VTRIM:
serverDacIndex = M_VTRIM;
break;
case VDCSH:
serverDacIndex = M_VDCSH;
break;
case VTHRESHOLD:
serverDacIndex = M_VTHRESHOLD;
break;
#elif GOTTHARD2D
case HIGH_VOLTAGE:
break;
@@ -1198,7 +1201,7 @@ int set_dac(int file_des) {
case E_VCMP_LR:
case E_VCMP_RL:
case E_VCMP_RR:
case E_VRF:
case E_VRPREAMP:
case E_VCP:
setSettings(UNDEFINED);
LOG(logERROR,