mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-02 19:00:05 +02:00
eiger and jungfrau server compiles, gotthard and receiver left to do
This commit is contained in:
parent
b9f97f42a6
commit
923a7e8936
@ -1974,38 +1974,8 @@ int slsDetector::setThresholdEnergy(int e_eV, detectorSettings isettings, int tb
|
||||
return thisDetector->currentThresholdEV;
|
||||
}
|
||||
|
||||
int fnum= F_SET_THRESHOLD_ENERGY;
|
||||
int retval;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Setting threshold energy "<< std::endl;
|
||||
#endif
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&e_eV,sizeof(e_eV));
|
||||
controlSocket->SendDataOnly(&isettings,sizeof(isettings));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
std::cout<< "Detector returned error: "<< std::endl;
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< mess << std::endl;
|
||||
} else {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Detector returned OK "<< std::endl;
|
||||
#endif
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
thisDetector->currentThresholdEV=retval;
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
} else {
|
||||
thisDetector->currentThresholdEV=e_eV;
|
||||
}
|
||||
return thisDetector->currentThresholdEV;
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,17 +114,18 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
|
||||
/* digital test and debugging */
|
||||
|
||||
|
||||
/*! \page test
|
||||
- <b>digitest [i]</b> will perform test which will plot the unique channel identifier, instead of data. Only get!
|
||||
- <b>digibittest:[i]</b> performs digital test of the module i. Returns 0 if succeeded, otherwise error mask. Gotthard only. Only put!
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="digitest"; // /* find command! */
|
||||
descrToFuncMap[i].m_pFuncName="digibittest"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
|
||||
++i;
|
||||
|
||||
/*! \page test
|
||||
- <b>digibittest:[i]</b> performs digital test of the module i. Returns 0 if succeeded, otherwise error mask. Only put!
|
||||
- <b>bustest</b> performs test of the bus interface between FPGA and embedded Linux system. Can last up to a few minutes. Cannot set! Jungfrau only. Only get!
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="digibittest"; //
|
||||
descrToFuncMap[i].m_pFuncName="bustest"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
|
||||
++i;
|
||||
|
||||
@ -3671,14 +3672,14 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action, int d
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||
|
||||
if (cmd=="digitest") {
|
||||
if (cmd=="bustest"){
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
sprintf(answer,"0x%x",myDet->digitalTest(CHIP_TEST, -1, detPos));
|
||||
sprintf(answer,"0x%x",myDet->digitalTest(DETECTOR_BUS_TEST));
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
if (cmd=="digibittest") {
|
||||
else if (cmd=="digibittest") {
|
||||
if (action==GET_ACTION)
|
||||
return string("cannot get ")+cmd;
|
||||
int ival=-1;
|
||||
@ -3694,7 +3695,7 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action, int d
|
||||
}
|
||||
|
||||
|
||||
return string("unknown digital test mode ")+cmd;
|
||||
return string("unknown test mode ")+cmd;
|
||||
|
||||
}
|
||||
|
||||
@ -3703,10 +3704,8 @@ string slsDetectorCommand::helpDigiTest(int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "digitaltest:i \t performs digital test of the module i. Returns 0 if succeeded, otherwise error mask."<< std::endl;
|
||||
}
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "digibittest i\t will perform test which will plot the unique channel identifier, instead of data."<< std::endl;
|
||||
os << "digibittest:i \t performs digital test of the module i. Returns 0 if succeeded, otherwise error mask.Gotthard only."<< std::endl;
|
||||
os << "bustest \t performs test of the bus interface between FPGA and embedded Linux system. Can last up to a few minutes. Jungfrau only."<< std::endl;
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
CC = powerpc-4xx-softfloat-gcc
|
||||
BLACKFIN_CC = bfin-uclinux-gcc
|
||||
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN
|
||||
CFLAGS += -Wall -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE -DPCCOMPILE -DMARTIN
|
||||
LDLIBS += -lm -lstdc++
|
||||
|
||||
PROGS = eigerDetectorServer
|
||||
|
@ -1,5 +1,5 @@
|
||||
CC = gcc
|
||||
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DPCCOMPILE -DSTOP_SERVER #-DVERBOSE
|
||||
CFLAGS += -Wall -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DPCCOMPILE -DSTOP_SERVER #-DVERBOSE
|
||||
CFLAGS += -DVIRTUAL -DVIRTUAL_9M
|
||||
MASTERFLAG += -DVIRTUAL_MASTER
|
||||
LDLIBS += -lm -lstdc++ -pthread
|
||||
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/ansi.h
|
||||
../../../slsSupportLib/include/ansi.h
|
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
../commonFiles/communication_funcs.c
|
||||
../../../slsSupportLib/include/communication_funcs.c
|
@ -1 +1 @@
|
||||
../commonFiles/communication_funcs.h
|
||||
../../../slsSupportLib/include/communication_funcs.h
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||
Path: slsDetectorPackage/slsDetectorSoftware/slsDetectorServers/eigerDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 350
|
||||
Branch: developer
|
||||
Last Changed Author: Gemma_Tinti
|
||||
Last Changed Rev: 3999
|
||||
Last Changed Date: 2018-09-28 14:11:53.000000002 +0200 ./Makefile.virtual
|
||||
Repsitory UUID: b9f97f42a6a369dfb5c484bffeaa7a417e9cbca1
|
||||
Revision: 1
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4067
|
||||
Last Changed Date: 2018-10-08 11:18:41.000000002 +0200 ./Makefile
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
|
||||
#define GITAUTH "Gemma_Tinti"
|
||||
#define GITREV 0x3999
|
||||
#define GITDATE 0x20180928
|
||||
#define GITBRANCH "developer"
|
||||
#define GITREPUUID "b9f97f42a6a369dfb5c484bffeaa7a417e9cbca1"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4067
|
||||
#define GITDATE 0x20181008
|
||||
#define GITBRANCH "refactor"
|
||||
|
@ -29,8 +29,8 @@ enum{E_PARALLEL, E_NON_PARALLEL, E_SAFE};
|
||||
sls_detector_module *detectorModules=NULL;
|
||||
int *detectorChips=NULL;
|
||||
int *detectorChans=NULL;
|
||||
dacs_t *detectorDacs=NULL;
|
||||
dacs_t *detectorAdcs=NULL;
|
||||
int *detectorDacs=NULL;
|
||||
int *detectorAdcs=NULL;
|
||||
|
||||
int eiger_highvoltage = 0;
|
||||
int eiger_theo_highvoltage = 0;
|
||||
@ -406,8 +406,8 @@ void allocateDetectorStructureMemory(){
|
||||
detectorModules=malloc(sizeof(sls_detector_module));
|
||||
detectorChips=malloc(NCHIP*sizeof(int));
|
||||
detectorChans=malloc(NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs=malloc(NDAC*sizeof(dacs_t));
|
||||
detectorAdcs=malloc(NADC*sizeof(dacs_t));
|
||||
detectorDacs=malloc(NDAC*sizeof(int));
|
||||
detectorAdcs=malloc(NADC*sizeof(int));
|
||||
#ifdef VERBOSE
|
||||
printf("modules from 0x%x to 0x%x\n",detectorModules, detectorModules+n);
|
||||
printf("chips from 0x%x to 0x%x\n",detectorChips, detectorChips+n*NCHIP);
|
||||
@ -423,7 +423,6 @@ void allocateDetectorStructureMemory(){
|
||||
(detectorModules)->nadc=NADC;
|
||||
(detectorModules)->nchip=NCHIP;
|
||||
(detectorModules)->nchan=NCHIP*NCHAN;
|
||||
(detectorModules)->module=0;
|
||||
(detectorModules)->gain=0;
|
||||
(detectorModules)->offset=0;
|
||||
(detectorModules)->reg=0;
|
||||
@ -448,7 +447,7 @@ void setupDetector() {
|
||||
int retval[2]={-1,-1};
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for(i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i,defaultvals[i],0,0,retval);
|
||||
setDAC((enum DACINDEX)i,defaultvals[i],0,retval);
|
||||
if (retval[0] != defaultvals[i])
|
||||
cprintf(RED, "Warning: Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], retval[0]);
|
||||
}
|
||||
@ -467,7 +466,7 @@ void setupDetector() {
|
||||
setReadOutFlags(DEFAULT_READOUT_STOREINRAM_MODE);
|
||||
setReadOutFlags(DEFAULT_READOUT_OVERFLOW32_MODE);
|
||||
setSpeed(CLOCK_DIVIDER, DEFAULT_CLK_SPEED);//clk_devider,half speed
|
||||
setIODelay(DEFAULT_IO_DELAY, DEFAULT_MOD_INDEX);
|
||||
setIODelay(DEFAULT_IO_DELAY);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
//SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
|
||||
setRateCorrection(DEFAULT_RATE_CORRECTION);
|
||||
@ -503,16 +502,8 @@ uint32_t readRegister(uint32_t offset) {
|
||||
}
|
||||
|
||||
|
||||
/* set parameters - nmod, dr, roi */
|
||||
/* set parameters - dr, roi */
|
||||
|
||||
int setNMod(int nm, enum dimension dim){
|
||||
return NMOD;
|
||||
}
|
||||
|
||||
|
||||
int getNModBoard(enum dimension arg){
|
||||
return NMAXMOD;
|
||||
}
|
||||
|
||||
int setDynamicRange(int dr){
|
||||
#ifdef VIRTUAL
|
||||
@ -824,17 +815,17 @@ int setModule(sls_detector_module myMod, int delay){
|
||||
return FAIL;
|
||||
|
||||
// settings
|
||||
setSettings( (enum detectorSettings)myMod.reg,-1);
|
||||
setSettings( (enum detectorSettings)myMod.reg);
|
||||
|
||||
// iodelay
|
||||
if(setIODelay(delay, -1)!= delay){
|
||||
if(setIODelay(delay)!= delay){
|
||||
cprintf(RED,"could not set iodelay %d\n",delay);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// dacs
|
||||
for(i=0;i<myMod.ndac;i++)
|
||||
setDAC((enum DACINDEX)i,myMod.dacs[i],myMod.module,0,retval);
|
||||
setDAC((enum DACINDEX)i,myMod.dacs[i],0,retval);
|
||||
|
||||
// trimbits
|
||||
#ifndef VIRTUAL
|
||||
@ -876,7 +867,7 @@ int getModule(sls_detector_module *myMod){
|
||||
|
||||
//dacs
|
||||
for(i=0;i<NDAC;i++) {
|
||||
setDAC((enum DACINDEX)i,-1,-1,0,retval);
|
||||
setDAC((enum DACINDEX)i,-1,0,retval);
|
||||
//cprintf(BLUE,"dac%d:%d\n",i, *((detectorModules->dacs)+i));
|
||||
}
|
||||
|
||||
@ -911,7 +902,7 @@ int getModule(sls_detector_module *myMod){
|
||||
|
||||
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
||||
enum detectorSettings setSettings(enum detectorSettings sett){
|
||||
if(sett == UNINITIALIZED){
|
||||
return thisSettings;
|
||||
}if(sett != GET_SETTINGS)
|
||||
@ -931,17 +922,17 @@ enum detectorSettings getSettings(){
|
||||
|
||||
/* parameters - threshold */
|
||||
|
||||
int getThresholdEnergy(int imod){
|
||||
int getThresholdEnergy(){
|
||||
printf(" Getting Threshold energy\n");
|
||||
return eiger_photonenergy;
|
||||
}
|
||||
|
||||
|
||||
int setThresholdEnergy(int ev, int imod){
|
||||
int setThresholdEnergy(int ev){
|
||||
printf(" Setting threshold energy:%d\n",ev);
|
||||
if(ev >= 0)
|
||||
eiger_photonenergy = ev;
|
||||
return getThresholdEnergy(imod);
|
||||
return getThresholdEnergy();
|
||||
}
|
||||
|
||||
|
||||
@ -950,19 +941,19 @@ int setThresholdEnergy(int ev, int imod){
|
||||
|
||||
/* parameters - dac, adc, hv */
|
||||
|
||||
void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
|
||||
printf("Going to set dac %d to %d of imod %d with mv mode %d \n", (int)ind, val, imod, mV);
|
||||
void setDAC(enum DACINDEX ind, int val, int mV, int retval[]){
|
||||
printf("Going to set dac %d to %d with mv mode %d \n", (int)ind, val, mV);
|
||||
if(ind == VTHRESHOLD){
|
||||
int ret[5];
|
||||
setDAC(VCMP_LL,val,imod,mV,retval);
|
||||
setDAC(VCMP_LL,val,mV,retval);
|
||||
ret[0] = retval[mV];
|
||||
setDAC(VCMP_LR,val,imod,mV,retval);
|
||||
setDAC(VCMP_LR,val,mV,retval);
|
||||
ret[1] = retval[mV];
|
||||
setDAC(VCMP_RL,val,imod,mV,retval);
|
||||
setDAC(VCMP_RL,val,mV,retval);
|
||||
ret[2] = retval[mV];
|
||||
setDAC(VCMP_RR,val,imod,mV,retval);
|
||||
setDAC(VCMP_RR,val,mV,retval);
|
||||
ret[3] = retval[mV];
|
||||
setDAC(VCP,val,imod,mV,retval);
|
||||
setDAC(VCP,val,mV,retval);
|
||||
ret[4] = retval[mV];
|
||||
|
||||
|
||||
@ -1018,7 +1009,7 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
|
||||
|
||||
|
||||
|
||||
int getADC(enum ADCINDEX ind, int imod){
|
||||
int getADC(enum ADCINDEX ind){
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#else
|
||||
@ -1224,7 +1215,7 @@ int setDetectorPosition(int pos[]) {
|
||||
|
||||
/* eiger specific - iodelay, 10g, pulse, rate, temp, activate, delay nw parameter */
|
||||
|
||||
int setIODelay(int val, int imod){
|
||||
int setIODelay(int val){
|
||||
if(val!=-1){
|
||||
printf(" Setting IO Delay: %d\n",val);
|
||||
#ifndef VIRTUAL
|
||||
@ -1745,12 +1736,6 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
printf("Copying module %x to module %x\n",srcMod,destMod);
|
||||
#endif
|
||||
|
||||
if (srcMod->module>=0) {
|
||||
#ifdef VERBOSE
|
||||
printf("Copying module number %d to module number %d\n",srcMod->module,destMod->module);
|
||||
#endif
|
||||
destMod->module=srcMod->module;
|
||||
}
|
||||
if (srcMod->serialnumber>=0){
|
||||
|
||||
destMod->serialnumber=srcMod->serialnumber;
|
||||
@ -1829,37 +1814,21 @@ int calculateDataBytes(){
|
||||
}
|
||||
|
||||
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerModule() * (int)getTotalNumberOfModules());}
|
||||
int getTotalNumberOfChips(){return ((int)getNumberOfChipsPerModule() * (int)getTotalNumberOfModules());}
|
||||
int getTotalNumberOfModules(){return NMOD;}
|
||||
int getNumberOfChannelsPerModule(){return ((int)getNumberOfChannelsPerChip() * (int)getTotalNumberOfChips());}
|
||||
int getNumberOfChipsPerModule(){return NCHIP;}
|
||||
int getNumberOfDACsPerModule(){return NDAC;}
|
||||
int getNumberOfADCsPerModule(){return NADC;}
|
||||
|
||||
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
||||
int getNumberOfChips(){return NCHIP;}
|
||||
int getNumberOfDACs(){return NDAC;}
|
||||
int getNumberOfADCs(){return NADC;}
|
||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||
int getNumberOfGainsPerModule(){return NGAIN;}
|
||||
int getNumberOfOffsetsPerModule(){return NOFFSET;}
|
||||
int getNumberOfGains(){return NGAIN;}
|
||||
int getNumberOfOffsets(){return NOFFSET;}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* sync */
|
||||
|
||||
enum masterFlags setMaster(enum masterFlags arg){
|
||||
return NO_MASTER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum synchronizationMode setSynchronization(enum synchronizationMode arg){
|
||||
return NO_SYNCHRONIZATION;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -45,8 +45,6 @@ enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
|
||||
|
||||
|
||||
/* Hardware Definitions */
|
||||
#define NMAXMOD (1)
|
||||
#define NMOD (1)
|
||||
#define NCHAN (256 * 256)
|
||||
#define NCHIP (4)
|
||||
#define NADC (0)
|
||||
@ -65,7 +63,6 @@ enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
|
||||
#define SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE (16)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_MOD_INDEX (0)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_EXPTIME (1E9) //ns
|
||||
|
@ -1 +1 @@
|
||||
../commonFiles/sls_detector_defs.h
|
||||
../../../slsSupportLib/include/sls_detector_defs.h
|
@ -1 +1 @@
|
||||
../commonFiles/sls_detector_funcs.h
|
||||
../../../slsSupportLib/include/sls_detector_funcs.h
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/sls_receiver_defs.h
|
||||
../../../slsSupportLib/include/sls_receiver_defs.h
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/sls_receiver_funcs.h
|
||||
../../../slsSupportLib/include/sls_receiver_funcs.h
|
@ -1,11 +1,11 @@
|
||||
SERVER=eigerDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
MAINDIR=slsDetectorPackage
|
||||
SPECDIR=slsDetectorSoftware/slsDetectorServers/$SERVER
|
||||
TMPFILE=gitInfoEigerTmp.h
|
||||
INCLFILE=gitInfoEiger.h
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
EVALFILE=../../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ OLDDATE=$(more $INCLFILE | grep '#define GITDATE' | awk '{print $3}')
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
cd ../../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
||||
|
@ -1 +1 @@
|
||||
../commonFiles/versionAPI.h
|
||||
../../../slsSupportLib/include/versionAPI.h
|
@ -6,7 +6,7 @@
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
CFLAGS += -Wall -DGOTTHARDD -DMCB_FUNCS -DDACS_INT -DDEBUG # -DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||
CFLAGS += -Wall -DGOTTHARDD -DMCB_FUNCS -DDEBUG # -DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||
|
||||
|
||||
PROGS= gotthardDetectorServer
|
||||
|
@ -1,49 +0,0 @@
|
||||
# $Id: Makefile,v 1.1.1.1 2006/02/04 03:35:01 freza Exp $
|
||||
# first compile
|
||||
# make cris-axis-linux-gnu
|
||||
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
CFLAGS += -Wall -DGOTTHARDD -DPROPIXD -DMCB_FUNCS -DDACS_INT -DDEBUG # -DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||
|
||||
|
||||
PROGS= propixDetectorServer
|
||||
INSTDIR= /tftpboot
|
||||
INSTMODE= 0777
|
||||
|
||||
|
||||
|
||||
BINS = testlib_sharedlibc
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c
|
||||
OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
|
||||
|
||||
all: clean $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
echo $(OBJS)
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
||||
|
||||
install: $(PROGS)
|
||||
$(INSTALL) -d $(INSTDIR)
|
||||
$(INSTALL) -m $(INSTMODE) $(PROGS) $(INSTDIR)
|
||||
|
||||
|
||||
romfs:
|
||||
$(ROMFSINST) /bin/$(PROGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(PROGS) *.o *.gdb
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
DESTDIR ?= ./
|
||||
|
||||
CC = gcc
|
||||
CFLAGS += -Wall -DGOTTHARDD -DMCB_FUNCS -DDACS_INT -DDEBUG -DVIRTUAL
|
||||
CFLAGS += -Wall -DGOTTHARDD -DMCB_FUNCS -DDEBUG -DVIRTUAL
|
||||
|
||||
|
||||
PROGS= $(DESTDIR)/gotthardDetectorServer_virtual
|
||||
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/ansi.h
|
||||
../../../slsSupportLib/include/ansi.h
|
@ -1 +1 @@
|
||||
../commonFiles/communication_funcs.c
|
||||
../../../slsSupportLib/include/communication_funcs.c
|
@ -1 +1 @@
|
||||
../commonFiles/communication_funcs.h
|
||||
../../../slsSupportLib/include/communication_funcs.h
|
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
../commonFiles/sls_detector_defs.h
|
||||
../../../slsSupportLib/include/sls_detector_defs.h
|
@ -1 +1 @@
|
||||
../commonFiles/sls_detector_funcs.h
|
||||
../../../slsSupportLib/include/sls_detector_funcs.h
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/sls_receiver_defs.h
|
||||
../../../slsSupportLib/include/sls_receiver_defs.h
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/sls_receiver_funcs.h
|
||||
../../../slsSupportLib/include/sls_receiver_funcs.h
|
@ -1,11 +1,11 @@
|
||||
SERVER=gotthardDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
MAINDIR=slsDetectorPackage
|
||||
SPECDIR=slsDetectorSoftware/slsDetectorServers/$SERVER
|
||||
TMPFILE=gitInfoGotthardTmp.h
|
||||
INCLFILE=gitInfoGotthard.h
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
EVALFILE=../../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ OLDDATE=$(more $INCLFILE | grep '#define GITDATE' | awk '{print $3}')
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
cd ../../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
@ -1 +1 @@
|
||||
../commonFiles/versionAPI.h
|
||||
../../../slsSupportLib/include/versionAPI.h
|
@ -1,6 +1,6 @@
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DJUNGFRAUD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -DJUNGFRAUD -DSLS_DETECTOR_FUNCTION_LIST -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lstdc++
|
||||
|
||||
PROGS = jungfrauDetectorServer
|
||||
|
@ -1,5 +1,5 @@
|
||||
CC = gcc
|
||||
CFLAGS += -Wall -DJUNGFRAUD -DVIRTUAL -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -DJUNGFRAUD -DVIRTUAL -DSLS_DETECTOR_FUNCTION_LIST -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lstdc++ -pthread
|
||||
|
||||
PROGS = jungfrauDetectorServer_virtual
|
||||
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/ansi.h
|
||||
../../../slsSupportLib/include/ansi.h
|
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
../commonFiles/communication_funcs.c
|
||||
../../../slsSupportLib/include/communication_funcs.c
|
@ -1 +1 @@
|
||||
../commonFiles/communication_funcs.h
|
||||
../../../slsSupportLib/include/communication_funcs.h
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
|
||||
Path: slsDetectorPackage/slsDetectorSoftware/slsDetectorServers/jungfrauDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 163
|
||||
Branch: developer
|
||||
Last Changed Author: Gemma_Tinti
|
||||
Last Changed Rev: 3999
|
||||
Last Changed Date: 2018-09-28 14:11:53.000000002 +0200 ./RegisterDefs.h
|
||||
Repsitory UUID: b9f97f42a6a369dfb5c484bffeaa7a417e9cbca1
|
||||
Revision: 1
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4067
|
||||
Last Changed Date: 2018-10-08 13:53:39.000000002 +0200 ./Makefile.virtual
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
|
||||
#define GITAUTH "Gemma_Tinti"
|
||||
#define GITREV 0x3999
|
||||
#define GITDATE 0x20180928
|
||||
#define GITBRANCH "developer"
|
||||
#define GITREPUUID "b9f97f42a6a369dfb5c484bffeaa7a417e9cbca1"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4067
|
||||
#define GITDATE 0x20181008
|
||||
#define GITBRANCH "refactor"
|
||||
|
@ -14,8 +14,8 @@
|
||||
/* global variables */
|
||||
//jungfrau doesnt require chips and chans (save memory)
|
||||
sls_detector_module *detectorModules=NULL;
|
||||
dacs_t *detectorDacs=NULL;
|
||||
dacs_t *detectorAdcs=NULL;
|
||||
int *detectorDacs=NULL;
|
||||
int *detectorAdcs=NULL;
|
||||
|
||||
enum detectorSettings thisSettings;
|
||||
enum masterFlags masterMode = NO_MASTER;
|
||||
@ -234,9 +234,6 @@ int testBus() {
|
||||
}
|
||||
|
||||
|
||||
int moduleTest( enum digitalTestMode arg, int imod){
|
||||
return OK;
|
||||
}
|
||||
|
||||
int detectorTest( enum digitalTestMode arg){
|
||||
#ifdef VIRTUAL
|
||||
@ -402,8 +399,8 @@ void allocateDetectorStructureMemory(){
|
||||
if (detectorDacs!=NULL) free(detectorDacs);
|
||||
if (detectorAdcs!=NULL) free(detectorAdcs);
|
||||
detectorModules=malloc(sizeof(sls_detector_module));
|
||||
detectorDacs=malloc(NDAC*sizeof(dacs_t));
|
||||
detectorAdcs=malloc(NADC*sizeof(dacs_t));
|
||||
detectorDacs=malloc(NDAC*sizeof(int));
|
||||
detectorAdcs=malloc(NADC*sizeof(int));
|
||||
#ifdef VERBOSE
|
||||
printf("modules from 0x%x to 0x%x\n",detectorModules, detectorModules+n);
|
||||
printf("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs+n*NDAC);
|
||||
@ -415,7 +412,6 @@ void allocateDetectorStructureMemory(){
|
||||
(detectorModules)->nadc=NADC;
|
||||
(detectorModules)->nchip=NCHIP;
|
||||
(detectorModules)->nchan=NCHIP*NCHAN;
|
||||
(detectorModules)->module=0;
|
||||
(detectorModules)->gain=0;
|
||||
(detectorModules)->offset=0;
|
||||
(detectorModules)->reg=0;
|
||||
@ -460,7 +456,7 @@ void setupDetector() {
|
||||
bus_w(ADC_PORT_INVERT_REG, ADC_PORT_INVERT_VAL);
|
||||
|
||||
//Initialization of acquistion parameters
|
||||
setSettings(DEFAULT_SETTINGS,-1);
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
@ -493,7 +489,7 @@ int setDefaultDacs() {
|
||||
for(i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i,defaultvals[i],0,0,retval);
|
||||
setDAC((enum DACINDEX)i,defaultvals[i],0,retval);
|
||||
if (retval[0] != defaultvals[i]) {
|
||||
cprintf(RED, "Warning: Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], retval[0]);
|
||||
ret = FAIL;
|
||||
@ -602,16 +598,8 @@ void configureASICTimer() {
|
||||
|
||||
|
||||
|
||||
/* set parameters - nmod, dr, roi */
|
||||
/* set parameters - dr, roi */
|
||||
|
||||
int setNMod(int nm, enum dimension dim){
|
||||
return NMOD;
|
||||
}
|
||||
|
||||
|
||||
int getNModBoard(enum dimension arg){
|
||||
return NMAXMOD;
|
||||
}
|
||||
|
||||
|
||||
int setDynamicRange(int dr){
|
||||
@ -861,7 +849,7 @@ int setModule(sls_detector_module myMod){
|
||||
printf("Setting module with settings %d\n",myMod.reg);
|
||||
//#endif
|
||||
|
||||
setSettings( (enum detectorSettings)myMod.reg,-1);
|
||||
setSettings( (enum detectorSettings)myMod.reg);
|
||||
|
||||
//copy module locally
|
||||
if (detectorModules)
|
||||
@ -869,7 +857,7 @@ int setModule(sls_detector_module myMod){
|
||||
|
||||
//set dac values
|
||||
for(i=0;i<myMod.ndac;i++)
|
||||
setDAC((enum DACINDEX)i,myMod.dacs[i],myMod.module,0,retval);
|
||||
setDAC((enum DACINDEX)i,myMod.dacs[i],0,retval);
|
||||
|
||||
return thisSettings;
|
||||
}
|
||||
@ -881,7 +869,7 @@ int getModule(sls_detector_module *myMod){
|
||||
|
||||
//dacs
|
||||
for(i=0;i<NDAC;i++)
|
||||
setDAC((enum DACINDEX)i,-1,-1,0,retval);
|
||||
setDAC((enum DACINDEX)i,-1,0,retval);
|
||||
|
||||
//copy from local copy
|
||||
if (detectorModules)
|
||||
@ -893,7 +881,7 @@ int getModule(sls_detector_module *myMod){
|
||||
|
||||
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
||||
enum detectorSettings setSettings(enum detectorSettings sett){
|
||||
if(sett == UNINITIALIZED)
|
||||
return thisSettings;
|
||||
|
||||
@ -1047,7 +1035,7 @@ int dacToVoltage(unsigned int digital){
|
||||
|
||||
|
||||
|
||||
void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
|
||||
void setDAC(enum DACINDEX ind, int val, int mV, int retval[]){
|
||||
int dacval = val;
|
||||
|
||||
//if set and mv, convert to dac
|
||||
@ -1099,7 +1087,7 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
|
||||
}
|
||||
|
||||
|
||||
int getADC(enum ADCINDEX ind, int imod){
|
||||
int getADC(enum ADCINDEX ind){
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#endif
|
||||
@ -1668,12 +1656,6 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
printf("Copying module %x to module %x\n",srcMod,destMod);
|
||||
#endif
|
||||
|
||||
if (srcMod->module>=0) {
|
||||
#ifdef VERBOSE
|
||||
printf("Copying module number %d to module number %d\n",srcMod->module,destMod->module);
|
||||
#endif
|
||||
destMod->module=srcMod->module;
|
||||
}
|
||||
if (srcMod->serialnumber>=0){
|
||||
|
||||
destMod->serialnumber=srcMod->serialnumber;
|
||||
@ -1732,28 +1714,14 @@ int calculateDataBytes(){
|
||||
return DATA_BYTES;
|
||||
}
|
||||
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerModule() * (int)getTotalNumberOfModules());}
|
||||
int getTotalNumberOfChips(){return ((int)getNumberOfChipsPerModule() * (int)getTotalNumberOfModules());}
|
||||
int getTotalNumberOfModules(){return NMOD;}
|
||||
int getNumberOfChannelsPerModule(){return ((int)getNumberOfChannelsPerChip() * (int)getTotalNumberOfChips());}
|
||||
int getNumberOfChipsPerModule(){return NCHIP;}
|
||||
int getNumberOfDACsPerModule(){return NDAC;}
|
||||
int getNumberOfADCsPerModule(){return NADC;}
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
||||
int getNumberOfChips(){return NCHIP;}
|
||||
int getNumberOfDACs(){return NDAC;}
|
||||
int getNumberOfADCs(){return NADC;}
|
||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||
|
||||
|
||||
|
||||
/* sync */
|
||||
|
||||
enum masterFlags setMaster(enum masterFlags arg){
|
||||
return NO_MASTER;
|
||||
}
|
||||
|
||||
enum synchronizationMode setSynchronization(enum synchronizationMode arg){
|
||||
return NO_SYNCHRONIZATION;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -46,8 +46,6 @@ enum NETWORKINDEX { TXN_FRAME };
|
||||
|
||||
|
||||
/* Hardware Definitions */
|
||||
#define NMAXMOD (1)
|
||||
#define NMOD (1)
|
||||
#define NCHAN (256 * 256)
|
||||
#define NCHIP (8)
|
||||
#define NADC (0)
|
||||
|
@ -1 +1 @@
|
||||
../commonFiles/sls_detector_defs.h
|
||||
../../../slsSupportLib/include/sls_detector_defs.h
|
@ -1 +1 @@
|
||||
../commonFiles/sls_detector_funcs.h
|
||||
../../../slsSupportLib/include/sls_detector_funcs.h
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/sls_receiver_defs.h
|
||||
../../../slsSupportLib/include/sls_receiver_defs.h
|
@ -1 +1 @@
|
||||
../../slsReceiverSoftware/include/sls_receiver_funcs.h
|
||||
../../../slsSupportLib/include/sls_receiver_funcs.h
|
@ -1,12 +1,12 @@
|
||||
SERVER=jungfrauDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
MAINDIR=slsDetectorPackage
|
||||
SPECDIR=slsDetectorSoftware/slsDetectorServers/$SERVER
|
||||
TMPFILE=gitInfoJungfrauTmp.h
|
||||
INCLFILE=gitInfoJungfrau.h
|
||||
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
EVALFILE=../../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ OLDDATE=$(more $INCLFILE | grep '#define GITDATE' | awk '{print $3}')
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
cd ../../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
@ -1 +1 @@
|
||||
../commonFiles/versionAPI.h
|
||||
../../../slsSupportLib/include/versionAPI.h
|
@ -1 +0,0 @@
|
||||
AXIS_BUILDTYPE ?= cris-axis-linux-gnu
|
@ -1,51 +0,0 @@
|
||||
# $Id: Makefile,v 1.1.1.1 2006/02/04 03:35:01 freza Exp $
|
||||
# first compile
|
||||
# make cris-axis-linux-gnu
|
||||
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||
|
||||
|
||||
PROGS= moenchDetectorServer
|
||||
INSTDIR= /tftpboot
|
||||
INSTMODE= 0777
|
||||
|
||||
|
||||
|
||||
BINS = testlib_sharedlibc
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
|
||||
OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
|
||||
|
||||
all: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
||||
|
||||
install: $(PROGS)
|
||||
$(INSTALL) -d $(INSTDIR)
|
||||
$(INSTALL) -m $(INSTMODE) $(PROGS) $(INSTDIR)
|
||||
|
||||
|
||||
romfs:
|
||||
$(ROMFSINST) /bin/$(PROGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(PROGS) *.o *.gdb
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
|
||||
DESTDIR ?= ./
|
||||
|
||||
CC = gcc
|
||||
CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG -DVIRTUAL
|
||||
|
||||
|
||||
PROGS= $(DESTDIR)/moenchVirtualServer
|
||||
|
||||
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
|
||||
OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
moenchVirtualServer = $(PROGS)
|
||||
|
||||
all: clean $(PROGS)
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf $(PROGS) *.o *.gdb
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
../../slsReceiverSoftware/include/ansi.h
|
@ -1 +0,0 @@
|
||||
../commonFiles/communication_funcs.c
|
@ -1 +0,0 @@
|
||||
../commonFiles/communication_funcs.h
|
File diff suppressed because it is too large
Load Diff
@ -1,179 +0,0 @@
|
||||
#ifndef FIRMWARE_FUNCS_H
|
||||
#define FIRMWARE_FUNCS_H
|
||||
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
//#include <asm/page.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
int mapCSP0(void);
|
||||
|
||||
u_int16_t bus_r16(u_int32_t offset);
|
||||
u_int16_t bus_w16(u_int32_t offset, u_int16_t data);//aldos function
|
||||
u_int32_t bus_w(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t bus_r(u_int32_t offset);
|
||||
|
||||
int setPhaseShiftOnce();
|
||||
int phaseStep(int st);
|
||||
int cleanFifo();
|
||||
int setDAQRegister();
|
||||
|
||||
u_int32_t putout(char *s, int modnum);
|
||||
u_int32_t readin(int modnum);
|
||||
u_int32_t setClockDivider(int d);
|
||||
u_int32_t getClockDivider();
|
||||
u_int32_t setSetLength(int d);
|
||||
u_int32_t getSetLength();
|
||||
u_int32_t setWaitStates(int d);
|
||||
u_int32_t getWaitStates();
|
||||
u_int32_t setTotClockDivider(int d);
|
||||
u_int32_t getTotClockDivider();
|
||||
u_int32_t setTotDutyCycle(int d);
|
||||
u_int32_t getTotDutyCycle();
|
||||
u_int32_t setOversampling(int d);
|
||||
|
||||
u_int32_t setExtSignal(int d, enum externalSignalFlag mode);
|
||||
int getExtSignal(int d);
|
||||
|
||||
u_int32_t setFPGASignal(int d, enum externalSignalFlag mode);
|
||||
int getFPGASignal(int d);
|
||||
|
||||
int setTiming(int t);
|
||||
|
||||
|
||||
int setConfigurationRegister(int d);
|
||||
int setToT(int d);
|
||||
int setContinousReadOut(int d);
|
||||
int startReceiver(int d);
|
||||
|
||||
int setDACRegister(int idac, int val, int imod);
|
||||
|
||||
int getTemperature(int tempSensor,int imod);
|
||||
int initHighVoltage(int val,int imod);
|
||||
int initConfGain(int isettings,int val,int imod);
|
||||
|
||||
int setADC(int adc);
|
||||
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int ival, int udpport);
|
||||
int getAdcConfigured();
|
||||
|
||||
|
||||
u_int64_t getDetectorNumber();
|
||||
u_int32_t getFirmwareVersion();
|
||||
int testFifos(void);
|
||||
u_int32_t testFpga(void);
|
||||
u_int32_t testRAM(void);
|
||||
int testBus(void);
|
||||
int setDigitalTestBit(int ival);
|
||||
|
||||
int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
||||
int64_t get64BitReg(int aLSB, int aMSB);
|
||||
|
||||
int64_t setFrames(int64_t value);
|
||||
int64_t getFrames();
|
||||
|
||||
int64_t setExposureTime(int64_t value);
|
||||
int64_t getExposureTime();
|
||||
|
||||
int64_t setGates(int64_t value);
|
||||
int64_t getGates();
|
||||
|
||||
int64_t setDelay(int64_t value);
|
||||
int64_t getDelay();
|
||||
|
||||
int64_t setPeriod(int64_t value);
|
||||
int64_t getPeriod();
|
||||
|
||||
int64_t setTrains(int64_t value);
|
||||
int64_t getTrains();
|
||||
|
||||
int64_t setProbes(int64_t value);
|
||||
int64_t getProbes();
|
||||
|
||||
int64_t getProgress();
|
||||
int64_t setProgress();
|
||||
|
||||
int64_t getActualTime();
|
||||
int64_t getMeasurementTime();
|
||||
|
||||
|
||||
u_int32_t runBusy(void);
|
||||
u_int32_t runState(void);
|
||||
u_int32_t dataPresent(void);
|
||||
|
||||
|
||||
int startStateMachine();
|
||||
int stopStateMachine();
|
||||
int startReadOut();
|
||||
u_int32_t fifoReset(void);
|
||||
u_int32_t fifoReadCounter(int fifonum);
|
||||
u_int32_t fifoReadStatus();
|
||||
|
||||
|
||||
u_int32_t fifo_full(void);
|
||||
|
||||
|
||||
|
||||
u_int32_t* fifo_read_event();
|
||||
u_int32_t* decode_data(int* datain);
|
||||
//u_int32_t move_data(u_int64_t* datain, u_int64_t* dataout);
|
||||
int setDynamicRange(int dr);
|
||||
int getDynamicRange();
|
||||
int getNModBoard();
|
||||
int setNMod(int n);
|
||||
int setStoreInRAM(int b);
|
||||
int allocateRAM();
|
||||
int clearRAM();
|
||||
|
||||
|
||||
int setMaster(int f);
|
||||
int setSynchronization(int s);
|
||||
|
||||
int loadImage(int index, short int ImageVals[]);
|
||||
int readCounterBlock(int startACQ, short int CounterVals[]);
|
||||
int resetCounterBlock(int startACQ);
|
||||
|
||||
int calibratePedestal(int frames);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
u_int32_t setNBits(u_int32_t);
|
||||
u_int32_t getNBits();
|
||||
*/
|
||||
|
||||
/*
|
||||
//move to mcb_funcs?
|
||||
|
||||
int readOutChan(int *val);
|
||||
u_int32_t getModuleNumber(int modnum);
|
||||
int testShiftIn(int imod);
|
||||
int testShiftOut(int imod);
|
||||
int testShiftStSel(int imod);
|
||||
int testDataInOut(int num, int imod);
|
||||
int testExtPulse(int imod);
|
||||
int testExtPulseMux(int imod, int ow);
|
||||
int testDataInOutMux(int imod, int ow, int num);
|
||||
int testOutMux(int imod);
|
||||
int testFpgaMux(int imod);
|
||||
int calibration_sensor(int num, int *values, int *dacs) ;
|
||||
int calibration_chip(int num, int *values, int *dacs);
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
@ -1,9 +0,0 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: e6bd874a88493557fc5127d4a1686832299aaf06
|
||||
Revision: 85
|
||||
Branch: 3.0.1
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3346
|
||||
Last Changed Date: 2018-02-07 09:14:36.000000002 +0100 ./server_funcs.c
|
@ -1,6 +0,0 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "e6bd874a88493557fc5127d4a1686832299aaf06"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3346
|
||||
#define GITDATE 0x20180207
|
||||
#define GITBRANCH "3.0.1"
|
@ -1,6 +0,0 @@
|
||||
#define GITURL ""
|
||||
#define GITREPUUID ""
|
||||
#define GITAUTH ""
|
||||
#define GITREV ""
|
||||
#define GITDATE ""
|
||||
#define GITBRANCH ""
|
File diff suppressed because it is too large
Load Diff
@ -1,173 +0,0 @@
|
||||
#ifdef MCB_FUNCS
|
||||
|
||||
#ifndef MCB_FUNCS_H
|
||||
#define MCB_FUNCS_H
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define RGPRVALS {100,50,200}
|
||||
#define RGSH1VALS {300,200,400}
|
||||
#define RGSH2VALS {260,300,260}
|
||||
|
||||
//high,dynamic,low,medium,very high
|
||||
#define CONF_GAIN {0,0, 0, 1, 6, 2, 1}//dynamic gain confgain yet to be figured out-probably 8 or 16
|
||||
|
||||
|
||||
#define DEFAULTGAIN {11.66,9.32,14.99}
|
||||
#define DEFAULTOFFSET {817.5,828.6,804.2}
|
||||
|
||||
// DAC definitions
|
||||
enum dacsVal{VDAC0, VDAC1, VDAC2, VDAC3, VDAC4, VDAC5, VDAC6, VDAC7, HIGH_VOLTAGE, CONFGAIN};
|
||||
|
||||
/* DAC adresses */
|
||||
#define DACCS {0,0,1,1,2,2,3,3,4,4,5,5,6,6}
|
||||
#define DACADDR {0,1,0,1,0,1,0,1,0,1,0,1,0,1}
|
||||
|
||||
//Register Definitions for temp,hv,dac gain
|
||||
enum adcVals{TEMP_FPGA, TEMP_ADC};
|
||||
|
||||
//dynamic range
|
||||
/*
|
||||
#define MAX5523 commented out by dhanya
|
||||
#ifndef MAX5523
|
||||
#define MAX5533
|
||||
#endif
|
||||
#ifdef MAX5533
|
||||
#define DAC_DR 4096
|
||||
#endif
|
||||
#ifdef MAX5523
|
||||
*/
|
||||
#define DAC_DR 1024
|
||||
//#endif
|
||||
|
||||
|
||||
//reference voltage
|
||||
#define DAC_REFOUT1
|
||||
#ifdef DAC_REFOUT2
|
||||
#define DAC_MAX 2.425
|
||||
#define DAC_REFOUT 2
|
||||
#define DAC_REFOUT1
|
||||
#endif
|
||||
#ifdef DAC_REFOUT3
|
||||
#define DAC_MAX 3.885
|
||||
#define DAC_REFOUT 3
|
||||
#define DAC_REFOUT1
|
||||
#endif
|
||||
#ifdef DAC_REFOUT0
|
||||
#define DAC_MAX 1.214
|
||||
#define DAC_REFOUT 0
|
||||
#endif
|
||||
#ifdef DAC_REFOUT1
|
||||
#define DAC_MAX 1.940
|
||||
#define DAC_REFOUT 1
|
||||
#endif
|
||||
|
||||
/* dac calibration constants */
|
||||
|
||||
#define VA 1.11
|
||||
|
||||
#define CVTRIM 52.430851
|
||||
#define BVTRIM -0.102022
|
||||
#define AVTRIM 0.000050
|
||||
|
||||
#define PARTREF {100,1.55,-2.5,-2.5,0,-2.5}
|
||||
#define PARTR1 {78,10,10,10,10,10}
|
||||
#define PARTR2 {0,4.7,27,47,22,47}
|
||||
|
||||
|
||||
//chip shiftin register meaning
|
||||
#define OUTMUX_OFFSET 20
|
||||
#define PROBES_OFFSET 4
|
||||
#define OUTBUF_OFFSET 0
|
||||
|
||||
|
||||
void showbits(int h);
|
||||
|
||||
int initDetector();
|
||||
int copyChannel(sls_detector_channel *destChan, sls_detector_channel *srcChan);
|
||||
int copyChip(sls_detector_chip *destChip, sls_detector_chip *srcChip);
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);
|
||||
|
||||
/* Register commands */
|
||||
int clearDACSregister(int imod );
|
||||
int nextDAC(int imod );
|
||||
int clearCSregister(int imod );
|
||||
int setCSregister(int imod );
|
||||
int nextChip(int imod );
|
||||
int firstChip(int imod );
|
||||
int clearSSregister(int imod );
|
||||
int setSSregister(int imod );
|
||||
int nextStrip(int imod );
|
||||
int selChannel(int strip,int imod );
|
||||
int selChip(int chip,int imod );
|
||||
int selMod(int mod,int imod );
|
||||
|
||||
/* DACs routines */
|
||||
int program_one_dac(int addr, int value,int imod );
|
||||
int set_one_dac(int imod);
|
||||
int initDAC(int dac_addr, int value,int imod );
|
||||
int initDACs(int* v,int imod );
|
||||
int setSettings(int i,int imod);
|
||||
int initDACbyIndex(int ind,int val, int imod);
|
||||
int initDACbyIndexDACU(int ind,int val, int imod, int mV, int retval[]);
|
||||
int getDACbyIndexDACU(int ind, int imod);
|
||||
|
||||
|
||||
/* Other DAC index routines*/
|
||||
int getTemperatureByModule(int tempSensor, int imod);
|
||||
int initHighVoltageByModule(int val, int imod);
|
||||
int initConfGainByModule(int isettings,int val,int imod);
|
||||
|
||||
/* Initialization*/
|
||||
int initChannel(int ft,int cae, int ae, int coe, int ocoe, int counts,int imod );
|
||||
int initChannelbyNumber(sls_detector_channel myChan);
|
||||
int getChannelbyNumber(sls_detector_channel*);
|
||||
|
||||
int getTrimbit(int imod, int ichip, int ichan);
|
||||
|
||||
int initChip(int obe, int ow,int imod );
|
||||
|
||||
int initChipWithProbes(int obe, int ow,int nprobes, int imod);
|
||||
//int getNProbes();
|
||||
|
||||
int initChipbyNumber(sls_detector_chip myChip);
|
||||
int getChipbyNumber(sls_detector_chip*);
|
||||
int initMCBregisters(int cm,int imod );
|
||||
int initModulebyNumber(sls_detector_module);
|
||||
int getModulebyNumber(sls_detector_module*);
|
||||
|
||||
/* To chips */
|
||||
int clearCounter(int imod );
|
||||
int clearOutReg(int imod);
|
||||
int setOutReg(int imod );
|
||||
int extPulse(int ncal,int imod );
|
||||
int calPulse(int ncal,int imod );
|
||||
int counterClear(int imod );
|
||||
int countEnable(int imod );
|
||||
int counterSet(int imod );
|
||||
|
||||
|
||||
/* moved from firmware_funcs */
|
||||
|
||||
int readOutChan(int *val);
|
||||
|
||||
int getModuleNumber(int modnum);
|
||||
int testShiftIn(int imod);
|
||||
int testShiftOut(int imod);
|
||||
int testShiftStSel(int imod);
|
||||
int testDataInOut(int num, int imod);
|
||||
int testExtPulse(int imod);
|
||||
int testExtPulseMux(int imod, int ow);
|
||||
int testDataInOutMux(int imod, int ow, int num);
|
||||
int testOutMux(int imod);
|
||||
int testFpgaMux(int imod);
|
||||
int calibration_sensor(int num, int *values, int *dacs) ;
|
||||
int calibration_chip(int num, int *values, int *dacs);
|
||||
|
||||
|
||||
|
||||
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Binary file not shown.
@ -1,309 +0,0 @@
|
||||
#ifndef REGISTERS_G_H
|
||||
#define REGISTERS_G_H
|
||||
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
|
||||
/* Definitions for FPGA*/
|
||||
#define CSP0 0x20200000
|
||||
#define MEM_SIZE 0x100000
|
||||
|
||||
|
||||
|
||||
/* values defined for FPGA */
|
||||
#define MCSNUM 0x0
|
||||
#define FIXED_PATT_VAL 0xacdc1980
|
||||
|
||||
|
||||
#define FPGA_INIT_PAT 0x60008
|
||||
#define FPGA_INIT_ADDR 0xb0000000
|
||||
|
||||
|
||||
|
||||
|
||||
/* registers defined in FPGA */
|
||||
#define PCB_REV_REG 0x2c<<11
|
||||
#define GAIN_REG 0x10<<11
|
||||
//#define FLOW_CONTROL_REG 0x11<<11
|
||||
//#define FLOW_STATUS_REG 0x12<<11
|
||||
//#define FRAME_REG 0x13<<11
|
||||
#define MULTI_PURPOSE_REG 0x14<<11
|
||||
#define DAQ_REG 0x15<<11
|
||||
//#define TIME_FROM_START_REG 0x16<<11
|
||||
#define MCB_CNTRL_REG_OFF 0x17<<11// control the dacs
|
||||
//ADC
|
||||
#define ADC_WRITE_REG 0x18<<11
|
||||
#define ADC_SYNC_REG 0x19<<11
|
||||
//#define MUTIME_REG 0x1a<<11
|
||||
//temperature
|
||||
#define TEMP_IN_REG 0x1b<<11
|
||||
#define TEMP_OUT_REG 0x1c<<11
|
||||
//configure MAC
|
||||
#define TSE_CONF_REG 0x1d<<11
|
||||
#define ENET_CONF_REG 0x1e<<11
|
||||
//#define WRTSE_SHAD_REG 0x1f<<11
|
||||
//HV
|
||||
#define HV_REG 0x20<<11
|
||||
|
||||
|
||||
#define DUMMY_REG 0x21<<11
|
||||
#define FPGA_VERSION_REG 0x22<<11
|
||||
#define FIX_PATT_REG 0x23<<11
|
||||
#define CONTROL_REG 0x24<<11
|
||||
#define STATUS_REG 0x25<<11
|
||||
#define CONFIG_REG 0x26<<11
|
||||
#define EXT_SIGNAL_REG 0x27<<11
|
||||
#define FPGA_SVN_REG 0x29<<11
|
||||
|
||||
|
||||
#define CHIP_OF_INTRST_REG 0x2A<<11
|
||||
|
||||
//FIFO
|
||||
#define LOOK_AT_ME_REG 0x28<<11
|
||||
|
||||
#define FIFO_DATA_REG_OFF 0x50<<11 ///////
|
||||
|
||||
|
||||
//to read back dac registers
|
||||
#define MOD_DACS1_REG 0x65<<11
|
||||
#define MOD_DACS2_REG 0x66<<11
|
||||
#define MOD_DACS3_REG 0x67<<11
|
||||
|
||||
//user entered
|
||||
#define SET_DELAY_LSB_REG 0x68<<11
|
||||
#define SET_DELAY_MSB_REG 0x69<<11
|
||||
#define GET_DELAY_LSB_REG 0x6a<<11
|
||||
#define GET_DELAY_MSB_REG 0x6b<<11
|
||||
|
||||
#define SET_TRAINS_LSB_REG 0x6c<<11
|
||||
#define SET_TRAINS_MSB_REG 0x6d<<11
|
||||
#define GET_TRAINS_LSB_REG 0x6e<<11
|
||||
#define GET_TRAINS_MSB_REG 0x6f<<11
|
||||
|
||||
#define SET_FRAMES_LSB_REG 0x70<<11
|
||||
#define SET_FRAMES_MSB_REG 0x71<<11
|
||||
#define GET_FRAMES_LSB_REG 0x72<<11
|
||||
#define GET_FRAMES_MSB_REG 0x73<<11
|
||||
|
||||
#define SET_PERIOD_LSB_REG 0x74<<11
|
||||
#define SET_PERIOD_MSB_REG 0x75<<11
|
||||
#define GET_PERIOD_LSB_REG 0x76<<11
|
||||
#define GET_PERIOD_MSB_REG 0x77<<11
|
||||
|
||||
#define SET_EXPTIME_LSB_REG 0x78<<11
|
||||
#define SET_EXPTIME_MSB_REG 0x79<<11
|
||||
#define GET_EXPTIME_LSB_REG 0x7a<<11
|
||||
#define GET_EXPTIME_MSB_REG 0x7b<<11
|
||||
|
||||
#define SET_GATES_LSB_REG 0x7c<<11
|
||||
#define SET_GATES_MSB_REG 0x7d<<11
|
||||
#define GET_GATES_LSB_REG 0x7e<<11
|
||||
#define GET_GATES_MSB_REG 0x7f<<11
|
||||
|
||||
|
||||
|
||||
#define PLL_PARAM_REG 0x37<<11
|
||||
#define PLL_PARAM_OUT_REG 0x38<<11
|
||||
#define PLL_CNTRL_REG 0x34<<11
|
||||
|
||||
#define ROI_REG 0x35<<11
|
||||
#define OVERSAMPLING_REG 0x36<<11
|
||||
#define MOENCH_CNTR_REG 0x31<<11
|
||||
#define MOENCH_CNTR_OUT_REG 0x33<<11
|
||||
#define MOENCH_CNTR_CONF_REG 0x32<<11
|
||||
|
||||
|
||||
|
||||
//image
|
||||
#define DARK_IMAGE_REG 0x81<<11
|
||||
#define GAIN_IMAGE_REG 0x82<<11
|
||||
|
||||
//counter block memory
|
||||
#define COUNTER_MEMORY_REG 0x85<<11
|
||||
|
||||
|
||||
#define GET_MEASUREMENT_TIME_LSB_REG 0x023000
|
||||
#define GET_MEASUREMENT_TIME_MSB_REG 0x024000
|
||||
|
||||
#define GET_ACTUAL_TIME_LSB_REG 0x025000
|
||||
#define GET_ACTUAL_TIME_MSB_REG 0x026000
|
||||
|
||||
|
||||
//not used
|
||||
//#define MCB_DOUT_REG_OFF 0x200000
|
||||
//#define FIFO_CNTRL_REG_OFF 0x300000
|
||||
//#define FIFO_COUNTR_REG_OFF 0x400000
|
||||
//not used so far
|
||||
//#define SPEED_REG 0x006000
|
||||
//#define SET_NBITS_REG 0x008000
|
||||
//not used
|
||||
//#define GET_SHIFT_IN_REG 0x022000
|
||||
|
||||
|
||||
|
||||
#define SHIFTMOD 2
|
||||
#define SHIFTFIFO 9
|
||||
|
||||
/** for PCB_REV_REG */
|
||||
#define DETECTOR_TYPE_MASK 0xF0000
|
||||
#define DETECTOR_TYPE_OFFSET 16
|
||||
#define BOARD_REVISION_MASK 0xFFFF
|
||||
#define MOENCH_MODULE 2
|
||||
|
||||
|
||||
|
||||
|
||||
/* for control register */
|
||||
#define START_ACQ_BIT 0x00000001
|
||||
#define STOP_ACQ_BIT 0x00000002
|
||||
#define START_FIFOTEST_BIT 0x00000004 // ?????
|
||||
#define STOP_FIFOTEST_BIT 0x00000008 // ??????
|
||||
#define START_READOUT_BIT 0x00000010
|
||||
#define STOP_READOUT_BIT 0x00000020
|
||||
#define START_EXPOSURE_BIT 0x00000040
|
||||
#define STOP_EXPOSURE_BIT 0x00000080
|
||||
#define START_TRAIN_BIT 0x00000100
|
||||
#define STOP_TRAIN_BIT 0x00000200
|
||||
#define SYNC_RESET 0x00000400
|
||||
|
||||
/* for status register */
|
||||
#define RUN_BUSY_BIT 0x00000001
|
||||
#define READOUT_BUSY_BIT 0x00000002
|
||||
#define FIFOTEST_BUSY_BIT 0x00000004 //????
|
||||
#define WAITING_FOR_TRIGGER_BIT 0x00000008
|
||||
#define DELAYBEFORE_BIT 0x00000010
|
||||
#define DELAYAFTER_BIT 0x00000020
|
||||
#define EXPOSING_BIT 0x00000040
|
||||
#define COUNT_ENABLE_BIT 0x00000080
|
||||
#define READSTATE_0_BIT 0x00000100
|
||||
#define READSTATE_1_BIT 0x00000200
|
||||
#define READSTATE_2_BIT 0x00000400
|
||||
|
||||
#define RUNSTATE_0_BIT 0x00001000
|
||||
#define RUNSTATE_1_BIT 0x00002000
|
||||
#define RUNSTATE_2_BIT 0x00004000
|
||||
#define SOME_FIFO_FULL_BIT 0x00008000 // error!
|
||||
#define ALL_FIFO_EMPTY_BIT 0x00010000 // data ready
|
||||
#define RUNMACHINE_BUSY_BIT 0x00020000
|
||||
#define READMACHINE_BUSY_BIT 0x00040000
|
||||
|
||||
|
||||
|
||||
/* for fifo status register */
|
||||
#define FIFO_ENABLED_BIT 0x80000000
|
||||
#define FIFO_DISABLED_BIT 0x01000000
|
||||
#define FIFO_ERROR_BIT 0x08000000
|
||||
#define FIFO_EMPTY_BIT 0x04000000
|
||||
#define FIFO_DATA_READY_BIT 0x02000000
|
||||
#define FIFO_COUNTER_MASK 0x000001ff
|
||||
#define FIFO_NM_MASK 0x00e00000
|
||||
#define FIFO_NM_OFF 21
|
||||
#define FIFO_NC_MASK 0x001ffe00
|
||||
#define FIFO_NC_OFF 9
|
||||
|
||||
/* for config register *///not really used yet
|
||||
#define TOT_ENABLE_BIT 0x00000002
|
||||
#define TIMED_GATE_BIT 0x00000004
|
||||
#define CONT_RO_ENABLE_BIT 0x00080000
|
||||
#define CPU_OR_RECEIVER_BIT 0x00001000
|
||||
|
||||
|
||||
|
||||
/* for speed register */
|
||||
#define CLK_DIVIDER_MASK 0x000000ff
|
||||
#define CLK_DIVIDER_OFFSET 0
|
||||
#define SET_LENGTH_MASK 0x00000f00
|
||||
#define SET_LENGTH_OFFSET 8
|
||||
#define WAIT_STATES_MASK 0x0000f000
|
||||
#define WAIT_STATES_OFFSET 12
|
||||
#define TOTCLK_DIVIDER_MASK 0xff000000
|
||||
#define TOTCLK_DIVIDER_OFFSET 24
|
||||
#define TOTCLK_DUTYCYCLE_MASK 0x00ff0000
|
||||
#define TOTCLK_DUTYCYCLE_OFFSET 16
|
||||
|
||||
/* for external signal register */
|
||||
#define SIGNAL_OFFSET 4
|
||||
#define SIGNAL_MASK 0xF
|
||||
#define EXT_SIG_OFF 0x0
|
||||
#define EXT_GATE_IN_ACTIVEHIGH 0x1
|
||||
#define EXT_GATE_IN_ACTIVELOW 0x2
|
||||
#define EXT_TRIG_IN_RISING 0x3
|
||||
#define EXT_TRIG_IN_FALLING 0x4
|
||||
#define EXT_RO_TRIG_IN_RISING 0x5
|
||||
#define EXT_RO_TRIG_IN_FALLING 0x6
|
||||
#define EXT_GATE_OUT_ACTIVEHIGH 0x7
|
||||
#define EXT_GATE_OUT_ACTIVELOW 0x8
|
||||
#define EXT_TRIG_OUT_RISING 0x9
|
||||
#define EXT_TRIG_OUT_FALLING 0xA
|
||||
#define EXT_RO_TRIG_OUT_RISING 0xB
|
||||
#define EXT_RO_TRIG_OUT_FALLING 0xC
|
||||
|
||||
|
||||
|
||||
/* for temperature register */
|
||||
#define T1_CLK_BIT 0x00000001
|
||||
#define T1_CS_BIT 0x00000002
|
||||
#define T2_CLK_BIT 0x00000004
|
||||
#define T2_CS_BIT 0x00000008
|
||||
|
||||
|
||||
|
||||
/* fifo control register */
|
||||
#define FIFO_RESET_BIT 0x00000001
|
||||
#define FIFO_DISABLE_TOGGLE_BIT 0x00000002
|
||||
|
||||
|
||||
//chip shiftin register meaning
|
||||
#define OUTMUX_OFF 20
|
||||
#define OUTMUX_MASK 0x1f
|
||||
#define PROBES_OFF 4
|
||||
#define PROBES_MASK 0x7f
|
||||
#define OUTBUF_OFF 0
|
||||
#define OUTBUF_MASK 1
|
||||
|
||||
|
||||
/* multi purpose register */
|
||||
#define PHASE_STEP_BIT 0x00000001
|
||||
#define PHASE_STEP_OFFSET 0
|
||||
// #define xxx_BIT 0x00000002
|
||||
#define RESET_COUNTER_BIT 0x00000004
|
||||
#define RESET_COUNTER_OFFSET 2
|
||||
//#define xxx_BIT 0x00000008
|
||||
//#define xxx_BIT 0x00000010
|
||||
#define SW1_BIT 0x00000020
|
||||
#define SW1_OFFSET 5
|
||||
#define WRITE_BACK_BIT 0x00000040
|
||||
#define WRITE_BACK_OFFSET 6
|
||||
#define RESET_BIT 0x00000080
|
||||
#define RESET_OFFSET 7
|
||||
#define ENET_RESETN_BIT 0x00000800
|
||||
#define ENET_RESETN_OFFSET 11
|
||||
#define INT_RSTN_BIT 0x00002000
|
||||
#define INT_RSTN_OFFSET 13
|
||||
#define DIGITAL_TEST_BIT 0x00004000
|
||||
#define DIGITAL_TEST_OFFSET 14
|
||||
//#define CHANGE_AT_POWER_ON_BIT 0x00008000
|
||||
//#define CHANGE_AT_POWER_ON_OFFSET 15
|
||||
|
||||
|
||||
/* settings/conf gain register */
|
||||
#define GAIN_MASK 0x0000000f
|
||||
#define GAIN_OFFSET 0
|
||||
#define SETTINGS_MASK 0x000000f0
|
||||
#define SETTINGS_OFFSET 4
|
||||
|
||||
|
||||
/* CHIP_OF_INTRST_REG */
|
||||
#define CHANNEL_MASK 0xffff0000
|
||||
#define CHANNEL_OFFSET 16
|
||||
#define ACTIVE_ADC_MASK 0x0000001f
|
||||
|
||||
|
||||
|
||||
/**ADC SYNC CLEAN FIFO*/
|
||||
#define ADCSYNC_CLEAN_FIFO_BITS 0x300000
|
||||
#define CLEAN_FIFO_MASK 0x0fffff
|
||||
|
||||
#endif
|
||||
|
@ -1,112 +0,0 @@
|
||||
/* A simple server in the internet domain using TCP
|
||||
The port number is passed as an argument */
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include "communication_funcs.h"
|
||||
#include "server_funcs.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
extern int sockfd;
|
||||
extern int phase_shift;
|
||||
|
||||
|
||||
|
||||
void error(char *msg)
|
||||
{
|
||||
perror(msg);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int portno, b;
|
||||
char cmd[500];
|
||||
int retval=OK;
|
||||
int sd, fd;
|
||||
int iarg;
|
||||
|
||||
|
||||
for(iarg=1; iarg<argc; iarg++){
|
||||
|
||||
if(!strcasecmp(argv[iarg],"-phaseshift")){
|
||||
if(argc==iarg+1){
|
||||
printf("No phaseshift given. Exiting.\n");
|
||||
return 1;
|
||||
}
|
||||
if ( sscanf(argv[iarg+1],"%d",&phase_shift)==0) {
|
||||
printf("could not decode phase shift\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//stop server
|
||||
if ((argc > 2) && (!strcasecmp(argv[2],"stopserver"))){
|
||||
portno = DEFAULT_PORTNO+1;
|
||||
if ( sscanf(argv[1],"%d",&portno) ==0) {
|
||||
printf("could not open stop server: unknown port\n");
|
||||
return 1;
|
||||
}
|
||||
b=0;
|
||||
printf("\n\nStop Server\nOpening stop server on port %d\n",portno);
|
||||
}
|
||||
|
||||
//control server
|
||||
else {
|
||||
portno = DEFAULT_PORTNO;
|
||||
sprintf(cmd,"%s %d stopserver &",argv[0],DEFAULT_PORTNO+1);
|
||||
printf("\n\nControl Server\nOpening control server on port %d\n",portno );
|
||||
|
||||
//printf("\n\ncmd:%s\n",cmd);
|
||||
system(cmd);
|
||||
b=1;
|
||||
}
|
||||
|
||||
|
||||
init_detector(b);
|
||||
|
||||
|
||||
sd=bindSocket(portno);
|
||||
sockfd=sd;
|
||||
if (getServerError(sd)) {
|
||||
printf("server error!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* assign function table */
|
||||
function_table();
|
||||
#ifdef VERBOSE
|
||||
printf("function table assigned \n");
|
||||
#endif
|
||||
|
||||
|
||||
/* waits for connection */
|
||||
while(retval!=GOODBYE) {
|
||||
#ifdef VERBOSE
|
||||
printf("\n");
|
||||
#endif
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("Waiting for client call\n");
|
||||
#endif
|
||||
fd=acceptConnection(sockfd);
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("Conenction accepted\n");
|
||||
#endif
|
||||
retval=decode_function(fd);
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("function executed\n");
|
||||
#endif
|
||||
closeConnection(fd);
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("connection closed\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
exitServer(sockfd);
|
||||
printf("Goodbye!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
#ifndef SERVER_DEFS_H
|
||||
#define SERVER_DEFS_H
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// Hardware definitions
|
||||
|
||||
#define NCHAN (160*160)
|
||||
#define NCHIP 1
|
||||
#define NMAXMODX 1
|
||||
#define NMAXMODY 1
|
||||
#define NMAXMOD (NMAXMODX*NMAXMODY)
|
||||
#define NDAC 8
|
||||
#define NADC 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define NCHANS (NCHAN*NCHIP*NMAXMOD)
|
||||
#define NDACS (NDAC*NMAXMOD)
|
||||
|
||||
#define NTRIMBITS 6
|
||||
#define NCOUNTBITS 24
|
||||
|
||||
#define NCHIPS_PER_ADC 2
|
||||
|
||||
//#define TRIM_DR ((2**NTRIMBITS)-1)
|
||||
//#define COUNT_DR ((2**NCOUNTBITS)-1)
|
||||
#define TRIM_DR (((int)pow(2,NTRIMBITS))-1)
|
||||
#define COUNT_DR (((int)pow(2,NCOUNTBITS))-1)
|
||||
|
||||
|
||||
#define ALLMOD 0xffff
|
||||
#define ALLFIFO 0xffff
|
||||
|
||||
#define GOTTHARD_ADCSYNC_VAL 0x32214
|
||||
#define ADCSYNC_VAL 0x02111
|
||||
#define TOKEN_RESTART_DELAY 0x88000000
|
||||
#define TOKEN_RESTART_DELAY_ROI 0x1b000000
|
||||
#define TOKEN_TIMING_REV1 0x1f16
|
||||
#define TOKEN_TIMING_REV2 0x1f0f
|
||||
|
||||
#define DEFAULT_PHASE_SHIFT 0 // 120
|
||||
#define DEFAULT_IP_PACKETSIZE 0x0522
|
||||
#define DEFAULT_UDP_PACKETSIZE 0x050E
|
||||
#define ADC1_IP_PACKETSIZE 256*2+14+20
|
||||
#define ADC1_UDP_PACKETSIZE 256*2+4+8+2
|
||||
|
||||
#ifdef VIRTUAL
|
||||
#define DEBUGOUT
|
||||
#endif
|
||||
|
||||
#define CLK_FREQ 65.6E+6
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,97 +0,0 @@
|
||||
#ifndef SERVER_FUNCS_H
|
||||
#define SERVER_FUNCS_H
|
||||
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
/*
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
*/
|
||||
#include "communication_funcs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#define GOODBYE -200
|
||||
|
||||
int sockfd;
|
||||
|
||||
int function_table();
|
||||
|
||||
int decode_function(int);
|
||||
int init_detector(int);
|
||||
|
||||
int M_nofunc(int);
|
||||
int exit_server(int);
|
||||
|
||||
|
||||
|
||||
|
||||
// General purpose functions
|
||||
int get_detector_type(int);
|
||||
int set_number_of_modules(int);
|
||||
int get_max_number_of_modules(int);
|
||||
|
||||
|
||||
int exec_command(int);
|
||||
int set_external_signal_flag(int);
|
||||
int set_external_communication_mode(int);
|
||||
int get_id(int);
|
||||
int digital_test(int);
|
||||
int write_register(int);
|
||||
int read_register(int);
|
||||
int set_dac(int);
|
||||
int get_adc(int);
|
||||
int set_channel(int);
|
||||
int set_chip(int);
|
||||
int set_module(int);
|
||||
int get_channel(int);
|
||||
int get_chip(int);
|
||||
int get_module(int);
|
||||
|
||||
int get_threshold_energy(int);
|
||||
int set_threshold_energy(int);
|
||||
int set_settings(int);
|
||||
int start_acquisition(int);
|
||||
int stop_acquisition(int);
|
||||
int start_readout(int);
|
||||
int get_run_status(int);
|
||||
int read_frame(int);
|
||||
int read_all(int);
|
||||
int start_and_read_all(int);
|
||||
int set_timer(int);
|
||||
int get_time_left(int);
|
||||
int set_dynamic_range(int);
|
||||
int set_roi(int);
|
||||
int get_roi(int);
|
||||
int set_speed(int);
|
||||
void prepareADC(void);
|
||||
int set_readout_flags(int);
|
||||
int execute_trimming(int);
|
||||
int lock_server(int);
|
||||
int set_port(int);
|
||||
int get_last_client_ip(int);
|
||||
int set_master(int);
|
||||
int set_synchronization(int);
|
||||
|
||||
int update_client(int);
|
||||
int send_update(int);
|
||||
int configure_mac(int);
|
||||
|
||||
int load_image(int);
|
||||
int read_counter_block(int);
|
||||
int reset_counter_block(int);
|
||||
|
||||
int start_receiver(int);
|
||||
int stop_receiver(int);
|
||||
|
||||
|
||||
int calibrate_pedestal(int);
|
||||
|
||||
int set_roi(int);
|
||||
|
||||
#endif
|
@ -1,39 +0,0 @@
|
||||
#include "sharedmemory.h"
|
||||
|
||||
struct statusdata *stdata;
|
||||
|
||||
int inism(int clsv) {
|
||||
|
||||
static int scansmid;
|
||||
|
||||
if (clsv==SMSV) {
|
||||
if ( (scansmid=shmget(SMKEY,1024,IPC_CREAT | 0666 ))==-1 ) {
|
||||
return -1;
|
||||
}
|
||||
if ( (stdata=shmat(scansmid,NULL,0))==(void*)-1) {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
if (clsv==SMCL) {
|
||||
if ( (scansmid=shmget(SMKEY,0,0) )==-1 ) {
|
||||
return -3;
|
||||
}
|
||||
if ( (stdata=shmat(scansmid,NULL,0))==(void*)-1) {
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void write_status_sm(char *status) {
|
||||
strcpy(stdata->status,status);
|
||||
}
|
||||
|
||||
void write_stop_sm(int v) {
|
||||
stdata->stop=v;
|
||||
}
|
||||
|
||||
void write_runnumber_sm(int v) {
|
||||
stdata->runnumber=v;
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
#ifndef SM
|
||||
#define SM
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
//#include <asm/page.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* key for shared memory */
|
||||
#define SMKEY 10001
|
||||
|
||||
#define SMSV 1
|
||||
#define SMCL 2
|
||||
|
||||
|
||||
struct statusdata {
|
||||
int runnumber;
|
||||
int stop;
|
||||
char status[20];
|
||||
} ;
|
||||
|
||||
|
||||
/* for shared memory */
|
||||
|
||||
int inism(int clsv);
|
||||
void write_status_sm(char *status);
|
||||
void write_stop_sm(int v);
|
||||
void write_runnumber_sm(int v);
|
||||
|
||||
#endif
|
@ -1 +0,0 @@
|
||||
../commonFiles/sls_detector_defs.h
|
@ -1 +0,0 @@
|
||||
../commonFiles/sls_detector_funcs.h
|
@ -1 +0,0 @@
|
||||
../../slsReceiverSoftware/include/sls_receiver_defs.h
|
@ -1 +0,0 @@
|
||||
../../slsReceiverSoftware/include/sls_receiver_funcs.h
|
@ -1,46 +0,0 @@
|
||||
/* A simple server in the internet domain using TCP
|
||||
The port number is passed as an argument */
|
||||
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
|
||||
#include "communication_funcs.h"
|
||||
#include "firmware_funcs.h"
|
||||
|
||||
|
||||
int sockfd;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int portno;
|
||||
int retval=0;
|
||||
|
||||
portno = DEFAULT_PORTNO;
|
||||
|
||||
|
||||
bindSocket(portno);
|
||||
if (getServerError())
|
||||
return -1;
|
||||
|
||||
|
||||
|
||||
/* waits for connection */
|
||||
while(retval!=GOODBYE) {
|
||||
#ifdef VERBOSE
|
||||
printf("\n");
|
||||
#endif
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("Stop server: waiting for client call\n");
|
||||
#endif
|
||||
acceptConnection();
|
||||
retval=stopStateMachine();
|
||||
closeConnection();
|
||||
}
|
||||
|
||||
exitServer();
|
||||
printf("Goodbye!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,749 +0,0 @@
|
||||
#ifndef PICASSOD
|
||||
#include "server_defs.h"
|
||||
#else
|
||||
#include "picasso_defs.h"
|
||||
#endif
|
||||
#include "trimming_funcs.h"
|
||||
#include "mcb_funcs.h"
|
||||
#include "firmware_funcs.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
||||
extern int nModX;
|
||||
//extern int *values;
|
||||
|
||||
extern const int nChans;
|
||||
extern const int nChips;
|
||||
extern const int nDacs;
|
||||
extern const int nAdcs;
|
||||
|
||||
|
||||
int trim_fixed_settings(int countlim, int par2, int im)
|
||||
{
|
||||
|
||||
int retval=OK;
|
||||
#ifdef VERBOSE
|
||||
printf("Trimming with fixed settings\n");
|
||||
#endif
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
|
||||
if (par2<=0)
|
||||
retval=trim_with_level(countlim, im);
|
||||
else
|
||||
retval=trim_with_median(countlim,im);
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
int trim_with_noise(int countlim, int nsigma, int im)
|
||||
{
|
||||
|
||||
|
||||
int retval=OK, retval1=OK, retval2=OK;
|
||||
#ifdef VERBOSE
|
||||
printf("Trimming using noise\n");
|
||||
#endif
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
|
||||
/* threshold scan */
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("chosing vthresh and vtrim.....");
|
||||
#endif
|
||||
retval1=choose_vthresh_and_vtrim(countlim,nsigma, im);
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("trimming with noise.....\n");
|
||||
#endif
|
||||
retval2=trim_with_level(countlim, im);
|
||||
|
||||
#ifdef DEBUGOUT
|
||||
printf("done\n");
|
||||
#endif
|
||||
if (retval1==OK && retval2==OK)
|
||||
retval=OK;
|
||||
else
|
||||
retval=FAIL;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
int trim_with_beam(int countlim, int nsigma, int im) //rpc
|
||||
{
|
||||
|
||||
|
||||
int retval=OK, retval1=OK, retval2=OK;
|
||||
|
||||
printf("Trimming using beam\n");
|
||||
//return OK;
|
||||
#ifdef VIRTUAL
|
||||
printf("Trimming using beam\n");
|
||||
return OK;
|
||||
#endif
|
||||
/* threshold scan */
|
||||
#ifdef DEBUGOUT
|
||||
printf("chosing vthresh and vtrim.....");
|
||||
#endif
|
||||
|
||||
retval1=choose_vthresh_and_vtrim(countlim,nsigma,im);
|
||||
retval2=trim_with_median(TRIM_DR, im);
|
||||
|
||||
#ifdef DEBUGOUT
|
||||
printf("done\n");
|
||||
#endif
|
||||
|
||||
if (retval1==OK && retval2==OK)
|
||||
retval=OK;
|
||||
else
|
||||
retval=FAIL;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int trim_improve(int maxit, int par2, int im) //rpc
|
||||
{
|
||||
|
||||
int retval=OK, retval1=OK, retval2=OK;
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Improve the trimming\n");
|
||||
#endif
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
|
||||
|
||||
if (par2!=0 && im==ALLMOD)
|
||||
retval1=choose_vthresh();
|
||||
|
||||
retval2=trim_with_median(2*maxit+1, im);
|
||||
#ifdef DEBUGOUT
|
||||
printf("done\n");
|
||||
#endif
|
||||
if (retval1==OK && retval2==OK)
|
||||
retval=OK;
|
||||
else
|
||||
retval=FAIL;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
int calcthr_from_vcal(int vcal) {
|
||||
int thrmin;
|
||||
//thrmin=140+3*vcal/5;
|
||||
thrmin=180+3*vcal/5;
|
||||
return thrmin;
|
||||
}
|
||||
|
||||
int calccal_from_vthr(int vthr) {
|
||||
int vcal;
|
||||
vcal=5*(vthr-140)/3;
|
||||
return vcal;
|
||||
}
|
||||
|
||||
int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
|
||||
int retval=OK;
|
||||
#ifdef MCB_FUNCS
|
||||
int modma, modmi, nm;
|
||||
int thr, thrstep=5, nthr=31;
|
||||
|
||||
int *fifodata;
|
||||
|
||||
double vthreshmean, vthreshSTDev;
|
||||
int *thrmi, *thrma;
|
||||
double c;
|
||||
double b=BVTRIM;
|
||||
double a=AVTRIM;
|
||||
int *trim;
|
||||
int ich, imod, ichan;
|
||||
int nvalid=0;
|
||||
u_int32_t *scan;
|
||||
int ithr;
|
||||
sls_detector_channel myChan;
|
||||
|
||||
|
||||
|
||||
setFrames(1);
|
||||
// setNMod(getNModBoard());
|
||||
|
||||
if (im==ALLMOD){
|
||||
modmi=0;
|
||||
modma=nModX;
|
||||
} else {
|
||||
modmi=im;
|
||||
modma=im+1;
|
||||
}
|
||||
nm=modma-modmi;
|
||||
|
||||
trim=malloc(sizeof(int)*nChans*nChips*nModX);
|
||||
thrmi=malloc(sizeof(int)*nModX);
|
||||
thrma=malloc(sizeof(int)*nModX);
|
||||
|
||||
|
||||
for (ich=0; ich<nChans*nChips*nm; ich++)
|
||||
trim[ich]=-1;
|
||||
/*
|
||||
setCSregister(im);
|
||||
setSSregister(im);
|
||||
initChannel(0,0,0,1,0,0,im);
|
||||
counterClear(im);
|
||||
clearSSregister(im);
|
||||
usleep(500);
|
||||
*/
|
||||
myChan.chan=-1;
|
||||
myChan.chip=-1;
|
||||
myChan.module=ALLMOD;
|
||||
myChan.reg=COMPARATOR_ENABLE;
|
||||
initChannelbyNumber(myChan);
|
||||
|
||||
|
||||
for (ithr=0; ithr<nthr; ithr++) {
|
||||
fifoReset();
|
||||
/* scanning threshold */
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
//commented out by dhanya thr=getDACbyIndexDACU(VTHRESH,imod);
|
||||
if (ithr==0) {
|
||||
thrmi[imod]=thr;
|
||||
//commented out by dhanya initDACbyIndexDACU(VTHRESH,thr,imod);
|
||||
} else
|
||||
;//commented out by dhanya initDACbyIndexDACU(VTHRESH,thr+thrstep,imod);
|
||||
}
|
||||
|
||||
/* setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
initChannel(0,0,0,1,0,0,im);
|
||||
setDynamicRange(32);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
fifodata=fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichan=0; ichan<nChans*nChips; ichan++){
|
||||
ich=imod*nChips*nChans+ichan;
|
||||
if (scan[ich]>countlim && trim[ich]==-1) {
|
||||
//commented out by dhanya trim[ich]=getDACbyIndexDACU(VTHRESH,imod);
|
||||
#ifdef VERBOSE
|
||||
// printf("yes: %d %d %d\n",ich,ithr,scan[ich]);
|
||||
#endif
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
/* else {
|
||||
printf("no: %d %d %d\n",ich,ithr,scan[ich]);
|
||||
}*/
|
||||
#endif
|
||||
}
|
||||
}
|
||||
free(scan);
|
||||
}
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
vthreshmean=0;
|
||||
vthreshSTDev=0;
|
||||
nvalid=0;
|
||||
//commented out by dhanya thrma[imod]=getDACbyIndexDACU(VTHRESH,imod);
|
||||
|
||||
for (ichan=0; ichan<nChans*nChips; ichan++){
|
||||
ich=imod*nChans*nChips+ichan;
|
||||
if(trim[ich]>thrmi[imod] && trim[ich]<thrma[imod]) {
|
||||
vthreshmean=vthreshmean+trim[ich];
|
||||
vthreshSTDev=vthreshSTDev+trim[ich]*trim[ich];
|
||||
nvalid++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nvalid>0) {
|
||||
vthreshmean=vthreshmean/nvalid;
|
||||
//commented out by dhanya vthreshSTDev=sqrt((vthreshSTDev/nvalid)-vthreshmean*vthreshmean);
|
||||
} else {
|
||||
vthreshmean=thrmi[imod];
|
||||
vthreshSTDev=nthr*thrstep;
|
||||
printf("No valid channel for module %d\n",imod);
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
#ifdef DEBUGOUT
|
||||
printf("module= %d nvalid = %d mean=%f RMS=%f\n",imod, nvalid, vthreshmean,vthreshSTDev);
|
||||
#endif
|
||||
// *vthresh=round(vthreshmean-nsigma*vthreshSTDev);
|
||||
thr=(int)(vthreshmean-nsigma*vthreshSTDev);
|
||||
if (thr<0 || thr>(DAC_DR-1)) {
|
||||
thr=thrmi[imod]/2;
|
||||
printf("Can't find correct threshold for module %d\n",imod);
|
||||
retval=FAIL;
|
||||
}
|
||||
//commented out by dhanya initDACbyIndexDACU(VTHRESH,thr,imod);
|
||||
#ifdef VERBOSE
|
||||
printf("vthresh=%d \n",thr);
|
||||
#endif
|
||||
c=CVTRIM-2.*nsigma*vthreshSTDev/63.;
|
||||
//commented out by dhanya thr=(int)((-b-sqrt(b*b-4*a*c))/(2*a));
|
||||
if (thr<500 || thr>(DAC_DR-1)) {
|
||||
thr=750;
|
||||
printf("Can't find correct trimbit size for module %d\n",imod);
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
//commented out by dhanya initDACbyIndexDACU(VTRIM,thr,imod);
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("vtrim=%d \n",thr);
|
||||
#endif
|
||||
|
||||
}
|
||||
free(trim);
|
||||
free(thrmi);
|
||||
free(thrma);
|
||||
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int trim_with_level(int countlim, int im) {
|
||||
int ich, itrim, ichan, ichip, imod;
|
||||
u_int32_t *scan;
|
||||
int *inttrim;
|
||||
int modma, modmi, nm;
|
||||
int retval=OK;
|
||||
int *fifodata;
|
||||
sls_detector_channel myChan;
|
||||
printf("trimming module number %d", im);
|
||||
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
setFrames(1);
|
||||
// setNMod(getNModBoard());
|
||||
|
||||
if (im==ALLMOD){
|
||||
modmi=0;
|
||||
modma=nModX;
|
||||
} else {
|
||||
modmi=im;
|
||||
modma=im+1;
|
||||
}
|
||||
nm=modma-modmi;
|
||||
|
||||
inttrim=malloc(sizeof(int)*nChips*nChans*nModX);
|
||||
printf("countlim=%d\n",countlim);
|
||||
for (ich=0; ich<nChans*nChips*nModX; ich++)
|
||||
inttrim[ich]=-1;
|
||||
|
||||
for (itrim=0; itrim<TRIM_DR+1; itrim++) {
|
||||
fifoReset();
|
||||
printf("Trimbit %d\n",itrim);
|
||||
myChan.chan=-1;
|
||||
myChan.chip=-1;
|
||||
myChan.module=ALLMOD;
|
||||
myChan.reg=COMPARATOR_ENABLE|(itrim<<TRIMBIT_OFF);
|
||||
initChannelbyNumber(myChan);
|
||||
|
||||
/*
|
||||
setCSregister(im);
|
||||
setSSregister(im);
|
||||
initChannel(itrim,0,0,1,0,0,ALLMOD);
|
||||
setDynamicRange(32);
|
||||
*/
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichan=0; ichan<nChans*nChips; ichan++) {
|
||||
ich=ichan+imod*nChans*nChips;
|
||||
if (inttrim[ich]==-1) {
|
||||
if (scan[ich]>countlim){
|
||||
inttrim[ich]=itrim;
|
||||
if (scan[ich]>2*countlim && itrim>0) {
|
||||
//if (scan[ich]>2*countlim || itrim==0) {
|
||||
inttrim[ich]=itrim-1;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
printf("Channel %d trimbit %d counted %d (%08x) countlim %d\n",ich,itrim,scan[ich],fifodata[ich],countlim);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
/* else
|
||||
printf("Channel %d trimbit %d counted %d countlim %d\n",ich,itrim,scan[ich],countlim);*/
|
||||
#endif
|
||||
}
|
||||
}
|
||||
free(scan);
|
||||
}
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
clearCSregister(imod);
|
||||
firstChip(im);
|
||||
for (ichip=0; ichip<nChips; ichip++) {
|
||||
clearSSregister(imod);
|
||||
for (ichan=0; ichan<nChans; ichan++) {
|
||||
nextStrip(imod);
|
||||
ich=ichan+imod*nChans*nChips+ichip*nChans;
|
||||
if (*(inttrim+ich)==-1) {
|
||||
*(inttrim+ich)=TRIM_DR;
|
||||
// printf("could not trim channel %d chip %d module %d - set to %d\n", ichan, ichip, imod, *(inttrim+ich) );
|
||||
retval=FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
// else
|
||||
// printf("channel %d trimbit %d\n",ich,*(inttrim+ich) );
|
||||
#endif
|
||||
initChannel(inttrim[ich],0,0,1,0,0,imod);
|
||||
}
|
||||
nextChip(imod);
|
||||
}
|
||||
}
|
||||
free(inttrim);
|
||||
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
#define ELEM_SWAP(a,b) { register int t=(a);(a)=(b);(b)=t; }
|
||||
#define median(a,n) kth_smallest(a,n,(((n)&1)?((n)/2):(((n)/2)-1)))
|
||||
|
||||
|
||||
int kth_smallest(int *a, int n, int k)
|
||||
{
|
||||
register int i,j,l,m ;
|
||||
register double x ;
|
||||
|
||||
l=0 ; m=n-1 ;
|
||||
while (l<m) {
|
||||
x=a[k] ;
|
||||
i=l ;
|
||||
j=m ;
|
||||
do {
|
||||
while (a[i]<x) i++ ;
|
||||
while (x<a[j]) j-- ;
|
||||
if (i<=j) {
|
||||
ELEM_SWAP(a[i],a[j]) ;
|
||||
i++ ; j-- ;
|
||||
}
|
||||
} while (i<=j) ;
|
||||
if (j<k) l=i ;
|
||||
if (k<i) m=j ;
|
||||
}
|
||||
return a[k] ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ave(int *a, int n)
|
||||
{
|
||||
int av=0,i;
|
||||
for (i=0; i<n; i++)
|
||||
av=av+((double)*(a+i))/((double)n);
|
||||
return av;
|
||||
}
|
||||
|
||||
|
||||
int choose_vthresh() {
|
||||
|
||||
int retval=OK;
|
||||
#ifdef MCB_FUNCS
|
||||
int imod, ichan;
|
||||
u_int32_t *scan, *scan1;
|
||||
int olddiff[nModX], direction[nModX];
|
||||
int med[nModX], med1[nModX], diff, media;
|
||||
int change_flag=1;
|
||||
int iteration=0;
|
||||
int maxiterations=10;
|
||||
int vthreshmean=0;
|
||||
int vthresh;
|
||||
int im=ALLMOD;
|
||||
int modma, modmi, nm;
|
||||
int *fifodata;
|
||||
|
||||
setFrames(1);
|
||||
// setNMod(getNModBoard());
|
||||
|
||||
if (im==ALLMOD){
|
||||
modmi=0;
|
||||
modma=nModX;
|
||||
} else {
|
||||
modmi=im;
|
||||
modma=im+1;
|
||||
}
|
||||
nm=modma-modmi;
|
||||
|
||||
|
||||
|
||||
setDynamicRange(32);
|
||||
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
//printf(".");
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
//
|
||||
scan1=decode_data(fifodata);
|
||||
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
//
|
||||
med[imod]=median(scan1+imod*nChans*nChips,nChans*nChips);
|
||||
med1[imod]=med[imod];
|
||||
//commented out by dhanya vthreshmean=vthreshmean+getDACbyIndexDACU(VTHRESH,imod);
|
||||
olddiff[imod]=0xffffff;
|
||||
direction[imod]=0;
|
||||
printf("Median of module %d=%d\n",imod,med[imod]);
|
||||
}
|
||||
vthreshmean=vthreshmean/nm;
|
||||
//media=median(scan,nChans*nChips*nModX);
|
||||
//printf("Median overall=%d\n",media);
|
||||
media=median(med1+modmi,nm);
|
||||
printf("Median of modules=%d\n",media);
|
||||
free(scan);
|
||||
free(scan1);
|
||||
|
||||
|
||||
while(change_flag && iteration<maxiterations) {
|
||||
|
||||
setDynamicRange(32);
|
||||
fifoReset();
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
//
|
||||
scan1=decode_data(fifodata);
|
||||
|
||||
change_flag=0;
|
||||
printf("Vthresh iteration %3d 0f %3d\n",iteration, maxiterations);
|
||||
for (ichan=modmi; ichan<modma; ichan++) {
|
||||
med[ichan]=median(scan1+ichan*nChans*nChips,nChans*nChips);
|
||||
med1[imod]=med[imod];
|
||||
media=median(med1+modmi,nm);
|
||||
|
||||
diff=med[ichan]-media;
|
||||
if (direction[ichan]==0) {
|
||||
if (diff>0)
|
||||
direction[ichan]=1;
|
||||
else
|
||||
direction[ichan]=-1;
|
||||
}
|
||||
//commented out by dhanya vthresh=getDACbyIndexDACU(VTHRESH,imod);
|
||||
if ( direction[ichan]!=-3) {
|
||||
if (abs(diff)>abs(olddiff[ichan])) {
|
||||
vthresh=vthresh-direction[ichan];
|
||||
if (vthresh>(DAC_DR-1)) {
|
||||
vthresh=(DAC_DR-1);
|
||||
printf("can't equalize threshold for module %d\n", ichan);
|
||||
retval=FAIL;
|
||||
}
|
||||
if (vthresh<0) {
|
||||
vthresh=0;
|
||||
printf("can't equalize threshold for module %d\n", ichan);
|
||||
retval=FAIL;
|
||||
}
|
||||
direction[ichan]=-3;
|
||||
} else {
|
||||
vthresh=vthresh+direction[ichan];
|
||||
olddiff[ichan]=diff;
|
||||
change_flag=1;
|
||||
}
|
||||
//commented out by dhanya initDACbyIndex(VTHRESH,vthresh, ichan);
|
||||
}
|
||||
}
|
||||
iteration++;
|
||||
free(scan);
|
||||
free(scan1);
|
||||
}
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int trim_with_median(int stop, int im) {
|
||||
|
||||
|
||||
int retval=OK;
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
int ichan, imod, ichip, ich;
|
||||
u_int32_t *scan, *scan1;
|
||||
int *olddiff, *direction;
|
||||
int med, diff;
|
||||
int change_flag=1;
|
||||
int iteration=0;
|
||||
int me[nModX], me1[nModX];
|
||||
int modma, modmi, nm;
|
||||
int trim;
|
||||
int *fifodata;
|
||||
|
||||
setFrames(1);
|
||||
// setNMod(getNModBoard());
|
||||
|
||||
if (im==ALLMOD){
|
||||
modmi=0;
|
||||
modma=nModX;
|
||||
} else {
|
||||
modmi=im;
|
||||
modma=im+1;
|
||||
}
|
||||
nm=modma-modmi;
|
||||
|
||||
olddiff=malloc(4*nModX*nChips*nChans);
|
||||
direction=malloc(4*nModX*nChips*nChans);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichip=0; ichip<nChips; ichip++) {
|
||||
for (ich=0; ich<nChans; ich++) {
|
||||
ichan=imod*nChips*nChans+ichip*nChans+ich;
|
||||
direction[ichan]=0;
|
||||
olddiff[ichan]=0x0fffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
/********
|
||||
fifoReset();
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
scan=decode_data(fifo_read_event());
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
me[imod]=median(scan+imod*nChans*nChips,nChans*nChips);
|
||||
printf("Median of module %d=%d\n",imod,me[imod]);
|
||||
}
|
||||
med=median(me,nm);
|
||||
printf("median is %d\n",med);
|
||||
free(scan);
|
||||
**************/
|
||||
while(change_flag && iteration<stop) {
|
||||
|
||||
setDynamicRange(32);
|
||||
fifoReset();
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
fifodata=fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
scan1=decode_data(fifodata);
|
||||
|
||||
|
||||
|
||||
/********* calculates median every time ***********/
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
me[imod]=median(scan1+imod*nChans*nChips,nChans*nChips);
|
||||
me1[imod]=me[imod];
|
||||
printf("Median of module %d=%d\n",imod,me[imod]);
|
||||
}
|
||||
med=median(me1,nm);
|
||||
printf("median is %d\n",med);
|
||||
|
||||
change_flag=0;
|
||||
printf("Trimbits iteration %d of %d\n",iteration, stop);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichip=0; ichip<nChips; ichip++) {
|
||||
selChip(ichip,imod);
|
||||
clearSSregister(imod);
|
||||
for (ich=0; ich<nChans; ich++) {
|
||||
ichan=imod*nChips*nChans+ichip*nChans+ich;
|
||||
nextStrip(imod);
|
||||
diff=scan[ichan]-me[imod];
|
||||
if (direction[ichan]==0) {
|
||||
if (diff>0) {
|
||||
direction[ichan]=1;
|
||||
} else {
|
||||
direction[ichan]=-1;
|
||||
}
|
||||
}
|
||||
if ( direction[ichan]!=-3) {
|
||||
if (abs(diff)>abs(olddiff[ichan])) {
|
||||
trim=getTrimbit(imod,ichip,ich)+direction[ichan];
|
||||
printf("%d old diff %d < new diff %d %d - trimbit %d\n",ichan, olddiff[ichan], diff, direction[ichan], trim);
|
||||
direction[ichan]=-3;
|
||||
} else {
|
||||
trim=getTrimbit(imod,ichip,ich)-direction[ichan];
|
||||
olddiff[ichan]=diff;
|
||||
change_flag=1;
|
||||
}
|
||||
if (trim>TRIM_DR) {
|
||||
trim=63;
|
||||
printf("can't trim channel %d chip %d module %d to trim %d\n",ich, ichip, imod, trim);
|
||||
retval=FAIL;
|
||||
}
|
||||
if (trim<0) {
|
||||
printf("can't trim channel %d chip %d module %d to trim %d\n",ich, ichip, imod, trim);
|
||||
trim=0;
|
||||
retval=FAIL;
|
||||
}
|
||||
initChannel(trim,0,0,1,0,0,imod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
iteration++;
|
||||
free(scan);
|
||||
free(scan1);
|
||||
}
|
||||
free(olddiff);
|
||||
free(direction);
|
||||
#endif
|
||||
return retval;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#ifndef TRIMMING_FUNCS_H
|
||||
#define TRIMMING_FUNCS_H
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
int trim_fixed_settings(int countlim, int par2, int imod);
|
||||
int trim_with_noise(int countlim, int nsigma, int imod);
|
||||
int trim_with_beam(int countlim, int nsigma, int imod);
|
||||
int trim_improve(int maxit, int par2, int imod);
|
||||
int calcthr_from_vcal(int vcal);
|
||||
int calccal_from_vthr(int vthr);
|
||||
int choose_vthresh_and_vtrim(int countlim, int nsigma, int imod);
|
||||
|
||||
int choose_vthresh();
|
||||
int trim_with_level(int countlim, int imod);
|
||||
int trim_with_median(int stop, int imod);
|
||||
int calcthr_from_vcal(int vcal);
|
||||
int calccal_from_vthr(int vthr);
|
||||
|
||||
#endif
|
@ -1,31 +0,0 @@
|
||||
SERVER=moenchDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
TMPFILE=gitInfoMoenchTmp.h
|
||||
INCLFILE=gitInfoMoench.h
|
||||
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|.git|updateGitVersion|.o' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define GITDATE' | awk '{print $3}')
|
||||
|
||||
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
@ -29,24 +29,22 @@ u_int32_t testFpga(void);
|
||||
int testBus(void);
|
||||
#endif
|
||||
|
||||
#if defined(MYTHEND) || defined(JUNGFRAUD) || defined(MYTHEN3D)
|
||||
int moduleTest( enum digitalTestMode arg, int imod);
|
||||
#ifdef MYTHEN3D
|
||||
int moduleTest( enum digitalTestMode arg);
|
||||
#endif
|
||||
#if defined(MYTHEND) || defined(JUNGFRAUD)
|
||||
#ifdef JUNGFRAUD
|
||||
int detectorTest( enum digitalTestMode arg);
|
||||
#endif
|
||||
|
||||
// Ids
|
||||
int64_t getDetectorId(enum idMode arg);
|
||||
u_int64_t getFirmwareVersion();
|
||||
#ifdef MYTHEND
|
||||
int64_t getModuleId(enum idMode arg, int imod);
|
||||
#elif JUNGFRAUD
|
||||
#ifdef JUNGFRAUD
|
||||
u_int64_t getFirmwareAPIVersion();
|
||||
u_int16_t getHardwareVersionNumber();
|
||||
u_int16_t getHardwareSerialNumber();
|
||||
#endif
|
||||
#ifndef MYTHEN3D
|
||||
#if !defined(MYTHEN3D) || !defined(EIGERD)
|
||||
u_int32_t getDetectorNumber();
|
||||
#endif
|
||||
u_int64_t getDetectorMAC();
|
||||
@ -96,9 +94,7 @@ int getPhase();
|
||||
void configureASICTimer();
|
||||
#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
|
||||
// parameters - dr, roi
|
||||
int setDynamicRange(int dr);
|
||||
#ifdef GOTTHARD
|
||||
int setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
@ -106,12 +102,9 @@ int setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
|
||||
// parameters - readout
|
||||
int setSpeed(enum speedVariable arg, int val);
|
||||
#if defined(EIGERD) || defined(MYTHEND)
|
||||
#ifdef EIGERD
|
||||
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
||||
#endif
|
||||
#ifdef MYTHEND
|
||||
int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
||||
#endif
|
||||
|
||||
// parameters - timer
|
||||
#ifdef JUNGFRAUD
|
||||
@ -121,27 +114,22 @@ int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||
int64_t getTimeLeft(enum timerIndex ind);
|
||||
|
||||
|
||||
// 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);
|
||||
#endif
|
||||
// parameters - module, settings
|
||||
|
||||
#ifdef EIGERD
|
||||
int setModule(sls_detector_module myMod, int delay);
|
||||
#else
|
||||
int setModule(sls_detector_module myMod);
|
||||
#endif
|
||||
int getModule(sls_detector_module *myMod);
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||
enum detectorSettings getSettings();
|
||||
|
||||
|
||||
// parameters - threshold
|
||||
#if defined(MYTHEND) || defined(EIGERD)
|
||||
int getThresholdEnergy(int imod);
|
||||
int setThresholdEnergy(int ev, int imod);
|
||||
#ifdef EIGERD
|
||||
int getThresholdEnergy();
|
||||
int setThresholdEnergy(int ev);
|
||||
#endif
|
||||
|
||||
// parameters - dac, adc, hv
|
||||
@ -161,34 +149,30 @@ int dacToPower(int value, int chip);
|
||||
extern void setAdc(int addr, int val); // AD9257.h
|
||||
#endif
|
||||
|
||||
void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]);
|
||||
void setDAC(enum DACINDEX ind, int val, int mV, int retval[]);
|
||||
#ifdef MYTHEN3D
|
||||
int getVLimit();
|
||||
void setDacRegister(int dacnum,int dacvalue);
|
||||
int getDacRegister(int dacnum);
|
||||
#endif
|
||||
#ifndef MYTHEN3D
|
||||
int getADC(enum ADCINDEX ind, int imod);
|
||||
int getADC(enum ADCINDEX ind);
|
||||
#endif
|
||||
|
||||
#if !defined(MYTHEN3D) && !defined(MYTHEND)
|
||||
#ifndef MYTHEN3D
|
||||
int setHighVoltage(int val);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// parameters - timing, extsig
|
||||
#ifdef MYTHEND
|
||||
enum externalSignalFlag getExtSignal(int signalindex);
|
||||
enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag flag);
|
||||
#endif
|
||||
enum externalCommunicationMode setTiming( enum externalCommunicationMode arg);
|
||||
|
||||
// configure mac
|
||||
#ifdef JUNGFRAUD
|
||||
long int calcChecksum(int sourceip, int destip);
|
||||
#endif
|
||||
#if !defined(MYTHEN3D) && !defined(MYTHEND)
|
||||
#ifndef MYTHEN3D
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival);
|
||||
#endif
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
@ -220,7 +204,7 @@ extern int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp); // prog
|
||||
|
||||
// eiger specific - iodelay, 10g, pulse, rate, temp, activate, delay nw parameter
|
||||
#elif EIGERD
|
||||
int setIODelay(int val, int imod);
|
||||
int setIODelay(int val);
|
||||
int enableTenGigabitEthernet(int val);
|
||||
int setCounterBit(int val);
|
||||
int pulsePixel(int n, int x, int y);
|
||||
@ -270,22 +254,15 @@ u_int32_t runBusy(void);
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);
|
||||
int calculateDataBytes();
|
||||
int getTotalNumberOfChannels();
|
||||
int getTotalNumberOfChips();
|
||||
int getTotalNumberOfModules();
|
||||
int getNumberOfChannelsPerModule();
|
||||
int getNumberOfChipsPerModule();
|
||||
int getNumberOfDACsPerModule();
|
||||
int getNumberOfADCsPerModule();
|
||||
int getNumberOfChips();
|
||||
int getNumberOfDACs();
|
||||
int getNumberOfADCs();
|
||||
#ifdef EIGERD
|
||||
int getNumberOfGainsPerModule();
|
||||
int getNumberOfOffsetsPerModule();
|
||||
int getNumberOfGains();
|
||||
int getNumberOfOffsets();
|
||||
#endif
|
||||
int getNumberOfChannelsPerChip();
|
||||
|
||||
// sync
|
||||
enum masterFlags setMaster(enum masterFlags arg);
|
||||
enum synchronizationMode setSynchronization(enum synchronizationMode arg);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,41 +17,24 @@ int M_nofuncMode(int);
|
||||
|
||||
// functions called by client
|
||||
int exec_command(int);
|
||||
int get_error(int);
|
||||
int get_detector_type(int);
|
||||
int set_number_of_modules(int);
|
||||
int get_max_number_of_modules(int);
|
||||
int set_external_signal_flag(int);
|
||||
int set_external_communication_mode(int);
|
||||
int get_id(int);
|
||||
int digital_test(int);
|
||||
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);
|
||||
int write_memory(int);
|
||||
int read_memory(int);
|
||||
int set_channel(int);
|
||||
int get_channel(int);
|
||||
int set_all_channels(int);
|
||||
int set_chip(int);
|
||||
int get_chip(int);
|
||||
int set_all_chips(int);
|
||||
int set_module(int);
|
||||
int get_module(int);
|
||||
int set_all_modules(int);
|
||||
int set_settings(int);
|
||||
int get_threshold_energy(int);
|
||||
int set_threshold_energy(int);
|
||||
int start_acquisition(int);
|
||||
int stop_acquisition(int);
|
||||
int start_readout(int);
|
||||
int get_run_status(int);
|
||||
int start_and_read_all(int);
|
||||
int read_frame(int);
|
||||
int read_all(int);
|
||||
int set_timer(int);
|
||||
int get_time_left(int);
|
||||
@ -59,7 +42,6 @@ int set_dynamic_range(int);
|
||||
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);
|
||||
@ -68,8 +50,6 @@ 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 calibrate_pedestal(int);
|
||||
@ -89,7 +69,6 @@ int reset_fpga(int);
|
||||
int power_chip(int);
|
||||
int set_activate(int);
|
||||
int prepare_acquisition(int);
|
||||
int cleanup_acquisition(int);
|
||||
int threshold_temp(int);
|
||||
int temp_control(int);
|
||||
int temp_event(int);
|
||||
|
@ -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!!! */
|
||||
|
Loading…
x
Reference in New Issue
Block a user