mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
separated parameters and versions
This commit is contained in:
@ -454,6 +454,146 @@ int Beb_Set32bitOverflow(int val) {
|
||||
return valueread;
|
||||
}
|
||||
|
||||
int Beb_GetTenGigaFlowControl() {
|
||||
u_int32_t offset = FLOW_REG_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to get ten giga flow control. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
retval = (retval & FLOW_REG_TXM_FLOW_CNTRL_10G_MSK) >> FLOW_REG_TXM_FLOW_CNTRL_10G_OFST;
|
||||
|
||||
Beb_close(fd,csp0base);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
int Beb_SetTenGigaFlowControl(int value) {
|
||||
FILE_LOG(logINFO, ("Setting ten giga flow control to %d\n", value));
|
||||
value = value == 0 ? 0 : 1;
|
||||
u_int32_t offset = FLOW_REG_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to set ten giga flow control. FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
// reset bit
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
Beb_Write32(csp0base, offset,retval & ~FLOW_REG_TXM_FLOW_CNTRL_10G_MSK);
|
||||
|
||||
// set bit
|
||||
retval = Beb_Read32(csp0base, offset);
|
||||
Beb_Write32(csp0base, offset,retval |
|
||||
((value << FLOW_REG_TXM_FLOW_CNTRL_10G_OFST) & FLOW_REG_TXM_FLOW_CNTRL_10G_MSK));
|
||||
|
||||
Beb_close(fd,csp0base);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int Beb_GetTransmissionDelayFrame() {
|
||||
u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to get transmission delay frame. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
Beb_close(fd,csp0base);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
int Beb_SetTransmissionDelayFrame(int value) {
|
||||
FILE_LOG(logINFO, ("Setting transmission delay frame to %d\n", value));
|
||||
if (value < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid transmission delay frame value %d\n", value));
|
||||
return 0;
|
||||
}
|
||||
u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to set transmission delay frame. FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
Beb_Write32(csp0base, offset, value);
|
||||
Beb_close(fd,csp0base);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int Beb_GetTransmissionDelayLeft() {
|
||||
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to get transmission delay left. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
Beb_close(fd,csp0base);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
int Beb_SetTransmissionDelayLeft(int value) {
|
||||
FILE_LOG(logINFO, ("Setting transmission delay left to %d\n", value));
|
||||
if (value < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid transmission delay left value %d\n", value));
|
||||
return 0;
|
||||
}
|
||||
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to set transmission delay left. FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
Beb_Write32(csp0base, offset, value);
|
||||
Beb_close(fd,csp0base);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int Beb_GetTransmissionDelayRight() {
|
||||
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to get transmission delay right. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
Beb_close(fd,csp0base);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
int Beb_SetTransmissionDelayRight(int value) {
|
||||
FILE_LOG(logINFO, ("Setting transmission delay right to %d\n", value));
|
||||
if (value < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid transmission delay right value %d\n", value));
|
||||
return 0;
|
||||
}
|
||||
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to set transmission delay right. FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
Beb_Write32(csp0base, offset, value);
|
||||
Beb_close(fd,csp0base);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val) {
|
||||
|
||||
if (!Beb_activated)
|
||||
@ -475,15 +615,8 @@ int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val) {
|
||||
offset = TXM_DELAY_RIGHT_OFFSET;
|
||||
strcpy(modename,"Transmission Delay Right");
|
||||
break;
|
||||
case TXN_FRAME:
|
||||
offset = TXM_DELAY_FRAME_OFFSET;
|
||||
strcpy(modename,"Transmission Delay Frame");
|
||||
break;
|
||||
case FLOWCTRL_10G:
|
||||
offset = FLOW_REG_OFFSET;
|
||||
strcpy(modename,"Flow Control for 10G");
|
||||
if (val>0) val = 1;
|
||||
break;
|
||||
|
||||
|
||||
default: FILE_LOG(logERROR, ("Unrecognized mode in network parameter: %d\n",mode)); return -1;
|
||||
}
|
||||
//open file pointer
|
||||
@ -491,31 +624,15 @@ int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val) {
|
||||
if (fd < 0) {
|
||||
FILE_LOG(logERROR, ("Could not read register to set network parameter. FAIL\n"));
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (val > -1) {
|
||||
if (mode != FLOWCTRL_10G) {
|
||||
valueread = Beb_Read32(csp0base, offset);
|
||||
Beb_Write32(csp0base, offset,val);
|
||||
}
|
||||
// flow control reg has other bits for other control
|
||||
else {
|
||||
// reset bit
|
||||
valueread = Beb_Read32(csp0base, offset);
|
||||
Beb_Write32(csp0base, offset,valueread & ~FLOW_REG_TXM_FLOW_CNTRL_10G_MSK);
|
||||
|
||||
// set bit
|
||||
valueread = Beb_Read32(csp0base, offset);
|
||||
Beb_Write32(csp0base, offset,valueread |
|
||||
((val << FLOW_REG_TXM_FLOW_CNTRL_10G_OFST) & FLOW_REG_TXM_FLOW_CNTRL_10G_MSK));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
valueread = Beb_Read32(csp0base, offset);
|
||||
if (mode == FLOWCTRL_10G)
|
||||
valueread = (valueread & FLOW_REG_TXM_FLOW_CNTRL_10G_MSK) >> FLOW_REG_TXM_FLOW_CNTRL_10G_OFST;
|
||||
|
||||
|
||||
}
|
||||
//close file pointer
|
||||
|
@ -41,7 +41,16 @@ int Beb_SetSlaveViaSoftware();
|
||||
int Beb_Activate(int enable);
|
||||
int Beb_GetActivate();
|
||||
int Beb_Set32bitOverflow(int val);
|
||||
int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val);
|
||||
|
||||
int Beb_GetTenGigaFlowControl();
|
||||
int Beb_SetTenGigaFlowControl(int value);
|
||||
int Beb_GetTransmissionDelayFrame();
|
||||
int Beb_SetTransmissionDelayFrame(int value);
|
||||
int Beb_GetTransmissionDelayLeft();
|
||||
int Beb_SetTransmissionDelayLeft(int value);
|
||||
int Beb_GetTransmissionDelayRight();
|
||||
int Beb_SetTransmissionDelayRight(int value);
|
||||
|
||||
int Beb_ResetToHardwareSettings();
|
||||
u_int32_t Beb_GetFirmwareRevision();
|
||||
u_int32_t Beb_GetFirmwareSoftwareAPIVersion();
|
||||
|
Binary file not shown.
@ -110,10 +110,10 @@ void basictests() {
|
||||
#endif
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getDetectorId(DETECTOR_FIRMWARE_VERSION);
|
||||
int64_t swversion = getDetectorId(DETECTOR_SOFTWARE_VERSION);
|
||||
int64_t sw_fw_apiversion = getDetectorId(SOFTWARE_FIRMWARE_API_VERSION);
|
||||
int64_t client_sw_apiversion = getDetectorId(CLIENT_SOFTWARE_API_VERSION);
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
int64_t sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
|
||||
FILE_LOG(logINFOBLUE, ("**************** EIGER Server *********************\n\n"
|
||||
"Detector IP Addr:\t\t 0x%x\n"
|
||||
@ -190,26 +190,12 @@ void basictests() {
|
||||
|
||||
/* Ids */
|
||||
|
||||
int64_t getDetectorId(enum idMode arg) {
|
||||
|
||||
int64_t retval = -1;
|
||||
switch(arg) {
|
||||
case DETECTOR_SERIAL_NUMBER:
|
||||
retval = getDetectorNumber();/** to be implemented with mac? */
|
||||
break;
|
||||
case DETECTOR_FIRMWARE_VERSION:
|
||||
return (int64_t)getFirmwareVersion();
|
||||
case SOFTWARE_FIRMWARE_API_VERSION:
|
||||
return (int64_t)getFirmwareAPIVersion();
|
||||
case DETECTOR_SOFTWARE_VERSION:
|
||||
case CLIENT_SOFTWARE_API_VERSION:
|
||||
return APIEIGER;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
uint64_t getServerVersion() {
|
||||
return APIEIGER;
|
||||
}
|
||||
|
||||
uint64_t getClientServerAPIVersion() {
|
||||
return APIEIGER;
|
||||
}
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
@ -1347,6 +1333,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
||||
#endif
|
||||
eiger_readoutspeed = val;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getClockDivider(enum CLKINDEX ind) {
|
||||
@ -1600,44 +1587,83 @@ int activate(int enable) {
|
||||
#endif
|
||||
}
|
||||
|
||||
int setNetworkParameter(enum NETWORKINDEX mode, int value) {
|
||||
#ifndef VIRTUAL
|
||||
return Beb_SetNetworkParameter(mode, value);
|
||||
int getTenGigaFlowControl() {
|
||||
#ifdef VIRTUAL
|
||||
return eiger_virtual_transmission_flowcontrol_10g;
|
||||
#else
|
||||
if (value>-1) {
|
||||
switch(mode) {
|
||||
case TXN_LEFT:
|
||||
eiger_virtual_transmission_delay_left = value;
|
||||
break;
|
||||
case TXN_RIGHT:
|
||||
eiger_virtual_transmission_delay_right = value;
|
||||
break;
|
||||
case TXN_FRAME:
|
||||
eiger_virtual_transmission_delay_frame = value;
|
||||
break;
|
||||
case FLOWCTRL_10G:
|
||||
eiger_virtual_transmission_flowcontrol_10g = value;
|
||||
if (value>0) value = 1;
|
||||
break;
|
||||
default: FILE_LOG(logERROR, ("Unrecognized mode in network parameter: %d\n",mode));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
switch(mode) {
|
||||
case TXN_LEFT:
|
||||
return eiger_virtual_transmission_delay_left;
|
||||
case TXN_RIGHT:
|
||||
return eiger_virtual_transmission_delay_right;
|
||||
case TXN_FRAME:
|
||||
return eiger_virtual_transmission_delay_frame;
|
||||
case FLOWCTRL_10G:
|
||||
return eiger_virtual_transmission_flowcontrol_10g;
|
||||
default: FILE_LOG(logERROR, ("Unrecognized mode in network parameter: %d\n",mode));
|
||||
return -1;
|
||||
}
|
||||
return Beb_GetTenGigaFlowControl();
|
||||
#endif
|
||||
}
|
||||
|
||||
int setTenGigaFlowControl(int value) {
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_transmission_flowcontrol_10g = (value == 0? 0 : 1);
|
||||
#else
|
||||
if (!Beb_SetTenGigaFlowControl(value)) {
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getTransmissionDelayFrame() {
|
||||
#ifdef VIRTUAL
|
||||
return eiger_virtual_transmission_delay_frame;
|
||||
#else
|
||||
return Beb_GetTransmissionDelayFrame();
|
||||
#endif
|
||||
}
|
||||
|
||||
int setTransmissionDelayFrame(int value) {
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_transmission_delay_frame = value;
|
||||
#else
|
||||
if (!Beb_SetTransmissionDelayFrame(value)) {
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getTransmissionDelayLeft() {
|
||||
#ifdef VIRTUAL
|
||||
return eiger_virtual_transmission_delay_left;
|
||||
#else
|
||||
return Beb_GetTransmissionDelayLeft();
|
||||
#endif
|
||||
}
|
||||
|
||||
int setTransmissionDelayLeft(int value) {
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_transmission_delay_left = value;
|
||||
#else
|
||||
if (!Beb_SetTransmissionDelayLeft(value)) {
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getTransmissionDelayRight() {
|
||||
#ifdef VIRTUAL
|
||||
return eiger_virtual_transmission_delay_right;
|
||||
#else
|
||||
return Beb_GetTransmissionDelayRight();
|
||||
#endif
|
||||
}
|
||||
|
||||
int setTransmissionDelayRight(int value) {
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_transmission_delay_right = value;
|
||||
#else
|
||||
if (!Beb_SetTransmissionDelayRight(value)) {
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user