mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 08:09:21 +01:00
wip
This commit is contained in:
@@ -67,9 +67,6 @@ exposed to Python through pybind11.
|
|||||||
.. autoclass:: readoutMode
|
.. autoclass:: readoutMode
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
|
|
||||||
.. autoclass:: masterFlags
|
|
||||||
:undoc-members:
|
|
||||||
|
|
||||||
.. autoclass:: burstMode
|
.. autoclass:: burstMode
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ The enums can be found in slsdet.enums
|
|||||||
>>> [e for e in dir(slsdet.enums) if not e.startswith('_')]
|
>>> [e for e in dir(slsdet.enums) if not e.startswith('_')]
|
||||||
['burstMode', 'clockIndex', 'dacIndex',
|
['burstMode', 'clockIndex', 'dacIndex',
|
||||||
'detectorSettings', 'detectorType', 'dimension', 'externalSignalFlag',
|
'detectorSettings', 'detectorType', 'dimension', 'externalSignalFlag',
|
||||||
'fileFormat', 'frameDiscardPolicy', 'masterFlags',
|
'fileFormat', 'frameDiscardPolicy',
|
||||||
'readoutMode', 'runStatus', 'speedLevel', 'timingMode',
|
'readoutMode', 'runStatus', 'speedLevel', 'timingMode',
|
||||||
'timingSourceType']
|
'timingSourceType']
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
|||||||
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
||||||
clockIndex = _slsdet.slsDetectorDefs.clockIndex
|
clockIndex = _slsdet.slsDetectorDefs.clockIndex
|
||||||
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
||||||
masterFlags = _slsdet.slsDetectorDefs.masterFlags
|
|
||||||
burstMode = _slsdet.slsDetectorDefs.burstMode
|
burstMode = _slsdet.slsDetectorDefs.burstMode
|
||||||
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
|
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
|
||||||
M3_GainCaps = _slsdet.slsDetectorDefs.M3_GainCaps
|
M3_GainCaps = _slsdet.slsDetectorDefs.M3_GainCaps
|
||||||
@@ -428,9 +428,9 @@ void init_det(py::module &m) {
|
|||||||
Detector::setNextFrameNumber,
|
Detector::setNextFrameNumber,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("sendSoftwareTrigger",
|
.def("sendSoftwareTrigger",
|
||||||
(void (Detector::*)(sls::Positions)) &
|
(void (Detector::*)(const bool, sls::Positions)) &
|
||||||
Detector::sendSoftwareTrigger,
|
Detector::sendSoftwareTrigger,
|
||||||
py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getScan",
|
.def("getScan",
|
||||||
(Result<defs::scanParameters>(Detector::*)(sls::Positions) const) &
|
(Result<defs::scanParameters>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getScan,
|
Detector::getScan,
|
||||||
|
|||||||
@@ -255,12 +255,6 @@ void init_enums(py::module &m) {
|
|||||||
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
|
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags")
|
|
||||||
.value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER)
|
|
||||||
.value("IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
|
|
||||||
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
|
|
||||||
.export_values();
|
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
||||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||||
|
|||||||
Binary file not shown.
@@ -253,12 +253,12 @@ int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
|
|||||||
int maxtimer = (MAX(MAX(l_txndelaycounter, l_framedelaycounter),
|
int maxtimer = (MAX(MAX(l_txndelaycounter, l_framedelaycounter),
|
||||||
MAX(r_txndelaycounter, r_framedelaycounter))) /
|
MAX(r_txndelaycounter, r_framedelaycounter))) /
|
||||||
100; // counter values in 10 ns
|
100; // counter values in 10 ns
|
||||||
printf("Will wait for %d us\n", maxtimer);
|
printf("Beb: Will wait for %d us\n", maxtimer);
|
||||||
usleep(maxtimer);
|
usleep(maxtimer);
|
||||||
}
|
}
|
||||||
// wait for 1 ms
|
// wait for 1 ms
|
||||||
else {
|
else {
|
||||||
printf("Will wait for 1 ms\n");
|
printf("Beb: Will wait for 1 ms\n");
|
||||||
usleep(1 * 1000);
|
usleep(1 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1182,7 +1182,7 @@ int Beb_StopAcquisition() {
|
|||||||
// open file pointer
|
// open file pointer
|
||||||
int fd = Beb_open(&csp0base, XPAR_CMD_GENERATOR);
|
int fd = Beb_open(&csp0base, XPAR_CMD_GENERATOR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOG(logERROR, ("Beb Stop Acquisition FAIL\n"));
|
LOG(logERROR, ("Beb Reset FAIL\n"));
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
// find value
|
// find value
|
||||||
@@ -1199,7 +1199,7 @@ int Beb_StopAcquisition() {
|
|||||||
Beb_Write32(csp0base, (RIGHT_OFFSET + STOP_ACQ_OFFSET),
|
Beb_Write32(csp0base, (RIGHT_OFFSET + STOP_ACQ_OFFSET),
|
||||||
(valuer & (~STOP_ACQ_BIT)));
|
(valuer & (~STOP_ACQ_BIT)));
|
||||||
|
|
||||||
LOG(logINFO, ("Beb Stop Acquisition OK\n"));
|
LOG(logINFO, ("Beb: Reset done\n"));
|
||||||
// close file pointer
|
// close file pointer
|
||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -709,6 +709,32 @@ int Feb_Control_AcquisitionInProgress() {
|
|||||||
return STATUS_IDLE;
|
return STATUS_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Feb_Control_ProcessingInProgress() {
|
||||||
|
unsigned int regr = 0, regl = 0;
|
||||||
|
// deactivated should return end of processing
|
||||||
|
if (!Feb_Control_activated)
|
||||||
|
return IDLE;
|
||||||
|
|
||||||
|
if (!Feb_Interface_ReadRegister(Feb_Control_rightAddress, FEB_REG_STATUS,
|
||||||
|
®r)) {
|
||||||
|
LOG(logERROR, ("Could not read right FEB_REG_STATUS to get feb "
|
||||||
|
"processing status\n"));
|
||||||
|
return STATUS_ERROR;
|
||||||
|
}
|
||||||
|
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
||||||
|
®l)) {
|
||||||
|
LOG(logERROR, ("Could not read left FEB_REG_STATUS to get feb "
|
||||||
|
"processing status\n"));
|
||||||
|
return STATUS_ERROR;
|
||||||
|
}
|
||||||
|
// processing done
|
||||||
|
if ((regr | regl) & FEB_REG_STATUS_ACQ_DONE_MSK) {
|
||||||
|
return STATUS_IDLE;
|
||||||
|
}
|
||||||
|
// processing running
|
||||||
|
return STATUS_RUNNING;
|
||||||
|
}
|
||||||
|
|
||||||
int Feb_Control_AcquisitionStartedBit() {
|
int Feb_Control_AcquisitionStartedBit() {
|
||||||
unsigned int status_reg_r = 0, status_reg_l = 0;
|
unsigned int status_reg_r = 0, status_reg_l = 0;
|
||||||
// deactivated should return acquisition started/ready
|
// deactivated should return acquisition started/ready
|
||||||
@@ -817,7 +843,7 @@ int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_Reset() {
|
int Feb_Control_Reset() {
|
||||||
LOG(logINFO, ("Reset daq\n"));
|
LOG(logINFO, ("Feb: Reset daq\n"));
|
||||||
if (Feb_Control_activated) {
|
if (Feb_Control_activated) {
|
||||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||||
DAQ_REG_CTRL, 0, 0, 0) ||
|
DAQ_REG_CTRL, 0, 0, 0) ||
|
||||||
@@ -996,38 +1022,136 @@ int Feb_Control_StartAcquisition() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
int Feb_Control_StopAcquisition() {
|
||||||
|
|
||||||
int Feb_Control_SoftwareTrigger() {
|
|
||||||
if (Feb_Control_activated) {
|
if (Feb_Control_activated) {
|
||||||
|
|
||||||
|
// sends last frames from fifo
|
||||||
unsigned int orig_value = 0;
|
unsigned int orig_value = 0;
|
||||||
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
||||||
DAQ_REG_CHIP_CMDS, &orig_value)) {
|
DAQ_REG_CTRL, &orig_value)) {
|
||||||
LOG(logERROR, ("Could not read DAQ_REG_CHIP_CMDS to send software "
|
LOG(logERROR, ("Could not read DAQ_REG_CTRL to stop acquisition "
|
||||||
"trigger\n"));
|
"(send complete frames)\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
|
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||||
|
DAQ_REG_CTRL,
|
||||||
|
orig_value | DAQ_CTRL_STOP, 0, 0)) {
|
||||||
|
LOG(logERROR, ("Could not send last frames.\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("Feb: Command to Flush out images from fifo\n"));
|
||||||
|
|
||||||
// set trigger bit
|
// wait for feb processing to be done
|
||||||
LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n", cmd));
|
int is_processing = Feb_Control_ProcessingInProgress();
|
||||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
int check_error = 0;
|
||||||
DAQ_REG_CHIP_CMDS, cmd, 0, 0)) {
|
while (is_processing != STATUS_IDLE) {
|
||||||
LOG(logERROR, ("Could not give software trigger\n"));
|
usleep(500);
|
||||||
return 0;
|
is_processing = Feb_Control_ProcessingInProgress();
|
||||||
|
|
||||||
|
// check error only 5 times (ensuring it is not something that
|
||||||
|
// happens sometimes)
|
||||||
|
if (is_processing == STATUS_ERROR) {
|
||||||
|
if (check_error == 5)
|
||||||
|
break;
|
||||||
|
check_error++;
|
||||||
|
} // reset check_error for next time
|
||||||
|
else
|
||||||
|
check_error = 0;
|
||||||
}
|
}
|
||||||
// unset trigger bit
|
LOG(logINFO, ("Feb: Processing done (to stop acq)\n"));
|
||||||
LOG(logDEBUG1, ("Unsetting Trigger, Register:0x%x\n", orig_value));
|
|
||||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
return 0;
|
||||||
DAQ_REG_CHIP_CMDS, orig_value, 0, 0)) {
|
|
||||||
LOG(logERROR, ("Could not give software trigger\n"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
LOG(logINFO, ("Software Internal Trigger Sent!\n"));
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Feb_Control_IsReadyForTrigger(int *readyForTrigger) {
|
||||||
|
unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress};
|
||||||
|
unsigned int value[2] = {0, 0};
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
if (!Feb_Interface_ReadRegister(addr[i], FEB_REG_STATUS, &value[i])) {
|
||||||
|
LOG(logERROR, ("Could not read %s FEB_REG_STATUS reg\n",
|
||||||
|
(i == 0 ? "left" : "right")));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*readyForTrigger =
|
||||||
|
((value[0] | value[1]) & FEB_REG_STATUS_WAIT_FOR_TRGGR_MSK);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Feb_Control_SendSoftwareTrigger() {
|
||||||
|
// read old value in register
|
||||||
|
unsigned int orig_value = 0;
|
||||||
|
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
||||||
|
DAQ_REG_CHIP_CMDS, &orig_value)) {
|
||||||
|
LOG(logERROR, ("Could not read DAQ_REG_CHIP_CMDS to send software "
|
||||||
|
"trigger\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
|
||||||
|
|
||||||
|
// set trigger bit
|
||||||
|
LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n", cmd));
|
||||||
|
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||||
|
DAQ_REG_CHIP_CMDS, cmd, 0, 0)) {
|
||||||
|
LOG(logERROR, ("Could not give software trigger\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// unset trigger bit
|
||||||
|
LOG(logDEBUG1, ("Unsetting Trigger, Register:0x%x\n", orig_value));
|
||||||
|
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||||
|
DAQ_REG_CHIP_CMDS, orig_value, 0, 0)) {
|
||||||
|
LOG(logERROR, ("Could not give software trigger\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("Software Internal Trigger Sent!\n"));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Feb_Control_SoftwareTrigger(int block) {
|
||||||
|
if (Feb_Control_activated) {
|
||||||
|
// cant read reg
|
||||||
|
int readyForTrigger = 0;
|
||||||
|
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||||
|
LOG(logERROR, ("Could not read FEB_REG_STATUS reg!\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// if not ready for trigger, throw
|
||||||
|
if (!readyForTrigger) {
|
||||||
|
LOG(logWARNING, ("Not yet ready for trigger!\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// send trigger to both fpgas
|
||||||
|
Feb_Control_SendSoftwareTrigger();
|
||||||
|
|
||||||
|
// wait for next trigger ready
|
||||||
|
if (block) {
|
||||||
|
LOG(logINFO, ("Blocking Software Trigger\n"));
|
||||||
|
int readyForTrigger = 0;
|
||||||
|
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||||
|
LOG(logERROR, ("Could not read FEB_REG_STATUS reg after giving "
|
||||||
|
"trigger!\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!readyForTrigger) {
|
||||||
|
usleep(5000);
|
||||||
|
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||||
|
LOG(logERROR, ("Could not read FEB_REG_STATUS reg after "
|
||||||
|
"giving trigger!\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("Done waiting (wait for trigger)!\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo) {
|
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo) {
|
||||||
static unsigned int everything_but_bit_mode = DAQ_STATIC_BIT_PROGRAM |
|
static unsigned int everything_but_bit_mode = DAQ_STATIC_BIT_PROGRAM |
|
||||||
@@ -1883,15 +2007,15 @@ int Feb_Control_GetLeftFPGATemp() {
|
|||||||
if (!Feb_Control_activated) {
|
if (!Feb_Control_activated) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
unsigned int temperature = 0;
|
unsigned int value = 0;
|
||||||
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
||||||
&temperature)) {
|
&value)) {
|
||||||
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get left feb "
|
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get left feb "
|
||||||
"temperature\n"));
|
"temperature\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
unsigned int temperature =
|
||||||
temperature = temperature >> 16;
|
((value & FEB_REG_STATUS_TEMP_MSK) >> FEB_REG_STATUS_TEMP_OFST);
|
||||||
temperature =
|
temperature =
|
||||||
((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) *
|
((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) *
|
||||||
1000; // Static conversation, copied from xps sysmon standalone driver
|
1000; // Static conversation, copied from xps sysmon standalone driver
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ unsigned int *Feb_Control_GetTrimbits();
|
|||||||
|
|
||||||
// acquisition
|
// acquisition
|
||||||
int Feb_Control_AcquisitionInProgress();
|
int Feb_Control_AcquisitionInProgress();
|
||||||
|
int Feb_Control_ProcessingInProgress();
|
||||||
int Feb_Control_AcquisitionStartedBit();
|
int Feb_Control_AcquisitionStartedBit();
|
||||||
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
||||||
int Feb_Control_WaitForFinishedFlag(int sleep_time_us, int tempLock);
|
int Feb_Control_WaitForFinishedFlag(int sleep_time_us, int tempLock);
|
||||||
@@ -55,7 +56,9 @@ int Feb_Control_PrepareForAcquisition();
|
|||||||
void Feb_Control_PrintAcquisitionSetup();
|
void Feb_Control_PrintAcquisitionSetup();
|
||||||
int Feb_Control_StartAcquisition();
|
int Feb_Control_StartAcquisition();
|
||||||
int Feb_Control_StopAcquisition();
|
int Feb_Control_StopAcquisition();
|
||||||
int Feb_Control_SoftwareTrigger();
|
int Feb_Control_IsReadyForTrigger(int *readyForTrigger);
|
||||||
|
int Feb_Control_SendSoftwareTrigger();
|
||||||
|
int Feb_Control_SoftwareTrigger(int block);
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||||
|
|||||||
@@ -30,7 +30,16 @@
|
|||||||
|
|
||||||
#define DAQ_REG_RO_OFFSET 20
|
#define DAQ_REG_RO_OFFSET 20
|
||||||
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) // also pg and fifo status register
|
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) // also pg and fifo status register
|
||||||
|
|
||||||
#define FEB_REG_STATUS (DAQ_REG_RO_OFFSET + 3)
|
#define FEB_REG_STATUS (DAQ_REG_RO_OFFSET + 3)
|
||||||
|
|
||||||
|
#define FEB_REG_STATUS_WAIT_FOR_TRGGR_OFST (5)
|
||||||
|
#define FEB_REG_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FEB_REG_STATUS_WAIT_FOR_TRGGR_OFST)
|
||||||
|
#define FEB_REG_STATUS_ACQ_DONE_OFST (6)
|
||||||
|
#define FEB_REG_STATUS_ACQ_DONE_MSK (0x00000001 << FEB_REG_STATUS_ACQ_DONE_OFST)
|
||||||
|
#define FEB_REG_STATUS_TEMP_OFST (16)
|
||||||
|
#define FEB_REG_STATUS_TEMP_MSK (0x0000FFFF << FEB_REG_STATUS_TEMP_OFST)
|
||||||
|
|
||||||
#define MEAS_SUBPERIOD_REG (DAQ_REG_RO_OFFSET + 4)
|
#define MEAS_SUBPERIOD_REG (DAQ_REG_RO_OFFSET + 4)
|
||||||
#define MEAS_PERIOD_REG (DAQ_REG_RO_OFFSET + 5)
|
#define MEAS_PERIOD_REG (DAQ_REG_RO_OFFSET + 5)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
@@ -38,7 +47,8 @@
|
|||||||
#define DAQ_CTRL_RESET 0x80000000
|
#define DAQ_CTRL_RESET 0x80000000
|
||||||
#define DAQ_CTRL_START 0x40000000
|
#define DAQ_CTRL_START 0x40000000
|
||||||
#define ACQ_CTRL_START 0x50000000 // this is 0x10000000 (acq) | 0x40000000 (daq)
|
#define ACQ_CTRL_START 0x50000000 // this is 0x10000000 (acq) | 0x40000000 (daq)
|
||||||
#define DAQ_CTRL_STOP 0x00000000
|
#define DAQ_CTRL_STOP 0x08000000 // sends last complete frame
|
||||||
|
#define DAQ_CTRL_DONE 0x00000040 // data processing done in feb
|
||||||
|
|
||||||
// direct chip commands to the DAQ_REG_CHIP_CMDS register
|
// direct chip commands to the DAQ_REG_CHIP_CMDS register
|
||||||
#define DAQ_SET_STATIC_BIT 0x00000001
|
#define DAQ_SET_STATIC_BIT 0x00000001
|
||||||
|
|||||||
Binary file not shown.
@@ -46,7 +46,6 @@ int on_dst = 0;
|
|||||||
int dst_requested[32] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
int dst_requested[32] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
enum masterFlags masterMode = IS_SLAVE;
|
|
||||||
int top = 0;
|
int top = 0;
|
||||||
int master = 0;
|
int master = 0;
|
||||||
int normal = 0;
|
int normal = 0;
|
||||||
@@ -1415,6 +1414,8 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing, extsig */
|
/* parameters - timing, extsig */
|
||||||
|
|
||||||
|
int isMaster() { return master; }
|
||||||
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
@@ -2444,29 +2445,53 @@ int stopStateMachine() {
|
|||||||
return OK;
|
return OK;
|
||||||
#else
|
#else
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
if ((Feb_Control_StopAcquisition() != STATUS_IDLE) ||
|
// sends last frames from fifo and wait for feb processing done
|
||||||
(!Beb_StopAcquisition())) {
|
if ((Feb_Control_StopAcquisition() != STATUS_IDLE)) {
|
||||||
LOG(logERROR, ("failed to stop acquisition\n"));
|
LOG(logERROR, ("failed to stop acquisition\n"));
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
|
|
||||||
|
// wait for beb to finish sending packets
|
||||||
|
int isTransmitting = 1;
|
||||||
|
while (isTransmitting) {
|
||||||
|
// wait for beb to send out all packets
|
||||||
|
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 1) == FAIL) {
|
||||||
|
LOG(logERROR, ("failed to stop beb acquisition\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (isTransmitting) {
|
||||||
|
printf("Transmitting...\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("Beb: Detector has sent all data (stop)\n"));
|
||||||
|
|
||||||
|
// reset feb and beb
|
||||||
|
sharedMemory_lockLocalLink();
|
||||||
|
Feb_Control_Reset();
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
|
if (!Beb_StopAcquisition()) {
|
||||||
|
LOG(logERROR, ("failed to stop acquisition\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
// ensure all have same starting frame numbers
|
// ensure all have same starting frame numbers
|
||||||
uint64_t retval = 0;
|
uint64_t retval = 0;
|
||||||
if (Beb_GetNextFrameNumber(&retval, send_to_ten_gig) == -2) {
|
if (Beb_GetNextFrameNumber(&retval, send_to_ten_gig) == -2) {
|
||||||
Beb_SetNextFrameNumber(retval + 1);
|
Beb_SetNextFrameNumber(retval + 1);
|
||||||
}
|
}
|
||||||
|
LOG(logINFOBLUE, ("Stopping state machine complete\n\n"));
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int softwareTrigger() {
|
int softwareTrigger(int block) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#else
|
#else
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
if (!Feb_Control_SoftwareTrigger()) {
|
if (!Feb_Control_SoftwareTrigger(block)) {
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@@ -2567,6 +2592,21 @@ void readFrame(int *ret, char *mess) {
|
|||||||
// wait for detector to send
|
// wait for detector to send
|
||||||
int isTransmitting = 1;
|
int isTransmitting = 1;
|
||||||
while (isTransmitting) {
|
while (isTransmitting) {
|
||||||
|
// wait for feb processing to be done
|
||||||
|
sharedMemory_lockLocalLink();
|
||||||
|
int i = Feb_Control_ProcessingInProgress();
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
|
if (i == STATUS_ERROR) {
|
||||||
|
strcpy(mess, "Could not read feb processing done register\n");
|
||||||
|
*ret = (int)FAIL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (i == RUNNING) {
|
||||||
|
LOG(logINFOBLUE, ("Status: TRANSMITTING (feb processing)\n"));
|
||||||
|
isTransmitting = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for beb to send out all packets
|
||||||
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 1) == FAIL) {
|
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 1) == FAIL) {
|
||||||
strcpy(mess, "Could not read delay counters\n");
|
strcpy(mess, "Could not read delay counters\n");
|
||||||
*ret = (int)FAIL;
|
*ret = (int)FAIL;
|
||||||
@@ -2576,7 +2616,7 @@ void readFrame(int *ret, char *mess) {
|
|||||||
printf("Transmitting...\n");
|
printf("Transmitting...\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Detector has sent all data\n"));
|
LOG(logINFO, ("Beb: Detector has sent all data (acquire)\n"));
|
||||||
LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -55,7 +55,7 @@ int ipPacketSize = 0;
|
|||||||
int udpPacketSize = 0;
|
int udpPacketSize = 0;
|
||||||
|
|
||||||
// master slave configuration (for 25um)
|
// master slave configuration (for 25um)
|
||||||
int masterflags = NO_MASTER;
|
int master = 0;
|
||||||
int masterdefaultdelay = 62;
|
int masterdefaultdelay = 62;
|
||||||
int patternphase = 0;
|
int patternphase = 0;
|
||||||
int adcphase = 0;
|
int adcphase = 0;
|
||||||
@@ -364,6 +364,8 @@ void initStopServer() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
#endif
|
#endif
|
||||||
|
// to get master from file
|
||||||
|
readConfigFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up detector */
|
/* set up detector */
|
||||||
@@ -621,14 +623,12 @@ int readConfigFile() {
|
|||||||
// key is master/ slave flag
|
// key is master/ slave flag
|
||||||
if (!strcasecmp(key, "masterflags")) {
|
if (!strcasecmp(key, "masterflags")) {
|
||||||
if (!strcasecmp(value, "is_master")) {
|
if (!strcasecmp(value, "is_master")) {
|
||||||
masterflags = IS_MASTER;
|
master = 1;
|
||||||
LOG(logINFOBLUE, ("\tMaster\n"));
|
LOG(logINFOBLUE, ("\tMaster\n"));
|
||||||
} else if (!strcasecmp(value, "is_slave")) {
|
} else if ((!strcasecmp(value, "is_slave")) ||
|
||||||
masterflags = IS_SLAVE;
|
(!strcasecmp(value, "no_master"))) {
|
||||||
LOG(logINFOBLUE, ("\tSlave\n"));
|
master = 0;
|
||||||
} else if (!strcasecmp(value, "no_master")) {
|
LOG(logINFOBLUE, ("\tSlave or No Master\n"));
|
||||||
masterflags = NO_MASTER;
|
|
||||||
LOG(logINFOBLUE, ("\tNo Master\n"));
|
|
||||||
} else {
|
} else {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("\tCould not scan masterflags %s value from config file\n",
|
("\tCould not scan masterflags %s value from config file\n",
|
||||||
@@ -705,7 +705,7 @@ void setMasterSlaveConfiguration() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// master configuration
|
// master configuration
|
||||||
if (masterflags == IS_MASTER) {
|
if (master) {
|
||||||
// master default delay set, so reset delay
|
// master default delay set, so reset delay
|
||||||
setDelayAfterTrigger(0);
|
setDelayAfterTrigger(0);
|
||||||
|
|
||||||
@@ -876,7 +876,7 @@ int setDelayAfterTrigger(int64_t val) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||||
if (masterflags == IS_MASTER) {
|
if (master) {
|
||||||
val += masterdefaultdelay;
|
val += masterdefaultdelay;
|
||||||
LOG(logINFO, ("\tActual Delay (master): %lld\n", (long long int)val));
|
LOG(logINFO, ("\tActual Delay (master): %lld\n", (long long int)val));
|
||||||
}
|
}
|
||||||
@@ -900,7 +900,7 @@ int setDelayAfterTrigger(int64_t val) {
|
|||||||
int64_t getDelayAfterTrigger() {
|
int64_t getDelayAfterTrigger() {
|
||||||
int64_t retval =
|
int64_t retval =
|
||||||
get64BitReg(SET_DELAY_LSB_REG, SET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ);
|
get64BitReg(SET_DELAY_LSB_REG, SET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||||
if (masterflags == IS_MASTER) {
|
if (master) {
|
||||||
LOG(logDEBUG1,
|
LOG(logDEBUG1,
|
||||||
("\tActual Delay read (master): %lld\n", (long long int)retval));
|
("\tActual Delay read (master): %lld\n", (long long int)retval));
|
||||||
retval -= masterdefaultdelay;
|
retval -= masterdefaultdelay;
|
||||||
@@ -924,7 +924,7 @@ int64_t getPeriodLeft() {
|
|||||||
int64_t getDelayAfterTriggerLeft() {
|
int64_t getDelayAfterTriggerLeft() {
|
||||||
int64_t retval =
|
int64_t retval =
|
||||||
get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ);
|
get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||||
if (masterflags == IS_MASTER) {
|
if (master) {
|
||||||
LOG(logDEBUG1,
|
LOG(logDEBUG1,
|
||||||
("\tGetting Actual delay (master): %lld\n", (long long int)retval));
|
("\tGetting Actual delay (master): %lld\n", (long long int)retval));
|
||||||
retval -= masterdefaultdelay;
|
retval -= masterdefaultdelay;
|
||||||
@@ -1201,6 +1201,8 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing, extsig */
|
/* parameters - timing, extsig */
|
||||||
|
|
||||||
|
int isMaster() { return master; }
|
||||||
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
u_int32_t addr = EXT_SIGNAL_REG;
|
u_int32_t addr = EXT_SIGNAL_REG;
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
@@ -1451,7 +1453,7 @@ int configureMAC() {
|
|||||||
setExpTime(900 * 1000);
|
setExpTime(900 * 1000);
|
||||||
|
|
||||||
// take an image
|
// take an image
|
||||||
if (masterflags == IS_MASTER)
|
if (master)
|
||||||
usleep(1 * 1000 * 1000); // required to ensure master starts
|
usleep(1 * 1000 * 1000); // required to ensure master starts
|
||||||
// acquisition only after slave has changed
|
// acquisition only after slave has changed
|
||||||
// to basic parameters and is waiting
|
// to basic parameters and is waiting
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1395,12 +1395,13 @@ int setHighVoltage(int val) {
|
|||||||
return highvoltage;
|
return highvoltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* parameters - timing */
|
||||||
|
|
||||||
int isMaster() {
|
int isMaster() {
|
||||||
return !((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >>
|
return !((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >>
|
||||||
SYSTEM_STATUS_SLV_BRD_DTCT_OFST);
|
SYSTEM_STATUS_SLV_BRD_DTCT_OFST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parameters - timing */
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
|
|
||||||
if (!isMaster() && arg == AUTO_TIMING)
|
if (!isMaster() && arg == AUTO_TIMING)
|
||||||
|
|||||||
@@ -347,6 +347,9 @@ int getADC(enum ADCINDEX ind);
|
|||||||
int setHighVoltage(int val);
|
int setHighVoltage(int val);
|
||||||
|
|
||||||
// parameters - timing, extsig
|
// parameters - timing, extsig
|
||||||
|
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD)
|
||||||
|
int isMaster();
|
||||||
|
#endif
|
||||||
#ifdef GOTTHARD2D
|
#ifdef GOTTHARD2D
|
||||||
void updatingRegisters();
|
void updatingRegisters();
|
||||||
#endif
|
#endif
|
||||||
@@ -354,7 +357,6 @@ void setTiming(enum timingMode arg);
|
|||||||
enum timingMode getTiming();
|
enum timingMode getTiming();
|
||||||
#ifdef MYTHEN3D
|
#ifdef MYTHEN3D
|
||||||
void setInitialExtSignals();
|
void setInitialExtSignals();
|
||||||
int isMaster();
|
|
||||||
int setGainCaps(int caps);
|
int setGainCaps(int caps);
|
||||||
int getGainCaps();
|
int getGainCaps();
|
||||||
int setChipStatusRegister(int csr);
|
int setChipStatusRegister(int csr);
|
||||||
@@ -556,9 +558,12 @@ int startStateMachine();
|
|||||||
void *start_timer(void *arg);
|
void *start_timer(void *arg);
|
||||||
#endif
|
#endif
|
||||||
int stopStateMachine();
|
int stopStateMachine();
|
||||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
#ifdef MYTHEN3D
|
||||||
int softwareTrigger();
|
int softwareTrigger();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef EIGERD
|
||||||
|
int softwareTrigger(int block);
|
||||||
|
#endif
|
||||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||||
int startReadOut();
|
int startReadOut();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4096,16 +4096,29 @@ int check_version(int file_des) {
|
|||||||
int software_trigger(int file_des) {
|
int software_trigger(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int arg = -1;
|
||||||
|
|
||||||
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
LOG(logDEBUG1, ("Software Trigger (block: %d\n", arg));
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Software Trigger\n"));
|
|
||||||
#if !defined(EIGERD) && !defined(MYTHEN3D)
|
#if !defined(EIGERD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
|
if (arg && myDetectorType == MYTHEN3) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Blocking trigger not implemented for Mythen3. Please use non blocking trigger.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
else if (Server_VerifyLock() == OK) {
|
||||||
|
#ifdef MYTHEN3
|
||||||
ret = softwareTrigger();
|
ret = softwareTrigger();
|
||||||
|
#else
|
||||||
|
ret = softwareTrigger(arg);
|
||||||
|
#endif
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
sprintf(mess, "Could not send software trigger\n");
|
strcpy(mess, "Could not send software trigger\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("Software trigger successful\n"));
|
LOG(logDEBUG1, ("Software trigger successful\n"));
|
||||||
@@ -8145,7 +8158,7 @@ int get_master(int file_des) {
|
|||||||
|
|
||||||
LOG(logDEBUG1, ("Getting master\n"));
|
LOG(logDEBUG1, ("Getting master\n"));
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
#if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
retval = isMaster();
|
retval = isMaster();
|
||||||
|
|||||||
@@ -488,12 +488,14 @@ class Detector {
|
|||||||
void stopReceiver();
|
void stopReceiver();
|
||||||
|
|
||||||
/** Non blocking: start detector acquisition. Status changes to RUNNING or
|
/** Non blocking: start detector acquisition. Status changes to RUNNING or
|
||||||
* WAITING and automatically returns to idle at the end of acquisition. */
|
* WAITING and automatically returns to idle at the end of acquisition.
|
||||||
|
[Mythen3] Master starts acquisition first */
|
||||||
void startDetector();
|
void startDetector();
|
||||||
|
|
||||||
/** [Mythen3] Non blocking: start detector readout of counters in chip.
|
/** [Mythen3] Non blocking: start detector readout of counters in chip.
|
||||||
* Status changes to TRANSMITTING and automatically returns to idle at the
|
* Status changes to TRANSMITTING and automatically returns to idle at the
|
||||||
* end of readout. */
|
* end of readout.
|
||||||
|
[Eiger] Master stops acquisition last */
|
||||||
void startDetectorReadout();
|
void startDetectorReadout();
|
||||||
|
|
||||||
/** Non blocking: Abort detector acquisition. Status changes to IDLE or
|
/** Non blocking: Abort detector acquisition. Status changes to IDLE or
|
||||||
@@ -520,8 +522,10 @@ class Detector {
|
|||||||
* numbers for different modules.*/
|
* numbers for different modules.*/
|
||||||
void setNextFrameNumber(uint64_t value, Positions pos = {});
|
void setNextFrameNumber(uint64_t value, Positions pos = {});
|
||||||
|
|
||||||
/** [Eiger][Mythen3] Sends an internal software trigger to the detector */
|
/** [Eiger][Mythen3] Sends an internal software trigger to the detector
|
||||||
void sendSoftwareTrigger(Positions pos = {});
|
* block true if command blocks till frames are sent out from that trigger
|
||||||
|
*/
|
||||||
|
void sendSoftwareTrigger(const bool block = false, Positions pos = {});
|
||||||
|
|
||||||
Result<defs::scanParameters> getScan(Positions pos = {}) const;
|
Result<defs::scanParameters> getScan(Positions pos = {}) const;
|
||||||
|
|
||||||
@@ -1316,6 +1320,7 @@ class Detector {
|
|||||||
* (internal gating). Gate index: 0-2, -1 for all */
|
* (internal gating). Gate index: 0-2, -1 for all */
|
||||||
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
|
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Eiger][Mythen3][Gotthard1] via stop server **/
|
||||||
Result<bool> getMaster(Positions pos = {}) const;
|
Result<bool> getMaster(Positions pos = {}) const;
|
||||||
|
|
||||||
// TODO! check if we really want to expose this !!!!!
|
// TODO! check if we really want to expose this !!!!!
|
||||||
|
|||||||
@@ -1193,6 +1193,41 @@ std::string CmdProxy::Scan(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::Trigger(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
if (cmd == "trigger") {
|
||||||
|
os << "[Eiger][Mythen3] Sends software trigger signal to detector";
|
||||||
|
} else if (cmd == "blockingtrigger") {
|
||||||
|
os << "[Eiger] Sends software trigger signal to detector and "
|
||||||
|
"blocks till "
|
||||||
|
"the frames are sent out for that trigger.";
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("unknown command " + cmd);
|
||||||
|
}
|
||||||
|
os << '\n';
|
||||||
|
} else if (action == slsDetectorDefs::GET_ACTION) {
|
||||||
|
throw sls::RuntimeError("Cannot get");
|
||||||
|
} else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||||
|
if (det_id != -1) {
|
||||||
|
throw sls::RuntimeError("Cannot execute this at module level");
|
||||||
|
}
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
bool block = false;
|
||||||
|
if (cmd == "blockingtrigger") {
|
||||||
|
block = true;
|
||||||
|
}
|
||||||
|
det->sendSoftwareTrigger(block);
|
||||||
|
os << "successful\n";
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
/* Network Configuration (Detector<->Receiver) */
|
/* Network Configuration (Detector<->Receiver) */
|
||||||
|
|
||||||
std::string CmdProxy::UDPDestinationIP(int action) {
|
std::string CmdProxy::UDPDestinationIP(int action) {
|
||||||
|
|||||||
@@ -838,7 +838,7 @@ class CmdProxy {
|
|||||||
{"rx_framescaught", &CmdProxy::rx_framescaught},
|
{"rx_framescaught", &CmdProxy::rx_framescaught},
|
||||||
{"rx_missingpackets", &CmdProxy::rx_missingpackets},
|
{"rx_missingpackets", &CmdProxy::rx_missingpackets},
|
||||||
{"nextframenumber", &CmdProxy::nextframenumber},
|
{"nextframenumber", &CmdProxy::nextframenumber},
|
||||||
{"trigger", &CmdProxy::trigger},
|
{"trigger", &CmdProxy::Trigger},
|
||||||
{"scan", &CmdProxy::Scan},
|
{"scan", &CmdProxy::Scan},
|
||||||
{"scanerrmsg", &CmdProxy::scanerrmsg},
|
{"scanerrmsg", &CmdProxy::scanerrmsg},
|
||||||
|
|
||||||
@@ -899,6 +899,7 @@ class CmdProxy {
|
|||||||
{"rx_zmqhwm", &CmdProxy::rx_zmqhwm},
|
{"rx_zmqhwm", &CmdProxy::rx_zmqhwm},
|
||||||
|
|
||||||
/* Eiger Specific */
|
/* Eiger Specific */
|
||||||
|
{"blockingtrigger", &CmdProxy::Trigger},
|
||||||
{"subexptime", &CmdProxy::subexptime},
|
{"subexptime", &CmdProxy::subexptime},
|
||||||
{"subdeadtime", &CmdProxy::subdeadtime},
|
{"subdeadtime", &CmdProxy::subdeadtime},
|
||||||
{"overflow", &CmdProxy::overflow},
|
{"overflow", &CmdProxy::overflow},
|
||||||
@@ -1094,6 +1095,7 @@ class CmdProxy {
|
|||||||
std::string ReceiverStatus(int action);
|
std::string ReceiverStatus(int action);
|
||||||
std::string DetectorStatus(int action);
|
std::string DetectorStatus(int action);
|
||||||
std::string Scan(int action);
|
std::string Scan(int action);
|
||||||
|
std::string Trigger(int action);
|
||||||
/* Network Configuration (Detector<->Receiver) */
|
/* Network Configuration (Detector<->Receiver) */
|
||||||
std::string UDPDestinationIP(int action);
|
std::string UDPDestinationIP(int action);
|
||||||
std::string UDPDestinationIP2(int action);
|
std::string UDPDestinationIP2(int action);
|
||||||
@@ -1461,10 +1463,6 @@ class CmdProxy {
|
|||||||
"Stopping acquisition might result in "
|
"Stopping acquisition might result in "
|
||||||
"different frame numbers for different modules.");
|
"different frame numbers for different modules.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(
|
|
||||||
trigger, sendSoftwareTrigger,
|
|
||||||
"\n\t[Eiger][Mythen3] Sends software trigger signal to detector.");
|
|
||||||
|
|
||||||
GET_COMMAND(scanerrmsg, getScanErrorMessage,
|
GET_COMMAND(scanerrmsg, getScanErrorMessage,
|
||||||
"\n\tGets Scan error message if scan ended in error for non "
|
"\n\tGets Scan error message if scan ended in error for non "
|
||||||
"blocking acquisitions.");
|
"blocking acquisitions.");
|
||||||
|
|||||||
@@ -677,16 +677,16 @@ void Detector::startDetector() {
|
|||||||
auto detector_type = getDetectorType().squash();
|
auto detector_type = getDetectorType().squash();
|
||||||
if (detector_type == defs::MYTHEN3 && size() > 1) {
|
if (detector_type == defs::MYTHEN3 && size() > 1) {
|
||||||
auto is_master = getMaster();
|
auto is_master = getMaster();
|
||||||
std::vector<int> master;
|
int masterPosition = 0;
|
||||||
std::vector<int> slaves;
|
std::vector<int> slaves;
|
||||||
for (int i = 0; i < size(); ++i) {
|
for (int i = 0; i < size(); ++i) {
|
||||||
if (is_master[i])
|
if (is_master[i])
|
||||||
master.push_back(i);
|
masterPosition = i;
|
||||||
else
|
else
|
||||||
slaves.push_back(i);
|
slaves.push_back(i);
|
||||||
}
|
}
|
||||||
pimpl->Parallel(&Module::startAcquisition, slaves);
|
pimpl->Parallel(&Module::startAcquisition, slaves);
|
||||||
pimpl->Parallel(&Module::startAcquisition, master);
|
pimpl->Parallel(&Module::startAcquisition, {masterPosition});
|
||||||
} else {
|
} else {
|
||||||
pimpl->Parallel(&Module::startAcquisition, {});
|
pimpl->Parallel(&Module::startAcquisition, {});
|
||||||
}
|
}
|
||||||
@@ -725,8 +725,8 @@ void Detector::setNextFrameNumber(uint64_t value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setNextFrameNumber, pos, value);
|
pimpl->Parallel(&Module::setNextFrameNumber, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::sendSoftwareTrigger(Positions pos) {
|
void Detector::sendSoftwareTrigger(const bool block, Positions pos) {
|
||||||
pimpl->Parallel(&Module::sendSoftwareTrigger, pos);
|
pimpl->Parallel(&Module::sendSoftwareTrigger, pos, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<defs::scanParameters> Detector::getScan(Positions pos) const {
|
Result<defs::scanParameters> Detector::getScan(Positions pos) const {
|
||||||
|
|||||||
@@ -776,7 +776,9 @@ void Module::setNextFrameNumber(uint64_t value) {
|
|||||||
sendToDetector(F_SET_NEXT_FRAME_NUMBER, value, nullptr);
|
sendToDetector(F_SET_NEXT_FRAME_NUMBER, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::sendSoftwareTrigger() { sendToDetectorStop(F_SOFTWARE_TRIGGER); }
|
void Module::sendSoftwareTrigger(const bool block) {
|
||||||
|
sendToDetectorStop(F_SOFTWARE_TRIGGER, static_cast<int>(block), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
defs::scanParameters Module::getScan() const {
|
defs::scanParameters Module::getScan() const {
|
||||||
return sendToDetector<defs::scanParameters>(F_GET_SCAN);
|
return sendToDetector<defs::scanParameters>(F_GET_SCAN);
|
||||||
@@ -2006,7 +2008,7 @@ std::array<time::ns, 3> Module::getGateDelayForAllGates() const {
|
|||||||
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
|
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::isMaster() const { return sendToDetector<int>(F_GET_MASTER); }
|
bool Module::isMaster() const { return sendToDetectorStop<int>(F_GET_MASTER); }
|
||||||
|
|
||||||
int Module::getChipStatusRegister() const {
|
int Module::getChipStatusRegister() const {
|
||||||
return sendToDetector<int>(F_GET_CSR);
|
return sendToDetector<int>(F_GET_CSR);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
std::vector<uint64_t> getNumMissingPackets() const;
|
std::vector<uint64_t> getNumMissingPackets() const;
|
||||||
uint64_t getNextFrameNumber() const;
|
uint64_t getNextFrameNumber() const;
|
||||||
void setNextFrameNumber(uint64_t value);
|
void setNextFrameNumber(uint64_t value);
|
||||||
void sendSoftwareTrigger();
|
void sendSoftwareTrigger(const bool block);
|
||||||
defs::scanParameters getScan() const;
|
defs::scanParameters getScan() const;
|
||||||
void setScan(const defs::scanParameters t);
|
void setScan(const defs::scanParameters t);
|
||||||
std::string getScanErrorMessage() const;
|
std::string getScanErrorMessage() const;
|
||||||
|
|||||||
@@ -1446,6 +1446,45 @@ TEST_CASE("trigger", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("blockingtrigger", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
REQUIRE_THROWS(proxy.Call("blockingtrigger", {}, -1, GET));
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type != defs::EIGER) {
|
||||||
|
REQUIRE_THROWS(proxy.Call("blockingtrigger", {}, -1, PUT));
|
||||||
|
} else if (det_type == defs::EIGER) {
|
||||||
|
auto prev_timing =
|
||||||
|
det.getTimingMode().tsquash("inconsistent timing mode in test");
|
||||||
|
auto prev_frames =
|
||||||
|
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
|
||||||
|
auto prev_exptime =
|
||||||
|
det.getExptime().tsquash("inconsistent exptime in test");
|
||||||
|
auto prev_period =
|
||||||
|
det.getPeriod().tsquash("inconsistent period in test");
|
||||||
|
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||||
|
det.setNumberOfFrames(1);
|
||||||
|
det.setExptime(std::chrono::microseconds(200));
|
||||||
|
det.setPeriod(std::chrono::milliseconds(1));
|
||||||
|
auto nextframenumber =
|
||||||
|
det.getNextFrameNumber().tsquash("inconsistent frame nr in test");
|
||||||
|
det.startDetector();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("blockingtrigger", {}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "blockingtrigger successful\n");
|
||||||
|
}
|
||||||
|
auto currentfnum =
|
||||||
|
det.getNextFrameNumber().tsquash("inconsistent frame nr in test");
|
||||||
|
REQUIRE(nextframenumber + 1 == currentfnum);
|
||||||
|
det.stopDetector();
|
||||||
|
det.setTimingMode(prev_timing);
|
||||||
|
det.setNumberOfFrames(prev_frames);
|
||||||
|
det.setExptime(prev_exptime);
|
||||||
|
det.setPeriod(prev_period);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("clearbusy", "[.cmd]") {
|
TEST_CASE("clearbusy", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
|||||||
@@ -375,9 +375,6 @@ typedef struct {
|
|||||||
/** chip speed */
|
/** chip speed */
|
||||||
enum speedLevel { FULL_SPEED, HALF_SPEED, QUARTER_SPEED };
|
enum speedLevel { FULL_SPEED, HALF_SPEED, QUARTER_SPEED };
|
||||||
|
|
||||||
/** hierarchy in multi-detector structure, if any */
|
|
||||||
enum masterFlags { NO_MASTER, IS_MASTER, IS_SLAVE };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* burst mode for gotthard2
|
* burst mode for gotthard2
|
||||||
*/
|
*/
|
||||||
@@ -394,14 +391,14 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
enum timingSourceType { TIMING_INTERNAL, TIMING_EXTERNAL };
|
enum timingSourceType { TIMING_INTERNAL, TIMING_EXTERNAL };
|
||||||
|
|
||||||
//gain caps Mythen3
|
// gain caps Mythen3
|
||||||
enum M3_GainCaps {
|
enum M3_GainCaps {
|
||||||
M3_C10pre= 1<<7,
|
M3_C10pre = 1 << 7,
|
||||||
M3_C15sh = 1<<10,
|
M3_C15sh = 1 << 10,
|
||||||
M3_C30sh = 1<<11,
|
M3_C30sh = 1 << 11,
|
||||||
M3_C50sh = 1<<12,
|
M3_C50sh = 1 << 12,
|
||||||
M3_C225ACsh = 1<<13,
|
M3_C225ACsh = 1 << 13,
|
||||||
M3_C15pre = 1<<14,
|
M3_C15pre = 1 << 14,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -636,9 +633,6 @@ typedef struct {
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO! discuss this
|
// TODO! discuss this
|
||||||
#include <vector> //hmm... but currently no way around
|
#include <vector> //hmm... but currently no way around
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
/** API versions */
|
/** API versions */
|
||||||
#define GITBRANCH "developer"
|
#define GITBRANCH "developer"
|
||||||
#define APILIB 0x210225
|
#define APILIB 0x210225
|
||||||
#define APIRECEIVER 0x210225
|
#define APIRECEIVER 0x210225
|
||||||
#define APIGUI 0x210225
|
#define APIGUI 0x210225
|
||||||
#define APICTB 0x210621
|
#define APICTB 0x210621
|
||||||
#define APIGOTTHARD 0x210621
|
#define APIGOTTHARD 0x210621
|
||||||
#define APIGOTTHARD2 0x210621
|
#define APIGOTTHARD2 0x210621
|
||||||
#define APIJUNGFRAU 0x210621
|
#define APIJUNGFRAU 0x210621
|
||||||
#define APIMYTHEN3 0x210621
|
#define APIMYTHEN3 0x210621
|
||||||
#define APIMOENCH 0x210621
|
#define APIMOENCH 0x210621
|
||||||
#define APIEIGER 0x210621
|
|
||||||
|
#define APIEIGER 0x210701
|
||||||
|
|||||||
Reference in New Issue
Block a user