mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
parent
91ad7b0594
commit
47018b61cd
@ -132,7 +132,7 @@
|
|||||||
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
|
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
|
||||||
#define CONTROL_STRT_PATTERN_OFST (2)
|
#define CONTROL_STRT_PATTERN_OFST (2)
|
||||||
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
|
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
|
||||||
#define CONTROL_STRT_READOUT_OFST (3) // not connected in software yet
|
#define CONTROL_STRT_READOUT_OFST (3)
|
||||||
#define CONTROL_STRT_READOUT_MSK (0x00000001 << CONTROL_STRT_READOUT_OFST)
|
#define CONTROL_STRT_READOUT_MSK (0x00000001 << CONTROL_STRT_READOUT_OFST)
|
||||||
#define CONTROL_STRT_SW_TRIGGER_OFST (4)
|
#define CONTROL_STRT_SW_TRIGGER_OFST (4)
|
||||||
#define CONTROL_STRT_SW_TRIGGER_MSK (0x00000001 << CONTROL_STRT_SW_TRIGGER_OFST)
|
#define CONTROL_STRT_SW_TRIGGER_MSK (0x00000001 << CONTROL_STRT_SW_TRIGGER_OFST)
|
||||||
|
Binary file not shown.
@ -2407,6 +2407,22 @@ int softwareTrigger() {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int startReadOut() {
|
||||||
|
LOG(logINFOBLUE, ("Starting Readout\n"));
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
// cannot set #frames and exptiem temporarily to 1 and 0,
|
||||||
|
// because have to set it back after readout (but this is non blocking)
|
||||||
|
return startStateMachine();
|
||||||
|
#endif
|
||||||
|
cleanFifos();
|
||||||
|
|
||||||
|
// start readout
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_READOUT_MSK);
|
||||||
|
|
||||||
|
LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
enum runStatus getRunStatus() {
|
enum runStatus getRunStatus() {
|
||||||
LOG(logDEBUG1, ("Getting status\n"));
|
LOG(logDEBUG1, ("Getting status\n"));
|
||||||
// scan error or running
|
// scan error or running
|
||||||
|
@ -567,8 +567,7 @@ int stopStateMachine();
|
|||||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||||
int softwareTrigger();
|
int softwareTrigger();
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||||
#ifdef EIGERD
|
|
||||||
int startReadOut();
|
int startReadOut();
|
||||||
#endif
|
#endif
|
||||||
enum runStatus getRunStatus();
|
enum runStatus getRunStatus();
|
||||||
|
@ -240,3 +240,4 @@ int set_bad_channels(int);
|
|||||||
int reconfigure_udp(int);
|
int reconfigure_udp(int);
|
||||||
int validate_udp_configuration(int);
|
int validate_udp_configuration(int);
|
||||||
int get_bursts_left(int);
|
int get_bursts_left(int);
|
||||||
|
int start_readout(int);
|
@ -358,6 +358,7 @@ void function_table() {
|
|||||||
flist[F_RECONFIGURE_UDP] = &reconfigure_udp;
|
flist[F_RECONFIGURE_UDP] = &reconfigure_udp;
|
||||||
flist[F_VALIDATE_UDP_CONFIG] = &validate_udp_configuration;
|
flist[F_VALIDATE_UDP_CONFIG] = &validate_udp_configuration;
|
||||||
flist[F_GET_BURSTS_LEFT] = &get_bursts_left;
|
flist[F_GET_BURSTS_LEFT] = &get_bursts_left;
|
||||||
|
flist[F_START_READOUT] = &start_readout;
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -8104,3 +8105,43 @@ int get_bursts_left(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int start_readout(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
#ifndef MYTHEN3D
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
enum runStatus s = getRunStatus();
|
||||||
|
if (s == RUNNING || s == WAITING) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not start readout because the detector is "
|
||||||
|
"already running!\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else if (configured == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not start readout because ");
|
||||||
|
strcat(mess, configureMessage);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
memset(scanErrMessage, 0, MAX_STR_LENGTH);
|
||||||
|
sharedMemory_setScanStop(0);
|
||||||
|
sharedMemory_setScanStatus(IDLE); // if it was error
|
||||||
|
// start readout
|
||||||
|
ret = startReadOut();
|
||||||
|
if (ret == FAIL) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not start readout. Could not create udp "
|
||||||
|
"socket in server. Check udp_dstip & udp_dstport.\n");
|
||||||
|
#else
|
||||||
|
sprintf(mess, "Could not start readout\n");
|
||||||
|
#endif
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
}
|
||||||
|
@ -456,6 +456,11 @@ class Detector {
|
|||||||
* WAITING and automatically returns to idle at the end of acquisition. */
|
* WAITING and automatically returns to idle at the end of acquisition. */
|
||||||
void startDetector();
|
void startDetector();
|
||||||
|
|
||||||
|
/** [Mythen3] Non blocking: start detector readout of counters in chip.
|
||||||
|
* Status changes to TRANSMITTING and automatically returns to idle at the
|
||||||
|
* end of readout. */
|
||||||
|
void startDetectorReadout();
|
||||||
|
|
||||||
/** Non blocking: Abort detector acquisition. Status changes to IDLE or
|
/** Non blocking: Abort detector acquisition. Status changes to IDLE or
|
||||||
* STOPPED. Goes to stop server. */
|
* STOPPED. Goes to stop server. */
|
||||||
void stopDetector();
|
void stopDetector();
|
||||||
|
@ -835,6 +835,7 @@ class CmdProxy {
|
|||||||
{"rx_start", &CmdProxy::rx_start},
|
{"rx_start", &CmdProxy::rx_start},
|
||||||
{"rx_stop", &CmdProxy::rx_stop},
|
{"rx_stop", &CmdProxy::rx_stop},
|
||||||
{"start", &CmdProxy::start},
|
{"start", &CmdProxy::start},
|
||||||
|
{"readout", &CmdProxy::readout},
|
||||||
{"stop", &CmdProxy::stop},
|
{"stop", &CmdProxy::stop},
|
||||||
{"rx_status", &CmdProxy::ReceiverStatus},
|
{"rx_status", &CmdProxy::ReceiverStatus},
|
||||||
{"status", &CmdProxy::DetectorStatus},
|
{"status", &CmdProxy::DetectorStatus},
|
||||||
@ -1429,7 +1430,14 @@ class CmdProxy {
|
|||||||
EXECUTE_SET_COMMAND_NOID(
|
EXECUTE_SET_COMMAND_NOID(
|
||||||
start, startDetector,
|
start, startDetector,
|
||||||
"\n\tStarts detector acquisition. Status changes to RUNNING or WAITING "
|
"\n\tStarts detector acquisition. Status changes to RUNNING or WAITING "
|
||||||
"and automatically returns to idle at the end of acquisition.");
|
"and automatically returns to idle at the end of acquisition. If the "
|
||||||
|
"acquisition was abruptly stopped, some detectors come back to "
|
||||||
|
"STOPPED.");
|
||||||
|
|
||||||
|
EXECUTE_SET_COMMAND_NOID(
|
||||||
|
readout, startDetectorReadout,
|
||||||
|
"\n\t[Mythen3] Starts detector readout. Status changes to TRANSMITTING "
|
||||||
|
"and automatically returns to idle at the end of readout.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND_NOID(stop, stopDetector,
|
EXECUTE_SET_COMMAND_NOID(stop, stopDetector,
|
||||||
"\n\tAbort detector acquisition. Status changes "
|
"\n\tAbort detector acquisition. Status changes "
|
||||||
|
@ -593,6 +593,10 @@ void Detector::startDetector() {
|
|||||||
pimpl->Parallel(&Module::startAcquisition, {});
|
pimpl->Parallel(&Module::startAcquisition, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Detector::startDetectorReadout() {
|
||||||
|
pimpl->Parallel(&Module::startReadout, {});
|
||||||
|
}
|
||||||
|
|
||||||
void Detector::stopDetector() { pimpl->Parallel(&Module::stopAcquisition, {}); }
|
void Detector::stopDetector() { pimpl->Parallel(&Module::stopAcquisition, {}); }
|
||||||
|
|
||||||
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
|
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
|
||||||
|
@ -407,6 +407,11 @@ void Module::startAcquisition() {
|
|||||||
sendToDetector(F_START_ACQUISITION);
|
sendToDetector(F_START_ACQUISITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Module::startReadout() {
|
||||||
|
shm()->stoppedFlag = false;
|
||||||
|
sendToDetector(F_START_READOUT);
|
||||||
|
}
|
||||||
|
|
||||||
void Module::stopAcquisition() {
|
void Module::stopAcquisition() {
|
||||||
// get status before stopping acquisition
|
// get status before stopping acquisition
|
||||||
runStatus s = ERROR, r = ERROR;
|
runStatus s = ERROR, r = ERROR;
|
||||||
|
@ -160,6 +160,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void startReceiver();
|
void startReceiver();
|
||||||
void stopReceiver();
|
void stopReceiver();
|
||||||
void startAcquisition();
|
void startAcquisition();
|
||||||
|
void startReadout();
|
||||||
void stopAcquisition();
|
void stopAcquisition();
|
||||||
void restreamStopFromReceiver();
|
void restreamStopFromReceiver();
|
||||||
void startAndReadAll();
|
void startAndReadAll();
|
||||||
|
@ -115,6 +115,23 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* acquisition */
|
||||||
|
|
||||||
|
TEST_CASE("readout", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
// PUT only command
|
||||||
|
REQUIRE_THROWS(proxy.Call("readout", {}, -1, GET));
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type != defs::MYTHEN3) {
|
||||||
|
REQUIRE_THROWS(proxy.Call("readout", {}, -1, GET));
|
||||||
|
} else {
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("readout", {}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "readout successful\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
|
||||||
TEST_CASE("counters", "[.cmd][.new]") {
|
TEST_CASE("counters", "[.cmd][.new]") {
|
||||||
|
@ -214,6 +214,7 @@ enum detFuncs {
|
|||||||
F_RECONFIGURE_UDP,
|
F_RECONFIGURE_UDP,
|
||||||
F_VALIDATE_UDP_CONFIG,
|
F_VALIDATE_UDP_CONFIG,
|
||||||
F_GET_BURSTS_LEFT,
|
F_GET_BURSTS_LEFT,
|
||||||
|
F_START_READOUT,
|
||||||
|
|
||||||
NUM_DET_FUNCTIONS,
|
NUM_DET_FUNCTIONS,
|
||||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||||
@ -533,6 +534,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_RECONFIGURE_UDP: return "F_RECONFIGURE_UDP";
|
case F_RECONFIGURE_UDP: return "F_RECONFIGURE_UDP";
|
||||||
case F_VALIDATE_UDP_CONFIG: return "F_VALIDATE_UDP_CONFIG";
|
case F_VALIDATE_UDP_CONFIG: return "F_VALIDATE_UDP_CONFIG";
|
||||||
case F_GET_BURSTS_LEFT: return "F_GET_BURSTS_LEFT";
|
case F_GET_BURSTS_LEFT: return "F_GET_BURSTS_LEFT";
|
||||||
|
case F_START_READOUT: return "F_START_READOUT";
|
||||||
|
|
||||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
#define APIGOTTHARD2 0x201016
|
#define APIGOTTHARD2 0x201016
|
||||||
#define APIJUNGFRAU 0x201016
|
#define APIJUNGFRAU 0x201016
|
||||||
#define APIMOENCH 0x201013
|
#define APIMOENCH 0x201013
|
||||||
#define APIMYTHEN3 0x201020
|
#define APIMYTHEN3 0x201026
|
||||||
|
Loading…
x
Reference in New Issue
Block a user