diff --git a/slsDetectorSoftware/eigerDetectorServer/Beb.c b/slsDetectorSoftware/eigerDetectorServer/Beb.c index 64f78e1cc..b0522622f 100644 --- a/slsDetectorSoftware/eigerDetectorServer/Beb.c +++ b/slsDetectorSoftware/eigerDetectorServer/Beb.c @@ -170,6 +170,38 @@ void Beb_GetModuleCopnfiguration(int* master, int* top){ } +u_int32_t Beb_GetFirmwareRevision(){ + //mapping new memory + u_int32_t baseaddr, value = 0; + + //open file pointer + int fd = Beb_open(XPAR_VERSION,&baseaddr); + if(fd < 0) + cprintf(RED,"Firmware Revision Read FAIL\n"); + + else{ + //read revision existing bit + value = Beb_Read32(baseaddr, REVISION_EXISTING_OFFSET); + printf("Firmware Revision Read OK\n"); + //error reading + if(!(value&REVISION_EXISTING_BIT)){ + cprintf(RED,"Firmware Revision Number does not exist in this version\n"); + value = 0; + }else{ + //read revision number + value = Beb_Read32(baseaddr, 0); + printf("Firmware Revision Number Read OK\n"); + printf("Rev: 0x%x.%x\n\n",value & REVISION_MASK,value & SUB_REVISION_MASK); + value &= REVISION_MASK; + } + } + + //close file pointer + if(fd > 0) + Beb_close(fd); + + return value; +} void Beb_ClearBebInfos(){ //unsigned int i; @@ -760,12 +792,17 @@ int Beb_open(u_int32_t baseaddr, u_int32_t* csp0base){ if (fd == -1) cprintf(RED,"\nCan't find /dev/mem!\n"); else{ +#ifdef VERBOSE printf("/dev/mem opened\n"); +#endif *csp0base = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, baseaddr); if (*csp0base == (u_int32_t)MAP_FAILED) { cprintf(RED,"\nCan't map memmory area!!\n"); fd = -1; - }else printf("CSP0 mapped\n"); + } +#ifdef VERBOSE + else printf("CSP0 mapped\n"); +#endif } return fd; } diff --git a/slsDetectorSoftware/eigerDetectorServer/Beb.h b/slsDetectorSoftware/eigerDetectorServer/Beb.h index a5c9fc3ba..2e6f9d2a0 100644 --- a/slsDetectorSoftware/eigerDetectorServer/Beb.h +++ b/slsDetectorSoftware/eigerDetectorServer/Beb.h @@ -48,8 +48,7 @@ struct BebInfo{ void Beb_GetModuleCopnfiguration(int* master, int* top); - - + u_int32_t Beb_GetFirmwareRevision(); int Beb_WriteTo(unsigned int index); diff --git a/slsDetectorSoftware/eigerDetectorServer/FebRegisterDefs.h b/slsDetectorSoftware/eigerDetectorServer/FebRegisterDefs.h index 1f9b522c1..a0380c848 100644 --- a/slsDetectorSoftware/eigerDetectorServer/FebRegisterDefs.h +++ b/slsDetectorSoftware/eigerDetectorServer/FebRegisterDefs.h @@ -116,7 +116,7 @@ // Master Slave Top Bottom Definition #define MODULE_CONFIGURATION_MASK 0x84 -//new memory +//command memory #define LEFT_OFFSET 0x0 #define RIGHT_OFFSET 0x100 @@ -130,4 +130,9 @@ #define TWO_REQUESTS_OFFSET 0x1c #define TWO_REQUESTS_BIT 0x80000000 +//firmware version +#define REVISION_EXISTING_OFFSET 8 +#define REVISION_EXISTING_BIT 0x80000000 +#define REVISION_MASK 0x0FFFFFFF +#define SUB_REVISION_MASK 0xF0000000 diff --git a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer index 2aa58e4fa..ef98c4c4d 100755 Binary files a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer and b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer differ diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index 5f5ccd92f..e2287f1e0 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -209,7 +209,7 @@ int64_t getDetectorId(enum idMode arg){ retval = getDetectorNumber();/** to be implemented with mac? */ break; case DETECTOR_FIRMWARE_VERSION: - return FIRMWAREREV;/** to be implemented */ + return (int64_t)Beb_GetFirmwareRevision(); case DETECTOR_SOFTWARE_VERSION: retval= SVNREV; retval= (retval <<32) | SVNDATE; diff --git a/slsDetectorSoftware/eigerDetectorServer/xparameters.h b/slsDetectorSoftware/eigerDetectorServer/xparameters.h index 191bd6e2f..424ff8d15 100644 --- a/slsDetectorSoftware/eigerDetectorServer/xparameters.h +++ b/slsDetectorSoftware/eigerDetectorServer/xparameters.h @@ -49,9 +49,13 @@ XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR #define XPAR_PLB_GPIO_SYS_BASEADDR 0xD1000000 #define XPAR_PLB_GPIO_SYS_HIGHADDR 0xD100FFFF -/** Stop Acquisition */ +/** Command Generator */ #define XPAR_CMD_GENERATOR 0xC5000000 + +/** Version Numbers */ +#define XPAR_VERSION 0xc6000000 + /* Definitions for peripheral PLB_GPIO_TEST */ #define XPAR_PLB_GPIO_TEST_BASEADDR 0xD1010000 #define XPAR_PLB_GPIO_TEST_HIGHADDR 0xD101FFFF