mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 10:20:04 +02:00
commit
f5759921d2
@ -45,7 +45,9 @@ void qDacWidget::GetDac() {
|
|||||||
spinDac->setValue(retval);
|
spinDac->setValue(retval);
|
||||||
// mv
|
// mv
|
||||||
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
||||||
lblDacmV->setText(QString("%1mV").arg(retval - 10));
|
// -6 is the minimum amt of space it occupies, if more needed, its
|
||||||
|
// padded with ' ', negative value for left aligned text
|
||||||
|
lblDacmV->setText(QString("%1mV").arg(retval, -6));
|
||||||
}
|
}
|
||||||
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
|
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
|
||||||
"qDacWidget::GetDac")
|
"qDacWidget::GetDac")
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,123 +3,67 @@
|
|||||||
#include "slsDetectorServer_defs.h"
|
#include "slsDetectorServer_defs.h"
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
struct Module {
|
// setup
|
||||||
unsigned int module_number;
|
|
||||||
int top_address_valid;
|
|
||||||
unsigned int top_left_address;
|
|
||||||
unsigned int top_right_address;
|
|
||||||
int bottom_address_valid;
|
|
||||||
unsigned int bottom_left_address;
|
|
||||||
unsigned int bottom_right_address;
|
|
||||||
|
|
||||||
unsigned int idelay_top[4]; // ll,lr,rl,ll
|
|
||||||
unsigned int idelay_bottom[4]; // ll,lr,rl,ll
|
|
||||||
float high_voltage;
|
|
||||||
int *top_dac;
|
|
||||||
int *bottom_dac;
|
|
||||||
};
|
|
||||||
|
|
||||||
void Module_Module(struct Module *mod, unsigned int number,
|
|
||||||
unsigned int address_top);
|
|
||||||
void Module_ModuleBottom(struct Module *mod, unsigned int number,
|
|
||||||
unsigned int address_bottom);
|
|
||||||
void Module_Module1(struct Module *mod, unsigned int number,
|
|
||||||
unsigned int address_top, unsigned int address_bottom);
|
|
||||||
unsigned int Module_GetModuleNumber(struct Module *mod);
|
|
||||||
int Module_TopAddressIsValid(struct Module *mod);
|
|
||||||
unsigned int Module_GetTopBaseAddress(struct Module *mod);
|
|
||||||
unsigned int Module_GetTopLeftAddress(struct Module *mod);
|
|
||||||
unsigned int Module_GetTopRightAddress(struct Module *mod);
|
|
||||||
unsigned int Module_GetBottomBaseAddress(struct Module *mod);
|
|
||||||
int Module_BottomAddressIsValid(struct Module *mod);
|
|
||||||
unsigned int Module_GetBottomLeftAddress(struct Module *mod);
|
|
||||||
unsigned int Module_GetBottomRightAddress(struct Module *mod);
|
|
||||||
unsigned int Module_SetTopIDelay(struct Module *mod, unsigned int chip,
|
|
||||||
unsigned int value);
|
|
||||||
unsigned int Module_GetTopIDelay(struct Module *mod, unsigned int chip);
|
|
||||||
unsigned int Module_SetBottomIDelay(struct Module *mod, unsigned int chip,
|
|
||||||
unsigned int value);
|
|
||||||
unsigned int Module_GetBottomIDelay(struct Module *mod, unsigned int chip);
|
|
||||||
|
|
||||||
float Module_SetHighVoltage(struct Module *mod, float value);
|
|
||||||
float Module_GetHighVoltage(struct Module *mod);
|
|
||||||
|
|
||||||
int Module_SetTopDACValue(struct Module *mod, unsigned int i, int value);
|
|
||||||
int Module_GetTopDACValue(struct Module *mod, unsigned int i);
|
|
||||||
int Module_SetBottomDACValue(struct Module *mod, unsigned int i, int value);
|
|
||||||
int Module_GetBottomDACValue(struct Module *mod, unsigned int i);
|
|
||||||
|
|
||||||
void Feb_Control_activate(int activate);
|
void Feb_Control_activate(int activate);
|
||||||
|
void Feb_Control_FebControl();
|
||||||
int Feb_Control_IsBottomModule();
|
int Feb_Control_Init(int master, int normal, int module_num);
|
||||||
int Feb_Control_GetModuleNumber();
|
int Feb_Control_OpenSerialCommunication();
|
||||||
|
void Feb_Control_CloseSerialCommunication();
|
||||||
void Feb_Control_PrintModuleList();
|
int Feb_Control_CheckSetup();
|
||||||
int Feb_Control_GetModuleIndex(unsigned int module_number,
|
unsigned int Feb_Control_AddressToAll();
|
||||||
unsigned int *module_index);
|
int Feb_Control_SetCommandRegister(unsigned int cmd);
|
||||||
int Feb_Control_CheckModuleAddresses(struct Module *m);
|
int Feb_Control_SetStaticBits();
|
||||||
int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address);
|
int Feb_Control_SetStaticBits1(unsigned int the_static_bits);
|
||||||
int Feb_Control_AddModule1(unsigned int module_number, int top_enable,
|
int Feb_Control_SetInTestModeVariable(int on);
|
||||||
unsigned int top_address,
|
int Feb_Control_GetTestModeVariable();
|
||||||
unsigned int bottom_address, int half_module);
|
// idelays
|
||||||
int Feb_Control_GetDACNumber(char *s, unsigned int *n);
|
int Feb_Control_SetIDelays(unsigned int ndelay_units);
|
||||||
int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch,
|
int Feb_Control_SetIDelays1(unsigned int chip_pos, unsigned int ndelay_units);
|
||||||
unsigned int *value);
|
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr,
|
||||||
|
unsigned int channels, unsigned int ndelay_units);
|
||||||
|
// high voltage
|
||||||
|
int Feb_Control_SetHighVoltage(int value);
|
||||||
|
int Feb_Control_GetHighVoltage(int *value);
|
||||||
|
int Feb_Control_SendHighVoltage(int dacvalue);
|
||||||
|
int Feb_Control_ReceiveHighVoltage(unsigned int *value);
|
||||||
|
// dacs
|
||||||
int Feb_Control_VoltageToDAC(float value, unsigned int *digital,
|
int Feb_Control_VoltageToDAC(float value, unsigned int *digital,
|
||||||
unsigned int nsteps, float vmin, float vmax);
|
unsigned int nsteps, float vmin, float vmax);
|
||||||
float Feb_Control_DACToVoltage(unsigned int digital, unsigned int nsteps,
|
float Feb_Control_DACToVoltage(unsigned int digital, unsigned int nsteps,
|
||||||
float vmin, float vmax);
|
float vmin, float vmax);
|
||||||
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr,
|
int Feb_Control_SetDAC(unsigned int ch, int value);
|
||||||
unsigned int channels, unsigned int ndelay_units);
|
|
||||||
int Feb_Control_SetStaticBits();
|
// trimbits
|
||||||
int Feb_Control_SetStaticBits1(unsigned int the_static_bits);
|
int Feb_Control_SetTrimbits(unsigned int *trimbits, int top);
|
||||||
int Feb_Control_SendBitModeToBebServer();
|
int Feb_Control_SaveAllTrimbitsTo(int value, int top);
|
||||||
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
|
unsigned int *Feb_Control_GetTrimbits();
|
||||||
unsigned int Feb_Control_AddressToAll();
|
|
||||||
int Feb_Control_SetCommandRegister(unsigned int cmd);
|
// acquisition
|
||||||
|
int Feb_Control_AcquisitionInProgress();
|
||||||
|
int Feb_Control_AcquisitionStartedBit();
|
||||||
|
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
||||||
|
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
|
||||||
int Feb_Control_GetDAQStatusRegister(unsigned int dst_address,
|
int Feb_Control_GetDAQStatusRegister(unsigned int dst_address,
|
||||||
unsigned int *ret_status);
|
unsigned int *ret_status);
|
||||||
int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us);
|
int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us);
|
||||||
|
int Feb_Control_Reset();
|
||||||
int Feb_Control_ResetChipCompletely();
|
int Feb_Control_ResetChipCompletely();
|
||||||
int Feb_Control_ResetChipPartially();
|
int Feb_Control_ResetChipPartially();
|
||||||
void Feb_Control_FebControl();
|
int Feb_Control_SendBitModeToBebServer();
|
||||||
int Feb_Control_Init(int master, int top, int normal, int module_num);
|
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
|
||||||
int Feb_Control_OpenSerialCommunication();
|
|
||||||
void Feb_Control_CloseSerialCommunication();
|
|
||||||
int Feb_Control_CheckSetup();
|
|
||||||
unsigned int Feb_Control_GetNModules();
|
|
||||||
unsigned int Feb_Control_GetNHalfModules();
|
|
||||||
|
|
||||||
int Feb_Control_SetHighVoltage(int value);
|
|
||||||
int Feb_Control_GetHighVoltage(int *value);
|
|
||||||
|
|
||||||
int Feb_Control_SendHighVoltage(int dacvalue);
|
|
||||||
int Feb_Control_ReceiveHighVoltage(unsigned int *value);
|
|
||||||
|
|
||||||
int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units);
|
|
||||||
int Feb_Control_SetIDelays1(unsigned int module_num, unsigned int chip_pos,
|
|
||||||
unsigned int ndelay_units);
|
|
||||||
|
|
||||||
int Feb_Control_DecodeDACString(char *dac_str, unsigned int *module_index,
|
|
||||||
int *top, int *bottom, unsigned int *dac_ch);
|
|
||||||
int Feb_Control_SetDAC(char *s, int value, int is_a_voltage_mv);
|
|
||||||
int Feb_Control_GetDAC(char *s, int *ret_value, int voltage_mv);
|
|
||||||
int Feb_Control_GetDACName(unsigned int dac_num, char *s);
|
|
||||||
|
|
||||||
int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
|
||||||
int top);
|
|
||||||
unsigned int *Feb_Control_GetTrimbits();
|
|
||||||
int Feb_Control_SaveAllTrimbitsTo(int value, int top);
|
|
||||||
int Feb_Control_Reset();
|
|
||||||
int Feb_Control_PrepareForAcquisition();
|
int Feb_Control_PrepareForAcquisition();
|
||||||
|
void Feb_Control_PrintAcquisitionSetup();
|
||||||
int Feb_Control_StartAcquisition();
|
int Feb_Control_StartAcquisition();
|
||||||
int Feb_Control_StopAcquisition();
|
int Feb_Control_StopAcquisition();
|
||||||
int Feb_Control_AcquisitionInProgress();
|
int Feb_Control_SoftwareTrigger();
|
||||||
int Feb_Control_AcquisitionStartedBit();
|
|
||||||
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
|
// parameters
|
||||||
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||||
void Feb_Control_PrintAcquisitionSetup();
|
unsigned int Feb_Control_GetDynamicRange();
|
||||||
|
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed);
|
||||||
|
int Feb_Control_SetReadoutMode(unsigned int readout_mode);
|
||||||
|
int Feb_Control_SetTriggerMode(unsigned int trigger_mode);
|
||||||
|
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);
|
||||||
int Feb_Control_SetNExposures(unsigned int n_images);
|
int Feb_Control_SetNExposures(unsigned int n_images);
|
||||||
unsigned int Feb_Control_GetNExposures();
|
unsigned int Feb_Control_GetNExposures();
|
||||||
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
||||||
@ -132,25 +76,20 @@ int Feb_Control_SetSubFramePeriod(int64_t the_subframe_period_in_10nsec);
|
|||||||
int64_t Feb_Control_GetSubFramePeriod();
|
int64_t Feb_Control_GetSubFramePeriod();
|
||||||
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
||||||
double Feb_Control_GetExposurePeriod();
|
double Feb_Control_GetExposurePeriod();
|
||||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
|
||||||
unsigned int Feb_Control_GetDynamicRange();
|
|
||||||
int Feb_Control_SetReadoutSpeed(
|
|
||||||
unsigned int readout_speed); // 0 was default, 0->full,1->half,2->quarter or
|
|
||||||
// 3->super_slow
|
|
||||||
int Feb_Control_SetReadoutMode(
|
|
||||||
unsigned int readout_mode); /// 0 was
|
|
||||||
/// default,0->parallel,1->non-parallel,2->
|
|
||||||
/// safe_mode
|
|
||||||
int Feb_Control_SetTriggerMode(unsigned int trigger_mode,
|
|
||||||
int polarity); // 0 and 1 was default,
|
|
||||||
int Feb_Control_SetExternalEnableMode(int use_external_enable,
|
|
||||||
int polarity); // 0 and 1 was default,
|
|
||||||
|
|
||||||
int Feb_Control_SetInTestModeVariable(int on);
|
|
||||||
int Feb_Control_GetTestModeVariable();
|
|
||||||
|
|
||||||
void Feb_Control_Set_Counter_Bit(int value);
|
void Feb_Control_Set_Counter_Bit(int value);
|
||||||
int Feb_Control_Get_Counter_Bit();
|
int Feb_Control_Get_Counter_Bit();
|
||||||
|
int Feb_Control_SetInterruptSubframe(int val);
|
||||||
|
int Feb_Control_GetInterruptSubframe();
|
||||||
|
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_SetReadNLines(int value);
|
||||||
|
int Feb_Control_GetReadNLines();
|
||||||
|
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
||||||
|
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
|
||||||
|
|
||||||
|
// pulsing
|
||||||
int Feb_Control_Pulse_Pixel(int npulses, int x, int y);
|
int Feb_Control_Pulse_Pixel(int npulses, int x, int y);
|
||||||
int Feb_Control_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos);
|
int Feb_Control_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos);
|
||||||
int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in);
|
int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in);
|
||||||
@ -158,6 +97,7 @@ int Feb_Control_SendTokenIn();
|
|||||||
int Feb_Control_ClockRowClock(unsigned int ntimes);
|
int Feb_Control_ClockRowClock(unsigned int ntimes);
|
||||||
int Feb_Control_PulseChip(int npulses);
|
int Feb_Control_PulseChip(int npulses);
|
||||||
|
|
||||||
|
// rate correction
|
||||||
int64_t Feb_Control_Get_RateTable_Tau_in_nsec();
|
int64_t Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||||
int64_t Feb_Control_Get_RateTable_Period_in_nsec();
|
int64_t Feb_Control_Get_RateTable_Period_in_nsec();
|
||||||
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec);
|
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec);
|
||||||
@ -166,22 +106,8 @@ int Feb_Control_GetRateCorrectionVariable();
|
|||||||
void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction);
|
void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction);
|
||||||
int Feb_Control_PrintCorrectedValues();
|
int Feb_Control_PrintCorrectedValues();
|
||||||
|
|
||||||
|
// adcs
|
||||||
int Feb_Control_GetLeftFPGATemp();
|
int Feb_Control_GetLeftFPGATemp();
|
||||||
int Feb_Control_GetRightFPGATemp();
|
int Feb_Control_GetRightFPGATemp();
|
||||||
|
|
||||||
int64_t Feb_Control_GetMeasuredPeriod();
|
int64_t Feb_Control_GetMeasuredPeriod();
|
||||||
int64_t Feb_Control_GetSubMeasuredPeriod();
|
int64_t Feb_Control_GetSubMeasuredPeriod();
|
||||||
|
|
||||||
int Feb_Control_SoftwareTrigger();
|
|
||||||
int Feb_Control_SetInterruptSubframe(int val);
|
|
||||||
int Feb_Control_GetInterruptSubframe();
|
|
||||||
|
|
||||||
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_SetReadNLines(int value);
|
|
||||||
int Feb_Control_GetReadNLines();
|
|
||||||
|
|
||||||
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
|
||||||
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
|
|
||||||
|
@ -41,13 +41,13 @@ void Feb_Interface_FebInterface() {
|
|||||||
ll, XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
|
ll, XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list) {
|
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr) {
|
||||||
if (Feb_Interface_feb_numb)
|
if (Feb_Interface_feb_numb)
|
||||||
free(Feb_Interface_feb_numb);
|
free(Feb_Interface_feb_numb);
|
||||||
Feb_Interface_nfebs = n;
|
Feb_Interface_nfebs = 2;
|
||||||
Feb_Interface_feb_numb = malloc(n * sizeof(unsigned int));
|
Feb_Interface_feb_numb = malloc(2 * sizeof(unsigned int));
|
||||||
for (unsigned int i = 0; i < n; i++)
|
Feb_Interface_feb_numb[0] = leftAddr;
|
||||||
Feb_Interface_feb_numb[i] = list[i];
|
Feb_Interface_feb_numb[1] = rightAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Interface_WriteTo(unsigned int ch) {
|
int Feb_Interface_WriteTo(unsigned int ch) {
|
||||||
@ -104,7 +104,9 @@ int Feb_Interface_SetByteOrder() {
|
|||||||
for (unsigned int i = 0; i < Feb_Interface_nfebs; i++)
|
for (unsigned int i = 0; i < Feb_Interface_nfebs; i++)
|
||||||
dst = (dst | Feb_Interface_feb_numb[i]);
|
dst = (dst | Feb_Interface_feb_numb[i]);
|
||||||
int passed = Feb_Interface_WriteTo(dst);
|
int passed = Feb_Interface_WriteTo(dst);
|
||||||
|
if (!passed) {
|
||||||
|
LOG(logERROR, ("Could not set byte order in Feb Interface\n"));
|
||||||
|
}
|
||||||
return passed;
|
return passed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
int Feb_Interface_WriteTo(unsigned int ch);
|
int Feb_Interface_WriteTo(unsigned int ch);
|
||||||
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
|
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
|
||||||
void Feb_Interface_FebInterface();
|
void Feb_Interface_FebInterface();
|
||||||
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list);
|
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr);
|
||||||
int Feb_Interface_SetByteOrder();
|
int Feb_Interface_SetByteOrder();
|
||||||
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
|
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
|
||||||
unsigned int *value_read);
|
unsigned int *value_read);
|
||||||
|
Binary file not shown.
@ -33,10 +33,6 @@ int initError = OK;
|
|||||||
int initCheckDone = 0;
|
int initCheckDone = 0;
|
||||||
char initErrorMessage[MAX_STR_LENGTH];
|
char initErrorMessage[MAX_STR_LENGTH];
|
||||||
|
|
||||||
const char *dac_names[16] = {"VSvP", "Vtrim", "Vrpreamp", "Vrshaper",
|
|
||||||
"VSvN", "Vtgstv", "Vcmp_ll", "Vcmp_lr",
|
|
||||||
"Vcal", "Vcmp_rl", "rxb_rb", "rxb_lb",
|
|
||||||
"Vcmp_rr", "Vcp", "Vcn", "Vishaper"};
|
|
||||||
int default_tau_from_file = -1;
|
int default_tau_from_file = -1;
|
||||||
enum detectorSettings thisSettings;
|
enum detectorSettings thisSettings;
|
||||||
sls_detector_module *detectorModules = NULL;
|
sls_detector_module *detectorModules = NULL;
|
||||||
@ -333,11 +329,24 @@ void initControlServer() {
|
|||||||
Feb_Interface_FebInterface();
|
Feb_Interface_FebInterface();
|
||||||
Feb_Control_FebControl();
|
Feb_Control_FebControl();
|
||||||
// same addresses for top and bottom
|
// same addresses for top and bottom
|
||||||
Feb_Control_Init(master, 1, normal, getDetectorNumber());
|
if (!Feb_Control_Init(master, normal, getDetectorNumber())) {
|
||||||
|
initError = FAIL;
|
||||||
|
sprintf(initErrorMessage, "Could not intitalize feb control\n");
|
||||||
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
// master of 9M, check high voltage serial communication to blackfin
|
// master of 9M, check high voltage serial communication to blackfin
|
||||||
if (master && !normal) {
|
if (master && !normal) {
|
||||||
if (Feb_Control_OpenSerialCommunication())
|
if (!Feb_Control_OpenSerialCommunication()) {
|
||||||
; // Feb_Control_CloseSerialCommunication();
|
initError = FAIL;
|
||||||
|
sprintf(
|
||||||
|
initErrorMessage,
|
||||||
|
"Could not intitalize feb control serial communication\n");
|
||||||
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
|
LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
|
||||||
Beb_SetTopVariable(top);
|
Beb_SetTopVariable(top);
|
||||||
@ -372,7 +381,7 @@ void initStopServer() {
|
|||||||
Feb_Interface_FebInterface();
|
Feb_Interface_FebInterface();
|
||||||
Feb_Control_FebControl();
|
Feb_Control_FebControl();
|
||||||
// same addresses for top and bottom
|
// same addresses for top and bottom
|
||||||
Feb_Control_Init(master, 1, normal, getDetectorNumber());
|
Feb_Control_Init(master, normal, getDetectorNumber());
|
||||||
LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
|
LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
|
||||||
#endif
|
#endif
|
||||||
// client first connect (from shm) will activate
|
// client first connect (from shm) will activate
|
||||||
@ -695,7 +704,12 @@ void setupDetector() {
|
|||||||
#endif
|
#endif
|
||||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
Feb_Control_CheckSetup();
|
if (!Feb_Control_CheckSetup()) {
|
||||||
|
initError = FAIL;
|
||||||
|
sprintf(initErrorMessage, "Could not pass feb control setup checks\n");
|
||||||
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
// force top or master if in config file
|
// force top or master if in config file
|
||||||
if (readConfigFile() == FAIL) {
|
if (readConfigFile() == FAIL) {
|
||||||
@ -1049,7 +1063,7 @@ int setModule(sls_detector_module myMod, char *mess) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set trimbits
|
// set trimbits
|
||||||
if (!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(), tt, top)) {
|
if (!Feb_Control_SetTrimbits(tt, top)) {
|
||||||
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
setSettings(UNDEFINED);
|
setSettings(UNDEFINED);
|
||||||
@ -1187,6 +1201,10 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *dac_names[] = {DAC_NAMES};
|
||||||
|
LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
||||||
|
val, (mV ? "mV" : "dac units")));
|
||||||
|
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
int dacval = 0;
|
int dacval = 0;
|
||||||
if (!mV) {
|
if (!mV) {
|
||||||
@ -1198,11 +1216,17 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
(detectorModules)->dacs[ind] = dacval;
|
(detectorModules)->dacs[ind] = dacval;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
char iname[10];
|
int dacval = val;
|
||||||
strcpy(iname, dac_names[(int)ind]);
|
if (mV) {
|
||||||
if (Feb_Control_SetDAC(iname, val, mV)) {
|
// convert to dac units
|
||||||
int dacval = 0;
|
if (ConvertToDifferentRange(DAC_MIN_MV, DAC_MAX_MV, LTC2620_MIN_VAL,
|
||||||
Feb_Control_GetDAC(iname, &dacval, 0);
|
LTC2620_MAX_VAL, val, &dacval) == FAIL) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Could not convert %d mV for dac to dac units\n", val));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Feb_Control_SetDAC(ind, dacval)) {
|
||||||
(detectorModules)->dacs[ind] = dacval;
|
(detectorModules)->dacs[ind] = dacval;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1355,7 +1379,7 @@ void setTiming(enum timingMode arg) {
|
|||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
if (Feb_Control_SetTriggerMode(ret, 1))
|
if (Feb_Control_SetTriggerMode(ret))
|
||||||
#endif
|
#endif
|
||||||
eiger_triggermode = ret;
|
eiger_triggermode = ret;
|
||||||
}
|
}
|
||||||
@ -1476,6 +1500,11 @@ int setQuad(int value) {
|
|||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
// only top can be set to quad
|
||||||
|
if (!top && value > 0) {
|
||||||
|
LOG(logERROR, ("Only a top can be set to quad\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
if (Beb_SetQuad(value) == FAIL) {
|
if (Beb_SetQuad(value) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -1580,7 +1609,7 @@ int setIODelay(int val) {
|
|||||||
if (val != -1) {
|
if (val != -1) {
|
||||||
LOG(logDEBUG1, ("Setting IO Delay: %d\n", val));
|
LOG(logDEBUG1, ("Setting IO Delay: %d\n", val));
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
if (Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(), val))
|
if (Feb_Control_SetIDelays(val))
|
||||||
#endif
|
#endif
|
||||||
eiger_iodelay = val;
|
eiger_iodelay = val;
|
||||||
}
|
}
|
||||||
@ -1813,6 +1842,8 @@ int64_t getCurrentTau() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setExternalGating(int enable[]) {
|
void setExternalGating(int enable[]) {
|
||||||
|
// not configured from client
|
||||||
|
// default: disable gating with positive polarity
|
||||||
if (enable[0] >= 0 && enable[1] >= 0) {
|
if (enable[0] >= 0 && enable[1] >= 0) {
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
Feb_Control_SetExternalEnableMode(
|
Feb_Control_SetExternalEnableMode(
|
||||||
|
@ -30,6 +30,10 @@ enum DACINDEX {
|
|||||||
E_VISHAPER,
|
E_VISHAPER,
|
||||||
E_VTHRESHOLD
|
E_VTHRESHOLD
|
||||||
};
|
};
|
||||||
|
#define DAC_NAMES \
|
||||||
|
"VSvP", "Vtrim", "Vrpreamp", "Vrshaper", "VSvN", "Vtgstv", "Vcmp_ll", \
|
||||||
|
"Vcmp_lr", "Vcal", "Vcmp_rl", "rxb_rb", "rxb_lb", "Vcmp_rr", "Vcp", \
|
||||||
|
"Vcn", "Vishaper"
|
||||||
#define DEFAULT_DAC_VALS \
|
#define DEFAULT_DAC_VALS \
|
||||||
{ \
|
{ \
|
||||||
0, /* VSvP */ \
|
0, /* VSvP */ \
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
#define APIJUNGFRAU 0x200610
|
#define APIJUNGFRAU 0x200610
|
||||||
#define APIMOENCH 0x200610
|
#define APIMOENCH 0x200610
|
||||||
#define APIGOTTHARD2 0x200610
|
#define APIGOTTHARD2 0x200610
|
||||||
#define APIEIGER 0x200615
|
|
||||||
#define APIMYTHEN3 0x200616
|
#define APIMYTHEN3 0x200616
|
||||||
|
#define APIEIGER 0x200617
|
||||||
|
Loading…
x
Reference in New Issue
Block a user