mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-05 20:30:03 +02:00
Merge branch '3.0-rc' into developer
This commit is contained in:
commit
ae6884949b
@ -43,7 +43,8 @@ using namespace std;
|
|||||||
#define COULDNOT_STOP_RECEIVER 0x0000800000000000ULL
|
#define COULDNOT_STOP_RECEIVER 0x0000800000000000ULL
|
||||||
#define RECEIVER_DET_POSID_NOT_SET 0x0000400000000000ULL
|
#define RECEIVER_DET_POSID_NOT_SET 0x0000400000000000ULL
|
||||||
#define RECEIVER_MULTI_DET_SIZE_NOT_SET 0x0000200000000000ULL
|
#define RECEIVER_MULTI_DET_SIZE_NOT_SET 0x0000200000000000ULL
|
||||||
|
#define PREPARE_ACQUISITION 0x0000100000000000ULL
|
||||||
|
#define CLEANUP_ACQUISITION 0x0000080000000000ULL
|
||||||
// 0xFFFFFFF000000000ULL
|
// 0xFFFFFFF000000000ULL
|
||||||
|
|
||||||
// 0x0000000FFFFFFFFFULL
|
// 0x0000000FFFFFFFFFULL
|
||||||
@ -79,6 +80,7 @@ using namespace std;
|
|||||||
#define RECEIVER_FLIPPED_DATA_NOT_SET 0x0000000020000000ULL
|
#define RECEIVER_FLIPPED_DATA_NOT_SET 0x0000000020000000ULL
|
||||||
#define THRESHOLD_NOT_SET 0x0000000040000000ULL
|
#define THRESHOLD_NOT_SET 0x0000000040000000ULL
|
||||||
#define RECEIVER_FILE_FORMAT 0x0000000080000000ULL
|
#define RECEIVER_FILE_FORMAT 0x0000000080000000ULL
|
||||||
|
#define RECEIVER_SUBF_TIME_NOT_SET 0x0000000100000000ULL
|
||||||
// 0x0000000FFFFFFFFFULL
|
// 0x0000000FFFFFFFFFULL
|
||||||
|
|
||||||
/** @short class returning all error messages for error mask */
|
/** @short class returning all error messages for error mask */
|
||||||
@ -145,6 +147,12 @@ public:
|
|||||||
if(slsErrorMask&RECEIVER_MULTI_DET_SIZE_NOT_SET)
|
if(slsErrorMask&RECEIVER_MULTI_DET_SIZE_NOT_SET)
|
||||||
retval.append("Could not set multi detector size\n");
|
retval.append("Could not set multi detector size\n");
|
||||||
|
|
||||||
|
if(slsErrorMask&PREPARE_ACQUISITION)
|
||||||
|
retval.append("Could not prepare acquisition in detector\n");
|
||||||
|
|
||||||
|
if(slsErrorMask&CLEANUP_ACQUISITION)
|
||||||
|
retval.append("Could not clean up after acquisition in detector\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -251,6 +259,9 @@ public:
|
|||||||
if(slsErrorMask&RECEIVER_FILE_FORMAT)
|
if(slsErrorMask&RECEIVER_FILE_FORMAT)
|
||||||
retval.append("Could not set receiver file format\n");
|
retval.append("Could not set receiver file format\n");
|
||||||
|
|
||||||
|
if(slsErrorMask&RECEIVER_SUBF_TIME_NOT_SET)
|
||||||
|
retval.append("Could not set sub exposure time in receiver.\n");
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------ length of message
|
//------------------------------------------------------ length of message
|
||||||
|
|
||||||
|
@ -1921,4 +1921,35 @@ int Feb_Control_GetRightFPGATemp(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
|
||||||
|
uint32_t value=0;
|
||||||
|
if(Module_TopAddressIsValid(&modules[1])){
|
||||||
|
if(!Feb_Interface_WriteRegister(Module_GetTopRightAddress (&modules[1]),offset, data,0, 0)) {
|
||||||
|
cprintf(RED,"Could not read value. Value read:%d\n", value);
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(!Feb_Interface_WriteRegister(Module_GetBottomRightAddress (&modules[1]),offset, data,0, 0)) {
|
||||||
|
cprintf(RED,"Could not read value. Value read:%d\n", value);
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Feb_Control_ReadRegister(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t Feb_Control_ReadRegister(uint32_t offset) {
|
||||||
|
uint32_t value=0;
|
||||||
|
if(Module_TopAddressIsValid(&modules[1])){
|
||||||
|
if(!Feb_Interface_ReadRegister(Module_GetTopRightAddress (&modules[1]),offset, &value)) {
|
||||||
|
cprintf(RED,"Could not read value. Value read:%d\n", value);
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(!Feb_Interface_ReadRegister(Module_GetBottomRightAddress (&modules[1]),offset, &value)) {
|
||||||
|
cprintf(RED,"Could not read value. Value read:%d\n", value);
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
@ -198,4 +198,6 @@ int Feb_Control_GetModuleNumber();
|
|||||||
int Feb_Control_GetLeftFPGATemp();
|
int Feb_Control_GetLeftFPGATemp();
|
||||||
int Feb_Control_GetRightFPGATemp();
|
int Feb_Control_GetRightFPGATemp();
|
||||||
|
|
||||||
|
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
||||||
|
uint32_t Feb_Control_ReadRegister(uint32_t offset);
|
||||||
#endif
|
#endif
|
||||||
|
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: d3b24894af8a588e6945240c3b80c2b7024608c4
|
Repsitory UUID: 2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8
|
||||||
Revision: 295
|
Revision: 296
|
||||||
Branch: 3.0-rc
|
Branch: 3.0-rc
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 1448
|
Last Changed Rev: 1457
|
||||||
Last Changed Date: 2017-07-25 13:53:46.000000002 +0200 ./Beb.c
|
Last Changed Date: 2017-08-08 15:23:10.000000002 +0200 ./Makefile
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "d3b24894af8a588e6945240c3b80c2b7024608c4"
|
#define SVNREPUUID "2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8"
|
||||||
//#define SVNREV 0x1448
|
//#define SVNREV 0x1457
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x1448
|
#define SVNREV 0x1457
|
||||||
#define SVNDATE 0x20170725
|
#define SVNDATE 0x20170808
|
||||||
//
|
//
|
||||||
|
@ -30,6 +30,7 @@ dacs_t *detectorDacs=NULL;
|
|||||||
dacs_t *detectorAdcs=NULL;
|
dacs_t *detectorAdcs=NULL;
|
||||||
|
|
||||||
int eiger_highvoltage = 0;
|
int eiger_highvoltage = 0;
|
||||||
|
int eiger_theo_highvoltage = 0;
|
||||||
int eiger_iodelay = 0;
|
int eiger_iodelay = 0;
|
||||||
int eiger_photonenergy = 0;
|
int eiger_photonenergy = 0;
|
||||||
int eiger_dynamicrange = 0;
|
int eiger_dynamicrange = 0;
|
||||||
@ -341,7 +342,14 @@ void setupDetector() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* advanced read/write reg */
|
||||||
|
uint32_t writeRegister(uint32_t offset, uint32_t data) {
|
||||||
|
return Feb_Control_WriteRegister(offset, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t readRegister(uint32_t offset) {
|
||||||
|
return Feb_Control_ReadRegister(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* set parameters - nmod, dr, roi */
|
/* set parameters - nmod, dr, roi */
|
||||||
@ -745,22 +753,33 @@ int getADC(enum ADCINDEX ind, int imod){
|
|||||||
|
|
||||||
|
|
||||||
int setHighVoltage(int val){
|
int setHighVoltage(int val){
|
||||||
if(val!=-1){
|
if (master) {
|
||||||
eiger_highvoltage = val;
|
|
||||||
if(master){
|
// set
|
||||||
|
if(val!=-1){
|
||||||
|
eiger_theo_highvoltage = val;
|
||||||
int ret = Feb_Control_SetHighVoltage(val);
|
int ret = Feb_Control_SetHighVoltage(val);
|
||||||
if(!ret) //could not set
|
if(!ret) //could not set
|
||||||
return -2;
|
return -2;
|
||||||
else if (ret == -1) //outside range
|
else if (ret == -1) //outside range
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get
|
||||||
|
if (!Feb_Control_GetHighVoltage(&eiger_highvoltage)) {
|
||||||
|
cprintf(RED,"Warning: Could not read high voltage\n");
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tolerance of 5
|
||||||
|
if (abs(eiger_theo_highvoltage-eiger_highvoltage) > HIGH_VOLTAGE_TOLERANCE) {
|
||||||
|
cprintf(BLUE, "High voltage still ramping: %d\n", eiger_highvoltage);
|
||||||
|
return eiger_highvoltage;
|
||||||
|
}
|
||||||
|
return eiger_theo_highvoltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(master && !Feb_Control_GetHighVoltage(&eiger_highvoltage)){
|
return SLAVE_HIGH_VOLTAGE_READ_VAL;
|
||||||
cprintf(RED,"Warning: Could not read high voltage\n");
|
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
return eiger_highvoltage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +84,8 @@ enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
|
|||||||
|
|
||||||
#define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS (0x1FFFFFFF) /** 29 bit register for max subframe exposure value */
|
#define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS (0x1FFFFFFF) /** 29 bit register for max subframe exposure value */
|
||||||
|
|
||||||
|
#define SLAVE_HIGH_VOLTAGE_READ_VAL (-999)
|
||||||
|
#define HIGH_VOLTAGE_TOLERANCE (5)
|
||||||
|
|
||||||
|
|
||||||
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: ef36cb7a54e1ae34ad1e85a46da6c121902108e6
|
Repsitory UUID: 2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8
|
||||||
Revision: 1451
|
Revision: 1452
|
||||||
Branch: 3.0-rc
|
Branch: 3.0-rc
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 1456
|
Last Changed Rev: 1457
|
||||||
Last Changed Date: 2017-08-08 18:21:02.000000002 +0200 ./multiSlsDetector/multiSlsDetector.cpp
|
Last Changed Date: 2017-08-09 11:36:51.000000002 +0200 ./multiSlsDetector/multiSlsDetector.cpp
|
||||||
|
@ -1359,75 +1359,219 @@ int multiSlsDetector::getChanRegs(double* retval,bool fromDetector){
|
|||||||
|
|
||||||
/* Communication to server */
|
/* Communication to server */
|
||||||
|
|
||||||
|
int multiSlsDetector::prepareAcquisition(){
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
int ret=OK;
|
||||||
|
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||||
|
|
||||||
|
if(!threadpool){
|
||||||
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
|
return FAIL;
|
||||||
|
}else{
|
||||||
|
int* iret[posmax-posmin];
|
||||||
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
|
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||||
|
iret[idet]= new int(OK);
|
||||||
|
Task* task = new Task(new func0_t<int,slsDetector,int>(&slsDetector::prepareAcquisition,
|
||||||
|
detectors[idet],iret[idet]));
|
||||||
|
threadpool->add_task(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
threadpool->startExecuting();
|
||||||
|
threadpool->wait_for_tasks_to_complete();
|
||||||
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
|
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||||
|
if(iret[idet] != NULL){
|
||||||
|
if(*iret[idet] != OK)
|
||||||
|
ret = FAIL;
|
||||||
|
delete iret[idet];
|
||||||
|
}else ret = FAIL;
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//master
|
||||||
|
int ret1=OK;
|
||||||
|
i=thisMultiDetector->masterPosition;
|
||||||
|
if (thisMultiDetector->masterPosition>=0) {
|
||||||
|
if (detectors[i]) {
|
||||||
|
ret1=detectors[i]->prepareAcquisition();
|
||||||
|
if(detectors[i]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
|
if (ret1!=OK)
|
||||||
|
ret=FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int multiSlsDetector::cleanupAcquisition(){
|
||||||
|
int i=0;
|
||||||
|
int ret=OK,ret1=OK;
|
||||||
|
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||||
|
|
||||||
|
i=thisMultiDetector->masterPosition;
|
||||||
|
if (thisMultiDetector->masterPosition>=0) {
|
||||||
|
if (detectors[i]) {
|
||||||
|
ret1=detectors[i]->cleanupAcquisition();
|
||||||
|
if(detectors[i]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
|
if (ret1!=OK)
|
||||||
|
ret=FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!threadpool){
|
||||||
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
|
return FAIL;
|
||||||
|
}else{
|
||||||
|
int* iret[posmax-posmin];
|
||||||
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
|
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||||
|
iret[idet]= new int(OK);
|
||||||
|
Task* task = new Task(new func0_t<int,slsDetector,int>(&slsDetector::cleanupAcquisition,
|
||||||
|
detectors[idet],iret[idet]));
|
||||||
|
threadpool->add_task(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
threadpool->startExecuting();
|
||||||
|
threadpool->wait_for_tasks_to_complete();
|
||||||
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
|
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||||
|
if(iret[idet] != NULL){
|
||||||
|
if(*iret[idet] != OK)
|
||||||
|
ret = FAIL;
|
||||||
|
delete iret[idet];
|
||||||
|
}else ret = FAIL;
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Acquisition functions
|
// Acquisition functions
|
||||||
/* change these funcs accepting also ok/fail */
|
/* change these funcs accepting also ok/fail */
|
||||||
|
|
||||||
int multiSlsDetector::startAcquisition(){
|
int multiSlsDetector::startAcquisition(){
|
||||||
|
|
||||||
int i=0;
|
|
||||||
int ret=OK, ret1=OK;
|
|
||||||
|
|
||||||
for (i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
if (getDetectorsType() == EIGER) {
|
||||||
if (i!=thisMultiDetector->masterPosition)
|
if (prepareAcquisition() == FAIL)
|
||||||
if (detectors[i]) {
|
return FAIL;
|
||||||
ret=detectors[i]->startAcquisition();
|
}
|
||||||
if(detectors[i]->getErrorMask())
|
|
||||||
setErrorMask(getErrorMask()|(1<<i));
|
int i=0;
|
||||||
if (ret!=OK)
|
int ret=OK;
|
||||||
ret1=FAIL;
|
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||||
}
|
|
||||||
}
|
if(!threadpool){
|
||||||
i=thisMultiDetector->masterPosition;
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
if (thisMultiDetector->masterPosition>=0) {
|
return FAIL;
|
||||||
if (detectors[i]) {
|
}else{
|
||||||
ret=detectors[i]->startAcquisition();
|
int* iret[posmax-posmin];
|
||||||
if(detectors[i]->getErrorMask())
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
setErrorMask(getErrorMask()|(1<<i));
|
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||||
if (ret!=OK)
|
iret[idet]= new int(OK);
|
||||||
ret1=FAIL;
|
Task* task = new Task(new func0_t<int,slsDetector,int>(&slsDetector::startAcquisition,
|
||||||
}
|
detectors[idet],iret[idet]));
|
||||||
}
|
threadpool->add_task(task);
|
||||||
return ret1;
|
}
|
||||||
|
}
|
||||||
|
threadpool->startExecuting();
|
||||||
|
threadpool->wait_for_tasks_to_complete();
|
||||||
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
|
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||||
|
if(iret[idet] != NULL){
|
||||||
|
if(*iret[idet] != OK)
|
||||||
|
ret = FAIL;
|
||||||
|
delete iret[idet];
|
||||||
|
}else ret = FAIL;
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//master
|
||||||
|
int ret1=OK;
|
||||||
|
i=thisMultiDetector->masterPosition;
|
||||||
|
if (thisMultiDetector->masterPosition>=0) {
|
||||||
|
if (detectors[i]) {
|
||||||
|
ret1=detectors[i]->startAcquisition();
|
||||||
|
if(detectors[i]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
|
if (ret1!=OK)
|
||||||
|
ret=FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::stopAcquisition(){
|
int multiSlsDetector::stopAcquisition(){
|
||||||
int i=0;
|
int i=0;
|
||||||
int ret=OK, ret1=OK;
|
int ret=OK,ret1=OK;
|
||||||
|
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||||
|
|
||||||
|
i=thisMultiDetector->masterPosition;
|
||||||
|
if (thisMultiDetector->masterPosition>=0) {
|
||||||
|
if (detectors[i]) {
|
||||||
|
ret1=detectors[i]->stopAcquisition();
|
||||||
|
if(detectors[i]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
|
if (ret1!=OK)
|
||||||
|
ret=FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!threadpool){
|
||||||
i=thisMultiDetector->masterPosition;
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
if (thisMultiDetector->masterPosition>=0) {
|
return FAIL;
|
||||||
if (detectors[i]) {
|
}else{
|
||||||
ret=detectors[i]->stopAcquisition();
|
int* iret[posmax-posmin];
|
||||||
if(detectors[i]->getErrorMask())
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
setErrorMask(getErrorMask()|(1<<i));
|
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||||
if (ret!=OK)
|
iret[idet]= new int(OK);
|
||||||
ret1=FAIL;
|
Task* task = new Task(new func0_t<int,slsDetector,int>(&slsDetector::stopAcquisition,
|
||||||
}
|
detectors[idet],iret[idet]));
|
||||||
}
|
threadpool->add_task(task);
|
||||||
for (i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
}
|
||||||
if (detectors[i]) {
|
}
|
||||||
ret=detectors[i]->stopAcquisition();
|
threadpool->startExecuting();
|
||||||
if(detectors[i]->getErrorMask())
|
threadpool->wait_for_tasks_to_complete();
|
||||||
setErrorMask(getErrorMask()|(1<<i));
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
if (ret!=OK)
|
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||||
ret1=FAIL;
|
if(iret[idet] != NULL){
|
||||||
}
|
if(*iret[idet] != OK)
|
||||||
}
|
ret = FAIL;
|
||||||
*stoppedFlag=1;
|
delete iret[idet];
|
||||||
setAcquiringFlag(false);
|
}else ret = FAIL;
|
||||||
return ret1;
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*stoppedFlag=1;
|
||||||
|
setAcquiringFlag(false);
|
||||||
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::startReadOut(){
|
int multiSlsDetector::startReadOut(){
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
@ -1633,8 +1777,12 @@ int* multiSlsDetector::startAndReadAll(){
|
|||||||
int* retval;
|
int* retval;
|
||||||
int i=0;
|
int i=0;
|
||||||
if (thisMultiDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisMultiDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
|
|
||||||
startAndReadAllNoWait();
|
if(getDetectorsType() == EIGER) {
|
||||||
|
if (prepareAcquisition() == FAIL)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
startAndReadAllNoWait();
|
||||||
|
|
||||||
while ((retval=getDataFromDetector())){
|
while ((retval=getDataFromDetector())){
|
||||||
i++;
|
i++;
|
||||||
@ -3009,16 +3157,24 @@ dacs_t multiSlsDetector::setDAC(dacs_t val, dacIndex idac, int mV, int imod) {
|
|||||||
for(int idet=posmin; idet<posmax; idet++){
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
if(detectors[idet]){
|
if(detectors[idet]){
|
||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if (ret==-100)
|
|
||||||
ret=*iret[idet];
|
// highvoltage of slave, ignore value
|
||||||
else if (ret!=*iret[idet])
|
if ((idac == HV_NEW) && (*iret[idet] == -999))
|
||||||
ret=-1;
|
;
|
||||||
|
else {
|
||||||
|
if (ret==-100)
|
||||||
|
ret=*iret[idet];
|
||||||
|
else if (ret!=*iret[idet])
|
||||||
|
ret=-1;
|
||||||
|
}
|
||||||
delete iret[idet];
|
delete iret[idet];
|
||||||
}else ret=-1;
|
}else ret=-1;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ret==-100)
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,17 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
|
|
||||||
|
|
||||||
// Acquisition functions
|
// Acquisition functions
|
||||||
|
/**
|
||||||
|
prepares detector for acquisition
|
||||||
|
\returns OK if all detectors are properly started, FAIL otherwise
|
||||||
|
*/
|
||||||
|
int prepareAcquisition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
prepares detector for acquisition
|
||||||
|
\returns OK if all detectors are properly started, FAIL otherwise
|
||||||
|
*/
|
||||||
|
int cleanupAcquisition();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
start detector acquisition (master is started as last)
|
start detector acquisition (master is started as last)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUIDLIB "ef36cb7a54e1ae34ad1e85a46da6c121902108e6"
|
#define SVNREPUUIDLIB "2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8"
|
||||||
//#define SVNREV 0x1456
|
//#define SVNREV 0x1457
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "Dhanya_Maliakal"
|
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||||
#define SVNREVLIB 0x1456
|
#define SVNREVLIB 0x1457
|
||||||
#define SVNDATELIB 0x20170808
|
#define SVNDATELIB 0x20170809
|
||||||
//
|
//
|
||||||
|
@ -3976,6 +3976,62 @@ int slsDetector::updateDetector() {
|
|||||||
// Acquisition functions
|
// Acquisition functions
|
||||||
/* change these funcs accepting also ok/fail */
|
/* change these funcs accepting also ok/fail */
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetector::prepareAcquisition() {
|
||||||
|
int fnum = F_PREPARE_ACQUISITION;
|
||||||
|
int ret=FAIL;
|
||||||
|
char mess[MAX_STR_LENGTH]="";
|
||||||
|
|
||||||
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Preparing Detector for Acquisition" << std::endl;
|
||||||
|
#endif
|
||||||
|
if (connectControl() == OK){
|
||||||
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
if (ret==FAIL){
|
||||||
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
|
setErrorMask((getErrorMask())|(PREPARE_ACQUISITION));
|
||||||
|
}
|
||||||
|
disconnectControl();
|
||||||
|
if (ret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
std::cout << "cannot connect to detector" << endl;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsDetector::cleanupAcquisition() {
|
||||||
|
int fnum = F_CLEANUP_ACQUISITION;
|
||||||
|
int ret=FAIL;
|
||||||
|
char mess[MAX_STR_LENGTH]="";
|
||||||
|
|
||||||
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Cleaning up Detector after Acquisition " << std::endl;
|
||||||
|
#endif
|
||||||
|
if (connectControl() == OK){
|
||||||
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
if (ret==FAIL){
|
||||||
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
|
setErrorMask((getErrorMask())|(CLEANUP_ACQUISITION));
|
||||||
|
}
|
||||||
|
disconnectControl();
|
||||||
|
if (ret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
std::cout << "cannot connect to detector" << endl;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int slsDetector::startAcquisition(){
|
int slsDetector::startAcquisition(){
|
||||||
|
|
||||||
|
|
||||||
@ -4258,6 +4314,10 @@ int* slsDetector::startAndReadAll(){
|
|||||||
int i=0;
|
int i=0;
|
||||||
#endif
|
#endif
|
||||||
//#endif
|
//#endif
|
||||||
|
if(thisDetector->myDetectorType == EIGER) {
|
||||||
|
if (prepareAcquisition() == FAIL)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
startAndReadAllNoWait();
|
startAndReadAllNoWait();
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
// std::cout<< "started" << std::endl;
|
// std::cout<< "started" << std::endl;
|
||||||
@ -4450,7 +4510,8 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
|
|
||||||
|
|
||||||
//send acquisiton period/frame number to receiver
|
//send acquisiton period/frame number to receiver
|
||||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||(index==ACQUISITION_TIME)){
|
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||(index==ACQUISITION_TIME) || (index==SUBFRAME_ACQUISITION_TIME)){
|
||||||
|
string timername = getTimerType(index);
|
||||||
if(ret != FAIL){
|
if(ret != FAIL){
|
||||||
int64_t args[2];
|
int64_t args[2];
|
||||||
retval = -1;
|
retval = -1;
|
||||||
@ -4459,25 +4520,21 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
|
|
||||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||||
|
|
||||||
//set #frames, #cycles
|
//set #frames * #cycles
|
||||||
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){
|
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){
|
||||||
|
timername.assign("(Number of Frames) * (Number of cycles)");
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Setting/Getting number of frames*cycles " << index <<" to/from receiver " << args[1] << std::endl;
|
std::cout << "Setting/Getting " << timername << " " << index <<" to/from receiver " << args[1] << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if(thisDetector->timerValue[CYCLES_NUMBER]==0)
|
if(thisDetector->timerValue[CYCLES_NUMBER]==0)
|
||||||
args[1] = thisDetector->timerValue[FRAME_NUMBER];
|
args[1] = thisDetector->timerValue[FRAME_NUMBER];
|
||||||
else
|
else
|
||||||
args[1] = thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER];
|
args[1] = thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER];
|
||||||
}
|
}
|
||||||
//set period/exptime
|
|
||||||
else{
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(index==ACQUISITION_TIME)
|
// set period/exptime/subexptime
|
||||||
std::cout << "Setting/Getting acquisition time " << index << " to/from receiver " << args[1] << std::endl;
|
else std::cout << "Setting/Getting " << timername << " " << index << " to/from receiver " << args[1] << std::endl;
|
||||||
else
|
|
||||||
std::cout << "Setting/Getting acquisition period " << index << " to/from receiver " << args[1] << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
char mess[MAX_STR_LENGTH]="";
|
char mess[MAX_STR_LENGTH]="";
|
||||||
if (connectData() == OK){
|
if (connectData() == OK){
|
||||||
@ -4486,18 +4543,23 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
}
|
}
|
||||||
if((args[1] != retval)|| (ret==FAIL)){
|
if((args[1] != retval)|| (ret==FAIL)){
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
if(index==ACQUISITION_TIME){
|
cout << "ERROR: " << timername << " in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
|
||||||
if(strstr(mess,"receiver not idle")==NULL)
|
|
||||||
cout << "ERROR:Acquisition Time in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
|
if(strstr(mess,"receiver is not idle")==NULL) {
|
||||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_TIME_NOT_SET));
|
switch(index) {
|
||||||
}else if(index==FRAME_PERIOD){
|
case ACQUISITION_TIME:
|
||||||
if(strstr(mess,"receiver not idle")==NULL)
|
setErrorMask((getErrorMask())|(RECEIVER_ACQ_TIME_NOT_SET));
|
||||||
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
|
break;
|
||||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
case FRAME_PERIOD:
|
||||||
}else{
|
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
||||||
if(strstr(mess,"receiver not idle")==NULL)
|
break;
|
||||||
cout << "ERROR:Number of Frames (* Number of cycles) in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
|
case SUBFRAME_ACQUISITION_TIME:
|
||||||
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
|
setErrorMask((getErrorMask())|(RECEIVER_SUBF_TIME_NOT_SET));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
@ -5990,6 +6052,7 @@ string slsDetector::setReceiver(string receiverIP){
|
|||||||
std::cout << "frame index needed:" << ((thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER])>1) << endl;
|
std::cout << "frame index needed:" << ((thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER])>1) << endl;
|
||||||
std::cout << "frame period:" << thisDetector->timerValue[FRAME_PERIOD] << endl;
|
std::cout << "frame period:" << thisDetector->timerValue[FRAME_PERIOD] << endl;
|
||||||
std::cout << "frame number:" << thisDetector->timerValue[FRAME_NUMBER] << endl;
|
std::cout << "frame number:" << thisDetector->timerValue[FRAME_NUMBER] << endl;
|
||||||
|
std::cout << "sub exp time:" << thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] << endl;
|
||||||
std::cout << "dynamic range:" << thisDetector->dynamicRange << endl << endl;
|
std::cout << "dynamic range:" << thisDetector->dynamicRange << endl << endl;
|
||||||
std::cout << "flippeddatax:" << thisDetector->flippedData[d] << endl;
|
std::cout << "flippeddatax:" << thisDetector->flippedData[d] << endl;
|
||||||
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl << endl;
|
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl << endl;
|
||||||
@ -6026,6 +6089,7 @@ string slsDetector::setReceiver(string receiverIP){
|
|||||||
setTimer(FRAME_PERIOD,thisDetector->timerValue[FRAME_PERIOD]);
|
setTimer(FRAME_PERIOD,thisDetector->timerValue[FRAME_PERIOD]);
|
||||||
setTimer(FRAME_NUMBER,thisDetector->timerValue[FRAME_NUMBER]);
|
setTimer(FRAME_NUMBER,thisDetector->timerValue[FRAME_NUMBER]);
|
||||||
setTimer(ACQUISITION_TIME,thisDetector->timerValue[ACQUISITION_TIME]);
|
setTimer(ACQUISITION_TIME,thisDetector->timerValue[ACQUISITION_TIME]);
|
||||||
|
setTimer(SUBFRAME_ACQUISITION_TIME,thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]);
|
||||||
setDynamicRange(thisDetector->dynamicRange);
|
setDynamicRange(thisDetector->dynamicRange);
|
||||||
if(thisDetector->myDetectorType == EIGER){
|
if(thisDetector->myDetectorType == EIGER){
|
||||||
setFlippedData(X,-1);
|
setFlippedData(X,-1);
|
||||||
@ -7855,12 +7919,9 @@ int slsDetector::startReceiver(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//let detector prepare anyway even if receiver didnt work (for those not using the receiver)
|
// tell detector to send to receiver (if start receiver failed, this is not executed)
|
||||||
if((thisDetector->myDetectorType != JUNGFRAU)) {
|
if((thisDetector->myDetectorType != JUNGFRAU && thisDetector->myDetectorType != EIGER && ret!= FAIL))
|
||||||
int ret1 = detectorSendToReceiver(true);
|
return prepareAcquisition(); // send data to receiver for these detectors
|
||||||
if (ret != FAIL)
|
|
||||||
ret = ret1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -7874,7 +7935,7 @@ int slsDetector::stopReceiver(){
|
|||||||
char mess[MAX_STR_LENGTH] = "";
|
char mess[MAX_STR_LENGTH] = "";
|
||||||
|
|
||||||
if(thisDetector->myDetectorType != EIGER && thisDetector->myDetectorType != JUNGFRAU)
|
if(thisDetector->myDetectorType != EIGER && thisDetector->myDetectorType != JUNGFRAU)
|
||||||
detectorSendToReceiver(false);
|
cleanupAcquisition(); // reset (send data to receiver) for these detectors, so back to CPU (dont care about ok/fail at this point)
|
||||||
|
|
||||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -7920,37 +7981,6 @@ slsDetectorDefs::runStatus slsDetector::startReceiverReadout(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::detectorSendToReceiver(bool set){
|
|
||||||
int fnum;
|
|
||||||
if(set) fnum=F_PREPARE_ACQUISITION;
|
|
||||||
else fnum=F_CLEANUP_ACQUISITION;
|
|
||||||
int ret = FAIL;
|
|
||||||
char mess[MAX_STR_LENGTH]="";
|
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
std::cout << "Setting detector to send packets via client to: " << set << std::endl;
|
|
||||||
#endif
|
|
||||||
if (connectControl() == OK){
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
|
||||||
if (ret==FAIL){
|
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
|
||||||
}
|
|
||||||
disconnectControl();
|
|
||||||
if (ret==FORCE_UPDATE)
|
|
||||||
updateDetector();
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
std::cout << "cannot connect to detector" << endl;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1063,6 +1063,17 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
|
|
||||||
// Acquisition functions
|
// Acquisition functions
|
||||||
|
|
||||||
|
/**
|
||||||
|
prepares detector for acquisition
|
||||||
|
\returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int prepareAcquisition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
prepares detector for acquisition
|
||||||
|
\returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int cleanupAcquisition();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
start detector acquisition
|
start detector acquisition
|
||||||
@ -1614,10 +1625,6 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
*/
|
*/
|
||||||
runStatus startReceiverReadout();
|
runStatus startReceiverReadout();
|
||||||
|
|
||||||
/** Sets(false) or Resets(true) the CPU bit in detector
|
|
||||||
\returns OK or FAIL
|
|
||||||
*/
|
|
||||||
int detectorSendToReceiver(bool set);
|
|
||||||
|
|
||||||
/** gets the status of the listening mode of receiver
|
/** gets the status of the listening mode of receiver
|
||||||
\returns status
|
\returns status
|
||||||
|
@ -751,6 +751,30 @@ virtual void readFrameFromReceiver()=0;
|
|||||||
default: return string("unknown"); \
|
default: return string("unknown"); \
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
/** returns string from timer index
|
||||||
|
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME
|
||||||
|
\returns string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time
|
||||||
|
*/
|
||||||
|
static string getTimerType(timerIndex t){ \
|
||||||
|
switch (t) { \
|
||||||
|
case FRAME_NUMBER: return string("frame_number"); \
|
||||||
|
case ACQUISITION_TIME: return string("acquisition_time"); \
|
||||||
|
case FRAME_PERIOD: return string("frame_period"); \
|
||||||
|
case DELAY_AFTER_TRIGGER: return string("delay_after_trigger"); \
|
||||||
|
case GATES_NUMBER: return string("gates_number"); \
|
||||||
|
case PROBES_NUMBER: return string("probes_number"); \
|
||||||
|
case CYCLES_NUMBER: return string("cycles_number"); \
|
||||||
|
case ACTUAL_TIME: return string("actual_time"); \
|
||||||
|
case MEASUREMENT_TIME: return string("measurement_time"); \
|
||||||
|
case PROGRESS: return string("progress"); \
|
||||||
|
case MEASUREMENTS_NUMBER: return string("measurements_number"); \
|
||||||
|
case FRAMES_FROM_START: return string("frames_from_start"); \
|
||||||
|
case FRAMES_FROM_START_PG: return string("frames_from_start_pg"); \
|
||||||
|
case SAMPLES_JCTB: return string("samples_jctb"); \
|
||||||
|
case SUBFRAME_ACQUISITION_TIME: return string("subframe_acquisition_time"); \
|
||||||
|
default: return string("unknown"); \
|
||||||
|
}};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -3359,9 +3359,9 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
|||||||
return string("unknown detector size ")+cmd;
|
return string("unknown detector size ")+cmd;
|
||||||
|
|
||||||
if (cmd=="roimask")
|
if (cmd=="roimask")
|
||||||
sprintf(ans,"%x",ret);
|
sprintf(ans,"0x%x",ret);
|
||||||
else
|
else
|
||||||
sprintf(ans,"%d",ret);
|
sprintf(ans,"0x%d",ret);
|
||||||
|
|
||||||
return string(ans);
|
return string(ans);
|
||||||
|
|
||||||
@ -3586,7 +3586,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
sprintf(answer, "%d", -1);
|
sprintf(answer, "%d", -1);
|
||||||
else
|
else
|
||||||
sprintf(answer,"%lx", retval);
|
sprintf(answer,"0x%lx", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3600,7 +3600,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
sprintf(answer, "%d", -1);
|
sprintf(answer, "%d", -1);
|
||||||
else
|
else
|
||||||
sprintf(answer,"%lx", retval);
|
sprintf(answer,"0x%lx", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else
|
} else
|
||||||
return string("undefined module number");
|
return string("undefined module number");
|
||||||
@ -3610,7 +3610,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
sprintf(answer, "%d", -1);
|
sprintf(answer, "%d", -1);
|
||||||
else
|
else
|
||||||
sprintf(answer,"%lx", retval);
|
sprintf(answer,"0x%lx", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
if (cmd.find("modulenumber")!=string::npos) {
|
if (cmd.find("modulenumber")!=string::npos) {
|
||||||
@ -3620,7 +3620,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
sprintf(answer, "%d", -1);
|
sprintf(answer, "%d", -1);
|
||||||
else
|
else
|
||||||
sprintf(answer,"%lx", retval);
|
sprintf(answer,"0x%lx", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else
|
} else
|
||||||
return string("undefined module number");
|
return string("undefined module number");
|
||||||
@ -3631,7 +3631,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
sprintf(answer, "%d", -1);
|
sprintf(answer, "%d", -1);
|
||||||
else
|
else
|
||||||
sprintf(answer,"%lx", retval);
|
sprintf(answer,"0x%lx", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3640,7 +3640,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
sprintf(answer, "%d", -1);
|
sprintf(answer, "%d", -1);
|
||||||
else
|
else
|
||||||
sprintf(answer,"%lx", retval);
|
sprintf(answer,"0x%lx", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3650,7 +3650,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
sprintf(answer, "%d", -1);
|
sprintf(answer, "%d", -1);
|
||||||
else
|
else
|
||||||
sprintf(answer,"%lx", retval);
|
sprintf(answer,"0x%lx", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
return string("unknown id mode ")+cmd;
|
return string("unknown id mode ")+cmd;
|
||||||
@ -3689,7 +3689,7 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action) {
|
|||||||
if (cmd=="bustest"){
|
if (cmd=="bustest"){
|
||||||
if (action==PUT_ACTION)
|
if (action==PUT_ACTION)
|
||||||
return string("cannot set ")+cmd;
|
return string("cannot set ")+cmd;
|
||||||
sprintf(answer,"%x",myDet->digitalTest(DETECTOR_BUS_TEST));
|
sprintf(answer,"0x%x",myDet->digitalTest(DETECTOR_BUS_TEST));
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3698,7 +3698,7 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action) {
|
|||||||
return string("cannot set ")+cmd;
|
return string("cannot set ")+cmd;
|
||||||
int ival=-1;
|
int ival=-1;
|
||||||
if (sscanf(args[0],"digitest:%d",&ival)) {
|
if (sscanf(args[0],"digitest:%d",&ival)) {
|
||||||
sprintf(answer,"%x",myDet->digitalTest(CHIP_TEST, ival));
|
sprintf(answer,"0x%x",myDet->digitalTest(CHIP_TEST, ival));
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else
|
} else
|
||||||
return string("undefined module number");
|
return string("undefined module number");
|
||||||
@ -3710,7 +3710,7 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action) {
|
|||||||
int ival=-1;
|
int ival=-1;
|
||||||
if (sscanf(args[1],"%d",&ival)) {
|
if (sscanf(args[1],"%d",&ival)) {
|
||||||
if((ival==0)||(ival==1)){
|
if((ival==0)||(ival==1)){
|
||||||
sprintf(answer,"%x",myDet->digitalTest(DIGITAL_BIT_TEST,ival));
|
sprintf(answer,"0x%x",myDet->digitalTest(DIGITAL_BIT_TEST,ival));
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3783,13 +3783,13 @@ string slsDetectorCommand::cmdRegister(int narg, char *args[], int action) {
|
|||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
|
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
|
||||||
sprintf(answer,"%x",myDet->writeRegister(addr,val));
|
sprintf(answer,"0x%x",myDet->writeRegister(addr,val));
|
||||||
} else if (cmd=="adcreg") {
|
} else if (cmd=="adcreg") {
|
||||||
if (sscanf(args[2],"%x",&val))
|
if (sscanf(args[2],"%x",&val))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
|
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
|
||||||
sprintf(answer,"%x",myDet->writeAdcRegister(addr,val));
|
sprintf(answer,"0x%x",myDet->writeAdcRegister(addr,val));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (sscanf(args[2],"%d",&n))
|
if (sscanf(args[2],"%d",&n))
|
||||||
@ -3801,9 +3801,9 @@ string slsDetectorCommand::cmdRegister(int narg, char *args[], int action) {
|
|||||||
return string("Bit number out of range")+string(args[2]);
|
return string("Bit number out of range")+string(args[2]);
|
||||||
|
|
||||||
if (cmd=="setbit")
|
if (cmd=="setbit")
|
||||||
sprintf(answer,"%x",myDet->writeRegister(addr,myDet->readRegister(addr)| 1<<n));
|
sprintf(answer,"0x%x",myDet->writeRegister(addr,myDet->readRegister(addr)| 1<<n));
|
||||||
if (cmd=="clearbit")
|
if (cmd=="clearbit")
|
||||||
sprintf(answer,"%x",myDet->writeRegister(addr,myDet->readRegister(addr) & ~(1<<n)));
|
sprintf(answer,"0x%x",myDet->writeRegister(addr,myDet->readRegister(addr) & ~(1<<n)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3824,7 +3824,7 @@ string slsDetectorCommand::cmdRegister(int narg, char *args[], int action) {
|
|||||||
return string("Could not scan address (hexadecimal fomat) ")+string(args[1]);
|
return string("Could not scan address (hexadecimal fomat) ")+string(args[1]);
|
||||||
|
|
||||||
|
|
||||||
sprintf(answer,"%x",myDet->readRegister(addr));
|
sprintf(answer,"0x%x",myDet->readRegister(addr));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3861,7 +3861,7 @@ string slsDetectorCommand::helpRegister(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||||
os << "reg addr val \n writes the register addr with the value val"<< std::endl;
|
os << "reg addr val \n writes the register addr with the value val (hexadecimal format)"<< std::endl;
|
||||||
}
|
}
|
||||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||||
os << "reg addr \n reads the register addr"<< std::endl;
|
os << "reg addr \n reads the register addr"<< std::endl;
|
||||||
|
@ -59,6 +59,9 @@ void setupDetector();
|
|||||||
#ifndef EIGERD
|
#ifndef EIGERD
|
||||||
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h
|
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h
|
||||||
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h
|
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h
|
||||||
|
#else
|
||||||
|
uint32_t writeRegister(uint32_t offset, uint32_t data);
|
||||||
|
uint32_t readRegister(uint32_t offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1059,7 +1059,7 @@ int set_dac(int file_des) {
|
|||||||
if((ind == HV_POT) || (ind == HV_NEW)) {
|
if((ind == HV_POT) || (ind == HV_NEW)) {
|
||||||
retval[0] = setHighVoltage(val);
|
retval[0] = setHighVoltage(val);
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
if(retval[0] < 0){
|
if ((retval[0] != SLAVE_HIGH_VOLTAGE_READ_VAL) && (retval[0] < 0)) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
if(retval[0] == -1)
|
if(retval[0] == -1)
|
||||||
sprintf(mess, "Setting high voltage failed.Bad value %d. The range is from 0 to 200 V.\n",val);
|
sprintf(mess, "Setting high voltage failed.Bad value %d. The range is from 0 to 200 V.\n",val);
|
||||||
@ -1242,15 +1242,6 @@ int write_register(int file_des) {
|
|||||||
int retval=-1;
|
int retval=-1;
|
||||||
sprintf(mess,"write to register failed\n");
|
sprintf(mess,"write to register failed\n");
|
||||||
|
|
||||||
#ifdef EIGERD
|
|
||||||
//to receive any arguments
|
|
||||||
while (n > 0)
|
|
||||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,"Function (Write Register) is not implemented for this detector\n");
|
|
||||||
cprintf(RED, "Warning: %s", mess);
|
|
||||||
#else
|
|
||||||
|
|
||||||
// receive arguments
|
// receive arguments
|
||||||
int arg[2]={-1,-1};
|
int arg[2]={-1,-1};
|
||||||
n = receiveData(file_des,arg,sizeof(arg),INT32);
|
n = receiveData(file_des,arg,sizeof(arg),INT32);
|
||||||
@ -1282,7 +1273,6 @@ int write_register(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
if (ret==OK && differentClients)
|
if (ret==OK && differentClients)
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
#endif
|
|
||||||
|
|
||||||
// ret could be swapped during sendData
|
// ret could be swapped during sendData
|
||||||
ret1 = ret;
|
ret1 = ret;
|
||||||
@ -1310,15 +1300,6 @@ int read_register(int file_des) {
|
|||||||
int retval=-1;
|
int retval=-1;
|
||||||
sprintf(mess,"read register failed\n");
|
sprintf(mess,"read register failed\n");
|
||||||
|
|
||||||
#ifdef EIGERD
|
|
||||||
//to receive any arguments
|
|
||||||
while (n > 0)
|
|
||||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,"Function (Read Register) is not implemented for this detector\n");
|
|
||||||
cprintf(RED, "Warning: %s", mess);
|
|
||||||
#else
|
|
||||||
|
|
||||||
// receive arguments
|
// receive arguments
|
||||||
int arg=0;
|
int arg=0;
|
||||||
n = receiveData(file_des,&arg,sizeof(arg),INT32);
|
n = receiveData(file_des,&arg,sizeof(arg),INT32);
|
||||||
@ -1337,7 +1318,6 @@ int read_register(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
if (ret==OK && differentClients)
|
if (ret==OK && differentClients)
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
#endif
|
|
||||||
|
|
||||||
// ret could be swapped during sendData
|
// ret could be swapped during sendData
|
||||||
ret1 = ret;
|
ret1 = ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user