solving merging conflicts from 3.1.0 to developer

This commit is contained in:
2018-03-14 15:45:35 +01:00
129 changed files with 1120 additions and 8750 deletions

View File

@@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 897cbac27d3154d72893e331df3147d4b706ccc8
Revision: 321
Repsitory UUID: 06cdf8ad9204fd306cb1017b91e67452c61715d4
Revision: 323
Branch: developer
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 3600
Last Changed Date: 2018-02-07 15:22:30.000000002 +0100 ./FebRegisterDefs.h
Last Changed Author: Erik_Frojdh
Last Changed Rev: 3671
Last Changed Date: 2018-03-13 10:28:12.000000002 +0100 ./FebRegisterDefs.h

View File

@@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "897cbac27d3154d72893e331df3147d4b706ccc8"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x3600
#define GITDATE 0x20180207
#define GITREPUUID "06cdf8ad9204fd306cb1017b91e67452c61715d4"
#define GITAUTH "Erik_Frojdh"
#define GITREV 0x3671
#define GITDATE 0x20180313
#define GITBRANCH "developer"

View File

@@ -1,9 +1,18 @@
Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
<<<<<<< HEAD
Repsitory UUID: 92b4b3324e09299663b9862bad26b38a3257dd60
Revision: 1752
Branch: developer
Last Changed Author: Andrä_Marie
Last Changed Rev: 3570
Last Changed Date: 2018-01-19 14:14:34.000000002 +0100 ./commonFiles/sls_detector_defs.h
=======
Repsitory UUID: b389402d647e939342dbb2c9317c688c0eb6b105
Revision: 1714
Branch: 3.1.0-rc
Last Changed Author: Erik_Frojdh
Last Changed Rev: 3458
Last Changed Date: 2018-03-12 14:19:44.000000002 +0100 ./threadFiles/ThreadPool.o
>>>>>>> 3.1.0

View File

@@ -5,7 +5,7 @@ CC = gcc
CFLAGS += -Wall -DGOTTHARDD -DMCB_FUNCS -DDACS_INT -DDEBUG -DVIRTUAL
PROGS= $(DESTDIR)/gotthardVirtualServer
PROGS= $(DESTDIR)/gotthardDetectorServer_virtual
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c

View File

@@ -1474,6 +1474,7 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
#endif
// if(val!=0x2820) return -1;
usleep(1000 * 1000);
return adcConfigured;
}
@@ -1536,12 +1537,8 @@ int startStateMachine(){
int stopStateMachine(){
//#ifdef VERBOSE
printf("*******Stopping State Machine*******\n");
cprintf(BG_RED,"*******Stopping State Machine*******\n");
//#endif
#ifdef SHAREDMEMORY
write_stop_sm(1);
write_status_sm("Stopped");
#endif
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
bus_w16(CONTROL_REG, 0x0);
usleep(500);

View File

@@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 94b61ea2c40176cf2a9a36c7d6477016cd5d7fcd
Revision: 218
Branch: 3.0.1
Repsitory UUID: 675d69392a6497d42b23057c7c8783c8dad768d0
Revision: 223
Branch: 3.1.0-rc
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 3351
Last Changed Date: 2018-02-08 11:04:28.000000002 +0100 ./firmware_funcs.c
Last Changed Rev: 3447
Last Changed Date: 2018-02-27 14:04:08.000000002 +0100 ./server_funcs.c

View File

@@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "94b61ea2c40176cf2a9a36c7d6477016cd5d7fcd"
#define GITREPUUID "675d69392a6497d42b23057c7c8783c8dad768d0"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x3351
#define GITDATE 0x20180208
#define GITBRANCH "3.0.1"
#define GITREV 0x3447
#define GITDATE 0x20180227
#define GITBRANCH "3.1.0-rc"

View File

@@ -579,16 +579,18 @@ int get_id(int file_des) {
#ifdef VERBOSE
printf("Getting id %d\n", arg);
#endif
#endif
switch (arg) {
case DETECTOR_SERIAL_NUMBER:
retval=getDetectorNumber();
break;
case DETECTOR_FIRMWARE_VERSION:
return (getFirmwareVersion() & 0xFFFFFF);
retval = (getFirmwareVersion() & 0xFFFFFF);
break;
case DETECTOR_SOFTWARE_VERSION:
return (GITDATE & 0xFFFFFF);
retval = (GITDATE & 0xFFFFFF);
break;
default:
printf("Required unknown id %d \n", arg);
ret=FAIL;
@@ -1725,12 +1727,10 @@ int stop_acquisition(int file_des) {
int ret=OK;
int n;
sprintf(mess,"can't stop acquisition\n");
#ifdef VERBOSE
printf("Stopping acquisition\n");
#endif
cprintf(BG_RED,"Client command received to stop acquisition\n");
if (differentClients==1 && lockStatus==1) {

View File

@@ -1,24 +1,26 @@
CC = gcc
CFLAGS += -Wall -DJUNGFRAUD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
CFLAGS += -Wall -DJUNGFRAUD -DVIRTUAL -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lstdc++
PROGS = jungfrauDetectorServer
PROGS = jungfrauDetectorServer_virtual
DESTDIR ?= bin
INSTMODE = 0777
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRC_CLNT:.c=.o)
all: clean $(PROGS)
all: clean versioning $(PROGS)
boot: $(OBJS)
versioning:
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
$(PROGS): $(OBJS)
echo $(OBJS)
# echo $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
rm *.gdb
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o

View File

@@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: a536f8ac9be2f064974da454273bfa828edb5bb1
Revision: 121
Repsitory UUID: 06cdf8ad9204fd306cb1017b91e67452c61715d4
Revision: 122
Branch: developer
Last Changed Author: Erik_Frojdh
Last Changed Rev: 3669
Last Changed Date: 2018-02-22 10:31:42.834118468 +0100 ./blackfin.h~
Last Changed Rev: 3671
Last Changed Date: 2018-03-13 10:29:31.000000002 +0100 ./Makefile.virtual

View File

@@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "a536f8ac9be2f064974da454273bfa828edb5bb1"
#define GITREPUUID "06cdf8ad9204fd306cb1017b91e67452c61715d4"
#define GITAUTH "Erik_Frojdh"
#define GITREV 0x3669
#define GITDATE 0x20180222
#define GITREV 0x3671
#define GITDATE 0x20180313
#define GITBRANCH "developer"

View File

@@ -26,6 +26,17 @@ int32_t clkPhase[2] = {0, 0};
/* basic tests */
void checkFirmwareCompatibility(int flag) {
#ifdef VIRTUAL
cprintf(BLUE,"\n\n"
"********************************************************\n"
"************** Jungfrau Virtual Server *****************\n"
"********************************************************\n\n");
if (mapCSP0() == FAIL) {
cprintf(BG_RED, "Dangerous to continue. Goodbye!\n");
exit(EXIT_FAILURE);
}
return;
#endif
defineGPIOpins();
resetFPGA();
@@ -104,6 +115,9 @@ void checkFirmwareCompatibility(int flag) {
int checkType() {
#ifdef VIRTUAL
return OK;
#endif
volatile u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
if (type != JUNGFRAU){
cprintf(BG_RED,"This is not a Jungfrau Server (read %d, expected %d)\n",type, JUNGFRAU);
@@ -116,6 +130,9 @@ int checkType() {
u_int32_t testFpga(void) {
#ifdef VIRTUAL
return OK;
#endif
printf("\nTesting FPGA...\n");
//fixed pattern
@@ -132,6 +149,9 @@ u_int32_t testFpga(void) {
int testBus() {
#ifdef VIRTUAL
return OK;
#endif
printf("\nTesting Bus...\n");
int ret = OK;
@@ -158,6 +178,9 @@ int moduleTest( enum digitalTestMode arg, int imod){
}
int detectorTest( enum digitalTestMode arg){
#ifdef VIRTUAL
return OK;
#endif
switch(arg){
case DETECTOR_FIRMWARE_TEST: return testFpga();
case DETECTOR_BUS_TEST: return testBus();
@@ -194,26 +217,44 @@ int64_t getDetectorId(enum idMode arg){
}
u_int64_t getFirmwareVersion() {
#ifdef VIRTUAL
return 0;
#endif
return ((bus_r(FPGA_VERSION_REG) & BOARD_REVISION_MSK) >> BOARD_REVISION_OFST);
}
u_int64_t getFirmwareAPIVersion() {
#ifdef VIRTUAL
return 0;
#endif
return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST);
}
u_int16_t getHardwareVersionNumber() {
#ifdef VIRTUAL
return 0;
#endif
return ((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) >> HARDWARE_VERSION_NUM_OFST);
}
u_int16_t getHardwareSerialNumber() {
#ifdef VIRTUAL
return 0;
#endif
return ((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_SERIAL_NUM_MSK) >> HARDWARE_SERIAL_NUM_OFST);
}
u_int32_t getDetectorNumber(){
#ifdef VIRTUAL
return 0;
#endif
return bus_r(MOD_SERIAL_NUM_REG);
}
u_int64_t getDetectorMAC() {
#ifdef VIRTUAL
return 0;
#endif
char output[255],mac[255]="";
u_int64_t res=0;
FILE* sysFile = popen("ifconfig eth0 | grep HWaddr | cut -d \" \" -f 11", "r");
@@ -231,6 +272,9 @@ u_int64_t getDetectorMAC() {
}
u_int32_t getDetectorIP(){
#ifdef VIRTUAL
return 0;
#endif
char temp[50]="";
u_int32_t res=0;
//execute and get address
@@ -325,9 +369,9 @@ void setupDetector() {
resetCore();
resetPeripheral();
cleanFifos();
#ifndef VIRTUAL
prepareADC();
#endif
// initialize dac series
initDac(0); /* todo might work without */
initDac(8); //only for old board compatibility
@@ -344,8 +388,7 @@ void setupDetector() {
cprintf(RED, "Warning: Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], retval[0]);
}
}
bus_w(DAQ_REG, 0x0); /* Only once at server startup */
bus_w(DAQ_REG, 0x0); /* Only once at server startup */
setSpeed(CLOCK_DIVIDER, HALF_SPEED);
cleanFifos(); /* todo might work without */
resetCore(); /* todo might work without */
@@ -414,18 +457,27 @@ int autoCompDisable(int on) {
void cleanFifos() {
#ifdef VIRTUAL
return;
#endif
printf("\nClearing Acquisition Fifos\n");
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_ACQ_FIFO_CLR_MSK);
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_ACQ_FIFO_CLR_MSK);
}
void resetCore() {
#ifdef VIRTUAL
return;
#endif
printf("\nResetting Core\n");
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CORE_RST_MSK);
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_CORE_RST_MSK);
}
void resetPeripheral() {
#ifdef VIRTUAL
return;
#endif
printf("\nResetting Peripheral\n");
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PERIPHERAL_RST_MSK);
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_PERIPHERAL_RST_MSK);
@@ -628,6 +680,9 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
int64_t getTimeLeft(enum timerIndex ind){
#ifdef VIRTUAL
return 0;
#endif
int64_t retval = -1;
switch(ind){
@@ -810,6 +865,9 @@ enum detectorSettings getSettings(){
void initDac(int dacnum) {
#ifdef VIRTUAL
return;
#endif
printf("\nInitializing dac for %d to \n",dacnum);
u_int32_t codata;
@@ -871,6 +929,9 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
}
if ( (val >= 0) || (val == -100)) {
#ifdef VIRTUAL
dacValues[ind] = dacval;
#else
u_int32_t codata;
int csdx = ind / NDAC + DAC_SERIAL_CS_OUT_OFST; // old board (16 dacs),so can be DAC_SERIAL_CS_OUT_OFST or +1
int dacchannel = ind % NDAC; // 0-8, dac channel number (also for dacnum 9-15 in old board)
@@ -902,6 +963,7 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
bus_w (VREF_COMP_MOD_REG, (bus_r(VREF_COMP_MOD_REG) &~ (VREF_COMP_MOD_MSK)) // reset
| ((val << VREF_COMP_MOD_OFST) & VREF_COMP_MOD_MSK)); // or it with value
}
#endif
}
printf("Getting DAC %d : ",ind);
@@ -911,6 +973,9 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
int getADC(enum ADCINDEX ind, int imod){
#ifdef VIRTUAL
return 0;
#endif
char tempnames[2][40]={"VRs/FPGAs Temperature", "ADCs/ASICs Temperature"};
printf("Getting Temperature for %s\n",tempnames[ind]);
u_int32_t addr = GET_TEMPERATURE_TMP112_REG;
@@ -936,6 +1001,11 @@ int getADC(enum ADCINDEX ind, int imod){
int setHighVoltage(int val){
#ifdef VIRTUAL
if (val >= 0)
highvoltage = val;
return highvoltage;
#endif
u_int32_t dacvalue;
float alpha = 0.55;
// setting hv
@@ -1029,6 +1099,9 @@ long int calcChecksum(int sourceip, int destip) {
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival){
#ifdef VIRTUAL
return 0;
#endif
cprintf(BLUE, "\n*** Configuring MAC ***\n");
uint32_t sourceport = DEFAULT_TX_UDP_PORT;
@@ -1137,6 +1210,9 @@ int setDetectorPosition(int pos[]) {
void resetPLL() {
#ifdef VIRTUAL
return;
#endif
// reset PLL Reconfiguration and PLL
bus_w(PLL_CONTROL_REG, bus_r(PLL_CONTROL_REG) | PLL_CTRL_RECONFIG_RST_MSK | PLL_CTRL_RST_MSK);
usleep(100);
@@ -1145,7 +1221,9 @@ void resetPLL() {
u_int32_t setPllReconfigReg(u_int32_t reg, u_int32_t val) {
#ifdef VIRTUAL
return val;
#endif
// set parameter
bus_w(PLL_PARAM_REG, val);
@@ -1165,6 +1243,9 @@ u_int32_t setPllReconfigReg(u_int32_t reg, u_int32_t val) {
void configurePll() {
#ifdef VIRTUAL
return;
#endif
u_int32_t val;
int32_t phase=0, inv=0;
@@ -1238,6 +1319,9 @@ int setTemperatureControl(int val) {
int setTemperatureEvent(int val) {
#ifdef VIRTUAL
return 0;
#endif
if (val >= 0) {
// set bit to clear it
val = 1;
@@ -1261,6 +1345,10 @@ int setNetworkParameter(enum NETWORKINDEX mode, int value) {
printf("\nSetting transmission delay: %d\n", value);
bus_w(CONFIG_REG, (bus_r(CONFIG_REG) &~CONFIG_TDMA_TIMESLOT_MSK)
| (((value << CONFIG_TDMA_TIMESLOT_OFST) & CONFIG_TDMA_TIMESLOT_MSK)));
if (value == 0)
bus_w(CONFIG_REG, bus_r(CONFIG_REG) &~ CONFIG_TDMA_MSK);
else
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_TDMA_MSK);
#ifdef VERBOSE
printf("Transmission delay set to %d\n", ((bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK) >> CONFIG_TDMA_TIMESLOT_OFST));
#endif
@@ -1276,6 +1364,9 @@ int setNetworkParameter(enum NETWORKINDEX mode, int value) {
/* aquisition */
int startStateMachine(){
#ifdef VIRTUAL
return OK;
#endif
printf("*******Starting State Machine*******\n");
cleanFifos();
@@ -1290,6 +1381,9 @@ int startStateMachine(){
int stopStateMachine(){
#ifdef VIRTUAL
return OK;
#endif
cprintf(BG_RED,"*******Stopping State Machine*******\n");
//stop state machine
@@ -1306,6 +1400,9 @@ int stopStateMachine(){
enum runStatus getRunStatus(){
#ifdef VIRTUAL
return IDLE;
#endif
#ifdef VERBOSE
printf("Getting status\n");
#endif
@@ -1349,7 +1446,11 @@ enum runStatus getRunStatus(){
void readFrame(int *ret, char *mess){
#ifdef VIRTUAL
*ret = (int)FAIL;
sprintf(mess,"virtual detector, no acquisition taken\n");
return;
#endif
// wait for status to be done
while(runBusy()){
usleep(500);
@@ -1371,6 +1472,9 @@ void readFrame(int *ret, char *mess){
u_int32_t runBusy(void) {
#ifdef VIRTUAL
return 0;
#endif
u_int32_t s = ((bus_r(STATUS_REG) & RUN_BUSY_MSK) >> RUN_BUSY_OFST);
#ifdef VERBOSE
printf("Status Register: %08x\n", s);

View File

@@ -593,9 +593,11 @@ int get_id(int file_des) {
retval=getDetectorNumber();
break;
case DETECTOR_FIRMWARE_VERSION:
return (getFirmwareVersion() & 0xFFFFFF);
retval = (getFirmwareVersion() & 0xFFFFFF);
break;
case DETECTOR_SOFTWARE_VERSION:
return (GITDATE & 0xFFFFFF);
retval = (GITDATE & 0xFFFFFF);
break;
default:
printf("Required unknown id %d \n", arg);
ret=FAIL;

View File

@@ -1215,7 +1215,7 @@ int multiSlsDetector::getThresholdEnergy(int pos) {
if (ret1==-100)
ret1=ret;
else if (ret<(ret1-200) || ret>(ret1+200))
ret1=FAIL;
ret1=-1;
}
@@ -1260,7 +1260,7 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
if(iret[idet] != NULL){
if (ret==-100)
ret=*iret[idet];
else if (ret<(*iret[idet]-200) || ret>(*iret[idet]+200))
else if (*iret[idet]<(ret-200) || *iret[idet]>(ret+200))
ret=-1;
delete iret[idet];
}else ret=-1;
@@ -4912,16 +4912,16 @@ int multiSlsDetector::saveCalibrationFile(string fname, int imod) {
int multiSlsDetector::writeRegister(int addr, int val){
uint32_t multiSlsDetector::writeRegister(uint32_t addr, uint32_t val){
int ret, ret1=-100;
uint32_t ret, ret1;
for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
if (detectors[i]) {
ret=detectors[i]->writeRegister(addr,val);
if(detectors[i]->getErrorMask())
setErrorMask(getErrorMask()|(1<<i));
if (ret1==-100)
if (i==0)
ret1=ret;
else if (ret!=ret1) {
// not setting it to -1 as it is a possible value
@@ -4959,16 +4959,16 @@ int multiSlsDetector::writeAdcRegister(int addr, int val){
}
int multiSlsDetector::readRegister(int addr){
uint32_t multiSlsDetector::readRegister(uint32_t addr){
int ret, ret1=-100;
uint32_t ret, ret1;
for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
if (detectors[i]) {
ret=detectors[i]->readRegister(addr);
if(detectors[i]->getErrorMask())
setErrorMask(getErrorMask()|(1<<i));
if (ret1==-100)
if (i==0)
ret1=ret;
else if (ret!=ret1) {
// not setting it to -1 as it is a possible value
@@ -4982,15 +4982,15 @@ int multiSlsDetector::readRegister(int addr){
}
int multiSlsDetector::setBit(int addr, int n) {
int ret1, ret=-100;
uint32_t multiSlsDetector::setBit(uint32_t addr, int n) {
uint32_t ret, ret1;
for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
if (detectors[i]) {
ret1=detectors[i]->setBit(addr,n);
if(detectors[i]->getErrorMask())
setErrorMask(getErrorMask()|(1<<i));
if (ret==-100)
if (i==0)
ret=ret1;
else if (ret!=ret1) {
// not setting it to -1 as it is a possible value
@@ -5004,15 +5004,15 @@ int multiSlsDetector::setBit(int addr, int n) {
}
int multiSlsDetector::clearBit(int addr, int n) {
int ret1, ret=-100;
uint32_t multiSlsDetector::clearBit(uint32_t addr, int n) {
uint32_t ret, ret1;
for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
if (detectors[i]) {
ret1=detectors[i]->clearBit(addr,n);
if(detectors[i]->getErrorMask())
setErrorMask(getErrorMask()|(1<<i));
if (ret==-100)
if (i==0)
ret=ret1;
else if (ret!=ret1) {
// not setting it to -1 as it is a possible value
@@ -6051,6 +6051,8 @@ void multiSlsDetector::readFrameFromReceiver(){
break;
case JUNGFRAU:
jungfrau = true;
maxX = thisMultiDetector->numberOfChannel[X];
maxY = thisMultiDetector->numberOfChannel[Y];
break;
default:
break;
@@ -6184,7 +6186,11 @@ void multiSlsDetector::readFrameFromReceiver(){
//assemble data with no interleaving, assumed detectors appended vertically
else{
memcpy(multiframe+slsdatabytes*isocket,image,slsdatabytes);
for(int i=0;i<slsmaxY;++i){
memcpy(((char*)multiframe) + (((thisMultiDetector->offsetY[isocket] + i) * maxX) + thisMultiDetector->offsetX[isocket])* (int)bytesperchannel,
(char*)image+ (i*slsmaxX*(int)bytesperchannel),
(slsmaxX*(int)bytesperchannel));
}
}
}

View File

@@ -1100,13 +1100,13 @@ class multiSlsDetector : public slsDetectorUtils {
int writeRegister(int addr, int val);
uint32_t writeRegister(uint32_t addr, uint32_t val);
int writeAdcRegister(int addr, int val);
int readRegister(int addr);
uint32_t readRegister(uint32_t addr);
/**
sets a bit in a register
@@ -1116,7 +1116,7 @@ class multiSlsDetector : public slsDetectorUtils {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
int setBit(int addr, int n);
uint32_t setBit(uint32_t addr, int n);
/**
@@ -1127,7 +1127,7 @@ class multiSlsDetector : public slsDetectorUtils {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
int clearBit(int addr, int n);
uint32_t clearBit(uint32_t addr, int n);
@@ -1244,6 +1244,7 @@ class multiSlsDetector : public slsDetectorUtils {
slsDetector *operator()(int pos) {if (pos>=0 && pos< MAXDET) return detectors[pos]; return NULL;};
//receiver
/**

View File

@@ -1,6 +1,14 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
<<<<<<< HEAD
#define GITREPUUID "92b4b3324e09299663b9862bad26b38a3257dd60"
#define GITAUTH "Andrä_Marie"
#define GITREV 0x3570
#define GITDATE 0x20180119
#define GITBRANCH "developer"
=======
#define GITREPUUID "b389402d647e939342dbb2c9317c688c0eb6b105"
#define GITAUTH "Erik_Frojdh"
#define GITREV 0x3458
#define GITDATE 0x20180312
#define GITBRANCH "3.1.0-rc"
>>>>>>> 3.1.0

View File

@@ -2397,13 +2397,13 @@ int slsDetector::digitalTest( digitalTestMode mode, int imod){
/* write or read register */
int slsDetector::writeRegister(int addr, int val){
uint32_t slsDetector::writeRegister(uint32_t addr, uint32_t val){
int retval=-1;
uint32_t retval = 0;
int fnum=F_WRITE_REGISTER;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
int arg[2];
uint32_t arg[2];
arg[0]=addr;
arg[1]=val;
@@ -2446,7 +2446,7 @@ int slsDetector::writeAdcRegister(int addr, int val){
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
int arg[2];
uint32_t arg[2];
arg[0]=addr;
arg[1]=val;
@@ -2485,13 +2485,13 @@ int slsDetector::writeAdcRegister(int addr, int val){
int slsDetector::readRegister(int addr){
uint32_t slsDetector::readRegister(uint32_t addr){
int retval=-1;
uint32_t retval = 0;
int fnum=F_READ_REGISTER;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
int arg;
uint32_t arg;
arg=addr;
@@ -2528,25 +2528,24 @@ int slsDetector::readRegister(int addr){
}
int slsDetector::setBit(int addr, int n) {
uint32_t slsDetector::setBit(uint32_t addr, int n) {
if (n<0 || n>31) {
std::cout << "Bit number out of Range" << std:: endl;
setErrorMask((getErrorMask())|(REGISER_WRITE_READ));
}
// normal bit range
//TODO! (Erik) Check for errors! cannot use value since reg is 32bits
else {
int val = readRegister(addr);
if (val != -1) {
writeRegister(addr,val | 1<<n);
}
uint32_t val = readRegister(addr);
writeRegister(addr,val | 1<<n);
}
return readRegister(addr);
}
int slsDetector::clearBit(int addr, int n) {
uint32_t slsDetector::clearBit(uint32_t addr, int n) {
if (n<0 || n>31) {
std::cout << "Bit number out of Range" << std:: endl;
setErrorMask((getErrorMask())|(REGISER_WRITE_READ));
@@ -2554,10 +2553,8 @@ int slsDetector::clearBit(int addr, int n) {
// normal bit range
else {
int val = readRegister(addr);
if (val != -1) {
writeRegister(addr,val & ~(1<<n));
}
uint32_t val = readRegister(addr);
writeRegister(addr,val & ~(1<<n));
}
return readRegister(addr);
@@ -3239,7 +3236,7 @@ int slsDetector::setModule(int reg, int imod){
int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval, int* offsetval, int tb){
int fnum=F_SET_MODULE;
int retval;
int retval=-1;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
@@ -3345,6 +3342,9 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
offset[i+imod*thisDetector->nOffset]=offsetval[i];
}
if (e_eV != -1)
thisDetector->currentThresholdEV = e_eV;
}
#ifdef VERBOSE
@@ -3549,7 +3549,7 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
//currently only for eiger
if (thisDetector->myDetectorType == EIGER) {
setThresholdEnergyAndSettings(e_eV,isettings,tb);
return thisDetector->currentThresholdEV;
return thisDetector->currentThresholdEV;
}
int fnum= F_SET_THRESHOLD_ENERGY;
@@ -6455,9 +6455,9 @@ string slsDetector::setReceiverUDPMAC(string udpmac){
#else
;
#endif
else if(setUDPConnection()==FAIL){
/* else if(setUDPConnection()==FAIL){ commented out to be replaced by user defined udpmac
std::cout<< "Warning: UDP connection set up failed" << std::endl;
}
}*/
}else{
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
std::cout << "Warning: receiver udp mac address should be in xx:xx:xx:xx:xx:xx format" << std::endl;

View File

@@ -892,7 +892,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
\returns current register value
*/
int writeRegister(int addr, int val);
uint32_t writeRegister(uint32_t addr, uint32_t val);
/**
@@ -910,7 +910,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
\returns current register value
*/
int readRegister(int addr);
uint32_t readRegister(uint32_t addr);
/**
sets a bit in a register
@@ -920,7 +920,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
int setBit(int addr, int n);
uint32_t setBit(uint32_t addr, int n);
/**
@@ -931,7 +931,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
int clearBit(int addr, int n);
uint32_t clearBit(uint32_t addr, int n);
/**
set dacs value

View File

@@ -1650,7 +1650,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
/* temperature control */
/*! \page settings
\section settingsadcs Temp Control
\section settingstmp Temp Control
commands to monitor and handle temperature overshoot (only JUNGFRAU)
*/
@@ -5829,6 +5829,9 @@ string slsDetectorCommand::cmdSpeed(int narg, char *args[], int action) {
return string("cannot scan speed value ")+string(args[1]);
}
// -1 could work
else if (cmd=="adcphase")
t = 65536;
myDet->setOnline(ONLINE_FLAG);

View File

@@ -537,7 +537,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
virtual int writeRegister(int addr, int val)=0;
virtual uint32_t writeRegister(uint32_t addr, uint32_t val)=0;
/**
@@ -548,7 +548,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
virtual int writeAdcRegister(int addr, int val)=0;
virtual int writeAdcRegister(int addr, int val)=0;
/**
@@ -558,7 +558,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
virtual int readRegister(int addr)=0;
virtual uint32_t readRegister(uint32_t addr)=0;
/**
@@ -569,7 +569,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
virtual int setBit(int addr, int n)=0;
virtual uint32_t setBit(uint32_t addr, int n)=0;
/**
@@ -580,7 +580,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
DO NOT USE!!! ONLY EXPERT USER!!!
*/
virtual int clearBit(int addr, int n)=0;
virtual uint32_t clearBit(uint32_t addr, int n)=0;
/**

View File

@@ -149,8 +149,8 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
enum eiger_DacIndex{SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RXB_RB,RXB_LB,VCMP_RR,VCP,VCN,VIS};
//Copy other dacs
int num_dacs_to_copy = 10;
int dacs_to_copy[] = {SVP,VTR,VRS,SVN,VTGSTV,CAL,RXB_RB,RXB_LB,VCN,VIS};
int num_dacs_to_copy = 9;
int dacs_to_copy[] = {SVP,VTR,SVN,VTGSTV,CAL,RXB_RB,RXB_LB,VCN,VIS};
for (int i = 0; i < num_dacs_to_copy; ++i) {
if(a->dacs[dacs_to_copy[i]] != b->dacs[dacs_to_copy[i]]) {
deleteModule(myMod);
@@ -160,8 +160,8 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
}
//Interpolate vrf, vcmp, vcp
int num_dacs_to_interpolate = 6;
int dacs_to_interpolate[] = {VRF,VCMP_LL,VCMP_LR,VCMP_RL,VCMP_RR,VCP};
int num_dacs_to_interpolate = 7;
int dacs_to_interpolate[] = {VRF,VCMP_LL,VCMP_LR,VCMP_RL,VCMP_RR,VCP, VRS};
for (int i = 0; i < num_dacs_to_interpolate; ++i) {
myMod->dacs[dacs_to_interpolate[i]] = linearInterpolation(energy, e1, e2,
a->dacs[dacs_to_interpolate[i]], b->dacs[dacs_to_interpolate[i]]);

View File

@@ -9,7 +9,7 @@
/* global variables */
u_int32_t CSP0BASE = 0;
u_int64_t CSP0BASE = 0;
#define CSP0 0x20200000
#define MEM_SIZE 0x100000
#define MEM_MAP_SHIFT 1
@@ -123,10 +123,14 @@ u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
*/
int mapCSP0(void) {
// if not mapped
if (!CSP0BASE) {
if (CSP0BASE == 0) {
printf("Mapping memory\n");
#ifdef VIRTUAL
CSP0BASE = malloc(MEM_SIZE);
if (CSP0BASE == NULL) {
cprintf(BG_RED, "Error: Could not allocate virtual memory.\n");
return FAIL;
}
printf("memory allocated\n");
#else
int fd;
@@ -138,14 +142,15 @@ int mapCSP0(void) {
#ifdef VERBOSE
printf("/dev/mem opened\n");
#endif
CSP0BASE = (u_int32_t)mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
if (CSP0BASE == (u_int32_t)MAP_FAILED) {
CSP0BASE = mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
if (CSP0BASE == MAP_FAILED) {
cprintf(BG_RED, "Error: Can't map memmory area\n");
return FAIL;
}
printf("CSPOBASE mapped from %08x to %08x\n",CSP0BASE,CSP0BASE+MEM_SIZE);
#endif
//printf("Status Register: %08x\n",bus_r(STATUS_REG));
printf("CSPOBASE mapped from 0x%llx to 0x%llx\n",CSP0BASE, CSP0BASE+MEM_SIZE);
printf("Status Register: %08x\n",bus_r(STATUS_REG));
}else
printf("Memory already mapped before\n");
return OK;

View File

@@ -1391,7 +1391,7 @@ int get_adc(int file_des) {
int write_register(int file_des) {
int ret=OK,ret1=OK;
int n=0;
int retval=-1;
uint32_t retval=-1;
sprintf(mess,"write to register failed\n");
// receive arguments
@@ -1399,7 +1399,7 @@ int write_register(int file_des) {
n = receiveData(file_des,arg,sizeof(arg),INT32);
if (n < 0) return printSocketReadError();
int addr=arg[0];
int val=arg[1];
uint32_t val=arg[1];
// execute action
if (differentClients && lockStatus) {
@@ -1449,7 +1449,7 @@ int write_register(int file_des) {
int read_register(int file_des) {
int ret=OK,ret1=OK;
int n=0;
int retval=-1;
uint32_t retval=-1;
sprintf(mess,"read register failed\n");
// receive arguments
@@ -3167,7 +3167,7 @@ int set_speed(int file_des) {
#ifdef JUNGFRAUD
case ADC_PHASE:
retval = adcPhase(val);
if ((retval!=val) && (val>=0)) {
if ((val != 65536) && (retval!=val) && (val>=0)) {
ret=FAIL;
sprintf(mess,"could not change set adc phase: should be %d but is %d \n", val, retval);
cprintf(RED, "Warning: %s", mess);