mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_detector_software into developer
This commit is contained in:
commit
ffd3cb6511
@ -8,6 +8,7 @@
|
|||||||
#include <unistd.h> // read, close
|
#include <unistd.h> // read, close
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
#include <linux/i2c-dev.h> // I2C_SLAVE, __u8 reg
|
#include <linux/i2c-dev.h> // I2C_SLAVE, __u8 reg
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#define PORTNAME "/dev/ttyBF1"
|
#define PORTNAME "/dev/ttyBF1"
|
||||||
#define GOODBYE 200
|
#define GOODBYE 200
|
||||||
@ -89,37 +90,40 @@ int i2c_write(unsigned int value){
|
|||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
int fd = open(PORTNAME, O_RDWR | O_NOCTTY);
|
int fd = open(PORTNAME, O_RDWR | O_NOCTTY | O_SYNC);
|
||||||
if(fd < 0){
|
if(fd < 0){
|
||||||
cprintf(RED,"Warning: Unable to open port %s\n", PORTNAME);
|
cprintf(RED,"Warning: Unable to open port %s\n", PORTNAME);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct termios serial_conf;
|
struct termios serial_conf;
|
||||||
// Get the current options for the port
|
|
||||||
tcgetattr(fd, &serial_conf);
|
|
||||||
// reset structure
|
// reset structure
|
||||||
memset(&serial_conf,0,sizeof(serial_conf));
|
memset(&serial_conf,0,sizeof(serial_conf));
|
||||||
// control options
|
// control options
|
||||||
serial_conf.c_cflag = B2400 | CS8 | CREAD | CLOCAL;
|
serial_conf.c_cflag = B2400 | CS8 | CREAD | CLOCAL;
|
||||||
// input options
|
// input options
|
||||||
serial_conf.c_iflag = IGNPAR;
|
serial_conf.c_iflag = 0;//IGNPAR; (stuck because it was in ignore parity)
|
||||||
// output options
|
// output options
|
||||||
serial_conf.c_oflag = 0;
|
serial_conf.c_oflag = 0;
|
||||||
// line options
|
// line options
|
||||||
serial_conf.c_lflag = ICANON;
|
serial_conf.c_lflag = ICANON;
|
||||||
// flush input
|
// flush input
|
||||||
tcflush(fd, TCIFLUSH);
|
if(tcflush(fd, TCIFLUSH) < 0){
|
||||||
|
cprintf(RED,"Warning: error form tcflush %d\n", errno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete
|
// set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete
|
||||||
tcsetattr(fd, TCSANOW, &serial_conf);
|
if(tcsetattr(fd, TCSANOW, &serial_conf) < 0){
|
||||||
|
cprintf(RED,"Warning: error form tcsetattr %d\n", errno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int ival= 0;
|
int ival= 0;
|
||||||
char buffer[BUFFERSIZE];
|
char buffer[BUFFERSIZE];
|
||||||
|
memset(buffer,0,BUFFERSIZE);
|
||||||
buffer[BUFFERSIZE-2] = '\0';
|
buffer[BUFFERSIZE-2] = '\0';
|
||||||
buffer[BUFFERSIZE-1] = '\n';
|
buffer[BUFFERSIZE-1] = '\n';
|
||||||
cprintf(GREEN,"Ready...\n");
|
cprintf(GREEN,"Ready...\n");
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <termios.h> // POSIX terminal control definitions(CS8, CREAD, CLOCAL..)
|
#include <termios.h> // POSIX terminal control definitions(CS8, CREAD, CLOCAL..)
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "FebRegisterDefs.h"
|
#include "FebRegisterDefs.h"
|
||||||
#include "FebControl.h"
|
#include "FebControl.h"
|
||||||
@ -225,31 +226,35 @@ int Feb_Control_Init(int master, int top, int normal, int module_num){
|
|||||||
|
|
||||||
int Feb_Control_OpenSerialCommunication(){
|
int Feb_Control_OpenSerialCommunication(){
|
||||||
cprintf(BG_BLUE,"opening serial communication of hv\n");
|
cprintf(BG_BLUE,"opening serial communication of hv\n");
|
||||||
if(Feb_Control_hv_fd != -1)
|
//if(Feb_Control_hv_fd != -1)
|
||||||
close(Feb_Control_hv_fd);
|
close(Feb_Control_hv_fd);
|
||||||
Feb_Control_hv_fd = open(SPECIAL9M_HIGHVOLTAGE_PORT, O_RDWR | O_NOCTTY);
|
Feb_Control_hv_fd = open(SPECIAL9M_HIGHVOLTAGE_PORT, O_RDWR | O_NOCTTY | O_SYNC);
|
||||||
if(Feb_Control_hv_fd < 0){
|
if(Feb_Control_hv_fd < 0){
|
||||||
cprintf(RED,"Warning: Unable to open port %s to set up high voltage serial communciation to the blackfin\n", SPECIAL9M_HIGHVOLTAGE_PORT);
|
cprintf(RED,"Warning: Unable to open port %s to set up high voltage serial communciation to the blackfin\n", SPECIAL9M_HIGHVOLTAGE_PORT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct termios serial_conf;
|
struct termios serial_conf;
|
||||||
// Get the current options for the port
|
|
||||||
tcgetattr(Feb_Control_hv_fd, &serial_conf);
|
|
||||||
// reset structure
|
// reset structure
|
||||||
memset(&serial_conf,0,sizeof(serial_conf));
|
memset (&serial_conf, 0, sizeof(serial_conf));
|
||||||
// control options
|
// control options
|
||||||
serial_conf.c_cflag = B2400 | CS8 | CREAD | CLOCAL;//57600 too high
|
serial_conf.c_cflag = B2400 | CS8 | CREAD | CLOCAL;//57600 too high
|
||||||
// input options
|
// input options
|
||||||
serial_conf.c_iflag = IGNPAR;
|
serial_conf.c_iflag = 0;//IGNPAR; (stuck because it was in ignore parity)
|
||||||
// output options
|
// output options
|
||||||
serial_conf.c_oflag = 0;
|
serial_conf.c_oflag = 0;
|
||||||
// line options
|
// line options
|
||||||
serial_conf.c_lflag = ICANON;
|
serial_conf.c_lflag = ICANON;
|
||||||
// flush input
|
// flush input
|
||||||
tcflush(Feb_Control_hv_fd, TCIFLUSH);
|
if(tcflush(Feb_Control_hv_fd, TCIFLUSH) < 0){
|
||||||
|
cprintf(RED,"Warning: error form tcflush %d\n", errno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete
|
// set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete
|
||||||
tcsetattr(Feb_Control_hv_fd, TCSANOW, &serial_conf);
|
if(tcsetattr(Feb_Control_hv_fd, TCSANOW, &serial_conf) < 0){
|
||||||
|
cprintf(RED,"Warning: error form tcsetattr %d\n", errno);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -605,6 +610,7 @@ int Feb_Control_SendHighVoltage(int dacvalue){
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE];
|
char buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE];
|
||||||
|
memset(buffer,0,SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE);
|
||||||
buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE-2]='\0';
|
buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE-2]='\0';
|
||||||
buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE-1]='\n';
|
buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE-1]='\n';
|
||||||
int n;
|
int n;
|
||||||
|
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/eigerDetectorServer
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer
|
||||||
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: 6d38c0622a2936f70345e7d53aaf1c9e2de4cbd6
|
Repsitory UUID: a5b59b47430913bb461b50da05b553874b33f39a
|
||||||
Revision: 285
|
Revision: 287
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 1401
|
Last Changed Rev: 1418
|
||||||
Last Changed Date: 2017-06-12 18:53:18 +0200
|
Last Changed Date: 2017-06-22 14:32:24 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "6d38c0622a2936f70345e7d53aaf1c9e2de4cbd6"
|
#define SVNREPUUID "a5b59b47430913bb461b50da05b553874b33f39a"
|
||||||
//#define SVNREV 0x1401
|
//#define SVNREV 0x1418
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x1401
|
#define SVNREV 0x1418
|
||||||
#define SVNDATE 0x20170612
|
#define SVNDATE 0x20170622
|
||||||
//
|
//
|
||||||
|
@ -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: 49f4f7295411e3dbcf00fd93ca821eb95e13771c
|
Repsitory UUID: a5b59b47430913bb461b50da05b553874b33f39a
|
||||||
Revision: 1411
|
Revision: 1418
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 1411
|
Last Changed Rev: 1418
|
||||||
Last Changed Date: 2017-06-14 11:40:35 +0200
|
Last Changed Date: 2017-06-22 14:32:24 +0200
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
//for memory mapping
|
//for memory mapping
|
||||||
u_int64_t CSP0BASE;
|
u_int64_t CSP0BASE;
|
||||||
|
|
||||||
@ -171,8 +172,8 @@ int mapCSP0(void) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
printf("CSPObase is 0x%x \n",CSP0BASE);
|
printf("CSPObase is 0x%llx \n",CSP0BASE);
|
||||||
printf("CSPOBASE=from %08x to %x\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
printf("CSPOBASE=from %llx to %llx\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||||
|
|
||||||
u_int32_t address;
|
u_int32_t address;
|
||||||
address = FIFO_DATA_REG_OFF;
|
address = FIFO_DATA_REG_OFF;
|
||||||
@ -827,7 +828,7 @@ u_int32_t testRAM(void) {
|
|||||||
int i=0;
|
int i=0;
|
||||||
allocateRAM();
|
allocateRAM();
|
||||||
// while(i<100000) {
|
// while(i<100000) {
|
||||||
memcpy(ram_values, values, dataBytes);
|
memcpy((char*)ram_values, (char*)values, dataBytes);
|
||||||
printf ("Testing RAM:\t%d: copied fifo %x to memory %x size %d\n",i++, (unsigned int)(values), (unsigned int)(ram_values), dataBytes);
|
printf ("Testing RAM:\t%d: copied fifo %x to memory %x size %d\n",i++, (unsigned int)(values), (unsigned int)(ram_values), dataBytes);
|
||||||
// }
|
// }
|
||||||
return result;
|
return result;
|
||||||
@ -970,7 +971,7 @@ int64_t getActualTime(){
|
|||||||
|
|
||||||
int64_t getMeasurementTime(){
|
int64_t getMeasurementTime(){
|
||||||
int64_t v=get64BitReg(GET_MEASUREMENT_TIME_LSB_REG, GET_MEASUREMENT_TIME_MSB_REG);
|
int64_t v=get64BitReg(GET_MEASUREMENT_TIME_LSB_REG, GET_MEASUREMENT_TIME_MSB_REG);
|
||||||
int64_t mask=0x8000000000000000;
|
u_int64_t mask=0x8000000000000000;
|
||||||
if (v & mask ) {
|
if (v & mask ) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("no measurement time left\n");
|
printf("no measurement time left\n");
|
||||||
@ -1000,7 +1001,7 @@ int loadImage(int index, short int ImageVals[]){
|
|||||||
for(i=0;i<6;i++)
|
for(i=0;i<6;i++)
|
||||||
printf("%d:%d\t",i,ImageVals[i]);
|
printf("%d:%d\t",i,ImageVals[i]);
|
||||||
#endif
|
#endif
|
||||||
memcpy(ptr,ImageVals ,dataBytes);
|
memcpy((char*)ptr,(char*)ImageVals ,dataBytes);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("\nLoaded x%08x address with image of index %d\n",(unsigned int)(ptr),index);
|
printf("\nLoaded x%08x address with image of index %d\n",(unsigned int)(ptr),index);
|
||||||
#endif
|
#endif
|
||||||
@ -1816,7 +1817,7 @@ int allocateRAM() {
|
|||||||
int prepareADC(){
|
int prepareADC(){
|
||||||
printf("Preparing ADC\n");
|
printf("Preparing ADC\n");
|
||||||
u_int32_t valw,codata,csmask;
|
u_int32_t valw,codata,csmask;
|
||||||
int i,j,cdx,ddx,value;
|
int i,j,cdx,ddx;
|
||||||
cdx=0; ddx=1;
|
cdx=0; ddx=1;
|
||||||
csmask=0x7c; // 1111100
|
csmask=0x7c; // 1111100
|
||||||
|
|
||||||
@ -2208,7 +2209,7 @@ int readCounterBlock(int startACQ, short int CounterVals[]){
|
|||||||
printf("Value of multipurpose reg:%d\n",bus_r(MULTI_PURPOSE_REG));
|
printf("Value of multipurpose reg:%d\n",bus_r(MULTI_PURPOSE_REG));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy(CounterVals,ptr,dataBytes);
|
memcpy((char*)CounterVals,(char*)ptr,dataBytes);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
int i;
|
int i;
|
||||||
printf("Copied counter memory block with size of %d bytes..\n",dataBytes);
|
printf("Copied counter memory block with size of %d bytes..\n",dataBytes);
|
||||||
@ -2278,7 +2279,7 @@ int resetCounterBlock(int startACQ){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
memcpy(counterVals,ptr,dataBytes);
|
memcpy((char*)counterVals,(char*)ptr,dataBytes);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
int i;
|
int i;
|
||||||
printf("Copied counter memory block with size of %d bytes..\n",(int)sizeof(counterVals));
|
printf("Copied counter memory block with size of %d bytes..\n",(int)sizeof(counterVals));
|
||||||
@ -2350,7 +2351,7 @@ int calibratePedestal(int frames){
|
|||||||
|
|
||||||
int a;
|
int a;
|
||||||
for (a=0;a<1280; a++){
|
for (a=0;a<1280; a++){
|
||||||
unsigned short v = (frame[a] << 8) + (frame[a] >> 8);
|
//unsigned short v = (frame[a] << 8) + (frame[a] >> 8);
|
||||||
// printf("%i: %i %i\n",a, frame[a],v);
|
// printf("%i: %i %i\n",a, frame[a],v);
|
||||||
avg[a] += ((double)frame[a])/(double)frames;
|
avg[a] += ((double)frame[a])/(double)frames;
|
||||||
//if(frame[a] == 8191)
|
//if(frame[a] == 8191)
|
||||||
@ -2377,7 +2378,7 @@ int calibratePedestal(int frames){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
double nf = (double)numberFrames;
|
//double nf = (double)numberFrames;
|
||||||
for(i =0; i < 1280; i++){
|
for(i =0; i < 1280; i++){
|
||||||
adc = i / 256;
|
adc = i / 256;
|
||||||
adcCh = (i - adc * 256) / 32;
|
adcCh = (i - adc * 256) / 32;
|
||||||
|
@ -72,6 +72,7 @@ int getAdcConfigured();
|
|||||||
|
|
||||||
u_int64_t getDetectorNumber();
|
u_int64_t getDetectorNumber();
|
||||||
u_int32_t getFirmwareVersion();
|
u_int32_t getFirmwareVersion();
|
||||||
|
u_int32_t getFirmwareSVNVersion();
|
||||||
int testFifos(void);
|
int testFifos(void);
|
||||||
u_int32_t testFpga(void);
|
u_int32_t testFpga(void);
|
||||||
u_int32_t testRAM(void);
|
u_int32_t testRAM(void);
|
||||||
|
Binary file not shown.
BIN
slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv3.0.0.0
Executable file
BIN
slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv3.0.0.0
Executable file
Binary file not shown.
@ -6,6 +6,7 @@
|
|||||||
#include "communication_funcs.h"
|
#include "communication_funcs.h"
|
||||||
#include "server_funcs.h"
|
#include "server_funcs.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
extern int sockfd;
|
extern int sockfd;
|
||||||
|
@ -2376,7 +2376,6 @@ int set_speed(int file_des) {
|
|||||||
int set_readout_flags(int file_des) {
|
int set_readout_flags(int file_des) {
|
||||||
|
|
||||||
enum readOutFlags arg;
|
enum readOutFlags arg;
|
||||||
int n;
|
|
||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,8 +164,8 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
|
|||||||
double vthreshmean, vthreshSTDev;
|
double vthreshmean, vthreshSTDev;
|
||||||
int *thrmi, *thrma;
|
int *thrmi, *thrma;
|
||||||
double c;
|
double c;
|
||||||
double b=BVTRIM;
|
//double b=BVTRIM;
|
||||||
double a=AVTRIM;
|
//double a=AVTRIM;
|
||||||
int *trim;
|
int *trim;
|
||||||
int ich, imod, ichan;
|
int ich, imod, ichan;
|
||||||
int nvalid=0;
|
int nvalid=0;
|
||||||
@ -236,7 +236,7 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
|
|||||||
while (runBusy()) {
|
while (runBusy()) {
|
||||||
}
|
}
|
||||||
usleep(500);
|
usleep(500);
|
||||||
fifodata=fifo_read_event();
|
fifodata=(int*)fifo_read_event();
|
||||||
scan=decode_data(fifodata);
|
scan=decode_data(fifodata);
|
||||||
for (imod=modmi; imod<modma; imod++) {
|
for (imod=modmi; imod<modma; imod++) {
|
||||||
for (ichan=0; ichan<nChans*nChips; ichan++){
|
for (ichan=0; ichan<nChans*nChips; ichan++){
|
||||||
@ -377,7 +377,7 @@ int trim_with_level(int countlim, int im) {
|
|||||||
}
|
}
|
||||||
usleep(500);
|
usleep(500);
|
||||||
|
|
||||||
fifodata=fifo_read_event();
|
fifodata=(int*)fifo_read_event();
|
||||||
scan=decode_data(fifodata);
|
scan=decode_data(fifodata);
|
||||||
for (imod=modmi; imod<modma; imod++) {
|
for (imod=modmi; imod<modma; imod++) {
|
||||||
for (ichan=0; ichan<nChans*nChips; ichan++) {
|
for (ichan=0; ichan<nChans*nChips; ichan++) {
|
||||||
@ -515,7 +515,7 @@ int choose_vthresh() {
|
|||||||
}
|
}
|
||||||
usleep(500);
|
usleep(500);
|
||||||
|
|
||||||
fifodata=fifo_read_event();
|
fifodata=(int*)fifo_read_event();
|
||||||
scan=decode_data(fifodata);
|
scan=decode_data(fifodata);
|
||||||
//
|
//
|
||||||
scan1=decode_data(fifodata);
|
scan1=decode_data(fifodata);
|
||||||
@ -523,7 +523,7 @@ int choose_vthresh() {
|
|||||||
|
|
||||||
for (imod=modmi; imod<modma; imod++) {
|
for (imod=modmi; imod<modma; imod++) {
|
||||||
//
|
//
|
||||||
med[imod]=median(scan1+imod*nChans*nChips,nChans*nChips);
|
med[imod]=(int)median((int*)scan1+imod*nChans*nChips,nChans*nChips);
|
||||||
med1[imod]=med[imod];
|
med1[imod]=med[imod];
|
||||||
//commented out by dhanya vthreshmean=vthreshmean+getDACbyIndexDACU(VTHRESH,imod);
|
//commented out by dhanya vthreshmean=vthreshmean+getDACbyIndexDACU(VTHRESH,imod);
|
||||||
olddiff[imod]=0xffffff;
|
olddiff[imod]=0xffffff;
|
||||||
@ -553,7 +553,7 @@ int choose_vthresh() {
|
|||||||
}
|
}
|
||||||
usleep(500);
|
usleep(500);
|
||||||
|
|
||||||
fifodata=fifo_read_event();
|
fifodata=(int*)fifo_read_event();
|
||||||
scan=decode_data(fifodata);
|
scan=decode_data(fifodata);
|
||||||
//
|
//
|
||||||
scan1=decode_data(fifodata);
|
scan1=decode_data(fifodata);
|
||||||
@ -561,7 +561,7 @@ int choose_vthresh() {
|
|||||||
change_flag=0;
|
change_flag=0;
|
||||||
printf("Vthresh iteration %3d 0f %3d\n",iteration, maxiterations);
|
printf("Vthresh iteration %3d 0f %3d\n",iteration, maxiterations);
|
||||||
for (ichan=modmi; ichan<modma; ichan++) {
|
for (ichan=modmi; ichan<modma; ichan++) {
|
||||||
med[ichan]=median(scan1+ichan*nChans*nChips,nChans*nChips);
|
med[ichan]=(int)median((int*)scan1+ichan*nChans*nChips,nChans*nChips);
|
||||||
med1[imod]=med[imod];
|
med1[imod]=med[imod];
|
||||||
media=median(med1+modmi,nm);
|
media=median(med1+modmi,nm);
|
||||||
|
|
||||||
@ -680,7 +680,7 @@ int trim_with_median(int stop, int im) {
|
|||||||
while (runBusy()) {
|
while (runBusy()) {
|
||||||
}
|
}
|
||||||
usleep(500);
|
usleep(500);
|
||||||
fifodata=fifo_read_event();
|
fifodata=(int*)fifo_read_event();
|
||||||
scan=decode_data(fifodata);
|
scan=decode_data(fifodata);
|
||||||
scan1=decode_data(fifodata);
|
scan1=decode_data(fifodata);
|
||||||
|
|
||||||
@ -689,7 +689,7 @@ int trim_with_median(int stop, int im) {
|
|||||||
/********* calculates median every time ***********/
|
/********* calculates median every time ***********/
|
||||||
|
|
||||||
for (imod=modmi; imod<modma; imod++) {
|
for (imod=modmi; imod<modma; imod++) {
|
||||||
me[imod]=median(scan1+imod*nChans*nChips,nChans*nChips);
|
me[imod]=median((int*)scan1+imod*nChans*nChips,nChans*nChips);
|
||||||
me1[imod]=me[imod];
|
me1[imod]=me[imod];
|
||||||
printf("Median of module %d=%d\n",imod,me[imod]);
|
printf("Median of module %d=%d\n",imod,me[imod]);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,9 @@ int multiSlsDetector::freeSharedMemory() {
|
|||||||
perror("shmdt failed\n");
|
perror("shmdt failed\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
printf("Shared memory %d detached\n", shmId);
|
printf("Shared memory %d detached\n", shmId);
|
||||||
|
#endif
|
||||||
// remove shared memory
|
// remove shared memory
|
||||||
if (shmctl(shmId, IPC_RMID, 0) == -1) {
|
if (shmctl(shmId, IPC_RMID, 0) == -1) {
|
||||||
perror("shmctl(IPC_RMID) failed\n");
|
perror("shmctl(IPC_RMID) failed\n");
|
||||||
@ -414,9 +416,9 @@ int multiSlsDetector::addSlsDetector(int id, int pos) {
|
|||||||
|
|
||||||
|
|
||||||
void multiSlsDetector::updateOffsets(){
|
void multiSlsDetector::updateOffsets(){
|
||||||
|
#ifdef VERBOSE
|
||||||
cout << endl << "Updating Multi-Detector Offsets" << endl;
|
cout << endl << "Updating Multi-Detector Offsets" << endl;
|
||||||
|
#endif
|
||||||
int offsetX=0, offsetY=0, numX=0, numY=0, maxX=0, maxY=0;
|
int offsetX=0, offsetY=0, numX=0, numY=0, maxX=0, maxY=0;
|
||||||
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];
|
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];
|
||||||
int maxChanY = thisMultiDetector->maxNumberOfChannelsPerDetector[Y];
|
int maxChanY = thisMultiDetector->maxNumberOfChannelsPerDetector[Y];
|
||||||
@ -432,7 +434,9 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
|
|
||||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
|
#ifdef VERBOSE
|
||||||
cout<<"offsetX:"<<offsetX<<" prevChanX:"<<prevChanX<<" offsetY:"<<offsetY<<" prevChanY:"<<prevChanY<<endl;
|
cout<<"offsetX:"<<offsetX<<" prevChanX:"<<prevChanX<<" offsetY:"<<offsetY<<" prevChanY:"<<prevChanY<<endl;
|
||||||
|
#endif
|
||||||
//cout<<" totalchan:"<< detectors[i]->getTotalNumberOfChannels(Y) <<" maxChanY:"<<maxChanY<<endl;
|
//cout<<" totalchan:"<< detectors[i]->getTotalNumberOfChannels(Y) <<" maxChanY:"<<maxChanY<<endl;
|
||||||
//incrementing in both direction
|
//incrementing in both direction
|
||||||
if(firstTime){
|
if(firstTime){
|
||||||
@ -448,7 +452,9 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
||||||
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
|
#ifdef VERBOSE
|
||||||
cout<<"incrementing in both direction"<<endl;
|
cout<<"incrementing in both direction"<<endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//incrementing in y direction
|
//incrementing in y direction
|
||||||
@ -457,7 +463,9 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
prevChanY = detectors[i]->getTotalNumberOfChannels(Y);
|
prevChanY = detectors[i]->getTotalNumberOfChannels(Y);
|
||||||
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
||||||
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
|
#ifdef VERBOSE
|
||||||
cout<<"incrementing in y direction"<<endl;
|
cout<<"incrementing in y direction"<<endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//incrementing in x direction
|
//incrementing in x direction
|
||||||
@ -472,13 +480,16 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
prevChanX = detectors[i]->getTotalNumberOfChannels(X);
|
prevChanX = detectors[i]->getTotalNumberOfChannels(X);
|
||||||
numX += detectors[i]->getTotalNumberOfChannels(X);
|
numX += detectors[i]->getTotalNumberOfChannels(X);
|
||||||
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
|
#ifdef VERBOSE
|
||||||
cout<<"incrementing in x direction"<<endl;
|
cout<<"incrementing in x direction"<<endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
thisMultiDetector->offsetX[i] = offsetX;
|
thisMultiDetector->offsetX[i] = offsetX;
|
||||||
thisMultiDetector->offsetY[i] = offsetY;
|
thisMultiDetector->offsetY[i] = offsetY;
|
||||||
|
#ifdef VERBOSE
|
||||||
cout << "Detector[" << i << "] has offsets (" << thisMultiDetector->offsetX[i] << ", " << thisMultiDetector->offsetY[i] << ")" << endl;
|
cout << "Detector[" << i << "] has offsets (" << thisMultiDetector->offsetX[i] << ", " << thisMultiDetector->offsetY[i] << ")" << endl;
|
||||||
|
#endif
|
||||||
//offsetY has been reset sometimes and offsetX the first time, but remember the highest values
|
//offsetY has been reset sometimes and offsetX the first time, but remember the highest values
|
||||||
if(numX > thisMultiDetector->numberOfChannel[X])
|
if(numX > thisMultiDetector->numberOfChannel[X])
|
||||||
thisMultiDetector->numberOfChannel[X] = numX;
|
thisMultiDetector->numberOfChannel[X] = numX;
|
||||||
@ -490,9 +501,10 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
thisMultiDetector->maxNumberOfChannel[Y] = maxY;
|
thisMultiDetector->maxNumberOfChannel[Y] = maxY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
cout << "Number of Channels in X direction:" << thisMultiDetector->numberOfChannel[X] << endl;
|
cout << "Number of Channels in X direction:" << thisMultiDetector->numberOfChannel[X] << endl;
|
||||||
cout << "Number of Channels in Y direction:" << thisMultiDetector->numberOfChannel[Y] << endl << endl;
|
cout << "Number of Channels in Y direction:" << thisMultiDetector->numberOfChannel[Y] << endl << endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
string multiSlsDetector::setHostname(const char* name, int pos){
|
string multiSlsDetector::setHostname(const char* name, int pos){
|
||||||
@ -560,7 +572,6 @@ string multiSlsDetector::ssetDetectorsType(string name, int pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string multiSlsDetector::getHostname(int pos) {
|
string multiSlsDetector::getHostname(int pos) {
|
||||||
|
|
||||||
string s=string("");
|
string s=string("");
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "returning hostname" << pos << endl;
|
cout << "returning hostname" << pos << endl;
|
||||||
@ -577,8 +588,8 @@ string multiSlsDetector::getHostname(int pos) {
|
|||||||
s+=detectors[ip]->getHostname();
|
s+=detectors[ip]->getHostname();
|
||||||
s+=string("+");
|
s+=string("+");
|
||||||
}
|
}
|
||||||
cout << s <<endl;
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
|
cout << s <<endl;
|
||||||
cout << "hostname " << s << endl;
|
cout << "hostname " << s << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1192,10 +1203,10 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret<(*iret[idet]-200) || ret>(*iret[idet]+200))
|
else if (ret<(*iret[idet]-200) || ret>(*iret[idet]+200))
|
||||||
ret=-1;
|
ret=-1;
|
||||||
|
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));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1243,10 +1254,10 @@ slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) {
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=GET_SETTINGS;
|
ret=GET_SETTINGS;
|
||||||
|
delete iret[idet];
|
||||||
}else ret=GET_SETTINGS;
|
}else ret=GET_SETTINGS;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1291,10 +1302,10 @@ slsDetectorDefs::detectorSettings multiSlsDetector::setSettings(detectorSettings
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=GET_SETTINGS;
|
ret=GET_SETTINGS;
|
||||||
|
delete iret[idet];
|
||||||
}else ret=GET_SETTINGS;
|
}else ret=GET_SETTINGS;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1680,10 +1691,10 @@ int multiSlsDetector::startAndReadAllNoWait(){
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
delete iret[idet];
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2959,53 +2970,86 @@ int multiSlsDetector::getAngularConversion(int &direction, angleConversionCons
|
|||||||
|
|
||||||
|
|
||||||
dacs_t multiSlsDetector::setDAC(dacs_t val, dacIndex idac, int mV, int imod) {
|
dacs_t multiSlsDetector::setDAC(dacs_t val, dacIndex idac, int mV, int imod) {
|
||||||
dacs_t ret, ret1=-100;
|
dacs_t ret = -100;
|
||||||
|
if(!threadpool){
|
||||||
int id=-1, im=-1;
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
int dmi=0, dma=thisMultiDetector->numberOfDetectors;
|
return -1;
|
||||||
|
}else{
|
||||||
if (decodeNMod(imod, id, im)>=0) {
|
int id=-1, im=-1;
|
||||||
dmi=id;
|
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||||
dma=dma+1;
|
if (decodeNMod(imod, id, im)>=0) {
|
||||||
}
|
posmin=id;
|
||||||
|
posmax=id+1;
|
||||||
|
}
|
||||||
|
|
||||||
for (int idet=dmi; idet<dma; idet++) {
|
//return storage values
|
||||||
if (detectors[idet]) {
|
dacs_t* iret[posmax-posmin];
|
||||||
ret=detectors[idet]->setDAC(val, idac, mV, im);
|
for(int idet=posmin; idet<posmax; ++idet){
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]){
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
iret[idet]= new dacs_t(-1);
|
||||||
if (ret1==-100)
|
Task* task = new Task(new func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>(&slsDetector::setDAC,
|
||||||
ret1=ret;
|
detectors[idet],val, idac, mV, im, iret[idet]));
|
||||||
else if (ret!=ret1)
|
threadpool->add_task(task);
|
||||||
ret1=-1;
|
}
|
||||||
}
|
}
|
||||||
}
|
threadpool->startExecuting();
|
||||||
return ret1;
|
threadpool->wait_for_tasks_to_complete();
|
||||||
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
|
if(detectors[idet]){
|
||||||
|
if(iret[idet] != NULL){
|
||||||
|
if (ret==-100)
|
||||||
|
ret=*iret[idet];
|
||||||
|
else if (ret!=*iret[idet])
|
||||||
|
ret=-1;
|
||||||
|
delete iret[idet];
|
||||||
|
}else ret=-1;
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
dacs_t multiSlsDetector::getADC(dacIndex idac, int imod) {
|
dacs_t multiSlsDetector::getADC(dacIndex idac, int imod) {
|
||||||
dacs_t ret, ret1=-100;
|
dacs_t ret = -100;
|
||||||
|
if(!threadpool){
|
||||||
int id=-1, im=-1;
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
int dmi=0, dma=thisMultiDetector->numberOfDetectors;
|
return -1;
|
||||||
|
}else{
|
||||||
if (decodeNMod(imod, id, im)>=0) {
|
int id=-1, im=-1;
|
||||||
dmi=id;
|
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||||
dma=dma+1;
|
if (decodeNMod(imod, id, im)>=0) {
|
||||||
}
|
posmin=id;
|
||||||
|
posmax=id+1;
|
||||||
for (int idet=dmi; idet<dma; idet++) {
|
}
|
||||||
if (detectors[idet]) {
|
//return storage values
|
||||||
ret=detectors[idet]->getADC(idac, im);
|
dacs_t* iret[posmax-posmin];
|
||||||
if(detectors[idet]->getErrorMask())
|
for(int idet=posmin; idet<posmax; ++idet){
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
if(detectors[idet]){
|
||||||
if (ret1==-100)
|
iret[idet]= new dacs_t(-1);
|
||||||
ret1=ret;
|
Task* task = new Task(new func2_t <dacs_t,slsDetector,dacIndex,int,dacs_t>(&slsDetector::getADC,
|
||||||
else if (ret!=ret1)
|
detectors[idet],idac, im, iret[idet]));
|
||||||
ret1=-1;
|
threadpool->add_task(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret1;
|
threadpool->startExecuting();
|
||||||
|
threadpool->wait_for_tasks_to_complete();
|
||||||
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
|
if(detectors[idet]){
|
||||||
|
if(iret[idet] != NULL){
|
||||||
|
if (ret==-100)
|
||||||
|
ret=*iret[idet];
|
||||||
|
else if (ret!=*iret[idet])
|
||||||
|
ret=-1;
|
||||||
|
delete iret[idet];
|
||||||
|
}else ret=-1;
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod) {
|
int multiSlsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod) {
|
||||||
@ -3327,9 +3371,9 @@ char* multiSlsDetector::setCalDir(string s){
|
|||||||
returns the location of the calibration files
|
returns the location of the calibration files
|
||||||
\sa sharedSlsDetector
|
\sa sharedSlsDetector
|
||||||
*/
|
*/
|
||||||
char* multiSlsDetector::getNetworkParameter(networkParameter p) {
|
string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||||
string s0="", s1="",s ;
|
string s0="", s1="",s ;
|
||||||
|
string ans="";
|
||||||
//char ans[1000];
|
//char ans[1000];
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||||
if (detectors[idet]) {
|
if (detectors[idet]) {
|
||||||
@ -3348,9 +3392,11 @@ char* multiSlsDetector::getNetworkParameter(networkParameter p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s1=="bad")
|
if (s1=="bad")
|
||||||
strcpy(ans,s0.c_str());
|
ans=s0;
|
||||||
|
// strcpy(ans,s0.c_str());
|
||||||
else
|
else
|
||||||
strcpy(ans,s1.c_str());
|
ans=s1;
|
||||||
|
// strcpy(ans,s1.c_str());
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3359,7 +3405,7 @@ char* multiSlsDetector::getNetworkParameter(networkParameter p) {
|
|||||||
sets the location of the calibration files
|
sets the location of the calibration files
|
||||||
\sa sharedSlsDetector
|
\sa sharedSlsDetector
|
||||||
*/
|
*/
|
||||||
char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||||
|
|
||||||
if (s.find('+')==string::npos) {
|
if (s.find('+')==string::npos) {
|
||||||
|
|
||||||
@ -3371,7 +3417,7 @@ char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
|||||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||||
if(detectors[idet]){
|
if(detectors[idet]){
|
||||||
sret[idet]=new string("error");
|
sret[idet]=new string("error");
|
||||||
Task* task = new Task(new func2_t <char*,slsDetector,networkParameter,string,string>(&slsDetector::setNetworkParameter,
|
Task* task = new Task(new func2_t <string,slsDetector,networkParameter,string,string>(&slsDetector::setNetworkParameter,
|
||||||
detectors[idet],p,s,sret[idet]));
|
detectors[idet],p,s,sret[idet]));
|
||||||
threadpool->add_task(task);
|
threadpool->add_task(task);
|
||||||
}
|
}
|
||||||
@ -3380,6 +3426,8 @@ char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
|||||||
threadpool->wait_for_tasks_to_complete();
|
threadpool->wait_for_tasks_to_complete();
|
||||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||||
if(detectors[idet]){
|
if(detectors[idet]){
|
||||||
|
if(sret[idet]!= NULL)
|
||||||
|
delete sret[idet];
|
||||||
//doing nothing with the return values
|
//doing nothing with the return values
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
@ -4028,10 +4076,10 @@ int multiSlsDetector::executeTrimming(trimMode mode, int par1, int par2, int imo
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
|
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));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4126,10 +4174,10 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
delete iret[idet];
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4203,10 +4251,10 @@ int multiSlsDetector::setAllTrimbits(int val, int imod){
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
|
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));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4251,10 +4299,10 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
delete iret[idet];
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4535,6 +4583,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
|||||||
for (int ia=0; ia<100; ia++) {
|
for (int ia=0; ia<100; ia++) {
|
||||||
args[ia]=new char[1000];
|
args[ia]=new char[1000];
|
||||||
}
|
}
|
||||||
|
int ret=OK;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -4577,15 +4626,19 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
|||||||
|
|
||||||
delete cmd;
|
delete cmd;
|
||||||
outfile.close();
|
outfile.close();
|
||||||
} else {
|
|
||||||
std::cout<< "Error opening configuration file " << fname << " for writing" << std::endl;
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "wrote " <<iline << " lines to configuration file " << std::endl;
|
std::cout<< "wrote " <<iline << " lines to configuration file " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
std::cout<< "Error opening configuration file " << fname << " for writing" << std::endl;
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int ia=0; ia<100; ia++) {
|
||||||
|
delete [] args[ia];
|
||||||
|
}
|
||||||
|
|
||||||
return OK;
|
return ret;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4928,10 +4981,10 @@ int multiSlsDetector::startReceiver(){
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
delete iret[idet];
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4990,10 +5043,10 @@ int multiSlsDetector::stopReceiver(){
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
delete iret[idet];
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5160,7 +5213,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
|
|||||||
for(int i=0;i<numSockets; ++i){
|
for(int i=0;i<numSockets; ++i){
|
||||||
uint32_t portnum = DEFAULT_ZMQ_PORTNO +
|
uint32_t portnum = DEFAULT_ZMQ_PORTNO +
|
||||||
(i/numSocketsPerDetector)*numSocketsPerDetector + (i%numSocketsPerDetector);
|
(i/numSocketsPerDetector)*numSocketsPerDetector + (i%numSocketsPerDetector);
|
||||||
zmqSocket[i] = new ZmqSocket(detectors[i/numSocketsPerDetector]->getReceiver(), portnum);
|
zmqSocket[i] = new ZmqSocket(detectors[i/numSocketsPerDetector]->getReceiver().c_str(), portnum);
|
||||||
if (zmqSocket[i]->IsError()) {
|
if (zmqSocket[i]->IsError()) {
|
||||||
cprintf(RED, "Error: Could not create Zmq socket on port %d\n", portnum);
|
cprintf(RED, "Error: Could not create Zmq socket on port %d\n", portnum);
|
||||||
createReceivingDataSockets(true);
|
createReceivingDataSockets(true);
|
||||||
@ -5244,6 +5297,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
slsmaxX = detectors[0]->getTotalNumberOfChannels(X);
|
slsmaxX = detectors[0]->getTotalNumberOfChannels(X);
|
||||||
slsmaxY = detectors[0]->getTotalNumberOfChannels(Y);
|
slsmaxY = detectors[0]->getTotalNumberOfChannels(Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting multi values
|
//getting multi values
|
||||||
nx = getTotalNumberOfChannels(slsDetectorDefs::X);
|
nx = getTotalNumberOfChannels(slsDetectorDefs::X);
|
||||||
ny = getTotalNumberOfChannels(slsDetectorDefs::Y);
|
ny = getTotalNumberOfChannels(slsDetectorDefs::Y);
|
||||||
@ -5273,7 +5327,8 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
int* multiframe=new int[nel]();
|
int* multiframe=new int[nel]();
|
||||||
int nch;
|
int nch;
|
||||||
|
|
||||||
volatile uint64_t dataThreadMask = 0x0;
|
bool runningList[numSockets];
|
||||||
|
int numRunning = 0;
|
||||||
|
|
||||||
//wait for real time acquisition to start
|
//wait for real time acquisition to start
|
||||||
bool running = true;
|
bool running = true;
|
||||||
@ -5282,21 +5337,23 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
running = false;
|
running = false;
|
||||||
|
|
||||||
for(int i = 0; i < numSockets; ++i)
|
for(int i = 0; i < numSockets; ++i)
|
||||||
dataThreadMask|=(1<<i);
|
runningList[i] = true;
|
||||||
|
numRunning = numSockets;
|
||||||
|
|
||||||
|
|
||||||
//exit when last message for each socket received
|
//exit when last message for each socket received
|
||||||
while(running){
|
while(running){
|
||||||
//memset(((char*)multiframe),0xFF,slsdatabytes*thisMultiDetector->numberOfDetectors); //reset frame memory
|
memset(((char*)multiframe),0xFF,slsdatabytes*thisMultiDetector->numberOfDetectors); //reset frame memory
|
||||||
|
|
||||||
//get each frame
|
//get each frame
|
||||||
for(int isocket=0; isocket<numSockets; ++isocket){
|
for(int isocket=0; isocket<numSockets; ++isocket){
|
||||||
|
|
||||||
//if running
|
//if running
|
||||||
if((1 << isocket) & dataThreadMask){
|
if (runningList[isocket]) {
|
||||||
|
|
||||||
//get individual images
|
//get individual images
|
||||||
if(FAIL == getData(isocket, jungfrau, image, expectedslssize, currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex,currentFileName)){
|
if(FAIL == getData(isocket, jungfrau, image, expectedslssize, currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex,currentFileName)){
|
||||||
dataThreadMask^=(1<<isocket);
|
runningList[isocket] = false;
|
||||||
|
numRunning--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5309,7 +5366,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
for(int i=0;i<slsmaxY;++i){
|
for(int i=0;i<slsmaxY;++i){
|
||||||
memcpy(((char*)multiframe) + offsetY[isocket] + offsetX[isocket] + (int)((slsmaxY-1-i)*maxX*bytesperchannel),
|
memcpy(((char*)multiframe) + offsetY[isocket] + offsetX[isocket] + (int)((slsmaxY-1-i)*maxX*bytesperchannel),
|
||||||
(char*)image+ (int)(i*(slsmaxX/numSocketsPerSLSDetector)*bytesperchannel),
|
(char*)image+ (int)(i*(slsmaxX/numSocketsPerSLSDetector)*bytesperchannel),
|
||||||
(int)(slsmaxX/numSocketsPerSLSDetector)*bytesperchannel);
|
(int)((slsmaxX/numSocketsPerSLSDetector)*bytesperchannel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//top
|
//top
|
||||||
@ -5317,7 +5374,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
for(int i=0;i<slsmaxY;++i){
|
for(int i=0;i<slsmaxY;++i){
|
||||||
memcpy(((char*)multiframe) + offsetY[isocket] + offsetX[isocket] + (int)(i*maxX*bytesperchannel),
|
memcpy(((char*)multiframe) + offsetY[isocket] + offsetX[isocket] + (int)(i*maxX*bytesperchannel),
|
||||||
(char*)image+ (int)(i*(slsmaxX/numSocketsPerSLSDetector)*bytesperchannel),
|
(char*)image+ (int)(i*(slsmaxX/numSocketsPerSLSDetector)*bytesperchannel),
|
||||||
(int)(slsmaxX/numSocketsPerSLSDetector)*bytesperchannel);
|
(int)((slsmaxX/numSocketsPerSLSDetector)*bytesperchannel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5332,7 +5389,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
|
|
||||||
|
|
||||||
//all done
|
//all done
|
||||||
if(!dataThreadMask){
|
if(!numRunning){
|
||||||
sem_wait(&sem_newRTAcquisition);
|
sem_wait(&sem_newRTAcquisition);
|
||||||
//done with complete acquisition
|
//done with complete acquisition
|
||||||
if(checkJoinThread())
|
if(checkJoinThread())
|
||||||
@ -5340,7 +5397,8 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
else{
|
else{
|
||||||
//starting a new scan/measurement
|
//starting a new scan/measurement
|
||||||
for(int i = 0; i < numSockets; ++i)
|
for(int i = 0; i < numSockets; ++i)
|
||||||
dataThreadMask|=(1<<i);
|
runningList[i] = true;
|
||||||
|
numRunning = numSockets;
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5631,25 +5689,46 @@ int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else enable = dataSocketsStarted;
|
}
|
||||||
|
|
||||||
int ret=-100, ret1;
|
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
|
||||||
if (detectors[idet]) {
|
int ret=-100;
|
||||||
ret1=detectors[idet]->enableDataStreamingFromReceiver(enable);
|
if(!threadpool){
|
||||||
if(detectors[idet]->getErrorMask())
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
return -1;
|
||||||
if (ret==-100)
|
}else{
|
||||||
ret=ret1;
|
//return storage values
|
||||||
else if (ret!=ret1)
|
int* iret[thisMultiDetector->numberOfDetectors];
|
||||||
ret=-1;
|
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||||
|
if(detectors[idet]){
|
||||||
|
iret[idet]= new int(-1);
|
||||||
|
Task* task = new Task(new func1_t <int,slsDetector,int,int>(&slsDetector::enableDataStreamingFromReceiver,
|
||||||
|
detectors[idet],enable,iret[idet]));
|
||||||
|
threadpool->add_task(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
threadpool->startExecuting();
|
||||||
|
threadpool->wait_for_tasks_to_complete();
|
||||||
|
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||||
|
if(detectors[idet]){
|
||||||
|
if(iret[idet] != NULL){
|
||||||
|
if (ret==-100)
|
||||||
|
ret=*iret[idet];
|
||||||
|
else if (ret!=*iret[idet])
|
||||||
|
ret=-1;
|
||||||
|
delete iret[idet];
|
||||||
|
}else ret=-1;
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if(enable == -1)
|
if(ret != dataSocketsStarted)
|
||||||
return dataSocketsStarted;
|
ret = -1;
|
||||||
*/
|
|
||||||
return (dataSocketsStarted & ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::enableReceiverCompression(int i){
|
int multiSlsDetector::enableReceiverCompression(int i){
|
||||||
@ -5866,10 +5945,10 @@ int multiSlsDetector::pulsePixel(int n,int x,int y) {
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
|
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));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5903,10 +5982,10 @@ int multiSlsDetector::pulsePixelNMove(int n,int x,int y) {
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
|
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));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5940,10 +6019,10 @@ int multiSlsDetector::pulseChip(int n) {
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
|
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));
|
||||||
delete iret[idet];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -930,7 +930,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
\param imod module number (if -1 alla modules)
|
\param imod module number (if -1 alla modules)
|
||||||
\returns current DAC value
|
\returns current DAC value
|
||||||
*/
|
*/
|
||||||
dacs_t getADC(dacIndex index, int imod=0);
|
dacs_t getADC(dacIndex index, int imod=-1);
|
||||||
/**
|
/**
|
||||||
configure channel
|
configure channel
|
||||||
\param reg channel register
|
\param reg channel register
|
||||||
@ -980,8 +980,8 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
char* setCalDir(string s);
|
char* setCalDir(string s);
|
||||||
|
|
||||||
|
|
||||||
char *getNetworkParameter(networkParameter);
|
string getNetworkParameter(networkParameter);
|
||||||
char *setNetworkParameter(networkParameter, std::string);
|
string setNetworkParameter(networkParameter, std::string);
|
||||||
int setPort(portType, int);
|
int setPort(portType, int);
|
||||||
int lockServer(int);
|
int lockServer(int);
|
||||||
|
|
||||||
|
@ -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 "49f4f7295411e3dbcf00fd93ca821eb95e13771c"
|
#define SVNREPUUIDLIB "a5b59b47430913bb461b50da05b553874b33f39a"
|
||||||
//#define SVNREV 0x1411
|
//#define SVNREV 0x1418
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "Dhanya_Maliakal"
|
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||||
#define SVNREVLIB 0x1411
|
#define SVNREVLIB 0x1418
|
||||||
#define SVNDATELIB 0x20170614
|
#define SVNDATELIB 0x20170622
|
||||||
//
|
//
|
||||||
|
@ -144,7 +144,9 @@ int slsDetector::freeSharedMemory() {
|
|||||||
perror("shmdt failed\n");
|
perror("shmdt failed\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
printf("Shared memory %d detached\n", shmId);
|
printf("Shared memory %d detached\n", shmId);
|
||||||
|
#endif
|
||||||
// remove shared memory
|
// remove shared memory
|
||||||
if (shmctl(shmId, IPC_RMID, 0) == -1) {
|
if (shmctl(shmId, IPC_RMID, 0) == -1) {
|
||||||
perror("shmctl(IPC_RMID) failed\n");
|
perror("shmctl(IPC_RMID) failed\n");
|
||||||
@ -247,7 +249,9 @@ slsDetector::slsDetector(int pos, detectorType type, int id, multiSlsDetector *p
|
|||||||
|
|
||||||
/**Initializes the detector stucture \sa initializeDetectorSize
|
/**Initializes the detector stucture \sa initializeDetectorSize
|
||||||
*/
|
*/
|
||||||
|
#ifdef VERBOSE
|
||||||
cout << "init det size"<< endl;
|
cout << "init det size"<< endl;
|
||||||
|
#endif
|
||||||
initializeDetectorSize(type);
|
initializeDetectorSize(type);
|
||||||
|
|
||||||
|
|
||||||
@ -261,9 +265,11 @@ slsDetector::~slsDetector(){
|
|||||||
if (shmdt(thisDetector) == -1) {
|
if (shmdt(thisDetector) == -1) {
|
||||||
perror("shmdt failed\n");
|
perror("shmdt failed\n");
|
||||||
printf("Could not detach shared memory %d\n", shmId);
|
printf("Could not detach shared memory %d\n", shmId);
|
||||||
} else
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
|
else
|
||||||
printf("Shared memory %d detached\n", shmId);
|
printf("Shared memory %d detached\n", shmId);
|
||||||
|
#endif
|
||||||
delete thisReceiver;
|
delete thisReceiver;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -539,14 +545,19 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
/** set receiver udp port for Eiger */
|
/** set receiver udp port for Eiger */
|
||||||
thisDetector->receiverUDPPort2=DEFAULT_UDP_PORTNO+1;
|
thisDetector->receiverUDPPort2=DEFAULT_UDP_PORTNO+1;
|
||||||
/** set receiver ip address/hostname */
|
/** set receiver ip address/hostname */
|
||||||
|
memset(thisDetector->receiver_hostname,0,MAX_STR_LENGTH);
|
||||||
strcpy(thisDetector->receiver_hostname,"none");
|
strcpy(thisDetector->receiver_hostname,"none");
|
||||||
/** set receiver udp ip address */
|
/** set receiver udp ip address */
|
||||||
|
memset(thisDetector->receiverUDPIP,0,MAX_STR_LENGTH);
|
||||||
strcpy(thisDetector->receiverUDPIP,"none");
|
strcpy(thisDetector->receiverUDPIP,"none");
|
||||||
/** set receiver udp mac address */
|
/** set receiver udp mac address */
|
||||||
|
memset(thisDetector->receiverUDPMAC,0,MAX_STR_LENGTH);
|
||||||
strcpy(thisDetector->receiverUDPMAC,"none");
|
strcpy(thisDetector->receiverUDPMAC,"none");
|
||||||
/** set detector mac address */
|
/** set detector mac address */
|
||||||
|
memset(thisDetector->detectorMAC,0,MAX_STR_LENGTH);
|
||||||
strcpy(thisDetector->detectorMAC,DEFAULT_DET_MAC);
|
strcpy(thisDetector->detectorMAC,DEFAULT_DET_MAC);
|
||||||
/** set detector ip address */
|
/** set detector ip address */
|
||||||
|
memset(thisDetector->detectorIP,0,MAX_STR_LENGTH);
|
||||||
strcpy(thisDetector->detectorIP,DEFAULT_DET_IP);
|
strcpy(thisDetector->detectorIP,DEFAULT_DET_IP);
|
||||||
|
|
||||||
/** sets onlineFlag to OFFLINE_FLAG */
|
/** sets onlineFlag to OFFLINE_FLAG */
|
||||||
@ -5814,7 +5825,7 @@ int slsDetector::exitServer(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
char* slsDetector::setNetworkParameter(networkParameter index, string value) {
|
string slsDetector::setNetworkParameter(networkParameter index, string value) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
@ -5855,7 +5866,7 @@ char* slsDetector::setNetworkParameter(networkParameter index, string value) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
char* slsDetector::getNetworkParameter(networkParameter index) {
|
string slsDetector::getNetworkParameter(networkParameter index) {
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case DETECTOR_MAC:
|
case DETECTOR_MAC:
|
||||||
@ -5890,13 +5901,17 @@ char* slsDetector::getNetworkParameter(networkParameter index) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* slsDetector::setDetectorMAC(string detectorMAC){
|
string slsDetector::setDetectorMAC(string detectorMAC){
|
||||||
if(detectorMAC.length()==17){
|
if(detectorMAC.length()==17){
|
||||||
if((detectorMAC[2]==':')&&(detectorMAC[5]==':')&&(detectorMAC[8]==':')&&
|
if((detectorMAC[2]==':')&&(detectorMAC[5]==':')&&(detectorMAC[8]==':')&&
|
||||||
(detectorMAC[11]==':')&&(detectorMAC[14]==':')){
|
(detectorMAC[11]==':')&&(detectorMAC[14]==':')){
|
||||||
strcpy(thisDetector->detectorMAC,detectorMAC.c_str());
|
strcpy(thisDetector->detectorMAC,detectorMAC.c_str());
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||||
|
#ifdef VERBOSE
|
||||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||||
|
#else
|
||||||
|
;
|
||||||
|
#endif
|
||||||
else if(setUDPConnection()==FAIL)
|
else if(setUDPConnection()==FAIL)
|
||||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||||
}else{
|
}else{
|
||||||
@ -5909,12 +5924,12 @@ char* slsDetector::setDetectorMAC(string detectorMAC){
|
|||||||
std::cout << "Warning: server MAC Address should be in xx:xx:xx:xx:xx:xx format" << std::endl;
|
std::cout << "Warning: server MAC Address should be in xx:xx:xx:xx:xx:xx format" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return thisDetector->detectorMAC;
|
return string(thisDetector->detectorMAC);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char* slsDetector::setDetectorIP(string detectorIP){
|
string slsDetector::setDetectorIP(string detectorIP){
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
//taking function arguments into consideration
|
//taking function arguments into consideration
|
||||||
if(detectorIP.length()){
|
if(detectorIP.length()){
|
||||||
@ -5923,7 +5938,11 @@ char* slsDetector::setDetectorIP(string detectorIP){
|
|||||||
if(result!=0){
|
if(result!=0){
|
||||||
strcpy(thisDetector->detectorIP,detectorIP.c_str());
|
strcpy(thisDetector->detectorIP,detectorIP.c_str());
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||||
|
#ifdef VERBOSE
|
||||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||||
|
#else
|
||||||
|
;
|
||||||
|
#endif
|
||||||
else if(setUDPConnection()==FAIL)
|
else if(setUDPConnection()==FAIL)
|
||||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||||
}else{
|
}else{
|
||||||
@ -5932,12 +5951,12 @@ char* slsDetector::setDetectorIP(string detectorIP){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return thisDetector->detectorIP;
|
return string(thisDetector->detectorIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char* slsDetector::setReceiver(string receiverIP){
|
string slsDetector::setReceiver(string receiverIP){
|
||||||
if(getRunStatus()==RUNNING){
|
if(getRunStatus()==RUNNING){
|
||||||
cprintf(RED,"Acquisition already running, Stopping it.\n");
|
cprintf(RED,"Acquisition already running, Stopping it.\n");
|
||||||
stopAcquisition();
|
stopAcquisition();
|
||||||
@ -6003,16 +6022,18 @@ char* slsDetector::setReceiver(string receiverIP){
|
|||||||
setUDPConnection();
|
setUDPConnection();
|
||||||
if(thisDetector->myDetectorType == EIGER)
|
if(thisDetector->myDetectorType == EIGER)
|
||||||
enableTenGigabitEthernet(thisDetector->tenGigaEnable);
|
enableTenGigabitEthernet(thisDetector->tenGigaEnable);
|
||||||
|
//datastreamenable
|
||||||
|
//fifodepth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return thisDetector->receiver_hostname;
|
return string(thisDetector->receiver_hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char* slsDetector::setReceiverUDPIP(string udpip){
|
string slsDetector::setReceiverUDPIP(string udpip){
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
//taking function arguments into consideration
|
//taking function arguments into consideration
|
||||||
if(udpip.length()){
|
if(udpip.length()){
|
||||||
@ -6023,21 +6044,26 @@ char* slsDetector::setReceiverUDPIP(string udpip){
|
|||||||
std::cout << "Warning: Receiver UDP IP Address should be VALID and in xxx.xxx.xxx.xxx format" << std::endl;
|
std::cout << "Warning: Receiver UDP IP Address should be VALID and in xxx.xxx.xxx.xxx format" << std::endl;
|
||||||
}else{
|
}else{
|
||||||
strcpy(thisDetector->receiverUDPIP,udpip.c_str());
|
strcpy(thisDetector->receiverUDPIP,udpip.c_str());
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
if(!strcmp(thisDetector->receiver_hostname,"none")) {
|
||||||
|
#ifdef VERBOSE
|
||||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||||
|
#else
|
||||||
|
;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else if(setUDPConnection()==FAIL){
|
else if(setUDPConnection()==FAIL){
|
||||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return thisDetector->receiverUDPIP;
|
return string(thisDetector->receiverUDPIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char* slsDetector::setReceiverUDPMAC(string udpmac){
|
string slsDetector::setReceiverUDPMAC(string udpmac){
|
||||||
if(udpmac.length()!=17){
|
if(udpmac.length()!=17){
|
||||||
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
||||||
std::cout << "Warning: receiver udp mac address should be in xx:xx:xx:xx:xx:xx format" << std::endl;
|
std::cout << "Warning: receiver udp mac address should be in xx:xx:xx:xx:xx:xx format" << std::endl;
|
||||||
@ -6047,7 +6073,11 @@ char* slsDetector::setReceiverUDPMAC(string udpmac){
|
|||||||
(udpmac[11]==':')&&(udpmac[14]==':')){
|
(udpmac[11]==':')&&(udpmac[14]==':')){
|
||||||
strcpy(thisDetector->receiverUDPMAC,udpmac.c_str());
|
strcpy(thisDetector->receiverUDPMAC,udpmac.c_str());
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||||
|
#ifdef VERBOSE
|
||||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||||
|
#else
|
||||||
|
;
|
||||||
|
#endif
|
||||||
else if(setUDPConnection()==FAIL){
|
else if(setUDPConnection()==FAIL){
|
||||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -6058,7 +6088,7 @@ char* slsDetector::setReceiverUDPMAC(string udpmac){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return thisDetector->receiverUDPMAC;
|
return string(thisDetector->receiverUDPMAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6066,7 +6096,11 @@ char* slsDetector::setReceiverUDPMAC(string udpmac){
|
|||||||
int slsDetector::setReceiverUDPPort(int udpport){
|
int slsDetector::setReceiverUDPPort(int udpport){
|
||||||
thisDetector->receiverUDPPort = udpport;
|
thisDetector->receiverUDPPort = udpport;
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||||
|
#else
|
||||||
|
;
|
||||||
|
#endif
|
||||||
else if(setUDPConnection()==FAIL){
|
else if(setUDPConnection()==FAIL){
|
||||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -6076,7 +6110,11 @@ int slsDetector::setReceiverUDPPort(int udpport){
|
|||||||
int slsDetector::setReceiverUDPPort2(int udpport){
|
int slsDetector::setReceiverUDPPort2(int udpport){
|
||||||
thisDetector->receiverUDPPort2 = udpport;
|
thisDetector->receiverUDPPort2 = udpport;
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||||
|
#else
|
||||||
|
;
|
||||||
|
#endif
|
||||||
else if(setUDPConnection()==FAIL){
|
else if(setUDPConnection()==FAIL){
|
||||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -6084,9 +6122,8 @@ int slsDetector::setReceiverUDPPort2(int udpport){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* slsDetector::setDetectorNetworkParameter(networkParameter index, int delay){
|
string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay){
|
||||||
int fnum = F_SET_NETWORK_PARAMETER;
|
int fnum = F_SET_NETWORK_PARAMETER;
|
||||||
char* cretval = new char[MAX_STR_LENGTH];
|
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
char mess[MAX_STR_LENGTH]="";
|
char mess[MAX_STR_LENGTH]="";
|
||||||
@ -6115,9 +6152,10 @@ char* slsDetector::setDetectorNetworkParameter(networkParameter index, int delay
|
|||||||
std::cout<< "Speed set to "<< retval << std::endl;
|
std::cout<< "Speed set to "<< retval << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ostringstream ss;
|
||||||
sprintf(cretval,"%d",retval);
|
ss << retval;
|
||||||
return cretval;
|
string s = ss.str();
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6130,7 +6168,9 @@ int slsDetector::setUDPConnection(){
|
|||||||
|
|
||||||
//called before set up
|
//called before set up
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"none")){
|
if(!strcmp(thisDetector->receiver_hostname,"none")){
|
||||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||||
|
#endif
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6188,9 +6228,9 @@ int slsDetector::setUDPConnection(){
|
|||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
|
#ifdef VERBOSE
|
||||||
printReceiverConfiguration();
|
printReceiverConfiguration();
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6610,12 +6650,10 @@ int slsDetector::printReceiverConfiguration(){
|
|||||||
std::cout << "Receiver Hostname:\t" << getNetworkParameter(RECEIVER_HOSTNAME) << std::endl;
|
std::cout << "Receiver Hostname:\t" << getNetworkParameter(RECEIVER_HOSTNAME) << std::endl;
|
||||||
std::cout << "Receiver UDP IP:\t" << getNetworkParameter(RECEIVER_UDP_IP) << std::endl;
|
std::cout << "Receiver UDP IP:\t" << getNetworkParameter(RECEIVER_UDP_IP) << std::endl;
|
||||||
std::cout << "Receiver UDP MAC:\t" << getNetworkParameter(RECEIVER_UDP_MAC) << std::endl;
|
std::cout << "Receiver UDP MAC:\t" << getNetworkParameter(RECEIVER_UDP_MAC) << std::endl;
|
||||||
|
|
||||||
|
|
||||||
std::cout << "Receiver UDP Port:\t" << getNetworkParameter(RECEIVER_UDP_PORT) << std::endl;
|
std::cout << "Receiver UDP Port:\t" << getNetworkParameter(RECEIVER_UDP_PORT) << std::endl;
|
||||||
if(thisDetector->myDetectorType == EIGER)
|
|
||||||
std::cout << "Receiver UDP Port2:\t" << getNetworkParameter(RECEIVER_UDP_PORT2) << std::endl;
|
|
||||||
|
|
||||||
|
if(thisDetector->myDetectorType == EIGER)
|
||||||
|
std::cout << "Receiver UDP Port2:\t" << getNetworkParameter(RECEIVER_UDP_PORT2) << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -444,7 +444,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
\returns parameter
|
\returns parameter
|
||||||
|
|
||||||
*/
|
*/
|
||||||
char* setNetworkParameter(networkParameter index, string value);
|
string setNetworkParameter(networkParameter index, string value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
gets the network parameters
|
gets the network parameters
|
||||||
@ -452,7 +452,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
\returns parameter
|
\returns parameter
|
||||||
|
|
||||||
*/
|
*/
|
||||||
char* getNetworkParameter(networkParameter index);
|
string getNetworkParameter(networkParameter index);
|
||||||
|
|
||||||
/* I/O */
|
/* I/O */
|
||||||
|
|
||||||
@ -1704,36 +1704,36 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
|
|
||||||
|
|
||||||
/** returns the detector MAC address\sa sharedSlsDetector */
|
/** returns the detector MAC address\sa sharedSlsDetector */
|
||||||
char* getDetectorMAC() {return thisDetector->detectorMAC;};
|
string getDetectorMAC() {return string(thisDetector->detectorMAC);};
|
||||||
/** returns the detector IP address\sa sharedSlsDetector */
|
/** returns the detector IP address\sa sharedSlsDetector */
|
||||||
char* getDetectorIP() {return thisDetector->detectorIP;};
|
string getDetectorIP() {return string(thisDetector->detectorIP);};
|
||||||
/** returns the receiver IP address \sa sharedSlsDetector */
|
/** returns the receiver IP address \sa sharedSlsDetector */
|
||||||
char* getReceiver() {return thisDetector->receiver_hostname;};
|
string getReceiver() {return string(thisDetector->receiver_hostname);};
|
||||||
/** returns the receiver UDP IP address \sa sharedSlsDetector */
|
/** returns the receiver UDP IP address \sa sharedSlsDetector */
|
||||||
char* getReceiverUDPIP() {return thisDetector->receiverUDPIP;};
|
string getReceiverUDPIP() {return string(thisDetector->receiverUDPIP);};
|
||||||
/** returns the receiver UDP MAC address \sa sharedSlsDetector */
|
/** returns the receiver UDP MAC address \sa sharedSlsDetector */
|
||||||
char* getReceiverUDPMAC() {return thisDetector->receiverUDPMAC;};
|
string getReceiverUDPMAC() {return string(thisDetector->receiverUDPMAC);};
|
||||||
/** returns the receiver UDP IP address \sa sharedSlsDetector */
|
/** returns the receiver UDP IP address \sa sharedSlsDetector */
|
||||||
char* getReceiverUDPPort() {char *c= new char[MAX_STR_LENGTH];sprintf(c,"%d",thisDetector->receiverUDPPort); return c;};
|
string getReceiverUDPPort() {ostringstream ss; ss << thisDetector->receiverUDPPort; string s = ss.str(); return s;};
|
||||||
/** returns the receiver UDP2 for Eiger IP address \sa sharedSlsDetector */
|
/** returns the receiver UDP2 for Eiger IP address \sa sharedSlsDetector */
|
||||||
char* getReceiverUDPPort2() {char *c= new char[MAX_STR_LENGTH];sprintf(c,"%d",thisDetector->receiverUDPPort2); return c;};
|
string getReceiverUDPPort2() {ostringstream ss; ss << thisDetector->receiverUDPPort2; string s = ss.str(); return s;};
|
||||||
|
|
||||||
/** validates the format of detector MAC address and sets it \sa sharedSlsDetector */
|
/** validates the format of detector MAC address and sets it \sa sharedSlsDetector */
|
||||||
char* setDetectorMAC(string detectorMAC);
|
string setDetectorMAC(string detectorMAC);
|
||||||
/** validates the format of detector IP address and sets it \sa sharedSlsDetector */
|
/** validates the format of detector IP address and sets it \sa sharedSlsDetector */
|
||||||
char* setDetectorIP(string detectorIP);
|
string setDetectorIP(string detectorIP);
|
||||||
/** validates and sets the receiver IP address/hostname \sa sharedSlsDetector */
|
/** validates and sets the receiver IP address/hostname \sa sharedSlsDetector */
|
||||||
char* setReceiver(string receiver);
|
string setReceiver(string receiver);
|
||||||
/** validates the format of receiver udp ip and sets it \sa sharedSlsDetector */
|
/** validates the format of receiver udp ip and sets it \sa sharedSlsDetector */
|
||||||
char* setReceiverUDPIP(string udpip);
|
string setReceiverUDPIP(string udpip);
|
||||||
/** validates the format of receiver udp mac and sets it \sa sharedSlsDetector */
|
/** validates the format of receiver udp mac and sets it \sa sharedSlsDetector */
|
||||||
char* setReceiverUDPMAC(string udpmac);
|
string setReceiverUDPMAC(string udpmac);
|
||||||
/** sets the receiver udp port \sa sharedSlsDetector */
|
/** sets the receiver udp port \sa sharedSlsDetector */
|
||||||
int setReceiverUDPPort(int udpport);
|
int setReceiverUDPPort(int udpport);
|
||||||
/** sets the receiver udp port2 for Eiger \sa sharedSlsDetector */
|
/** sets the receiver udp port2 for Eiger \sa sharedSlsDetector */
|
||||||
int setReceiverUDPPort2(int udpport);
|
int setReceiverUDPPort2(int udpport);
|
||||||
/** sets the transmission delay for left or right port or for an entire frame*/
|
/** sets the transmission delay for left or right port or for an entire frame*/
|
||||||
char* setDetectorNetworkParameter(networkParameter index, int delay);
|
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||||
|
|
||||||
/** Sets the read receiver frequency
|
/** Sets the read receiver frequency
|
||||||
if data required from receiver randomly readRxrFrequency=0,
|
if data required from receiver randomly readRxrFrequency=0,
|
||||||
|
@ -1319,7 +1319,15 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
if (myDet->setReceiverOnline(ONLINE_FLAG) == ONLINE_FLAG) {
|
||||||
|
//if it was not off
|
||||||
|
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
|
||||||
|
//switch it off, if error
|
||||||
|
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
|
||||||
|
return string("could not disable data streaming in receiver\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(myDet->acquire() == FAIL)
|
if(myDet->acquire() == FAIL)
|
||||||
return string("acquire unsuccessful");
|
return string("acquire unsuccessful");
|
||||||
@ -2930,7 +2938,6 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
|||||||
myDet->setNetworkParameter(t, args[1]);
|
myDet->setNetworkParameter(t, args[1]);
|
||||||
|
|
||||||
return myDet->getNetworkParameter(t);
|
return myDet->getNetworkParameter(t);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int action) {
|
string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int action) {
|
||||||
@ -4831,12 +4838,23 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
int receivers = myDet->setReceiverOnline(ONLINE_FLAG);
|
||||||
|
|
||||||
if(cmd=="receiver"){
|
if(cmd=="receiver"){
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
if(!strcasecmp(args[1],"start"))
|
if(!strcasecmp(args[1],"start")) {
|
||||||
|
//to ensure data streaming enable is the same across client and receiver
|
||||||
|
if (receivers == ONLINE_FLAG) {
|
||||||
|
//if it was not off
|
||||||
|
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
|
||||||
|
//switch it off, if error
|
||||||
|
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
|
||||||
|
return string("could not disable data streaming in receiver\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
myDet->startReceiver();
|
myDet->startReceiver();
|
||||||
|
}
|
||||||
else if(!strcasecmp(args[1],"stop")){
|
else if(!strcasecmp(args[1],"stop")){
|
||||||
//myDet->stopReceiver();
|
//myDet->stopReceiver();
|
||||||
// myDet->startReceiverReadout();
|
// myDet->startReceiverReadout();
|
||||||
|
@ -62,18 +62,6 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
bool receiver = (setReceiverOnline()==ONLINE_FLAG);
|
bool receiver = (setReceiverOnline()==ONLINE_FLAG);
|
||||||
if(!receiver){
|
if(!receiver){
|
||||||
setDetectorIndex(-1);
|
setDetectorIndex(-1);
|
||||||
}else{
|
|
||||||
//put receiver read frequency to random if no gui
|
|
||||||
int ret = setReadReceiverFrequency(0);
|
|
||||||
if(ret>0 && (dataReady == NULL)){
|
|
||||||
ret = setReadReceiverFrequency(1,0);
|
|
||||||
std::cout << "No Data call back and hence receiver read frequency reset to " << ret <<" (Random)" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//start/stop data streaming threads if threads in client enabled/disabled
|
|
||||||
ret = enableDataStreamingFromReceiver(-1);
|
|
||||||
// cout<<"getting datastream:"<<ret<<endl;
|
|
||||||
// cout<<"result of enabledatastream:"<<enableDataStreamingFromReceiver(ret)<<endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int nc=setTimer(CYCLES_NUMBER,-1);
|
int nc=setTimer(CYCLES_NUMBER,-1);
|
||||||
@ -154,11 +142,6 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
||||||
if(getReceiverStatus()!=IDLE)
|
if(getReceiverStatus()!=IDLE)
|
||||||
stopReceiver();
|
stopReceiver();
|
||||||
//multi detectors shouldnt have different receiver read frequencies enabled/disabled
|
|
||||||
if(setReadReceiverFrequency(0) < 0){
|
|
||||||
std::cout << "Error: The receiver read frequency is invalid:" << setReadReceiverFrequency(0) << std::endl;
|
|
||||||
*stoppedFlag=1;
|
|
||||||
}
|
|
||||||
if(setReceiverOnline()==OFFLINE_FLAG)
|
if(setReceiverOnline()==OFFLINE_FLAG)
|
||||||
*stoppedFlag=1;
|
*stoppedFlag=1;
|
||||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||||
|
@ -171,7 +171,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
\returns parameter
|
\returns parameter
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *getNetworkParameter(networkParameter i)=0;
|
virtual string getNetworkParameter(networkParameter i)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
sets the network parameters (implemented for gotthard)
|
sets the network parameters (implemented for gotthard)
|
||||||
@ -180,7 +180,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
\returns parameter
|
\returns parameter
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *setNetworkParameter(networkParameter i, string s)=0;
|
virtual string setNetworkParameter(networkParameter i, string s)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
changes/gets the port number
|
changes/gets the port number
|
||||||
|
@ -106,31 +106,36 @@ private:
|
|||||||
class Task: public virtual slsDetectorDefs{
|
class Task: public virtual slsDetectorDefs{
|
||||||
public:
|
public:
|
||||||
/* Return: int, Param: int */
|
/* Return: int, Param: int */
|
||||||
Task(func1_t <int,slsDetector,int,int>* t): m1(t),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0){};
|
Task(func1_t <int,slsDetector,int,int>* t): m1(t),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: int, Param: string,int */
|
/* Return: int, Param: string,int */
|
||||||
Task(func2_t <int,slsDetector,string,int,int>* t): m1(0),m2(t),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0){};
|
Task(func2_t <int,slsDetector,string,int,int>* t): m1(0),m2(t),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: string, Param: string */
|
/* Return: string, Param: string */
|
||||||
Task(func1_t <string,slsDetector,string,string>* t): m1(0),m2(0),m3(t),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0){};
|
Task(func1_t <string,slsDetector,string,string>* t): m1(0),m2(0),m3(t),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: char*, Param: char* */
|
/* Return: char*, Param: char* */
|
||||||
Task(func1_t <char*,slsDetector,char*,string>* t): m1(0),m2(0),m3(0),m4(t),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0){};
|
Task(func1_t <char*,slsDetector,char*,string>* t): m1(0),m2(0),m3(0),m4(t),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: detectorSettings, Param: int */
|
/* Return: detectorSettings, Param: int */
|
||||||
Task(func1_t <detectorSettings,slsDetector,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(t),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0){};
|
Task(func1_t <detectorSettings,slsDetector,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(t),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: detectorSettings, Param: detectorSettings,int */
|
/* Return: detectorSettings, Param: detectorSettings,int */
|
||||||
Task(func2_t <detectorSettings,slsDetector,detectorSettings,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(t),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0){};
|
Task(func2_t <detectorSettings,slsDetector,detectorSettings,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(t),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: int, Param: int,int */
|
/* Return: int, Param: int,int */
|
||||||
Task(func2_t <int,slsDetector,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(t),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0){};
|
Task(func2_t <int,slsDetector,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(t),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: int, Param: int,int,int */
|
/* Return: int, Param: int,int,int */
|
||||||
Task(func3_t <int,slsDetector,int,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(t),m9(0),m10(0),m11(0),m12(0),m13(0){};
|
Task(func3_t <int,slsDetector,int,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(t),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: int, Param: trimMode,int,int,int */
|
/* Return: int, Param: trimMode,int,int,int */
|
||||||
Task(func4_t <int,slsDetector,trimMode,int,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(t),m10(0),m11(0),m12(0),m13(0){};
|
Task(func4_t <int,slsDetector,trimMode,int,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(t),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: int, Param: none */
|
/* Return: int, Param: none */
|
||||||
Task(func0_t <int,slsDetector,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(t),m11(0),m12(0),m13(0){};
|
Task(func0_t <int,slsDetector,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(t),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: char*, Param: networkParameter,string */
|
/* Return: char*, Param: networkParameter,string */
|
||||||
Task(func2_t <char*,slsDetector,networkParameter,string,string>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(t),m12(0),m13(0){};
|
Task(func2_t <string,slsDetector,networkParameter,string,string>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(t),m12(0),m13(0),m14(0),m15(0){};
|
||||||
/* Return: void, Param: none */
|
/* Return: void, Param: none */
|
||||||
Task(func00_t <void,slsDetector>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(t),m13(0){};
|
Task(func00_t <void,slsDetector>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(t),m13(0),m14(0),m15(0){};
|
||||||
/* Return: int, Param: int,int,detectorSettings */
|
/* Return: int, Param: int,int,detectorSettings */
|
||||||
Task(func3_t <int,slsDetector,int,int,detectorSettings,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t){};
|
Task(func3_t <int,slsDetector,int,int,detectorSettings,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t),m14(0),m15(0){};
|
||||||
|
/* Return: dacs_t, Param: dacs_t, dacIndex, int, int */
|
||||||
|
Task(func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(t),m15(0){};
|
||||||
|
/* Return: dacs_t, Param: dacIndex, int */
|
||||||
|
Task(func2_t <dacs_t,slsDetector,dacIndex,int,dacs_t>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(t){};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -150,6 +155,9 @@ public:
|
|||||||
else if(m11) (*m11)();
|
else if(m11) (*m11)();
|
||||||
else if(m12) (*m12)();
|
else if(m12) (*m12)();
|
||||||
else if(m13) (*m13)();
|
else if(m13) (*m13)();
|
||||||
|
else if(m14) (*m14)();
|
||||||
|
else if(m15) (*m15)();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -174,11 +182,16 @@ private:
|
|||||||
/* Return: int, Param: int */
|
/* Return: int, Param: int */
|
||||||
func0_t <int,slsDetector,int>* m10;
|
func0_t <int,slsDetector,int>* m10;
|
||||||
/* Return: char*, Param: networkParameter,string */
|
/* Return: char*, Param: networkParameter,string */
|
||||||
func2_t <char*,slsDetector,networkParameter,string,string>* m11;
|
func2_t <string,slsDetector,networkParameter,string,string>* m11;
|
||||||
/* Return: void, Param: none */
|
/* Return: void, Param: none */
|
||||||
func00_t <void,slsDetector>* m12;
|
func00_t <void,slsDetector>* m12;
|
||||||
/* Return: int, Param: int,int,detectorSettings */
|
/* Return: int, Param: int,int,detectorSettings */
|
||||||
func3_t <int,slsDetector,int,int,detectorSettings,int>* m13;
|
func3_t <int,slsDetector,int,int,detectorSettings,int>* m13;
|
||||||
|
/* Return: dacs_t, Param: dacs_t, dacIndex, int, int */
|
||||||
|
func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>* m14;
|
||||||
|
/* Return: dacs_t, Param: dacIndex, int */
|
||||||
|
func2_t <dacs_t,slsDetector,dacIndex,int,dacs_t>* m15;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user