merge conflict and binaries in

This commit is contained in:
2021-09-09 11:22:09 +02:00
35 changed files with 237 additions and 289 deletions

View File

@ -392,7 +392,7 @@ uint32_t getDetectorIP() {
#ifdef VIRTUAL
return 0;
#endif
char temp[50] = "";
char temp[INET_ADDRSTRLEN] = "";
uint32_t res = 0;
// execute and get address
char output[255];
@ -1525,10 +1525,10 @@ int configureMAC() {
int dstport = udpDetails[0].dstport;
LOG(logINFOBLUE, ("Configuring MAC\n"));
char src_mac[50], src_ip[INET_ADDRSTRLEN], dst_mac[50],
dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, 50, srcmac);
getMacAddressinString(dst_mac, 50, dstmac);
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
getIpAddressinString(src_ip, srcip);
getIpAddressinString(dst_ip, dstip);

View File

@ -263,7 +263,7 @@ u_int64_t getDetectorMAC() {
}
u_int32_t getDetectorIP() {
char temp[50] = "";
char temp[INET_ADDRSTRLEN] = "";
u_int32_t res = 0;
// execute and get address
char output[255];
@ -303,7 +303,7 @@ void initControlServer() {
LOG(logINFOBLUE, ("Configuring Control server\n"));
if (!updateFlag && initError == OK) {
#ifndef VIRTUAL
int detid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
#else
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
#endif
@ -342,7 +342,7 @@ void initControlServer() {
LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
Beb_SetTopVariable(top);
Beb_Beb();
Beb_SetModuleId(detid);
Beb_SetModuleId(modid);
LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
#endif
// also reads config file and deactivates
@ -1531,10 +1531,10 @@ int configureMAC() {
int dstport = udpDetails[iRxEntry].dstport;
int dstport2 = udpDetails[iRxEntry].dstport2;
char src_mac[50], src_ip[INET_ADDRSTRLEN], dst_mac[50],
dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, 50, srcmac);
getMacAddressinString(dst_mac, 50, dstmac);
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
getIpAddressinString(src_ip, srcip);
getIpAddressinString(dst_ip, dstip);

View File

@ -288,16 +288,13 @@ u_int32_t getDetectorNumber() {
}
int getModuleId(int *ret, char *mess) {
return getModuleIdInFile(ret, mess, ID_FILE);
return ((bus_r(MOD_ID_REG) & ~MOD_ID_MSK) >> MOD_ID_OFST);
}
void setModuleId(int *ret, char *mess, int arg) {
*ret = setModuleIdInFile(mess, arg, ID_FILE);
if (*ret == FAIL) {
return;
}
void setModuleId(int modid) {
LOG(logINFOBLUE, ("Setting module id in fpga: %d\n", modid))
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) & ~MOD_ID_MSK);
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) | ((arg << MOD_ID_OFST) & MOD_ID_MSK));
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
}
u_int64_t getDetectorMAC() {
@ -326,7 +323,7 @@ u_int32_t getDetectorIP() {
#ifdef VIRTUAL
return 0;
#endif
char temp[50] = "";
char temp[INET_ADDRSTRLEN] = "";
u_int32_t res = 0;
// execute and get address
char output[255];
@ -422,10 +419,6 @@ void setupDetector() {
sharedMemory_setStatus(IDLE);
setupUDPCommParameters();
#endif
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
if (initError == FAIL) {
return;
}
// pll defines
ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL,
PLL_RESET_REG, PLL_RESET_READOUT_MSK,
@ -483,6 +476,14 @@ void setupDetector() {
if (readConfigFile() == FAIL) {
return;
}
// set module id in register
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
if (initError == FAIL) {
return;
}
setModuleId(modid);
setBurstMode(DEFAULT_BURST_MODE);
setFilterResistor(DEFAULT_FILTER_RESISTOR);
setCDSGain(DEFAILT_CDS_GAIN);
@ -1749,16 +1750,16 @@ int configureMAC() {
int dstport2 = udpDetails[0].dstport2;
LOG(logINFOBLUE, ("Configuring MAC\n"));
char src_mac[50], src_ip[INET_ADDRSTRLEN], dst_mac[50],
dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, 50, srcmac);
getMacAddressinString(dst_mac, 50, dstmac);
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
getIpAddressinString(src_ip, srcip);
getIpAddressinString(dst_ip, dstip);
char src_mac2[50], src_ip2[INET_ADDRSTRLEN], dst_mac2[50],
dst_ip2[INET_ADDRSTRLEN];
getMacAddressinString(src_mac2, 50, srcmac2);
getMacAddressinString(dst_mac2, 50, dstmac2);
char src_mac2[MAC_ADDRESS_SIZE], src_ip2[INET_ADDRSTRLEN],
dst_mac2[MAC_ADDRESS_SIZE], dst_ip2[INET_ADDRSTRLEN];
getMacAddressinString(src_mac2, MAC_ADDRESS_SIZE, srcmac2);
getMacAddressinString(dst_mac2, MAC_ADDRESS_SIZE, dstmac2);
getIpAddressinString(src_ip2, srcip2);
getIpAddressinString(dst_ip2, dstip2);

View File

@ -315,7 +315,7 @@ u_int32_t getDetectorIP() {
#ifdef VIRTUAL
return 0;
#endif
char temp[50] = "";
char temp[INET_ADDRSTRLEN] = "";
u_int32_t res = 0;
// execute and get address
char output[255];
@ -1340,10 +1340,10 @@ int configureMAC() {
int dstport = udpDetails[0].dstport;
LOG(logINFOBLUE, ("Configuring MAC\n"));
char src_mac[50], src_ip[INET_ADDRSTRLEN], dst_mac[50],
dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, 50, srcmac);
getMacAddressinString(dst_mac, 50, dstmac);
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
getIpAddressinString(src_ip, srcip);
getIpAddressinString(dst_ip, dstip);

View File

@ -52,9 +52,6 @@ int detPos[4] = {};
int chipVersion = 10; // (1.0)
int chipConfigured = 0;
// until firmware is done
int temp_readNRows = 512;
int isInitCheckDone() { return initCheckDone; }
int getInitResult(char **mess) {
@ -337,7 +334,7 @@ u_int32_t getDetectorIP() {
#ifdef VIRTUAL
return 0;
#endif
char temp[50] = "";
char temp[INET_ADDRSTRLEN] = "";
u_int32_t res = 0;
// execute and get address
char output[255];
@ -1480,16 +1477,16 @@ int configureMAC() {
int dstport = udpDetails[iRxEntry].dstport;
int dstport2 = udpDetails[iRxEntry].dstport2;
char src_mac[50], src_ip[INET_ADDRSTRLEN], dst_mac[50],
dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, 50, srcmac);
getMacAddressinString(dst_mac, 50, dstmac);
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
getIpAddressinString(src_ip, srcip);
getIpAddressinString(dst_ip, dstip);
char src_mac2[50], src_ip2[INET_ADDRSTRLEN], dst_mac2[50],
dst_ip2[INET_ADDRSTRLEN];
getMacAddressinString(src_mac2, 50, srcmac2);
getMacAddressinString(dst_mac2, 50, dstmac2);
char src_mac2[MAC_ADDRESS_SIZE], src_ip2[INET_ADDRSTRLEN],
dst_mac2[MAC_ADDRESS_SIZE], dst_ip2[INET_ADDRSTRLEN];
getMacAddressinString(src_mac2, MAC_ADDRESS_SIZE, srcmac2);
getMacAddressinString(dst_mac2, MAC_ADDRESS_SIZE, dstmac2);
getIpAddressinString(src_ip2, srcip2);
getIpAddressinString(dst_ip2, dstip2);
@ -1642,11 +1639,6 @@ int setReadNRows(int value) {
return FAIL;
}
// will be replaced when firmware is fixed
LOG(logWARNING, ("Setting number of rows: %d (Not implemented in firmware yet)\n", value));
temp_readNRows = value;
return OK;
// regval is numpackets - 1
int regval = (value / READ_N_ROWS_MULTIPLE) - 1;
uint32_t addr = READ_N_ROWS_REG;
@ -1665,10 +1657,6 @@ int setReadNRows(int value) {
}
int getReadNRows() {
// will be replaced when firmware is fixed
return temp_readNRows;
int enable = (bus_r(READ_N_ROWS_REG) & READ_N_ROWS_ENBL_MSK);
int regval = ((bus_r(READ_N_ROWS_REG) & READ_N_ROWS_NUM_ROWS_MSK) >> READ_N_ROWS_NUM_ROWS_OFST);

View File

@ -389,7 +389,7 @@ uint32_t getDetectorIP() {
#ifdef VIRTUAL
return 0;
#endif
char temp[50] = "";
char temp[INET_ADDRSTRLEN] = "";
uint32_t res = 0;
// execute and get address
char output[255];
@ -1190,10 +1190,10 @@ int configureMAC() {
int dstport = udpDetails[0].dstport;
LOG(logINFOBLUE, ("Configuring MAC\n"));
char src_mac[50], src_ip[INET_ADDRSTRLEN], dst_mac[50],
dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, 50, srcmac);
getMacAddressinString(dst_mac, 50, dstmac);
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
getIpAddressinString(src_ip, srcip);
getIpAddressinString(dst_ip, dstip);

View File

@ -312,7 +312,7 @@ u_int32_t getDetectorIP() {
#ifdef VIRTUAL
return 0;
#endif
char temp[50] = "";
char temp[INET_ADDRSTRLEN] = "";
u_int32_t res = 0;
// execute and get address
char output[255];
@ -444,6 +444,14 @@ void setupDetector() {
setASICDefaults();
setADIFDefaults();
// set module id in register
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
if (initError == FAIL) {
return;
}
// until firmware is done
// setModuleId(modid);
// set trigger flow for m3 (for all timing modes)
bus_w(FLOW_TRIGGER_REG, bus_r(FLOW_TRIGGER_REG) | FLOW_TRIGGER_MSK);
@ -1720,10 +1728,10 @@ int configureMAC() {
int dstport = udpDetails[0].dstport;
LOG(logINFOBLUE, ("Configuring MAC\n"));
char src_mac[50], src_ip[INET_ADDRSTRLEN], dst_mac[50],
dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, 50, srcmac);
getMacAddressinString(dst_mac, 50, dstmac);
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
getIpAddressinString(src_ip, srcip);
getIpAddressinString(dst_ip, dstip);

View File

@ -52,6 +52,7 @@ typedef struct udpStruct_s {
uint32_t dstip;
uint32_t dstip2;
} udpStruct;
#define MAC_ADDRESS_SIZE 18
// basic tests
int isInitCheckDone();
@ -96,7 +97,7 @@ u_int32_t getDetectorNumber();
int getModuleId(int *ret, char *mess);
#endif
#ifdef GOTTHARD2D
void setModuleId(int *ret, char *mess, int arg);
void setModuleId(int modid);
#endif
u_int64_t getDetectorMAC();
u_int32_t getDetectorIP();

View File

@ -268,7 +268,6 @@ int get_adc_pipeline(int);
int set_dbit_pipeline(int);
int get_dbit_pipeline(int);
int get_module_id(int);
int set_module_id(int);
int get_dest_udp_list(int);
int set_dest_udp_list(int);
int get_num_dest_list(int);

View File

@ -404,7 +404,6 @@ void function_table() {
flist[F_SET_DBIT_PIPELINE] = &set_dbit_pipeline;
flist[F_GET_DBIT_PIPELINE] = &get_dbit_pipeline;
flist[F_GET_MODULE_ID] = &get_module_id;
flist[F_SET_MODULE_ID] = &set_module_id;
flist[F_GET_DEST_UDP_LIST] = &get_dest_udp_list;
flist[F_SET_DEST_UDP_LIST] = &set_dest_udp_list;
flist[F_GET_NUM_DEST_UDP] = &get_num_dest_list;
@ -1760,8 +1759,8 @@ int acquire(int blocking, int file_des) {
if (udpDetails[0].srcmac != getDetectorMAC()) {
ret = FAIL;
uint64_t sourcemac = getDetectorMAC();
char src_mac[50];
getMacAddressinString(src_mac, 50, sourcemac);
char src_mac[MAC_ADDRESS_SIZE];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
sprintf(mess,
"Invalid udp source mac address for this detector. Must be "
"same as hardware detector mac address %s\n",
@ -4875,8 +4874,8 @@ void calculate_and_set_position() {
else {
// create detector mac from x and y
if (udpDetails[0].srcmac == 0) {
char dmac[50];
memset(dmac, 0, 50);
char dmac[MAC_ADDRESS_SIZE];
memset(dmac, 0, MAC_ADDRESS_SIZE);
sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[0] & 0xFF,
pos[1] & 0xFF);
LOG(logINFO, ("Udp source mac address created: %s\n", dmac));
@ -4895,8 +4894,8 @@ void calculate_and_set_position() {
#if defined(JUNGFRAUD) || defined(GOTTHARD2D)
if (getNumberofUDPInterfaces() > 1) {
if (udpDetails[0].srcmac2 == 0) {
char dmac2[50];
memset(dmac2, 0, 50);
char dmac2[MAC_ADDRESS_SIZE];
memset(dmac2, 0, MAC_ADDRESS_SIZE);
sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[0] + 1) & 0xFF,
pos[1] & 0xFF);
LOG(logINFO, ("Udp source mac address2 created: %s\n", dmac2));
@ -9034,34 +9033,6 @@ int get_module_id(int file_des) {
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_module_id(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = -1;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logDEBUG1, ("Setting module id to 0x%x\n", arg));
#ifndef GOTTHARD2D
functionNotImplemented();
#else
if (arg > 0xFFFF) {
ret = FAIL;
sprintf(mess, "Could not set module id. Max value: 0x%x\n", 0xFFFF);
LOG(logERROR, (mess));
} else {
setModuleId(&ret, mess, arg);
if (ret != FAIL) {
int retval = getModuleId(&ret, mess);
LOG(logDEBUG1, ("retval module id: %d\n", retval));
validate(&ret, mess, arg, retval, "set module id", DEC);
}
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_dest_udp_list(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
@ -9100,9 +9071,9 @@ int get_dest_udp_list(int file_des) {
char ip[INET_ADDRSTRLEN], ip2[INET_ADDRSTRLEN];
getIpAddressinString(ip, retvals[3]);
getIpAddressinString(ip2, retvals[4]);
char mac[50], mac2[50];
getMacAddressinString(mac, 50, retvals64[0]);
getMacAddressinString(mac2, 50, retvals64[1]);
char mac[MAC_ADDRESS_SIZE], mac2[MAC_ADDRESS_SIZE];
getMacAddressinString(mac, MAC_ADDRESS_SIZE, retvals64[0]);
getMacAddressinString(mac2, MAC_ADDRESS_SIZE, retvals64[1]);
LOG(logDEBUG1,
("Udp Dest. retval [%d]: [port %d, port2 %d, ip %s, ip2 %s, "
"mac %s, mac2 %s]\n",
@ -9136,9 +9107,9 @@ int set_dest_udp_list(int file_des) {
char ip[INET_ADDRSTRLEN], ip2[INET_ADDRSTRLEN];
getIpAddressinString(ip, args[3]);
getIpAddressinString(ip2, args[4]);
char mac[50], mac2[50];
getMacAddressinString(mac, 50, args64[0]);
getMacAddressinString(mac2, 50, args64[1]);
char mac[MAC_ADDRESS_SIZE], mac2[MAC_ADDRESS_SIZE];
getMacAddressinString(mac, MAC_ADDRESS_SIZE, args64[0]);
getMacAddressinString(mac2, MAC_ADDRESS_SIZE, args64[1]);
#if !defined(EIGERD) && !defined(JUNGFRAUD)
functionNotImplemented();