mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 17:10:03 +02:00
included command to get detector firmware svn version
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@261 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
8cc957f109
commit
32621b1916
@ -273,7 +273,8 @@ enum idMode{
|
|||||||
DETECTOR_SERIAL_NUMBER, /**<return detector system serial number */
|
DETECTOR_SERIAL_NUMBER, /**<return detector system serial number */
|
||||||
DETECTOR_FIRMWARE_VERSION, /**<return detector system firmware version */
|
DETECTOR_FIRMWARE_VERSION, /**<return detector system firmware version */
|
||||||
DETECTOR_SOFTWARE_VERSION, /**<return detector system software version */
|
DETECTOR_SOFTWARE_VERSION, /**<return detector system software version */
|
||||||
THIS_SOFTWARE_VERSION /**<return this software version */
|
THIS_SOFTWARE_VERSION, /**<return this software version */
|
||||||
|
DETECTOR_FIRMWARE_SVN_VERSION /**<return detector system firmware svn version */
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
detector digital test modes
|
detector digital test modes
|
||||||
|
@ -705,7 +705,7 @@ int setContinousReadOut(int d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u_int64_t getMcsNumber() {
|
u_int64_t getDetectorNumber() {
|
||||||
|
|
||||||
FILE *fp=NULL;
|
FILE *fp=NULL;
|
||||||
u_int64_t res;
|
u_int64_t res;
|
||||||
@ -737,11 +737,15 @@ u_int64_t getMcsNumber() {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t getMcsVersion() {
|
u_int32_t getFirmwareVersion() {
|
||||||
return bus_r(FPGA_VERSION_REG);
|
return bus_r(FPGA_VERSION_REG);
|
||||||
//return MCSVERSION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u_int32_t getFirmwareSVNVersion(){
|
||||||
|
return bus_r(FPGA_SVN_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// for fpga test
|
// for fpga test
|
||||||
u_int32_t testFpga(void) {
|
u_int32_t testFpga(void) {
|
||||||
printf("Test FPGA:\n");
|
printf("Test FPGA:\n");
|
||||||
@ -755,15 +759,6 @@ u_int32_t testFpga(void) {
|
|||||||
printf("fixed pattern wrong!! %08x\n",val);
|
printf("fixed pattern wrong!! %08x\n",val);
|
||||||
result=FAIL;
|
result=FAIL;
|
||||||
}
|
}
|
||||||
//FPGA code version
|
|
||||||
val=bus_r(FPGA_VERSION_REG)&0x00ffffff;
|
|
||||||
if (val>=(FPGA_VERSION_VAL&0x00ffffff)) {
|
|
||||||
printf("FPGA version ok!! %06x\n",val);
|
|
||||||
} else {
|
|
||||||
printf("FPGA version too old! %06x\n",val);
|
|
||||||
result= FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//dummy register
|
//dummy register
|
||||||
addr = DUMMY_REG;
|
addr = DUMMY_REG;
|
||||||
@ -821,129 +816,10 @@ u_int32_t testRAM(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getNModBoard() {
|
int getNModBoard() {
|
||||||
int nmodboard;
|
return nModX;
|
||||||
u_int32_t val;
|
|
||||||
val=bus_r(FPGA_VERSION_REG)&0xff000000;
|
|
||||||
nmodboard=val >> 24;
|
|
||||||
#ifdef VERY_VERBOSE
|
|
||||||
printf("The board hosts %d modules\n",nmodboard);
|
|
||||||
#endif
|
|
||||||
nModBoard=nmodboard;
|
|
||||||
return nmodboard;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int setNMod(int n) {
|
int setNMod(int n) {
|
||||||
|
|
||||||
|
|
||||||
/* commented out by dhanya
|
|
||||||
// int fifo;
|
|
||||||
// int ifsta, ifsto, ifste;
|
|
||||||
int imod;
|
|
||||||
int rval;
|
|
||||||
int reg;
|
|
||||||
int nf=0;
|
|
||||||
int shiftfifo=SHIFTFIFO;
|
|
||||||
int ntot=getNModBoard();
|
|
||||||
if (getProbes()==0) {
|
|
||||||
switch (dynamicRange) {
|
|
||||||
case 16:
|
|
||||||
shiftfifo=SHIFTFIFO-1;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
shiftfifo=SHIFTFIFO-2;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
shiftfifo=SHIFTFIFO-3;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
shiftfifo=SHIFTFIFO-5;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
shiftfifo=SHIFTFIFO;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
shiftfifo=SHIFTFIFO;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("SetNMod called arg %d -- dr %d shiftfifo %d\n",n,dynamicRange,shiftfifo);
|
|
||||||
#endif
|
|
||||||
if (n>0 && n<=ntot) {
|
|
||||||
nModX=n;
|
|
||||||
|
|
||||||
//d isable the fifos relative to the unused modules
|
|
||||||
for (ififo=0; ififo<ntot*NCHIP; ififo++) {
|
|
||||||
reg=bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo));
|
|
||||||
if (ififo<n*NCHIP) {
|
|
||||||
if (reg&FIFO_DISABLED_BIT) {
|
|
||||||
bus_w(FIFO_CNTRL_REG_OFF+(ififo<<shiftfifo), FIFO_DISABLE_TOGGLE_BIT);
|
|
||||||
#ifdef VERBOSE
|
|
||||||
if (bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo))&FIFO_DISABLED_BIT) {
|
|
||||||
printf("Fifo %d is %x (nm %d nc %d addr %08x)",ififo,reg, (reg&FIFO_NM_MASK)>>FIFO_NM_OFF, (reg&FIFO_NC_MASK)>>FIFO_NC_OFF, FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo));
|
|
||||||
printf(" enabling %08x\n",bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
//#ifdef VERBOSE
|
|
||||||
//else printf(" unmodified ",ififo,reg);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if ((reg&FIFO_ENABLED_BIT)) {
|
|
||||||
bus_w(FIFO_CNTRL_REG_OFF+(ififo<<shiftfifo), FIFO_DISABLE_TOGGLE_BIT);
|
|
||||||
#ifdef VERBOSE
|
|
||||||
if ((bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo))&FIFO_ENABLED_BIT)) {
|
|
||||||
printf("Fifo %d is %x (nm %d nc %d addr %08x)",ififo,reg, (reg&FIFO_NM_MASK)>>FIFO_NM_OFF, (reg&FIFO_NC_MASK)>>FIFO_NC_OFF, FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo));
|
|
||||||
printf(" disabling %08x\n",bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
//#ifdef VERBOSE
|
|
||||||
//else printf(" unmodified ",ififo,reg);
|
|
||||||
//#endif
|
|
||||||
}
|
|
||||||
//#ifdef VERBOSE
|
|
||||||
//printf(" done %x\n",bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo)));
|
|
||||||
//#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ifste=dynamicRange/32;
|
|
||||||
nModX=0;
|
|
||||||
nf=0;
|
|
||||||
for (imod=0; imod<ntot; imod++) {
|
|
||||||
rval=0;
|
|
||||||
for (ififo=imod*NCHIP; ififo<(imod+1)*NCHIP; ififo++) {
|
|
||||||
bus_w(FIFO_CNTRL_REG_OFF+(ififo<<shiftfifo), FIFO_RESET_BIT);
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("%08x ",(bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo))));
|
|
||||||
#endif
|
|
||||||
if ((bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo))&FIFO_ENABLED_BIT)){
|
|
||||||
rval=1; // checks if at least one fifo of the module is enabled
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("Fifo %d is enabled\n",ififo);
|
|
||||||
#endif
|
|
||||||
nf++;
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
|
||||||
else printf("Fifo %d is disabled\n",ififo);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (rval) {
|
|
||||||
nModX++;
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("Module %d is enabled --total %d (%d fifos)\n",imod,nModX,nf );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
|
||||||
else printf("Module %d is disabled --total %d (%d fifos)\n",imod,nModX,nf );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("There are %d modules enabled (%d fifos)\n",nModX, nf);
|
|
||||||
#endif
|
|
||||||
getDynamicRange();
|
|
||||||
*/
|
|
||||||
return nModX;
|
return nModX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ int initConfGain(int isettings,int val,int imod);
|
|||||||
|
|
||||||
int configureMAC(int ipad, long long int macad, long long int servermacad, int ival);
|
int configureMAC(int ipad, long long int macad, long long int servermacad, int ival);
|
||||||
|
|
||||||
u_int64_t getMcsNumber();
|
u_int64_t getDetectorNumber();
|
||||||
u_int32_t getMcsVersion();
|
u_int32_t getFirmwareVersion();
|
||||||
int testFifos(void);
|
int testFifos(void);
|
||||||
u_int32_t testFpga(void);
|
u_int32_t testFpga(void);
|
||||||
u_int32_t testRAM(void);
|
u_int32_t testRAM(void);
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
/* values defined for FPGA */
|
/* values defined for FPGA */
|
||||||
#define MCSNUM 0x0
|
#define MCSNUM 0x0
|
||||||
#define MCSVERSION 0x101
|
|
||||||
#define FIXED_PATT_VAL 0xacdc1980
|
#define FIXED_PATT_VAL 0xacdc1980
|
||||||
#define FPGA_VERSION_VAL 0x01110825 //0x00090514
|
|
||||||
|
|
||||||
#define FPGA_INIT_PAT 0x60008
|
#define FPGA_INIT_PAT 0x60008
|
||||||
#define FPGA_INIT_ADDR 0xb0000000
|
#define FPGA_INIT_ADDR 0xb0000000
|
||||||
|
|
||||||
@ -41,6 +41,8 @@
|
|||||||
//#define WRTSE_SHAD_REG 0x1f<<11
|
//#define WRTSE_SHAD_REG 0x1f<<11
|
||||||
//HV
|
//HV
|
||||||
#define HV_REG 0x20<<11
|
#define HV_REG 0x20<<11
|
||||||
|
|
||||||
|
|
||||||
#define DUMMY_REG 0x21<<11
|
#define DUMMY_REG 0x21<<11
|
||||||
#define FPGA_VERSION_REG 0x22<<11
|
#define FPGA_VERSION_REG 0x22<<11
|
||||||
#define FIX_PATT_REG 0x23<<11
|
#define FIX_PATT_REG 0x23<<11
|
||||||
@ -48,6 +50,7 @@
|
|||||||
#define STATUS_REG 0x25<<11
|
#define STATUS_REG 0x25<<11
|
||||||
#define CONFIG_REG 0x26<<11
|
#define CONFIG_REG 0x26<<11
|
||||||
#define EXT_SIGNAL_REG 0x27<<11
|
#define EXT_SIGNAL_REG 0x27<<11
|
||||||
|
#define FPGA_SVN_REG 0x29<<11
|
||||||
|
|
||||||
|
|
||||||
//FIFO
|
//FIFO
|
||||||
|
@ -40,5 +40,5 @@
|
|||||||
#define CLK_FREQ 32.1E+6
|
#define CLK_FREQ 32.1E+6
|
||||||
|
|
||||||
|
|
||||||
#define THIS_SOFTWARE_VERSION 0x20100429
|
#define THIS_SOFTWARE_VERSION 0x20120919
|
||||||
#endif
|
#endif
|
||||||
|
@ -565,39 +565,18 @@ int get_id(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case MODULE_SERIAL_NUMBER:
|
|
||||||
n = receiveDataOnly(file_des,&imod,sizeof(imod));
|
|
||||||
if (n < 0) {
|
|
||||||
sprintf(mess,"Error reading from socket\n");
|
|
||||||
retval=FAIL;
|
|
||||||
} else {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("of module %d\n", imod);
|
|
||||||
#endif
|
|
||||||
if (imod>=0 && imod<=getNModBoard()) {
|
|
||||||
#ifdef MCB_FUNCS
|
|
||||||
retval=getModuleNumber(imod);
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sprintf(mess,"Module number %d out of range\n",imod);
|
|
||||||
ret=FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MODULE_FIRMWARE_VERSION:
|
|
||||||
retval=0x1;
|
|
||||||
break;
|
|
||||||
case DETECTOR_SERIAL_NUMBER:
|
case DETECTOR_SERIAL_NUMBER:
|
||||||
retval=getMcsNumber();
|
retval=getDetectorNumber();
|
||||||
break;
|
break;
|
||||||
case DETECTOR_FIRMWARE_VERSION:
|
case DETECTOR_FIRMWARE_VERSION:
|
||||||
retval=getMcsVersion();
|
retval=getFirmwareVersion();
|
||||||
break;
|
break;
|
||||||
case DETECTOR_SOFTWARE_VERSION:
|
case DETECTOR_SOFTWARE_VERSION:
|
||||||
retval=THIS_SOFTWARE_VERSION;
|
retval=THIS_SOFTWARE_VERSION;
|
||||||
break;
|
break;
|
||||||
|
case DETECTOR_FIRMWARE_SVN_VERSION:
|
||||||
|
retval=getFirmwareSVNVersion();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Required unknown id %d \n", arg);
|
printf("Required unknown id %d \n", arg);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
|
@ -391,6 +391,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSN;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSN;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="detectorsvnversion"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSN;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
/* digital test and debugging */
|
/* digital test and debugging */
|
||||||
|
|
||||||
@ -2541,6 +2545,10 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd=="detectorsvnversion") {
|
||||||
|
sprintf(answer,"%llx",myDet->getId(DETECTOR_FIRMWARE_SVN_VERSION));
|
||||||
|
return string(answer);
|
||||||
|
}
|
||||||
return string("unknown id mode ")+cmd;
|
return string("unknown id mode ")+cmd;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user