firmware version for eiger added

This commit is contained in:
Dhanya Maliakal 2015-06-22 17:09:47 +02:00
parent 861753a5d1
commit f3d5de70bf
6 changed files with 51 additions and 6 deletions

View File

@ -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;
}

View File

@ -48,8 +48,7 @@ struct BebInfo{
void Beb_GetModuleCopnfiguration(int* master, int* top);
u_int32_t Beb_GetFirmwareRevision();
int Beb_WriteTo(unsigned int index);

View File

@ -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

View File

@ -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;

View File

@ -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