mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
eiger and jungfrau server compiles, gotthard and receiver left to do
This commit is contained in:
@ -361,40 +361,6 @@ int receiveData(int file_des, void* buf,int length, intType itype){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int sendChannel(int file_des, sls_detector_channel *myChan) {
|
||||
int ts=0;
|
||||
//sendDataOnly(file_des,myChan, sizeof(sls_detector_channel));
|
||||
ts+=sendData(file_des,&(myChan->chan),sizeof(myChan->chan),INT32);
|
||||
ts+=sendData(file_des,&(myChan->chip),sizeof(myChan->chip),INT32);
|
||||
ts+=sendData(file_des,&(myChan->module),sizeof(myChan->module),INT32);
|
||||
ts+=sendData(file_des,&(myChan->reg),sizeof(myChan->reg),INT64);
|
||||
return ts;
|
||||
}
|
||||
|
||||
int sendChip(int file_des, sls_detector_chip *myChip) {
|
||||
int ts=0;
|
||||
//ts+=sendDataOnly(file_des,myChip,sizeof(sls_detector_chip));
|
||||
ts+=sendData(file_des,&(myChip->chip),sizeof(myChip->chip),INT32);
|
||||
ts+=sendData(file_des,&(myChip->module),sizeof(myChip->module),INT32);
|
||||
ts+=sendData(file_des,&(myChip->nchan),sizeof(myChip->nchan),INT32);
|
||||
ts+=sendData(file_des,&(myChip->reg),sizeof(myChip->reg),INT32);
|
||||
ts+=sendData(file_des,(myChip->chanregs),sizeof(myChip->chanregs),INT32);
|
||||
ts+=sendData(file_des,myChip->chanregs,myChip->nchan*sizeof(int),INT32);
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
||||
int sendModule(int file_des, sls_detector_module *myMod) {
|
||||
return sendModuleGeneral(file_des, myMod, 1);
|
||||
}
|
||||
@ -410,7 +376,6 @@ int sendModuleGeneral(int file_des, sls_detector_module *myMod, int sendAll) {
|
||||
int nAdcs=myMod->nadc;
|
||||
int nDacs=myMod->ndac;
|
||||
//ts+= sendDataOnly(file_des,myMod,sizeof(sls_detector_module));
|
||||
ts+=sendData(file_des,&(myMod->module),sizeof(myMod->module),INT32);
|
||||
ts+=sendData(file_des,&(myMod->serialnumber),sizeof(myMod->serialnumber),INT32);
|
||||
ts+=sendData(file_des,&(myMod->nchan),sizeof(myMod->nchan),INT32);
|
||||
ts+=sendData(file_des,&(myMod->nchip),sizeof(myMod->nchip),INT32);
|
||||
@ -429,90 +394,38 @@ int sendModuleGeneral(int file_des, sls_detector_module *myMod, int sendAll) {
|
||||
ts+=sendData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("module %d of size %d sent\n",myMod->module, ts);
|
||||
printf("module of size %d sent\n",ts);
|
||||
#endif
|
||||
ts+= sendData(file_des,myMod->dacs,sizeof(dacs_t)*nDacs,INT32);
|
||||
ts+= sendData(file_des,myMod->dacs,sizeof(int)*nDacs,INT32);
|
||||
#ifdef VERBOSE
|
||||
printf("dacs %d of size %d sent\n",myMod->module, ts);
|
||||
printf("dacs of size %d sent\n",ts);
|
||||
int idac;
|
||||
for (idac=0; idac< nDacs; idac++)
|
||||
printf("dac %d is %d\n",idac,(int)myMod->dacs[idac]);
|
||||
#endif
|
||||
ts+= sendData(file_des,myMod->adcs,sizeof(dacs_t)*nAdcs,INT32);
|
||||
ts+= sendData(file_des,myMod->adcs,sizeof(int)*nAdcs,INT32);
|
||||
#ifdef VERBOSE
|
||||
printf("adcs %d of size %d sent\n",myMod->module, ts);
|
||||
printf("adcs of size %d sent\n", ts);
|
||||
#endif
|
||||
|
||||
/*some detectors dont require sending all trimbits etc.*/
|
||||
if(sendAll){
|
||||
ts+=sendData(file_des,myMod->chipregs,sizeof(int)*nChips,INT32);
|
||||
#ifdef VERBOSE
|
||||
printf("chips %d of size %d sent\n",myMod->module, ts);
|
||||
printf("chips of size %d sent\n", ts);
|
||||
#endif
|
||||
ts+=sendData(file_des,myMod->chanregs,sizeof(int)*nChans,INT32);
|
||||
#ifdef VERBOSE
|
||||
printf("chans %d of size %d sent - %d\n",myMod->module, ts, myMod->nchan);
|
||||
printf("chans of size %d sent - %d\n", ts, myMod->nchan);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("module %d of size %d sent register %x\n",myMod->module, ts, myMod->reg);
|
||||
printf("module of size %d sent register %x\n", ts, myMod->reg);
|
||||
#endif
|
||||
return ts;
|
||||
}
|
||||
|
||||
int receiveChannel(int file_des, sls_detector_channel *myChan) {
|
||||
int ts=0;
|
||||
//receiveDataOnly(file_des,myChan,sizeof(sls_detector_channel));
|
||||
ts+=receiveData(file_des,&(myChan->chan),sizeof(myChan->chan),INT32);
|
||||
ts+=receiveData(file_des,&(myChan->chip),sizeof(myChan->chip),INT32);
|
||||
ts+=receiveData(file_des,&(myChan->module),sizeof(myChan->module),INT32);
|
||||
ts+=receiveData(file_des,&(myChan->reg),sizeof(myChan->reg),INT32);
|
||||
return ts;
|
||||
}
|
||||
|
||||
int receiveChip(int file_des, sls_detector_chip* myChip) {
|
||||
|
||||
int *ptr=myChip->chanregs;
|
||||
int ts=0;
|
||||
int nChans, nchanold=myChip->nchan, chdiff;
|
||||
|
||||
//ts+= receiveDataOnly(file_des,myChip,sizeof(sls_detector_chip));
|
||||
ts+=receiveData(file_des,&(myChip->chip),sizeof(myChip->chip),INT32);
|
||||
ts+=receiveData(file_des,&(myChip->module),sizeof(myChip->module),INT32);
|
||||
ts+=receiveData(file_des,&(myChip->nchan),sizeof(myChip->nchan),INT32);
|
||||
ts+=receiveData(file_des,&(myChip->reg),sizeof(myChip->reg),INT32);
|
||||
ts+=receiveData(file_des,(myChip->chanregs),sizeof(myChip->chanregs),INT32);
|
||||
|
||||
myChip->chanregs=ptr;
|
||||
nChans=myChip->nchan;
|
||||
chdiff=nChans-nchanold;
|
||||
if (nchanold!=nChans) {
|
||||
printf("wrong number of channels received!\n");
|
||||
}
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("chip structure received\n");
|
||||
printf("now receiving %d channels\n", nChans);
|
||||
#endif
|
||||
|
||||
if (chdiff<=0)
|
||||
ts+=receiveData(file_des,myChip->chanregs, sizeof(int)*nChans,INT32);
|
||||
else {
|
||||
ptr=(int*)malloc(chdiff*sizeof(int));
|
||||
myChip->nchan=nchanold;
|
||||
ts+=receiveData(file_des,myChip->chanregs, sizeof(int)*nchanold,INT32);
|
||||
ts+=receiveData(file_des,ptr, sizeof(int)*chdiff,INT32);
|
||||
free(ptr);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("chip's channels received\n");
|
||||
#endif
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
||||
int receiveModule(int file_des, sls_detector_module* myMod) {
|
||||
@ -521,8 +434,8 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
|
||||
|
||||
int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveAll) {
|
||||
int ts=0;
|
||||
dacs_t *dacptr=myMod->dacs;
|
||||
dacs_t *adcptr=myMod->adcs;
|
||||
int *dacptr=myMod->dacs;
|
||||
int *adcptr=myMod->adcs;
|
||||
int *chipptr=myMod->chipregs, *chanptr=myMod->chanregs;
|
||||
int nChips, nchipold=myMod->nchip, nchipdiff;
|
||||
int nChans, nchanold=myMod->nchan, nchandiff;
|
||||
@ -532,7 +445,6 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
||||
int id=0;
|
||||
#endif
|
||||
// ts+= receiveDataOnly(file_des,myMod,sizeof(sls_detector_module));
|
||||
ts+=receiveData(file_des,&(myMod->module),sizeof(myMod->module),INT32);
|
||||
ts+=receiveData(file_des,&(myMod->serialnumber),sizeof(myMod->serialnumber),INT32);
|
||||
ts+=receiveData(file_des,&(myMod->nchan),sizeof(myMod->nchan),INT32);
|
||||
ts+=receiveData(file_des,&(myMod->nchip),sizeof(myMod->nchip),INT32);
|
||||
@ -604,7 +516,7 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
||||
printf("received %d adcs\n",nAdcs);
|
||||
#endif
|
||||
if (ndacdiff<=0) {
|
||||
ts+=receiveData(file_des,myMod->dacs, sizeof(dacs_t)*nDacs,INT32);
|
||||
ts+=receiveData(file_des,myMod->dacs, sizeof(int)*nDacs,INT32);
|
||||
#ifdef VERBOSE
|
||||
printf("dacs received\n");
|
||||
int id;
|
||||
@ -614,24 +526,24 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
||||
|
||||
#endif
|
||||
} else {
|
||||
dacptr=(dacs_t*)malloc(ndacdiff*sizeof(dacs_t));
|
||||
dacptr=(int*)malloc(ndacdiff*sizeof(int));
|
||||
myMod->ndac=ndold;
|
||||
ts+=receiveData(file_des,myMod->dacs, sizeof(dacs_t)*ndold,INT32);
|
||||
ts+=receiveData(file_des,dacptr, sizeof(dacs_t)*ndacdiff,INT32);
|
||||
ts+=receiveData(file_des,myMod->dacs, sizeof(int)*ndold,INT32);
|
||||
ts+=receiveData(file_des,dacptr, sizeof(int)*ndacdiff,INT32);
|
||||
free(dacptr);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (nadcdiff<=0) {
|
||||
ts+=receiveData(file_des,myMod->adcs, sizeof(dacs_t)*nAdcs,INT32);
|
||||
ts+=receiveData(file_des,myMod->adcs, sizeof(int)*nAdcs,INT32);
|
||||
#ifdef VERBOSE
|
||||
printf("adcs received\n");
|
||||
#endif
|
||||
} else {
|
||||
adcptr=(dacs_t*)malloc(nadcdiff*sizeof(dacs_t));
|
||||
adcptr=(int*)malloc(nadcdiff*sizeof(int));
|
||||
myMod->nadc=naold;
|
||||
ts+=receiveData(file_des,myMod->adcs, sizeof(dacs_t)*naold,INT32);
|
||||
ts+=receiveData(file_des,adcptr, sizeof(dacs_t)*nadcdiff,INT32);
|
||||
ts+=receiveData(file_des,myMod->adcs, sizeof(int)*naold,INT32);
|
||||
ts+=receiveData(file_des,adcptr, sizeof(int)*nadcdiff,INT32);
|
||||
free(adcptr);
|
||||
return FAIL;
|
||||
}
|
||||
@ -669,7 +581,7 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
printf("received module %d of size %d register %x\n",myMod->module,ts,myMod->reg);
|
||||
printf("received module of size %d register %x\n",ts,myMod->reg);
|
||||
#endif
|
||||
|
||||
return ts;
|
||||
|
@ -39,12 +39,8 @@ int receiveDataOnly(int file_des, void* buf,int length);
|
||||
|
||||
|
||||
int getServerError(int socketDescriptor);
|
||||
int sendChannel(int file_des, sls_detector_channel *myChan);
|
||||
int sendChip(int file_des, sls_detector_chip *myChip);
|
||||
int sendModule(int file_des, sls_detector_module *myMod);
|
||||
int sendModuleGeneral(int file_des, sls_detector_module *myMod, int sendAll);
|
||||
int receiveChannel(int file_des, sls_detector_channel *myChan);
|
||||
int receiveChip(int file_des, sls_detector_chip* myChip);
|
||||
int receiveModule(int file_des, sls_detector_module* myMod);
|
||||
int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveAll);
|
||||
|
||||
|
@ -213,11 +213,8 @@ enum idMode{
|
||||
detector digital test modes
|
||||
*/
|
||||
enum digitalTestMode {
|
||||
CHIP_TEST, /**< test chips */
|
||||
MODULE_FIRMWARE_TEST, /**< test module firmware */
|
||||
DETECTOR_FIRMWARE_TEST, /**< test detector system firmware */
|
||||
DETECTOR_MEMORY_TEST, /**< test detector system memory */
|
||||
DETECTOR_SOFTWARE_TEST, /**< test detector system software */
|
||||
DETECTOR_BUS_TEST, /**< test detector system CPU-FPGA bus */
|
||||
DIGITAL_BIT_TEST /**< gotthard digital bit test */
|
||||
};
|
||||
|
||||
|
@ -9,118 +9,65 @@
|
||||
#define SLS_DETECTOR_FUNCS_H
|
||||
|
||||
enum detFuncs{
|
||||
|
||||
// General purpose functions
|
||||
F_EXEC_COMMAND=0, /**< command is executed */
|
||||
F_GET_ERROR, /**< return detector error status */
|
||||
|
||||
// configuration functions
|
||||
F_GET_DETECTOR_TYPE, /**< return detector type */
|
||||
F_SET_NUMBER_OF_MODULES, /**< set/get number of installed modules */
|
||||
F_GET_MAX_NUMBER_OF_MODULES, /**< get maximum number of installed modules */
|
||||
F_SET_EXTERNAL_SIGNAL_FLAG, /**< set/get flag for external signal */
|
||||
F_SET_EXTERNAL_COMMUNICATION_MODE, /**< set/get external communication mode (obsolete) */
|
||||
|
||||
// Tests and identification
|
||||
F_GET_ID, /**< get detector id of version */
|
||||
F_DIGITAL_TEST, /**< digital test of the detector */
|
||||
F_ANALOG_TEST, /**<analog test of the detector */
|
||||
F_ENABLE_ANALOG_OUT, /**<enable the analog output */
|
||||
F_CALIBRATION_PULSE, /**<pulse the calibration input */
|
||||
|
||||
// Initialization functions
|
||||
F_SET_DAC, /**< set DAC value */
|
||||
F_GET_ADC, /**< get ADC value */
|
||||
F_SET_DAC, /**< set DAC value */
|
||||
F_GET_ADC, /**< get ADC value */
|
||||
F_WRITE_REGISTER, /**< write to register */
|
||||
F_READ_REGISTER, /**< read register */
|
||||
F_WRITE_MEMORY, /**< write to memory */
|
||||
F_READ_MEMORY, /**< read memory */
|
||||
|
||||
F_SET_CHANNEL, /**< initialize channel */
|
||||
F_GET_CHANNEL, /**< get channel register */
|
||||
F_SET_ALL_CHANNELS, /**< initialize all channels */
|
||||
|
||||
F_SET_CHIP, /**< initialize chip */
|
||||
F_GET_CHIP, /**< get chip status */
|
||||
F_SET_ALL_CHIPS, /**< initialize all chips */
|
||||
|
||||
F_SET_MODULE, /**< initialize module */
|
||||
F_GET_MODULE, /**< get module status */
|
||||
F_SET_ALL_MODULES, /**< initialize all modules */
|
||||
|
||||
F_SET_SETTINGS, /**< set detector settings */
|
||||
F_GET_THRESHOLD_ENERGY, /**< get detector threshold (in eV) */
|
||||
F_SET_THRESHOLD_ENERGY, /**< set detector threshold (in eV) */
|
||||
|
||||
// Acquisition functions
|
||||
F_START_ACQUISITION, /**< start acquisition */
|
||||
F_STOP_ACQUISITION, /**< stop acquisition */
|
||||
F_START_READOUT, /**< start readout */
|
||||
F_GET_RUN_STATUS, /**< get acquisition status */
|
||||
F_START_AND_READ_ALL, /**< start acquisition and read all frames*/
|
||||
F_READ_ALL, /**< read alla frames */
|
||||
|
||||
//Acquisition setup functions
|
||||
F_SET_TIMER, /**< set/get timer value */
|
||||
F_GET_TIME_LEFT, /**< get current value of the timer (time left) */
|
||||
|
||||
F_SET_DYNAMIC_RANGE, /**< set/get detector dynamic range */
|
||||
F_SET_READOUT_FLAGS, /**< set/get readout flags */
|
||||
F_SET_ROI, /**< set/get region of interest */
|
||||
F_SET_SPEED, /**< set/get readout speed parameters */
|
||||
|
||||
//Trimming
|
||||
F_EXECUTE_TRIMMING, /**< execute trimming */
|
||||
|
||||
F_EXIT_SERVER, /**< turn off detector server */
|
||||
F_LOCK_SERVER, /**< Locks/Unlocks server communication to the given client */
|
||||
F_GET_LAST_CLIENT_IP, /**< returns the IP of the client last connected to the detector */
|
||||
F_SET_PORT, /**< Changes communication port of the server */
|
||||
F_UPDATE_CLIENT, /**< Returns all the important parameters to update the shared memory of the client */
|
||||
|
||||
F_CONFIGURE_MAC, /**< Configures MAC for Gotthard readout */
|
||||
F_LOAD_IMAGE, /**< Loads Dark/Gain image to the Gotthard detector */
|
||||
|
||||
// multi detector structures
|
||||
F_SET_MASTER, /**< sets master/slave flag for multi detector structures */
|
||||
F_SET_SYNCHRONIZATION_MODE, /**< sets master/slave synchronization mode for multidetector structures */
|
||||
F_READ_COUNTER_BLOCK, /**< reads the counter block memory for gotthard */
|
||||
F_RESET_COUNTER_BLOCK, /**< resets the counter block memory for gotthard */
|
||||
F_CALIBRATE_PEDESTAL, /**< starts acquistion, calibrates pedestal and write back to fpga */
|
||||
|
||||
F_ENABLE_TEN_GIGA, /**< enable 10Gbe */
|
||||
F_SET_ALL_TRIMBITS, /** < set all trimbits to this value */
|
||||
|
||||
F_SET_CTB_PATTERN, /** < loads a pattern in the CTB */
|
||||
F_WRITE_ADC_REG, /** < writes an ADC register */
|
||||
|
||||
F_SET_COUNTER_BIT, /** < set/reset counter bit in detector for eiger */
|
||||
F_PULSE_PIXEL, /** < pulse pixel n number of times in eiger at (x,y) */
|
||||
F_PULSE_PIXEL_AND_MOVE, /** < pulse pixel n number of times and move relatively by x and y */
|
||||
F_PULSE_CHIP, /** < pulse chip n number of times */
|
||||
|
||||
F_SET_RATE_CORRECT, /** < set/reset rate correction tau */
|
||||
F_GET_RATE_CORRECT, /** < get rate correction tau */
|
||||
|
||||
|
||||
F_SET_NETWORK_PARAMETER, /**< set network parameters such as transmission delay, flow control */
|
||||
|
||||
F_PROGRAM_FPGA, /**< program FPGA */
|
||||
F_RESET_FPGA, /**< reset FPGA */
|
||||
F_POWER_CHIP, /**< power chip */
|
||||
F_ACTIVATE, /** < activate */
|
||||
F_PREPARE_ACQUISITION, /** < prepare acquisition */
|
||||
|
||||
F_THRESHOLD_TEMP, /** < set threshold temperature */
|
||||
F_TEMP_CONTROL, /** < set temperature control */
|
||||
F_TEMP_EVENT, /** < set temperature event */
|
||||
|
||||
F_AUTO_COMP_DISABLE, /** < auto comp disable mode */
|
||||
F_STORAGE_CELL_START, /** < storage cell start */
|
||||
|
||||
F_CHECK_VERSION, /** < check version compatibility */
|
||||
|
||||
F_SOFTWARE_TRIGGER, /** < software trigger */
|
||||
F_SET_COUNTER_BIT, /** < set/reset counter bit in detector for eiger */
|
||||
F_PULSE_PIXEL,/** < pulse pixel n number of times in eiger at (x,y) */
|
||||
F_PULSE_PIXEL_AND_MOVE,/** < pulse pixel n number of times and move relatively by x and y */
|
||||
F_PULSE_CHIP, /** < pulse chip n number of times */
|
||||
F_SET_RATE_CORRECT,/** < set/reset rate correction tau */
|
||||
F_GET_RATE_CORRECT,/** < get rate correction tau */
|
||||
F_SET_NETWORK_PARAMETER,/**< set network parameters such as transmission delay, flow control */
|
||||
F_PROGRAM_FPGA,/**< program FPGA */
|
||||
F_RESET_FPGA, /**< reset FPGA */
|
||||
F_POWER_CHIP, /**< power chip */
|
||||
F_ACTIVATE,/** < activate */
|
||||
F_PREPARE_ACQUISITION,/** < prepare acquisition */
|
||||
F_THRESHOLD_TEMP, /** < set threshold temperature */
|
||||
F_TEMP_CONTROL, /** < set temperature control */
|
||||
F_TEMP_EVENT, /** < set temperature event */
|
||||
F_AUTO_COMP_DISABLE, /** < auto comp disable mode */
|
||||
F_STORAGE_CELL_START, /** < storage cell start */
|
||||
F_CHECK_VERSION,/** < check version compatibility */
|
||||
F_SOFTWARE_TRIGGER,/** < software trigger */
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
/* Always append functions before!!! */
|
||||
|
Reference in New Issue
Block a user