mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
eiger quad server: set and reset chip signals before and after trimming
This commit is contained in:
parent
8ba37e99a7
commit
1e1c799223
@ -23,26 +23,26 @@ int Feb_Control_activated = 1;
|
||||
int Feb_Control_hv_fd = -1;
|
||||
unsigned int Feb_Control_idelay[4]; // ll,lr,rl,ll
|
||||
int Feb_Control_counter_bit = 1;
|
||||
unsigned int Feb_Control_staticBits;
|
||||
unsigned int Feb_Control_acquireNReadoutMode;
|
||||
unsigned int Feb_Control_triggerMode;
|
||||
unsigned int Feb_Control_externalEnableMode;
|
||||
unsigned int Feb_Control_subFrameMode;
|
||||
unsigned int Feb_Control_softwareTrigger;
|
||||
unsigned int Feb_Control_staticBits = 0;
|
||||
unsigned int Feb_Control_acquireNReadoutMode = 0;
|
||||
unsigned int Feb_Control_triggerMode = 0;
|
||||
unsigned int Feb_Control_externalEnableMode = 0;
|
||||
unsigned int Feb_Control_subFrameMode = 0;
|
||||
unsigned int Feb_Control_quadMode = 0;
|
||||
|
||||
unsigned int Feb_Control_nimages;
|
||||
double Feb_Control_exposure_time_in_sec;
|
||||
int64_t Feb_Control_subframe_exposure_time_in_10nsec;
|
||||
int64_t Feb_Control_subframe_period_in_10nsec;
|
||||
double Feb_Control_exposure_period_in_sec;
|
||||
unsigned int Feb_Control_nimages = 0;
|
||||
double Feb_Control_exposure_time_in_sec = 0;
|
||||
int64_t Feb_Control_subframe_exposure_time_in_10nsec = 0;
|
||||
int64_t Feb_Control_subframe_period_in_10nsec = 0;
|
||||
double Feb_Control_exposure_period_in_sec = 0;
|
||||
|
||||
unsigned int Feb_Control_trimbit_size;
|
||||
unsigned int *Feb_Control_last_downloaded_trimbits;
|
||||
unsigned int Feb_Control_trimbit_size = 0;
|
||||
unsigned int *Feb_Control_last_downloaded_trimbits = 0;
|
||||
|
||||
int64_t Feb_Control_RateTable_Tau_in_nsec = -1;
|
||||
int64_t Feb_Control_RateTable_Period_in_nsec = -1;
|
||||
unsigned int Feb_Control_rate_correction_table[1024];
|
||||
double Feb_Control_rate_meas[16384];
|
||||
unsigned int Feb_Control_rate_correction_table[1024] = {};
|
||||
double Feb_Control_rate_meas[16384] = 0;
|
||||
double ratemax = -1;
|
||||
|
||||
// setup
|
||||
@ -1518,10 +1518,31 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
||||
|
||||
int Feb_Control_SetQuad(int val) {
|
||||
LOG(logINFO, ("Setting Quad to %d in Feb\n", val));
|
||||
Feb_Control_quadMode = val;
|
||||
// only setting on the right feb if quad
|
||||
return Feb_Control_SetTop(val == 0 ? TOP_HARDWARE : OW_BOTTOM, 0, 1);
|
||||
}
|
||||
|
||||
int Feb_Control_SetChipSignalsToTrimQuad(bool enable) {
|
||||
if (Feb_Control_quadMode) {
|
||||
LOG(logINFO, ("%s chip signals to trim quad\n",
|
||||
enable ? "Enabling" : "Disabling"));
|
||||
unsigned int regval = 0;
|
||||
if (!Feb_Control_ReadRegister(DAQ_REG_HRDWRE, ®val)) {
|
||||
LOG(logERROR, ("Could not set chip signals to trim quad\n"));
|
||||
return 0;
|
||||
}
|
||||
if (enable) {
|
||||
regval |= (DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK);
|
||||
} else {
|
||||
regval &= ~(DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK);
|
||||
}
|
||||
|
||||
return Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Feb_Control_SetReadNLines(int value) {
|
||||
LOG(logINFO, ("Setting Read N Lines to %d\n", value));
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||
|
@ -87,6 +87,7 @@ int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
|
||||
void Feb_Control_SetMasterVariable(int val);
|
||||
int Feb_Control_SetMaster(enum MASTERINDEX ind);
|
||||
int Feb_Control_SetQuad(int val);
|
||||
int Feb_Control_SetChipSignalsToTrimQuad(bool enable);
|
||||
int Feb_Control_SetReadNLines(int value);
|
||||
int Feb_Control_GetReadNLines();
|
||||
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
||||
|
@ -27,6 +27,11 @@
|
||||
#define DAQ_REG_HRDWRE_OW_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_MASTER_OFST)
|
||||
#define DAQ_REG_HRDWRE_MASTER_OFST (4)
|
||||
#define DAQ_REG_HRDWRE_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_MASTER_OFST)
|
||||
#define DAQ_REG_HRDWRE_PROGRAM_OFST (30)
|
||||
#define DAQ_REG_HRDWRE_PROGRAM_MSK (0x00000001 << DAQ_REG_HRDWRE_PROGRAM_OFST)
|
||||
#define DAQ_REG_HRDWRE_M8_OFST (31)
|
||||
#define DAQ_REG_HRDWRE_M8_MSK (0x00000001 << DAQ_REG_HRDWRE_M8_OFST)
|
||||
|
||||
|
||||
#define DAQ_REG_RO_OFFSET 20
|
||||
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) // also pg and fifo status register
|
||||
|
@ -1137,15 +1137,33 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
|
||||
// set trimbits
|
||||
sharedMemory_lockLocalLink();
|
||||
|
||||
// if quad, set M8 and PROGRAM manually
|
||||
if (!Feb_Control_SetChipSignalsToTrimQuad(true)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (!Feb_Control_SetTrimbits(tt, top)) {
|
||||
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (random "
|
||||
"trim file)\n"));
|
||||
|
||||
// if quad, reset M8 and PROGRAM manually
|
||||
if (!Feb_Control_SetChipSignalsToTrimQuad(false)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
sharedMemory_unlockLocalLink();
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// if quad, reset M8 and PROGRAM manually
|
||||
if (!Feb_Control_SetChipSignalsToTrimQuad(false)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
sharedMemory_unlockLocalLink();
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user