mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
done, but need to compile
This commit is contained in:
parent
0254ff0281
commit
c755a8974c
@ -308,7 +308,7 @@ int receiveData(int file_des, void* buf,int length, intType itype){
|
||||
int ret = receiveDataOnly(file_des, buf, length);
|
||||
#ifndef PCCOMPILE
|
||||
#ifdef EIGERD
|
||||
swapData(buf, length, itype);
|
||||
if (ret >= 0) swapData(buf, length, itype);
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
@ -316,9 +316,9 @@ int receiveData(int file_des, void* buf,int length, intType itype){
|
||||
|
||||
|
||||
int sendDataOnly(int file_des, void* buf,int length) {
|
||||
|
||||
|
||||
return write(file_des, buf, length);
|
||||
int ret = write(file_des, buf, length); //value of -1 is other end socket crash as sigpipe is ignored
|
||||
if (ret < 0) cprintf(BG_RED, "Error writing to socket. Possible socket crash\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -332,33 +332,23 @@ int receiveData(int file_des, void* buf,int length, intType itype){
|
||||
printf("want to receive %d Bytes\n", length);
|
||||
//#endif
|
||||
|
||||
while(length>0){
|
||||
while(length > 0) {
|
||||
nreceiving = (length>send_rec_max_size) ? send_rec_max_size:length;
|
||||
|
||||
//#ifdef VERY_VERBOSE
|
||||
// printf("want to receive %d Bytes\n", nreceiving);
|
||||
//#endif
|
||||
nreceived = read(file_des,(char*)buf+total_received,nreceiving);
|
||||
//#ifdef VERY_VERBOSE
|
||||
// printf("read %d \n", nreceived);
|
||||
//#endif
|
||||
if(!nreceived) break;
|
||||
// if(nreceived<0) break;
|
||||
if(!nreceived){
|
||||
if(!total_received) {
|
||||
cprintf(BG_RED, "Error reading from socket. Possible socket crash\n");
|
||||
return -1; //to handle it
|
||||
}
|
||||
break;
|
||||
}
|
||||
length-=nreceived;
|
||||
total_received+=nreceived;
|
||||
// cout<<"nrec: "<<nreceived<<" waiting for ("<<length<<")"<<endl;
|
||||
}
|
||||
|
||||
//#ifdef VERY_VERBOSE
|
||||
// printf("received %d Bytes\n", total_received);
|
||||
//#endif
|
||||
|
||||
if (total_received>0)
|
||||
strcpy(thisClientIP,dummyClientIP);
|
||||
|
||||
//if (strcmp(lastClientIP,"none")==0)
|
||||
//strcpy(lastClientIP,thisClientIP);
|
||||
|
||||
if (strcmp(lastClientIP,thisClientIP))
|
||||
differentClients=1;
|
||||
else
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef SLS_DETECTOR_FUNCS_H
|
||||
#define SLS_DETECTOR_FUNCS_H
|
||||
|
||||
enum {
|
||||
enum detFuncs{
|
||||
|
||||
// General purpose functions
|
||||
F_EXEC_COMMAND=0, /**< command is executed */
|
||||
@ -109,10 +109,13 @@ enum {
|
||||
F_PROGRAM_FPGA, /**< program FPGA */
|
||||
F_RESET_FPGA, /**< reset FPGA */
|
||||
F_POWER_CHIP, /**< power chip */
|
||||
F_ACTIVATE, /** < activate */
|
||||
F_PREPARE_ACQUISITION, /** < prepare acquisition */
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
/* Always append functions before!!! */
|
||||
TOO_MANY_FUNCTIONS_DEFINED=128 //you should get a compilation error if there are already so many functions defined. It conflicts with sls_receiver_funcs.h
|
||||
NUM_DET_FUNCTIONS,
|
||||
TOO_MANY_FUNCTIONS_DEFINED=127 //you should get a compilation error if there are already so many functions defined. It conflicts with sls_receiver_funcs.h
|
||||
|
||||
|
||||
};
|
||||
|
@ -117,22 +117,6 @@ void checkFirmwareCompatibility(){
|
||||
|
||||
|
||||
|
||||
int moduleTest( enum digitalTestMode arg, int imod){
|
||||
cprintf(BG_RED, "Warning: Module Test not implemented for this detector\n");
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int detectorTest( enum digitalTestMode arg){
|
||||
cprintf(BG_RED, "Warning: Detector Tests not implemented for this detector\n");
|
||||
//DETECTOR_FIRMWARE_TEST:testFpga()
|
||||
//DETECTOR_MEMORY_TEST:testRAM()
|
||||
//DETECTOR_BUS_TEST:testBus()
|
||||
//DETECTOR_SOFTWARE_TEST:testFpga()
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Ids */
|
||||
@ -1079,7 +1063,7 @@ int setNetworkParameter(enum detNetworkParameter mode, int value){
|
||||
/* aquisition */
|
||||
|
||||
|
||||
int startReceiver(int d){
|
||||
int prepareAcquisition(){
|
||||
|
||||
printf("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit());
|
||||
Feb_Control_PrepareForAcquisition();
|
||||
@ -1159,10 +1143,10 @@ enum runStatus getRunStatus(){
|
||||
//if(trialMasterMode == IS_MASTER){
|
||||
int i = Feb_Control_AcquisitionInProgress();
|
||||
if(i== 0){
|
||||
//printf("IDLE\n");
|
||||
printf("Status: IDLE\n");
|
||||
return IDLE;
|
||||
}else{
|
||||
printf("RUNNING\n");
|
||||
printf("Status: RUNNING...\n");
|
||||
return RUNNING;
|
||||
}
|
||||
//}else printf("***** not master*** \n");
|
||||
|
@ -76,6 +76,11 @@ enum NETWORK_PARA_INDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_PHOTON_ENERGY (-1)
|
||||
#define DEFAULT_RATE_CORRECTION (0)
|
||||
#define DEFAULT_EXT_GATING_ENABLE (0)
|
||||
#define DEFAULT_EXT_GATING_POLARITY (1) //positive
|
||||
#define DEFAULT_TEST_MODE (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
|
||||
|
||||
#define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS (0x1FFFFFFF) /** 29 bit register for max subframe exposure value */
|
||||
|
||||
|
@ -1581,11 +1581,11 @@ int stop_acquisition(int file_des) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
int start_readout(int file_des) {
|
||||
|
||||
int n;
|
||||
int ret = FAIL;
|
||||
|
||||
strcpy(mess, "Start Readout is not implemented for this detector!\n");
|
||||
cprintf(RED,"Warning: %s", mess);
|
||||
|
||||
|
@ -1001,7 +1001,10 @@ int voltageToDac(int value){
|
||||
int vmin = 0;
|
||||
int vmax = 2500;
|
||||
int nsteps = 4096;
|
||||
if ((value < vmin) || (value > vmax)) return -1;
|
||||
if ((value < vmin) || (value > vmax)) {
|
||||
cprintf(RED,"Voltage value (to convert to dac value) is outside bounds: %d\n", value);
|
||||
return -1;
|
||||
}
|
||||
return (int)(((value - vmin) / (vmax - vmin)) * (nsteps - 1) + 0.5);
|
||||
}
|
||||
|
||||
@ -1010,32 +1013,35 @@ int dacToVoltage(unsigned int digital){
|
||||
int vmax = 2500;
|
||||
int nsteps = 4096;
|
||||
int v = vmin + (vmax - vmin) * digital / (nsteps - 1);
|
||||
if((v < 0) || (v > nsteps - 1))
|
||||
if((v < 0) || (v > nsteps - 1)) {
|
||||
cprintf(RED,"\nVoltage value (converted from dac value) is outside bounds: %d\n", v);
|
||||
return -1;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setDAC(enum DAC_INDEX ind, int val, int imod, int mV, int retval[]){
|
||||
int dacval = val;
|
||||
|
||||
//if set and mv, convert to dac
|
||||
if (val > 0 && mV)
|
||||
if (val > 0 && mV) {
|
||||
val = voltageToDac(val); //gives -1 on error
|
||||
|
||||
}
|
||||
|
||||
if ( (val >= 0) || (val == -100)) {
|
||||
u_int32_t codata;
|
||||
int csdx = dacnum / NDAC + DAC_SERIAL_CS_OUT_OFST; // old board (16 dacs),so can be DAC_SERIAL_CS_OUT_OFST or +1
|
||||
int dacchannel = dacnum % NDAC; // 0-8, dac channel number (also for dacnum 9-15 in old board)
|
||||
|
||||
printf("\n Setting of DAC %d with value %d\n",dacnum, dacvalue);
|
||||
printf("\n Setting of DAC %d : (%d dac units)\t %d mV\n",dacnum, dacval, val);
|
||||
// command
|
||||
if (dacvalue >= 0) {
|
||||
if (val >= 0) {
|
||||
printf("Write to Input Register and Update\n");
|
||||
codata = LTC2620_DAC_CMD_SET;
|
||||
|
||||
} else if (dacvalue == -100) {
|
||||
} else if (val == -100) {
|
||||
printf("POWER DOWN\n");
|
||||
codata = LTC2620_DAC_CMD_POWER_DOWN;
|
||||
}
|
||||
@ -1043,19 +1049,19 @@ void setDAC(enum DAC_INDEX ind, int val, int imod, int mV, int retval[]){
|
||||
printf("Chip select bit:%d\n"
|
||||
"Dac Channel:0x%x\n3"
|
||||
"Dac Value:0x%x",
|
||||
csdx, dacchannel, dacvalue);
|
||||
csdx, dacchannel, val);
|
||||
codata += ((dacchannel << LTC2620_DAC_ADDR_OFST) & LTC2620_DAC_ADDR_MSK) +
|
||||
((dacvalue << LTC2620_DAC_DATA_OFST) & LTC2620_DAC_DATA_MSK);
|
||||
((val << LTC2620_DAC_DATA_OFST) & LTC2620_DAC_DATA_MSK);
|
||||
// to spi
|
||||
serializeToSPI(SPI_REG, codata, (0x1 << csdx), LTC2620_DAC_NUMBITS,
|
||||
DAC_SERIAL_CLK_OUT_MSK, DAC_SERIAL_DIGITAL_OUT_MSK, DAC_SERIAL_DIGITAL_OUT_OFST);
|
||||
|
||||
dacValues[dacnum] = dacvalue;
|
||||
dacValues[dacnum] = dacval;
|
||||
}
|
||||
|
||||
printf("\nGetting DAC %d\n",dacnum);
|
||||
retval[0] = dacValues[dacnum];
|
||||
retval[1] = dacToVoltage(retval[0]);
|
||||
printf("\nGetting DAC %d : ",dacnum);
|
||||
retval[0] = dacValues[dacnum]; printf("(%d dac units)\t", retval[0]);
|
||||
retval[1] = dacToVoltage(retval[0]);printf("%d mV\n", retval[1]);
|
||||
}
|
||||
|
||||
|
||||
@ -1222,6 +1228,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
resetCore();
|
||||
|
||||
usleep(500 * 1000); /* todo maybe without */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,6 +58,7 @@ enum DAC_INDEX {VB_COMP, VDD_PROT, VIN_COM, VREF_PRECH, VB_PIXBUF, VB_DS, VRE
|
||||
#define NCHIP (8)
|
||||
#define NADC (0)
|
||||
#define NDAC (8)
|
||||
#define NDAC_OLDBOARD (16)
|
||||
#define DYNAMIC_RANGE (16)
|
||||
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
|
||||
|
@ -1304,6 +1304,7 @@ string slsDetector::checkOnline() {
|
||||
|
||||
int slsDetector::activate(int const enable){
|
||||
int fnum = F_ACTIVATE;
|
||||
int fnum2 = F_RECEIVER_ACTIVATE;
|
||||
int retval = -1;
|
||||
int arg = enable;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
@ -1355,7 +1356,7 @@ int slsDetector::activate(int const enable){
|
||||
std::cout << "Activating/Deactivating Receiver: " << retval << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum,retval,retval);
|
||||
ret=thisReceiver->sendInt(fnum2,retval,retval);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
@ -3851,14 +3852,12 @@ int slsDetector::updateDetectorNoWait() {
|
||||
|
||||
n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->dataBytes=nm;
|
||||
|
||||
//t=setSettings(GET_SETTINGS);
|
||||
n += controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||
thisDetector->currentSettings=t;
|
||||
|
||||
if((thisDetector->myDetectorType!= GOTTHARD)&&
|
||||
(thisDetector->myDetectorType!= PROPIX)&&
|
||||
(thisDetector->myDetectorType!= JUNGFRAU)&&
|
||||
(thisDetector->myDetectorType!= MOENCH) && (thisDetector->myDetectorType!= JUNGFRAUCTB)){
|
||||
if((thisDetector->myDetectorType == EIGER) || (thisDetector->myDetectorType == MYTHEN)){
|
||||
//thr=getThresholdEnergy();
|
||||
n += controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||
thisDetector->currentThresholdEV=thr;
|
||||
@ -3867,6 +3866,7 @@ int slsDetector::updateDetectorNoWait() {
|
||||
//retval=setFrames(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_NUMBER]=retval;
|
||||
|
||||
// retval=setExposureTime(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||
@ -3876,15 +3876,22 @@ int slsDetector::updateDetectorNoWait() {
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval;
|
||||
}
|
||||
|
||||
//retval=setPeriod(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||
//retval=setDelay(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER) {
|
||||
//retval=setDelay(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
||||
}
|
||||
|
||||
// retval=setGates(tns);
|
||||
if ((thisDetector->myDetectorType != JUNGFRAU) && (thisDetector->myDetectorType != EIGER)){
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[GATES_NUMBER]=retval;
|
||||
}
|
||||
|
||||
//retval=setProbes(tns);
|
||||
if (thisDetector->myDetectorType == MYTHEN){
|
||||
@ -3892,7 +3899,6 @@ int slsDetector::updateDetectorNoWait() {
|
||||
thisDetector->timerValue[PROBES_NUMBER]=retval;
|
||||
}
|
||||
|
||||
|
||||
//retval=setTrains(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[CYCLES_NUMBER]=retval;
|
||||
@ -3908,9 +3914,7 @@ int slsDetector::updateDetectorNoWait() {
|
||||
|
||||
//retval=setProbes(tns);
|
||||
getTotalNumberOfChannels();
|
||||
|
||||
// thisDetector->dataBytes=getTotalNumberOfChannels()*thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -6964,7 +6968,7 @@ int slsDetector::programFPGA(string fname){
|
||||
#endif
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));cprintf(BG_RED,"size of filesize:%d\n",sizeof(filesize));
|
||||
controlSocket->SendDataOnly(&filesize,sizeof(filesize));
|
||||
//check opening error
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
|
@ -25,9 +25,11 @@ int checkType();
|
||||
u_int32_t testFpga(void);
|
||||
int testBus(void);
|
||||
#endif
|
||||
|
||||
#if defined(MYTHEND) || defined(JUNGFRAUD)
|
||||
int moduleTest( enum digitalTestMode arg, int imod);
|
||||
int detectorTest( enum digitalTestMode arg);
|
||||
|
||||
#endif
|
||||
|
||||
// Ids
|
||||
int64_t getDetectorId(enum idMode arg);
|
||||
@ -86,95 +88,96 @@ int getPhase();
|
||||
#endif
|
||||
|
||||
// parameters - nmod, dr, roi
|
||||
int setNMod(int nm, enum dimension dim); // mythen specific, but for detector compatibility as a get
|
||||
int getNModBoard(enum dimension arg); // mythen specific, but for detector compatibility as a get
|
||||
int setDynamicRange(int dr);
|
||||
#ifdef MYTHEND
|
||||
int setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
int setNMod(int nm, enum dimension dim); // mythen specific, but for detector compatibility as a get
|
||||
int getNModBoard(enum dimension arg); // mythen specific, but for detector compatibility as a get
|
||||
int setDynamicRange(int dr);
|
||||
#ifdef GOTTHARD
|
||||
int setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
#endif
|
||||
|
||||
// parameters - readout
|
||||
int setSpeed(enum speedVariable arg, int val);
|
||||
int setSpeed(enum speedVariable arg, int val);
|
||||
#if defined(EIGERD) || defined(MYTHEND)
|
||||
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
||||
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
||||
#endif
|
||||
#ifdef MYTHEND
|
||||
int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
||||
int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
||||
#endif
|
||||
|
||||
// parameters - timer
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||
#ifndef EIGERD
|
||||
int64_t getTimeLeft(enum timerIndex ind);
|
||||
int64_t getTimeLeft(enum timerIndex ind);
|
||||
#endif
|
||||
|
||||
|
||||
// parameters - channel, chip, module, settings
|
||||
#ifdef MYTHEND
|
||||
int setChannel(sls_detector_channel myChan);
|
||||
int getChannel(sls_detector_channel *myChan);
|
||||
int setChip(sls_detector_chip myChip);
|
||||
int getChip(sls_detector_chip *myChip);
|
||||
int setChannel(sls_detector_channel myChan);
|
||||
int getChannel(sls_detector_channel *myChan);
|
||||
int setChip(sls_detector_chip myChip);
|
||||
int getChip(sls_detector_chip *myChip);
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
int setModule(sls_detector_module myMod, int delay);
|
||||
int setModule(sls_detector_module myMod, int delay);
|
||||
#else
|
||||
int setModule(sls_detector_module myMod);
|
||||
int setModule(sls_detector_module myMod);
|
||||
#endif
|
||||
int getModule(sls_detector_module *myMod);
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
||||
enum detectorSettings getSettings();
|
||||
int getModule(sls_detector_module *myMod);
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
||||
enum detectorSettings getSettings();
|
||||
|
||||
|
||||
#if defined(MYTHEND) || defined(EIGERD)
|
||||
// parameters - threshold
|
||||
int getThresholdEnergy(int imod);
|
||||
int setThresholdEnergy(int ev, int imod);
|
||||
#if defined(MYTHEND) || defined(EIGERD)
|
||||
int getThresholdEnergy(int imod);
|
||||
int setThresholdEnergy(int ev, int imod);
|
||||
#endif
|
||||
|
||||
// parameters - dac, adc, hv
|
||||
#ifdef JUNGFRAUD
|
||||
void serializeToSPI(u_int32_t addr, u_int32_t val, u_int16_t csmask, int numbitstosend, u_int16_t clkmask, u_int16_t digoutmask, int digofset);
|
||||
void initDac(int dacnum);
|
||||
void prepareADC();
|
||||
void setAdc(int addr, int val);
|
||||
int voltageToDac(int value);
|
||||
int dacToVoltage(unsigned int digital);
|
||||
void serializeToSPI(u_int32_t addr, u_int32_t val, u_int16_t csmask, int numbitstosend, u_int16_t clkmask, u_int16_t digoutmask, int digofset);
|
||||
void initDac(int dacnum);
|
||||
void prepareADC();
|
||||
void setAdc(int addr, int val);
|
||||
int voltageToDac(int value);
|
||||
int dacToVoltage(unsigned int digital);
|
||||
#endif
|
||||
void setDAC(enum DAC_INDEX ind, int val, int imod, int mV, int retval[]);
|
||||
int getADC(enum ADC_INDEX ind, int imod);
|
||||
void setDAC(enum DAC_INDEX ind, int val, int imod, int mV, int retval[]);
|
||||
int getADC(enum ADC_INDEX ind, int imod);
|
||||
#ifndef MYTHEND
|
||||
int setHighVoltage(int val);
|
||||
int setHighVoltage(int val);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// parameters - timing, extsig
|
||||
#ifdef MYTHEND
|
||||
enum externalSignalFlag getExtSignal(int signalindex);
|
||||
enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag flag);
|
||||
enum externalSignalFlag getExtSignal(int signalindex);
|
||||
enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag flag);
|
||||
#endif
|
||||
enum externalCommunicationMode setTiming( enum externalCommunicationMode arg);
|
||||
enum externalCommunicationMode setTiming( enum externalCommunicationMode arg);
|
||||
|
||||
// configure mac
|
||||
#ifdef JUNGFRAUD
|
||||
long int calcChecksum(int sourceip, int destip);
|
||||
long int calcChecksum(int sourceip, int destip);
|
||||
#endif
|
||||
#ifndef MYTHEND
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival);
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival);
|
||||
#endif
|
||||
|
||||
|
||||
// very detector specific
|
||||
#ifdef GOTTHARDD
|
||||
// gotthard specific - image, pedestal
|
||||
int loadImage(enum imageType index, char *imageVals);
|
||||
int readCounterBlock(int startACQ, char *counterVals);
|
||||
int resetCounterBlock(int startACQ);
|
||||
int calibratePedestal(int frames);
|
||||
|
||||
#elif JUNGFRAUD
|
||||
// gotthard specific - image, pedestal
|
||||
#ifdef GOTTHARDD
|
||||
int loadImage(enum imageType index, char *imageVals);
|
||||
int readCounterBlock(int startACQ, char *counterVals);
|
||||
int resetCounterBlock(int startACQ);
|
||||
int calibratePedestal(int frames);
|
||||
|
||||
// jungfrau specific - pll, flashing firmware
|
||||
#elif JUNGFRAUD
|
||||
void resetPLL();
|
||||
u_int32_t setPllReconfigReg(u_int32_t reg, u_int32_t val);
|
||||
void configurePll();
|
||||
@ -183,8 +186,8 @@ int startWritingFPGAprogram(FILE** filefp);
|
||||
int stopWritingFPGAprogram(FILE* filefp);
|
||||
int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp);
|
||||
|
||||
// eiger specific - iodelay, 10g, pulse, rate, temp, activate, delay nw parameter
|
||||
#elif EIGERD
|
||||
//eiger specific - iodelay, 10g, pulse, rate, temp, activate, delay nw parameter
|
||||
int setIODelay(int val, int imod);
|
||||
int enableTenGigabitEthernet(int val);
|
||||
int setCounterBit(int val);
|
||||
@ -208,8 +211,8 @@ int setNetworkParameter(enum NETWORK_PARA_INDEX mode, int value);
|
||||
|
||||
|
||||
// aquisition
|
||||
#ifdef defined(EIGERD) || defined(GOTTHARD)
|
||||
int startReceiver(int d);
|
||||
#if defined(EIGERD) || defined(GOTTHARD)
|
||||
int prepareAcquisition();
|
||||
#endif
|
||||
int startStateMachine();
|
||||
int stopStateMachine();
|
||||
|
@ -23,13 +23,16 @@ int main(int argc, char *argv[]){
|
||||
int retval=OK;
|
||||
int sd, fd;
|
||||
|
||||
// if socket crash, ignores SISPIPE, prevents global signal handler
|
||||
// subsequent read/write to socket gives error - must handle locally
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
|
||||
#ifdef STOP_SERVER
|
||||
char cmd[100];
|
||||
#endif
|
||||
if (argc==1) {
|
||||
|
||||
basictests();
|
||||
//#endif
|
||||
portno = DEFAULT_PORTNO;
|
||||
printf("opening control server on port %d\n",portno );
|
||||
b=1;
|
||||
@ -39,22 +42,18 @@ int main(int argc, char *argv[]){
|
||||
#endif
|
||||
} else {
|
||||
portno = DEFAULT_PORTNO+1;
|
||||
if ( sscanf(argv[1],"%d",&portno) ==0) {
|
||||
if ( sscanf(argv[1],"%d",&portno) == 0) {
|
||||
printf("could not open stop server: unknown port\n");
|
||||
return 1;
|
||||
}
|
||||
printf("opening stop server on port %d\n",portno);
|
||||
b=0;
|
||||
}
|
||||
//#endif
|
||||
|
||||
|
||||
init_detector(b); //defined in slsDetectorServer_funcs
|
||||
|
||||
sd=bindSocket(portno); //defined in communication_funcs
|
||||
|
||||
sockfd=sd;
|
||||
|
||||
if (getServerError(sd)) { //defined in communication_funcs
|
||||
printf("server error!\n");
|
||||
return -1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,37 +1,20 @@
|
||||
#ifndef SERVER_FUNCS_H
|
||||
#define SERVER_FUNCS_H
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include "slsDetectorServer_defs.h"
|
||||
|
||||
#include "sls_receiver_defs.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//basic server functions
|
||||
// initialization functions
|
||||
void basictests();
|
||||
int init_detector(int);
|
||||
void init_detector(int);
|
||||
int decode_function(int);
|
||||
int function_table();
|
||||
//int swap_int32(int val);
|
||||
//int64_t swap_int64(int64_t val);
|
||||
const char* getFunctionName(enum detFuncs func);
|
||||
void function_table();
|
||||
int M_nofunc(int);
|
||||
int exit_server(int);
|
||||
|
||||
// functions called by client
|
||||
int exec_command(int);
|
||||
|
||||
//advnaced server functions
|
||||
int lock_server(int);
|
||||
int get_last_client_ip(int);
|
||||
int set_port(int);
|
||||
int send_update(int);
|
||||
int update_client(int);
|
||||
int set_master(int);
|
||||
int set_synchronization(int);
|
||||
|
||||
//detector specific functions
|
||||
//F_GET_ERROR
|
||||
int get_error(int);
|
||||
int get_detector_type(int);
|
||||
int set_number_of_modules(int);
|
||||
int get_max_number_of_modules(int);
|
||||
@ -39,24 +22,23 @@ int set_external_signal_flag(int);
|
||||
int set_external_communication_mode(int);
|
||||
int get_id(int);
|
||||
int digital_test(int);
|
||||
//F_ANALOG_TEST
|
||||
//F_ENABLE_ANALOG_OUT
|
||||
//F_CALIBRATION_PULSE
|
||||
int analog_test(int);
|
||||
int enable_analog_out(int);
|
||||
int calibration_pulse(int);
|
||||
int set_dac(int);
|
||||
int get_adc(int);
|
||||
int write_register(int);
|
||||
int read_register(int);
|
||||
//F_WRITE_MEMORY
|
||||
//F_READ_MEMORY
|
||||
int write_memory(int);
|
||||
int read_memory(int);
|
||||
int set_channel(int);
|
||||
int get_channel(int);
|
||||
//F_SET_ALL_CHANNELS
|
||||
int set_all_channels(int);
|
||||
int set_chip(int);
|
||||
int get_chip(int);
|
||||
//F_SET_ALL_CHIPS
|
||||
int set_all_chips(int);
|
||||
int set_module(int);
|
||||
int get_module(int);
|
||||
//F_SET_ALL_MODULES
|
||||
int set_settings(int);
|
||||
int get_threshold_energy(int);
|
||||
int set_threshold_energy(int);
|
||||
@ -74,22 +56,35 @@ int set_readout_flags(int);
|
||||
int set_roi(int);
|
||||
int set_speed(int);
|
||||
int execute_trimming(int);
|
||||
int exit_server(int);
|
||||
int lock_server(int);
|
||||
int get_last_client_ip(int);
|
||||
int set_port(int);
|
||||
int update_client(int);
|
||||
int send_update(int);
|
||||
int configure_mac(int);
|
||||
int load_image(int);
|
||||
int set_master(int);
|
||||
int set_synchronization(int);
|
||||
int read_counter_block(int);
|
||||
int reset_counter_block(int);
|
||||
int start_receiver(int);
|
||||
int stop_receiver(int);
|
||||
int calibrate_pedestal(int);
|
||||
int enable_ten_giga(int);
|
||||
int set_all_trimbits(int);
|
||||
int set_ctb_pattern(int);
|
||||
int write_adc_register(int);
|
||||
int set_counter_bit(int);
|
||||
int pulse_pixel(int);
|
||||
int pulse_pixel_and_move(int);
|
||||
int pulse_chip(int);
|
||||
int set_rate_correct(int);
|
||||
int get_rate_correct(int);
|
||||
int set_activate(int);
|
||||
int set_network_parameter(int);
|
||||
int program_fpga(int);
|
||||
int reset_fpga(int);
|
||||
int power_chip(int);
|
||||
int set_activate(int);
|
||||
int prepare_acquisition(int);
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user