mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
module udpport2
This commit is contained in:
parent
fa6ab0b324
commit
d8c7201749
@ -177,7 +177,8 @@ enum networkParameter {
|
|||||||
RECEIVER_HOSTNAME, /**< receiver IP/hostname */
|
RECEIVER_HOSTNAME, /**< receiver IP/hostname */
|
||||||
RECEIVER_UDP_IP, /**< receiever UDP IP */
|
RECEIVER_UDP_IP, /**< receiever UDP IP */
|
||||||
RECEIVER_UDP_PORT, /**< receiever UDP Port */
|
RECEIVER_UDP_PORT, /**< receiever UDP Port */
|
||||||
RECEIVER_UDP_MAC /**< receiever UDP MAC */
|
RECEIVER_UDP_MAC, /**< receiever UDP MAC */
|
||||||
|
RECEIVER_UDP_PORT2 /**< receiever UDP Port of second half module for eiger */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,6 +52,7 @@ void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num){
|
|||||||
bebInfo->src_port_1GbE=bebInfo->src_port_10GbE=0;
|
bebInfo->src_port_1GbE=bebInfo->src_port_10GbE=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BebInfo_SetSerialAddress(struct BebInfo* bebInfo, unsigned int a){
|
int BebInfo_SetSerialAddress(struct BebInfo* bebInfo, unsigned int a){
|
||||||
//address pre shifted
|
//address pre shifted
|
||||||
if(a>0xff) return 0;
|
if(a>0xff) return 0;
|
||||||
@ -329,7 +330,7 @@ int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header
|
|||||||
Beb_SwapDataFun(1,12,&(Beb_send_data[2]));
|
Beb_SwapDataFun(1,12,&(Beb_send_data[2]));
|
||||||
|
|
||||||
if(!Beb_WriteTo(i)) return 0;
|
if(!Beb_WriteTo(i)) return 0;
|
||||||
|
printf("dst_port:%d\n",dst_port);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,12 +369,18 @@ int Beb_SetHeaderData1(char* src_mac, char* src_ip, unsigned int src_port, char*
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if(!Beb_SetMAC(src_mac,&(udp_header.src_mac[0]))) return 0;
|
if(!Beb_SetMAC(src_mac,&(udp_header.src_mac[0]))) return 0;
|
||||||
|
printf("Setting Source MAC to %s\n",src_mac);
|
||||||
if(!Beb_SetIP(src_ip,&(udp_header.src_ip[0]))) return 0;
|
if(!Beb_SetIP(src_ip,&(udp_header.src_ip[0]))) return 0;
|
||||||
|
printf("Setting Source IP to %s\n",src_ip);
|
||||||
if(!Beb_SetPortNumber(src_port,&(udp_header.src_port[0]))) return 0;
|
if(!Beb_SetPortNumber(src_port,&(udp_header.src_port[0]))) return 0;
|
||||||
|
printf("Setting Source port to %d\n",src_port);
|
||||||
|
|
||||||
if(!Beb_SetMAC(dst_mac,&(udp_header.dst_mac[0]))) return 0;
|
if(!Beb_SetMAC(dst_mac,&(udp_header.dst_mac[0]))) return 0;
|
||||||
|
printf("Setting Destination MAC to %s\n",dst_mac);
|
||||||
if(!Beb_SetIP(dst_ip,&(udp_header.dst_ip[0]))) return 0;
|
if(!Beb_SetIP(dst_ip,&(udp_header.dst_ip[0]))) return 0;
|
||||||
|
printf("Setting Destination IP to %s\n",dst_ip);
|
||||||
if(!Beb_SetPortNumber(dst_port,&(udp_header.dst_port[0]))) return 0;
|
if(!Beb_SetPortNumber(dst_port,&(udp_header.dst_port[0]))) return 0;
|
||||||
|
printf("Setting Destination port to %d\n",dst_port);
|
||||||
|
|
||||||
|
|
||||||
Beb_AdjustIPChecksum(&udp_header);
|
Beb_AdjustIPChecksum(&udp_header);
|
||||||
@ -392,7 +399,6 @@ int Beb_SetHeaderData1(char* src_mac, char* src_ip, unsigned int src_port, char*
|
|||||||
|
|
||||||
|
|
||||||
int Beb_SetMAC(char* mac, uint8_t* dst_ptr){
|
int Beb_SetMAC(char* mac, uint8_t* dst_ptr){
|
||||||
|
|
||||||
char macVal[50];strcpy(macVal,mac);
|
char macVal[50];strcpy(macVal,mac);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -28,6 +28,7 @@ struct BebInfo{
|
|||||||
|
|
||||||
|
|
||||||
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num);
|
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num);
|
||||||
|
void BebInfo_BebDstInfo(struct BebInfo* bebInfo, unsigned int beb_num);
|
||||||
int BebInfo_SetSerialAddress(struct BebInfo* bebInfo, unsigned int add);
|
int BebInfo_SetSerialAddress(struct BebInfo* bebInfo, unsigned int add);
|
||||||
int BebInfo_SetHeaderInfo(struct BebInfo* bebInfo, int ten_gig, char* src_mac, char* src_ip, unsigned int src_port);//src_port fixed 42000+beb_number or 52000 + beb_number);
|
int BebInfo_SetHeaderInfo(struct BebInfo* bebInfo, int ten_gig, char* src_mac, char* src_ip, unsigned int src_port);//src_port fixed 42000+beb_number or 52000 + beb_number);
|
||||||
unsigned int BebInfo_GetBebNumber(struct BebInfo* bebInfo);
|
unsigned int BebInfo_GetBebNumber(struct BebInfo* bebInfo);
|
||||||
|
@ -72,6 +72,29 @@ void Module_Module(struct Module* mod,unsigned int number, unsigned int address_
|
|||||||
for(i=0;i<Module_ndacs;i++) mod->bottom_dac[i] = mod->bottom_address_valid ? -1:0;
|
for(i=0;i<Module_ndacs;i++) mod->bottom_dac[i] = mod->bottom_address_valid ? -1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Module_ModuleBottom(struct Module* mod,unsigned int number, unsigned int address_bottom){
|
||||||
|
unsigned int i;
|
||||||
|
mod->module_number = number;
|
||||||
|
mod->top_address_valid = 0;
|
||||||
|
mod->top_left_address = 0;
|
||||||
|
mod->top_right_address = 0;
|
||||||
|
mod-> bottom_address_valid = 1;
|
||||||
|
mod-> bottom_left_address = 0x100 | (0xff & address_bottom);
|
||||||
|
mod-> bottom_right_address = (0x200 | (0xff & address_bottom));
|
||||||
|
|
||||||
|
mod->high_voltage = -1;
|
||||||
|
|
||||||
|
for(i=0;i<4;i++) mod->idelay_top[i]=mod->idelay_bottom[i]=0;
|
||||||
|
|
||||||
|
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
||||||
|
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
||||||
|
for(i=0;i<Module_ndacs;i++) mod->top_dac[i] = mod->top_address_valid ? -1:0;
|
||||||
|
for(i=0;i<Module_ndacs;i++) mod->bottom_dac[i] = mod->bottom_address_valid ? -1:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Module_Module1(struct Module* mod,unsigned int number, unsigned int address_top, unsigned int address_bottom){
|
void Module_Module1(struct Module* mod,unsigned int number, unsigned int address_top, unsigned int address_bottom){
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
mod->module_number = number;
|
mod->module_number = number;
|
||||||
@ -159,9 +182,9 @@ void Feb_Control_ClearModules(){
|
|||||||
int Feb_Control_Init(){
|
int Feb_Control_Init(){
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
Feb_Control_ClearModules();
|
Feb_Control_ClearModules();
|
||||||
Feb_Control_AddModule(0,0xff);//global send
|
/*Feb_Control_AddModule(0,0xff);//global send
|
||||||
|
|
||||||
Feb_Control_PrintModuleList();
|
Feb_Control_PrintModuleList();*/
|
||||||
|
|
||||||
Feb_Control_ReadSetUpFileToAddModules("/home/root/executables/setup.txt");
|
Feb_Control_ReadSetUpFileToAddModules("/home/root/executables/setup.txt");
|
||||||
|
|
||||||
@ -216,10 +239,29 @@ int Feb_Control_ReadSetUpFileToAddModules(char* file_name){
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
printf ("str:%s len:%d i0:%d i1:%d\n", str, strlen(str),i0,i1);
|
printf ("str:%s len:%d i0:%d i1:%d\n", str, strlen(str),i0,i1);
|
||||||
if(!Feb_Control_AddModule(i0,i1)){
|
|
||||||
|
/**Added by dhanya*/
|
||||||
|
if(i1 == 0){
|
||||||
|
Feb_Control_AddModule1(0,0xff,0,1);//global send
|
||||||
|
Feb_Control_PrintModuleList();
|
||||||
|
if(!Feb_Control_AddModule1(i0,i1,0,1)){
|
||||||
printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
|
printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
Feb_Control_AddModule1(0,0,0xff,1);//global send
|
||||||
|
Feb_Control_PrintModuleList();
|
||||||
|
if(!Feb_Control_AddModule1(i0,0,i1,1)){
|
||||||
|
printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* if(!Feb_Control_AddModule1(i0,i1)){
|
||||||
|
printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
|
||||||
|
exit(0);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -315,7 +357,10 @@ int Feb_Control_AddModule1(unsigned int module_number, unsigned int top_address,
|
|||||||
struct Module mod,* m;
|
struct Module mod,* m;
|
||||||
m= &mod;
|
m= &mod;
|
||||||
|
|
||||||
if(half_module) Module_Module(m,module_number,top_address);
|
/* if((half_module)&& (top_address != 1)) Module_Module(m,module_number,top_address);
|
||||||
|
else if(half_module) Module_ModuleBottom(m,module_number,top_address);*/
|
||||||
|
if ((half_module)&& (!bottom_address)) Module_Module(m,module_number,top_address);
|
||||||
|
else if (half_module) Module_ModuleBottom(m,module_number,bottom_address);
|
||||||
else Module_Module1(m,module_number,top_address,bottom_address);
|
else Module_Module1(m,module_number,top_address,bottom_address);
|
||||||
|
|
||||||
|
|
||||||
@ -657,6 +702,7 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int*
|
|||||||
strncpy(temp, p1+3, (p2-p1));
|
strncpy(temp, p1+3, (p2-p1));
|
||||||
temp[p2-p1] = '\0';
|
temp[p2-p1] = '\0';
|
||||||
unsigned int number = atoi(temp); //unsigned int number = atoi((local_s.substr(p1+3,p2-3)).c_str());
|
unsigned int number = atoi(temp); //unsigned int number = atoi((local_s.substr(p1+3,p2-3)).c_str());
|
||||||
|
|
||||||
if(!Feb_Control_GetModuleIndex(number,module_index)){
|
if(!Feb_Control_GetModuleIndex(number,module_index)){
|
||||||
printf("Error in dac_name \"%s\", module number %d not in list.\n",dac_str,number);
|
printf("Error in dac_name \"%s\", module number %d not in list.\n",dac_str,number);
|
||||||
return 0;
|
return 0;
|
||||||
@ -664,6 +710,7 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int*
|
|||||||
strcpy(local_s,p2+2);//local_s = local_s.substr(p2+2);
|
strcpy(local_s,p2+2);//local_s = local_s.substr(p2+2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
*top = 1;
|
*top = 1;
|
||||||
*bottom = 1;
|
*bottom = 1;
|
||||||
/*
|
/*
|
||||||
@ -682,12 +729,12 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int*
|
|||||||
strcpy(local_s,p1+8);
|
strcpy(local_s,p1+8);
|
||||||
*top=0;
|
*top=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*dac_ch = 0;
|
*dac_ch = 0;
|
||||||
if(!Feb_Control_GetDACNumber(local_s,dac_ch)){
|
if(!Feb_Control_GetDACNumber(local_s,dac_ch)){
|
||||||
printf("Error in dac_name: %s (%s)\n",dac_str,local_s);
|
printf("Error in dac_name: %s (%s)\n",dac_str,local_s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -935,7 +982,11 @@ unsigned int* Feb_Control_GetTrimbits(){
|
|||||||
|
|
||||||
unsigned int Feb_Control_AddressToAll(){
|
unsigned int Feb_Control_AddressToAll(){
|
||||||
if(moduleSize==0) return 0;
|
if(moduleSize==0) return 0;
|
||||||
return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]);
|
if(Module_BottomAddressIsValid(&modules[1])){//printf("************* bottom\n");
|
||||||
|
return Module_GetBottomLeftAddress(&modules[1])|Module_GetBottomRightAddress(&modules[1]);}
|
||||||
|
|
||||||
|
//printf("************* top\n");
|
||||||
|
return Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_SetCommandRegister(unsigned int cmd){
|
int Feb_Control_SetCommandRegister(unsigned int cmd){
|
||||||
@ -978,10 +1029,23 @@ int Feb_Control_WaitForFinishedFlag(int sleep_time_us){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_AcquisitionInProgress(){
|
int Feb_Control_AcquisitionInProgress(){
|
||||||
unsigned int status_reg_r=0;
|
unsigned int status_reg_r=0,status_reg_l=0;
|
||||||
|
|
||||||
|
|
||||||
|
//printf("right:%d\n",Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r));
|
||||||
|
//printf("left:%d\n",Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[1]),&status_reg_l));
|
||||||
|
|
||||||
|
if(Module_BottomAddressIsValid(&modules[0])){
|
||||||
|
//printf("************* bottom1\n");
|
||||||
|
|
||||||
|
if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[1]),&status_reg_r)))
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
//printf("************* top1\n");
|
||||||
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r)))
|
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r)))
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) return 1;
|
if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -35,6 +35,7 @@ struct Module{
|
|||||||
|
|
||||||
|
|
||||||
void Module_Module(struct Module* mod,unsigned int number, unsigned int address_top);
|
void Module_Module(struct Module* mod,unsigned int number, unsigned int address_top);
|
||||||
|
void Module_ModuleBottom(struct Module* mod,unsigned int number, unsigned int address_bottom);
|
||||||
void Module_Module1(struct Module* mod,unsigned int number, unsigned int address_top, unsigned int address_bottom);
|
void Module_Module1(struct Module* mod,unsigned int number, unsigned int address_top, unsigned int address_bottom);
|
||||||
unsigned int Module_GetModuleNumber(struct Module* mod);
|
unsigned int Module_GetModuleNumber(struct Module* mod);
|
||||||
int Module_TopAddressIsValid(struct Module* mod);
|
int Module_TopAddressIsValid(struct Module* mod);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CC = powerpc-4xx-softfloat-gcc
|
CC = powerpc-4xx-softfloat-gcc
|
||||||
CCX = powerpc-4xx-softfloat-g++
|
CCX = powerpc-4xx-softfloat-g++
|
||||||
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT #-DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE
|
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE
|
||||||
LDLIBS += -lm -lstdc++
|
LDLIBS += -lm -lstdc++
|
||||||
|
|
||||||
PROGS = eigerDetectorServer
|
PROGS = eigerDetectorServer
|
||||||
|
Binary file not shown.
@ -50,6 +50,10 @@ unsigned int nimages_per_request=1;
|
|||||||
int on_dst=0;
|
int on_dst=0;
|
||||||
int dst_requested[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
int dst_requested[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
|
int default_dac_values[16] = {0,2000,2000,1250,700,1278,500,500,2000,500,500,550,550,100,1000,775};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int initDetector(){
|
int initDetector(){
|
||||||
int imod,i,n;
|
int imod,i,n;
|
||||||
@ -106,10 +110,9 @@ int initDetector(){
|
|||||||
|
|
||||||
//get dac values
|
//get dac values
|
||||||
int retval[2];
|
int retval[2];
|
||||||
for(i=0;i<(detectorModules)->ndac;i++){
|
for(i=0;i<(detectorModules)->ndac;i++)
|
||||||
setDAC((enum detDacIndex)i,-1,(detectorModules)->module,0,retval);
|
setDAC((enum detDacIndex)i,default_dac_values[i],(detectorModules)->module,0,retval);
|
||||||
(detectorModules)->dacs[i] = retval[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize dynamic range etc. */
|
/* initialize dynamic range etc. */
|
||||||
|
|
||||||
@ -127,6 +130,7 @@ int initDetector(){
|
|||||||
setTiming(AUTO_TIMING);
|
setTiming(AUTO_TIMING);
|
||||||
int enable[2] = {0,1};
|
int enable[2] = {0,1};
|
||||||
setExternalGating(enable);//disable external gating
|
setExternalGating(enable);//disable external gating
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,7 +673,7 @@ int executeTrimming(enum trimMode mode, int par1, int par2, int imod){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int ival){
|
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int udpport2, int ival){
|
||||||
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
||||||
int src_port = 0xE185;
|
int src_port = 0xE185;
|
||||||
int dst_port = udpport;
|
int dst_port = udpport;
|
||||||
@ -688,7 +692,6 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
|
|||||||
(unsigned int)((macad>>8)&0xFF),
|
(unsigned int)((macad>>8)&0xFF),
|
||||||
(unsigned int)((macad>>0)&0xFF));
|
(unsigned int)((macad>>0)&0xFF));
|
||||||
|
|
||||||
printf("Seting up Table Entry Left:\n");
|
|
||||||
printf("src_port:%d\n",src_port);
|
printf("src_port:%d\n",src_port);
|
||||||
printf("dst_port:%d\n",dst_port);
|
printf("dst_port:%d\n",dst_port);
|
||||||
printf("src_ip:%s\n",src_ip);
|
printf("src_ip:%s\n",src_ip);
|
||||||
@ -696,27 +699,28 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
|
|||||||
printf("src_mac:%s\n",src_mac);
|
printf("src_mac:%s\n",src_mac);
|
||||||
printf("dst_mac:%s\n\n",dst_mac);
|
printf("dst_mac:%s\n\n",dst_mac);
|
||||||
|
|
||||||
|
|
||||||
int beb_num = 34;
|
int beb_num = 34;
|
||||||
int header_number = 0;
|
int header_number = 0;
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
//EigerSetupTableEntryLeft(ipad, macad, detectormacadd, detipad, udpport);
|
|
||||||
/* for(i=0;i<32;i++){/** modified for Aldo*/
|
/* for(i=0;i<32;i++){/** modified for Aldo*/
|
||||||
if(Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
if(Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
||||||
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port))
|
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port))
|
||||||
printf("set up left ok\n");
|
printf("set up left ok\n");
|
||||||
else return -1;
|
else return -1;
|
||||||
/*}*/
|
/*}*/
|
||||||
//EigerSetupTableEntryRight(ipad, macad, detectormacadd, detipad, udpport);
|
|
||||||
header_number = 32;
|
header_number = 32;
|
||||||
dst_port = udpport +1;
|
dst_port = udpport2;
|
||||||
|
|
||||||
/*for(i=0;i<32;i++){*//** modified for Aldo*/
|
/*for(i=0;i<32;i++){*//** modified for Aldo*/
|
||||||
if(Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
if(Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
||||||
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port))
|
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port))
|
||||||
printf("set up right ok\n");
|
printf("set up right ok\n");
|
||||||
else return -1;
|
else return -1;
|
||||||
/*}*/
|
/*}*/
|
||||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
|
||||||
on_dst = 0;
|
on_dst = 0;
|
||||||
|
|
||||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||||
|
@ -2547,7 +2547,7 @@ int update_client(int file_des) {
|
|||||||
int configure_mac(int file_des) {
|
int configure_mac(int file_des) {
|
||||||
|
|
||||||
int ret=OK;
|
int ret=OK;
|
||||||
char arg[5][50];
|
char arg[6][50];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
int imod=0;//should be in future sent from client as -1, arg[2]
|
int imod=0;//should be in future sent from client as -1, arg[2]
|
||||||
@ -2572,7 +2572,7 @@ int configure_mac(int file_des) {
|
|||||||
sscanf(arg[2], "%x", &udpport);
|
sscanf(arg[2], "%x", &udpport);
|
||||||
sscanf(arg[3], "%llx", &idetectormacadd);
|
sscanf(arg[3], "%llx", &idetectormacadd);
|
||||||
sscanf(arg[4], "%x", &detipad);
|
sscanf(arg[4], "%x", &detipad);
|
||||||
|
//arg[5] is udpport2 for eiger
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
int i;
|
int i;
|
||||||
printf("\ndigital_test_bit in server %d\t",digitalTestBit);
|
printf("\ndigital_test_bit in server %d\t",digitalTestBit);
|
||||||
|
@ -2629,7 +2629,7 @@ int update_client(int file_des) {
|
|||||||
int configure_mac(int file_des) {
|
int configure_mac(int file_des) {
|
||||||
|
|
||||||
int ret=OK;
|
int ret=OK;
|
||||||
char arg[5][50];
|
char arg[6][50];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
int imod=0;//should be in future sent from client as -1, arg[2]
|
int imod=0;//should be in future sent from client as -1, arg[2]
|
||||||
@ -2654,7 +2654,7 @@ int configure_mac(int file_des) {
|
|||||||
sscanf(arg[2], "%x", &udpport);
|
sscanf(arg[2], "%x", &udpport);
|
||||||
sscanf(arg[3], "%llx", &idetectormacadd);
|
sscanf(arg[3], "%llx", &idetectormacadd);
|
||||||
sscanf(arg[4], "%x", &detipad);
|
sscanf(arg[4], "%x", &detipad);
|
||||||
|
//arg[5] is for eiger
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
int i;
|
int i;
|
||||||
printf("\ndigital_test_bit in server %d\t",digitalTestBit);
|
printf("\ndigital_test_bit in server %d\t",digitalTestBit);
|
||||||
|
@ -351,56 +351,71 @@ int multiSlsDetector::addSlsDetector(int id, int pos) {
|
|||||||
|
|
||||||
|
|
||||||
void multiSlsDetector::updateOffsets(){
|
void multiSlsDetector::updateOffsets(){
|
||||||
int offsetX=0,offsetY=0,numX,numY;
|
|
||||||
|
cout << endl << "Updating multi detector offsets" << endl;
|
||||||
|
|
||||||
|
int offsetX=0, offsetY=0, numX=0, numY=0, maxX=0, maxY=0;
|
||||||
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];
|
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];
|
||||||
int maxChanY = thisMultiDetector->maxNumberOfChannelsPerDetector[Y];
|
int maxChanY = thisMultiDetector->maxNumberOfChannelsPerDetector[Y];
|
||||||
cout << "Updating multi detector offsets" << endl;
|
|
||||||
thisMultiDetector->numberOfChannel[X] = 0;
|
thisMultiDetector->numberOfChannel[X] = 0;
|
||||||
thisMultiDetector->maxNumberOfChannel[X] = 0;
|
thisMultiDetector->maxNumberOfChannel[X] = 0;
|
||||||
thisMultiDetector->numberOfChannel[Y] = 0;
|
thisMultiDetector->numberOfChannel[Y] = 0;
|
||||||
thisMultiDetector->maxNumberOfChannel[Y] = 0;
|
thisMultiDetector->maxNumberOfChannel[Y] = 0;
|
||||||
|
|
||||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
//0th position
|
||||||
|
if (detectors[0]){
|
||||||
|
offsetX = thisMultiDetector->offsetX[0] = 0;
|
||||||
|
offsetY = thisMultiDetector->offsetY[0] = 0;
|
||||||
|
numX = thisMultiDetector->numberOfChannel[X] = detectors[0]->getTotalNumberOfChannels(X);
|
||||||
|
numY = thisMultiDetector->numberOfChannel[Y] = detectors[0]->getTotalNumberOfChannels(Y);
|
||||||
|
maxX = thisMultiDetector->maxNumberOfChannel[X] = detectors[0]->getMaxNumberOfChannels(X);
|
||||||
|
maxY = thisMultiDetector->maxNumberOfChannel[Y] = detectors[0]->getMaxNumberOfChannels(Y);
|
||||||
|
|
||||||
|
cout << "Detector at position 0: x offset:" << offsetX << " y offset:" << offsetY << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=1; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
|
//incrementing in x direction
|
||||||
|
if ((maxChanX == -1) || ((maxChanX > 0) && ((offsetX + numX) < maxChanX))){
|
||||||
|
offsetX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
|
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
|
numX += detectors[i]->getTotalNumberOfChannels(X);
|
||||||
|
}
|
||||||
|
//incrementing in y direction
|
||||||
|
else{
|
||||||
|
offsetX = 0;
|
||||||
|
numX = 0;
|
||||||
|
maxX = 0;
|
||||||
|
thisMultiDetector->maxNumberOfChannel[X] = 0;
|
||||||
|
offsetY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
|
if ((maxChanY == -1) || ((maxChanY > 0) && (offsetY <= maxChanY))){
|
||||||
|
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
||||||
|
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
|
}else{
|
||||||
|
cout<<"Detector at position " << i << "exceeds maximum channels allowed for complete detector set in y dimension also!" << endl;
|
||||||
|
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
||||||
|
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
thisMultiDetector->offsetX[i] = offsetX;
|
thisMultiDetector->offsetX[i] = offsetX;
|
||||||
thisMultiDetector->offsetY[i] = offsetY;
|
thisMultiDetector->offsetY[i] = offsetY;
|
||||||
|
cout << "Detector at position: " << i << " x offset:" << thisMultiDetector->offsetX[i] << " y offset:" << thisMultiDetector->offsetY[i] << endl;
|
||||||
|
if(numX > thisMultiDetector->numberOfChannel[X])
|
||||||
|
thisMultiDetector->numberOfChannel[X] = numX;
|
||||||
|
if(numY > thisMultiDetector->numberOfChannel[Y])
|
||||||
|
thisMultiDetector->numberOfChannel[Y] = numY;
|
||||||
|
if(maxX > thisMultiDetector->maxNumberOfChannel[X])
|
||||||
|
thisMultiDetector->maxNumberOfChannel[X] = maxX;
|
||||||
|
if(maxY > thisMultiDetector->maxNumberOfChannel[Y])
|
||||||
|
thisMultiDetector->maxNumberOfChannel[Y] = maxY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cout << "Detector at position: " << i << " x offset:" << offsetX << " y offset:" << offsetY << endl;
|
|
||||||
|
|
||||||
numX = detectors[i]->getMaxNumberOfChannels(X);
|
cout << "Number of Channels in X direction:" << thisMultiDetector->numberOfChannel[X] << endl;
|
||||||
numY = detectors[i]->getMaxNumberOfChannels(Y);
|
cout << "Number of Channels in Y direction:" << thisMultiDetector->numberOfChannel[Y] << endl << endl;
|
||||||
|
|
||||||
offsetX += numX;
|
|
||||||
if ((maxChanX == -1) || ((maxChanX > 0) && (offsetX < maxChanX))){
|
|
||||||
thisMultiDetector->numberOfChannel[X] += detectors[i]->getTotalNumberOfChannels(X);
|
|
||||||
thisMultiDetector->maxNumberOfChannel[X] += numX;
|
|
||||||
//the first time y should be added but offset not increased
|
|
||||||
if (thisMultiDetector->numberOfChannel[Y] == 0){
|
|
||||||
if ((maxChanY == -1) || ((maxChanY > 0) && (numY < maxChanY))){
|
|
||||||
thisMultiDetector->numberOfChannel[Y] += detectors[i]->getTotalNumberOfChannels(Y);
|
|
||||||
thisMultiDetector->maxNumberOfChannel[Y] += numY;
|
|
||||||
}else{
|
|
||||||
cout<<"Detector at position " << i << "exceeds maximum channels allowed for complete detector set in y dimension also!" << endl;
|
|
||||||
thisMultiDetector->numberOfChannel[Y] += detectors[i]->getTotalNumberOfChannels(Y);
|
|
||||||
thisMultiDetector->maxNumberOfChannel[Y] += numY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
offsetX = 0;
|
|
||||||
thisMultiDetector->numberOfChannel[X] = 0;
|
|
||||||
thisMultiDetector->maxNumberOfChannel[X] = 0;
|
|
||||||
offsetY += numY;
|
|
||||||
if ((maxChanY == -1) || ((maxChanY > 0) && (offsetY < maxChanY))){
|
|
||||||
thisMultiDetector->numberOfChannel[Y] += detectors[i]->getTotalNumberOfChannels(Y);
|
|
||||||
thisMultiDetector->maxNumberOfChannel[Y] += numY;
|
|
||||||
}else{
|
|
||||||
cout<<"Detector at position " << i << "exceeds maximum channels allowed for complete detector set in y dimension also!" << endl;
|
|
||||||
thisMultiDetector->numberOfChannel[Y] += detectors[i]->getTotalNumberOfChannels(Y);
|
|
||||||
thisMultiDetector->maxNumberOfChannel[Y] += numY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string multiSlsDetector::setHostname(const char* name, int pos){
|
string multiSlsDetector::setHostname(const char* name, int pos){
|
||||||
@ -1182,6 +1197,16 @@ int multiSlsDetector::startAcquisition(){
|
|||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
int ret=OK, ret1=OK;
|
int ret=OK, ret1=OK;
|
||||||
|
|
||||||
|
if (detectors[0]) {
|
||||||
|
ret=detectors[0]->startAcquisition();
|
||||||
|
if(detectors[0]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
|
if (ret!=OK)
|
||||||
|
ret1=FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
for (i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
for (i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||||
if (i!=thisMultiDetector->masterPosition)
|
if (i!=thisMultiDetector->masterPosition)
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
@ -1201,7 +1226,7 @@ int multiSlsDetector::startAcquisition(){
|
|||||||
if (ret!=OK)
|
if (ret!=OK)
|
||||||
ret1=FAIL;
|
ret1=FAIL;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
return ret1;
|
return ret1;
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -1214,6 +1239,8 @@ int multiSlsDetector::stopAcquisition(){
|
|||||||
int i=0;
|
int i=0;
|
||||||
int ret=OK, ret1=OK;
|
int ret=OK, ret1=OK;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
i=thisMultiDetector->masterPosition;
|
i=thisMultiDetector->masterPosition;
|
||||||
if (thisMultiDetector->masterPosition>=0) {
|
if (thisMultiDetector->masterPosition>=0) {
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
@ -3474,11 +3501,13 @@ int multiSlsDetector::getMaxMods() {
|
|||||||
|
|
||||||
int multiSlsDetector::getTotalNumberOfChannels(){thisMultiDetector->numberOfChannels=0; for (int id=0; id< thisMultiDetector->numberOfDetectors; id++) thisMultiDetector->numberOfChannels+=detectors[id]->getTotalNumberOfChannels(); return thisMultiDetector->numberOfChannels;};
|
int multiSlsDetector::getTotalNumberOfChannels(){thisMultiDetector->numberOfChannels=0; for (int id=0; id< thisMultiDetector->numberOfDetectors; id++) thisMultiDetector->numberOfChannels+=detectors[id]->getTotalNumberOfChannels(); return thisMultiDetector->numberOfChannels;};
|
||||||
|
|
||||||
int multiSlsDetector::getTotalNumberOfChannels(dimension d){thisMultiDetector->numberOfChannel[d]=0; for (int id=0; id< thisMultiDetector->numberOfDetectors; id++) thisMultiDetector->numberOfChannel[d]+=detectors[id]->getTotalNumberOfChannels(d); return thisMultiDetector->numberOfChannel[d];};
|
//int multiSlsDetector::getTotalNumberOfChannels(dimension d){thisMultiDetector->numberOfChannel[d]=0; for (int id=0; id< thisMultiDetector->numberOfDetectors; id++) thisMultiDetector->numberOfChannel[d]+=detectors[id]->getTotalNumberOfChannels(d); return thisMultiDetector->numberOfChannel[d];};
|
||||||
|
int multiSlsDetector::getTotalNumberOfChannels(dimension d){updateOffsets();return thisMultiDetector->numberOfChannel[d];};
|
||||||
|
|
||||||
int multiSlsDetector::getMaxNumberOfChannels(){thisMultiDetector->maxNumberOfChannels=0; for (int id=0; id< thisMultiDetector->numberOfDetectors; id++) thisMultiDetector->maxNumberOfChannels+=detectors[id]->getMaxNumberOfChannels();return thisMultiDetector->maxNumberOfChannels;};
|
int multiSlsDetector::getMaxNumberOfChannels(){thisMultiDetector->maxNumberOfChannels=0; for (int id=0; id< thisMultiDetector->numberOfDetectors; id++) thisMultiDetector->maxNumberOfChannels+=detectors[id]->getMaxNumberOfChannels();return thisMultiDetector->maxNumberOfChannels;};
|
||||||
|
|
||||||
int multiSlsDetector::getMaxNumberOfChannels(dimension d){thisMultiDetector->maxNumberOfChannel[d]=0; for (int id=0; id< thisMultiDetector->numberOfDetectors; id++) thisMultiDetector->maxNumberOfChannel[d]+=detectors[id]->getMaxNumberOfChannels(d);return thisMultiDetector->maxNumberOfChannel[d];};
|
// int multiSlsDetector::getMaxNumberOfChannels(dimension d){thisMultiDetector->maxNumberOfChannel[d]=0; for (int id=0; id< thisMultiDetector->numberOfDetectors; id++) thisMultiDetector->maxNumberOfChannel[d]+=detectors[id]->getMaxNumberOfChannels(d);return thisMultiDetector->maxNumberOfChannel[d];};
|
||||||
|
int multiSlsDetector::getMaxNumberOfChannels(dimension d){updateOffsets();return thisMultiDetector->maxNumberOfChannel[d];};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -488,6 +488,8 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
thisDetector->receiverTCPPort=DEFAULT_PORTNO+2;
|
thisDetector->receiverTCPPort=DEFAULT_PORTNO+2;
|
||||||
/** set receiver udp port */
|
/** set receiver udp port */
|
||||||
thisDetector->receiverUDPPort=DEFAULT_UDP_PORTNO;
|
thisDetector->receiverUDPPort=DEFAULT_UDP_PORTNO;
|
||||||
|
/** set receiver udp port for Eiger */
|
||||||
|
thisDetector->receiverUDPPort2=DEFAULT_UDP_PORTNO+1;
|
||||||
/** set receiver ip address/hostname */
|
/** set receiver ip address/hostname */
|
||||||
strcpy(thisDetector->receiver_hostname,"none");
|
strcpy(thisDetector->receiver_hostname,"none");
|
||||||
/** set receiver udp ip address */
|
/** set receiver udp ip address */
|
||||||
@ -4838,6 +4840,15 @@ char* slsDetector::setNetworkParameter(networkParameter index, string value) {
|
|||||||
sscanf(value.c_str(),"%d",&i);
|
sscanf(value.c_str(),"%d",&i);
|
||||||
setReceiverUDPPort(i);
|
setReceiverUDPPort(i);
|
||||||
return getReceiverUDPPort();
|
return getReceiverUDPPort();
|
||||||
|
case RECEIVER_UDP_PORT2:
|
||||||
|
sscanf(value.c_str(),"%d",&i);
|
||||||
|
if(thisDetector->myDetectorType == EIGER)
|
||||||
|
setReceiverUDPPort2(i);
|
||||||
|
else
|
||||||
|
setReceiverUDPPort(i);
|
||||||
|
if(thisDetector->myDetectorType == EIGER)
|
||||||
|
return getReceiverUDPPort2();
|
||||||
|
return getReceiverUDPPort();
|
||||||
default:
|
default:
|
||||||
return ("unknown network parameter");
|
return ("unknown network parameter");
|
||||||
}
|
}
|
||||||
@ -4867,6 +4878,9 @@ char* slsDetector::getNetworkParameter(networkParameter index) {
|
|||||||
case RECEIVER_UDP_PORT:
|
case RECEIVER_UDP_PORT:
|
||||||
return getReceiverUDPPort();
|
return getReceiverUDPPort();
|
||||||
break;
|
break;
|
||||||
|
case RECEIVER_UDP_PORT2:
|
||||||
|
return getReceiverUDPPort2();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return ("unknown network parameter");
|
return ("unknown network parameter");
|
||||||
}
|
}
|
||||||
@ -5012,14 +5026,17 @@ int slsDetector::setReceiverUDPPort(int udpport){
|
|||||||
return thisDetector->receiverUDPPort;
|
return thisDetector->receiverUDPPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int slsDetector::setReceiverUDPPort2(int udpport){
|
||||||
|
thisDetector->receiverUDPPort2 = udpport;
|
||||||
|
return thisDetector->receiverUDPPort2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::setUDPConnection(){
|
int slsDetector::setUDPConnection(){
|
||||||
|
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
int fnum = F_SETUP_RECEIVER_UDP;
|
int fnum = F_SETUP_RECEIVER_UDP;
|
||||||
char args[2][MAX_STR_LENGTH];
|
char args[3][MAX_STR_LENGTH];
|
||||||
char retval[MAX_STR_LENGTH]="";
|
char retval[MAX_STR_LENGTH]="";
|
||||||
|
|
||||||
|
|
||||||
@ -5043,9 +5060,11 @@ int slsDetector::setUDPConnection(){
|
|||||||
//copy arguments to args[][]
|
//copy arguments to args[][]
|
||||||
strcpy(args[0],thisDetector->receiverUDPIP);
|
strcpy(args[0],thisDetector->receiverUDPIP);
|
||||||
sprintf(args[1],"%d",thisDetector->receiverUDPPort);
|
sprintf(args[1],"%d",thisDetector->receiverUDPPort);
|
||||||
|
sprintf(args[2],"%d",thisDetector->receiverUDPPort2);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Receiver udp ip address: " << thisDetector->receiverUDPIP << std::endl;
|
std::cout << "Receiver udp ip address: " << thisDetector->receiverUDPIP << std::endl;
|
||||||
std::cout << "Receiver udp port: " << thisDetector->receiverUDPPort << std::endl;
|
std::cout << "Receiver udp port: " << thisDetector->receiverUDPPort << std::endl;
|
||||||
|
std::cout << "Receiver udp port2: " << thisDetector->receiverUDPPort2 << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//set up receiver for UDP Connection and get receivermac address
|
//set up receiver for UDP Connection and get receivermac address
|
||||||
@ -5084,7 +5103,7 @@ int slsDetector::configureMAC(){
|
|||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
int fnum=F_CONFIGURE_MAC,fnum2=F_RECEIVER_SHORT_FRAME;
|
int fnum=F_CONFIGURE_MAC,fnum2=F_RECEIVER_SHORT_FRAME;
|
||||||
char mess[100];
|
char mess[100];
|
||||||
char arg[5][50];
|
char arg[6][50];
|
||||||
char cword[50]="", *pcword;
|
char cword[50]="", *pcword;
|
||||||
string sword;
|
string sword;
|
||||||
int retval=-1;
|
int retval=-1;
|
||||||
@ -5112,6 +5131,7 @@ int slsDetector::configureMAC(){
|
|||||||
sprintf(arg[2],"%x",thisDetector->receiverUDPPort);
|
sprintf(arg[2],"%x",thisDetector->receiverUDPPort);
|
||||||
strcpy(arg[3],thisDetector->detectorMAC);
|
strcpy(arg[3],thisDetector->detectorMAC);
|
||||||
strcpy(arg[4],thisDetector->detectorIP);
|
strcpy(arg[4],thisDetector->detectorIP);
|
||||||
|
sprintf(arg[5],"%x",thisDetector->receiverUDPPort2);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Configuring MAC"<< std::endl;
|
std::cout<< "Configuring MAC"<< std::endl;
|
||||||
@ -5174,6 +5194,9 @@ int slsDetector::configureMAC(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<<"detector ip:"<<arg[4]<<"."<<std::endl;
|
std::cout<<"detector ip:"<<arg[4]<<"."<<std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<<"receiver udp port2:"<<arg[5]<<"."<<std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
//send to server
|
//send to server
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
|
@ -240,6 +240,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
int receiverTCPPort;
|
int receiverTCPPort;
|
||||||
/** is the port used to communicate between detector and the receiver*/
|
/** is the port used to communicate between detector and the receiver*/
|
||||||
int receiverUDPPort;
|
int receiverUDPPort;
|
||||||
|
/** is the port used to communicate between second half module of Eiger detector and the receiver*/
|
||||||
|
int receiverUDPPort2;
|
||||||
/** ip address of the receiver for the detector to send packets to**/
|
/** ip address of the receiver for the detector to send packets to**/
|
||||||
char receiverUDPIP[MAX_STR_LENGTH];
|
char receiverUDPIP[MAX_STR_LENGTH];
|
||||||
/** mac address of receiver for the detector to send packets to **/
|
/** mac address of receiver for the detector to send packets to **/
|
||||||
@ -1603,6 +1605,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
char* getReceiverUDPMAC() {return thisDetector->receiverUDPMAC;};
|
char* getReceiverUDPMAC() {return thisDetector->receiverUDPMAC;};
|
||||||
/** returns the receiver UDP IP address \sa sharedSlsDetector */
|
/** returns the receiver UDP IP address \sa sharedSlsDetector */
|
||||||
char* getReceiverUDPPort() {char *c= new char[MAX_STR_LENGTH];sprintf(c,"%d",thisDetector->receiverUDPPort); return c;};
|
char* getReceiverUDPPort() {char *c= new char[MAX_STR_LENGTH];sprintf(c,"%d",thisDetector->receiverUDPPort); return c;};
|
||||||
|
/** returns the receiver UDP2 for Eiger IP address \sa sharedSlsDetector */
|
||||||
|
char* getReceiverUDPPort2() {char *c= new char[MAX_STR_LENGTH];sprintf(c,"%d",thisDetector->receiverUDPPort2); return c;};
|
||||||
|
|
||||||
/** validates the format of detector MAC address and sets it \sa sharedSlsDetector */
|
/** validates the format of detector MAC address and sets it \sa sharedSlsDetector */
|
||||||
char* setDetectorMAC(string detectorMAC);
|
char* setDetectorMAC(string detectorMAC);
|
||||||
@ -1616,6 +1620,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
char* setReceiverUDPMAC(string udpmac);
|
char* setReceiverUDPMAC(string udpmac);
|
||||||
/** sets the receiver udp port \sa sharedSlsDetector */
|
/** sets the receiver udp port \sa sharedSlsDetector */
|
||||||
int setReceiverUDPPort(int udpport);
|
int setReceiverUDPPort(int udpport);
|
||||||
|
/** sets the receiver udp port2 for Eiger \sa sharedSlsDetector */
|
||||||
|
int setReceiverUDPPort2(int udpport);
|
||||||
|
|
||||||
/** Sets the read receiver frequency
|
/** Sets the read receiver frequency
|
||||||
if Receiver read upon gui request, readRxrFrequency=0,
|
if Receiver read upon gui request, readRxrFrequency=0,
|
||||||
|
@ -344,6 +344,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="rx_udpport2"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||||
|
i++;
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="detectormac"; //
|
descrToFuncMap[i].m_pFuncName="detectormac"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||||
i++;
|
i++;
|
||||||
@ -2464,6 +2468,12 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
|||||||
if (!(sscanf(args[1],"%d",&i)))
|
if (!(sscanf(args[1],"%d",&i)))
|
||||||
return ("cannot parse argument") + string(args[1]);
|
return ("cannot parse argument") + string(args[1]);
|
||||||
}
|
}
|
||||||
|
} else if (cmd=="rx_udpport2") {
|
||||||
|
t=RECEIVER_UDP_PORT2;
|
||||||
|
if (action==PUT_ACTION){
|
||||||
|
if (!(sscanf(args[1],"%d",&i)))
|
||||||
|
return ("cannot parse argument") + string(args[1]);
|
||||||
|
}
|
||||||
} else return ("unknown network parameter")+cmd;
|
} else return ("unknown network parameter")+cmd;
|
||||||
|
|
||||||
if (action==PUT_ACTION)
|
if (action==PUT_ACTION)
|
||||||
@ -2485,6 +2495,7 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti
|
|||||||
os << "rx_udpip ip \n sets receiver udp ip to ip"<< std::endl;
|
os << "rx_udpip ip \n sets receiver udp ip to ip"<< std::endl;
|
||||||
os << "rx_udpmac mac \n sets receiver udp mac to mac"<< std::endl;
|
os << "rx_udpmac mac \n sets receiver udp mac to mac"<< std::endl;
|
||||||
os << "rx_udpport port \n sets receiver udp port to port"<< std::endl;
|
os << "rx_udpport port \n sets receiver udp port to port"<< std::endl;
|
||||||
|
os << "rx_udpport2 port \n sets receiver udp port to port. For Eiger, it is the second half module and for other detectors, same as rx_udpport"<< std::endl;
|
||||||
}
|
}
|
||||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||||
os << "detectormac \n gets detector mac "<< std::endl;
|
os << "detectormac \n gets detector mac "<< std::endl;
|
||||||
@ -2492,6 +2503,8 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti
|
|||||||
os << "rx_hostname \n gets receiver ip "<< std::endl;
|
os << "rx_hostname \n gets receiver ip "<< std::endl;
|
||||||
os << "rx_udpmac \n gets receiver udp mac "<< std::endl;
|
os << "rx_udpmac \n gets receiver udp mac "<< std::endl;
|
||||||
os << "rx_udpport \n gets receiver udp port "<< std::endl;
|
os << "rx_udpport \n gets receiver udp port "<< std::endl;
|
||||||
|
os << "rx_udpport2 \n gets receiver udp port. For Eiger, it is the second half module and for other detectors, same as rx_udpport"<< std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
|||||||
|
|
||||||
|
|
||||||
#ifndef MYTHEND
|
#ifndef MYTHEND
|
||||||
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int ival);
|
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int udpport2, int ival);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
|
@ -2963,11 +2963,11 @@ int execute_trimming(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int configure_mac(int file_des) {
|
int configure_mac(int file_des) {printf("in hereeeeee\n");
|
||||||
|
|
||||||
int retval=-100;
|
int retval=-100;
|
||||||
int ret=OK,ret1=OK;
|
int ret=OK,ret1=OK;
|
||||||
char arg[5][50];
|
char arg[6][50];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
#ifndef MYTHEND
|
#ifndef MYTHEND
|
||||||
@ -2976,9 +2976,10 @@ int configure_mac(int file_des) {
|
|||||||
long long int imacadd;
|
long long int imacadd;
|
||||||
long long int idetectormacadd;
|
long long int idetectormacadd;
|
||||||
int udpport;
|
int udpport;
|
||||||
|
int udpport2;
|
||||||
int detipad;
|
int detipad;
|
||||||
#endif
|
#endif
|
||||||
|
printf("111\n");
|
||||||
sprintf(mess,"Can't configure MAC\n");
|
sprintf(mess,"Can't configure MAC\n");
|
||||||
|
|
||||||
n = receiveData(file_des,arg,sizeof(arg),OTHER);
|
n = receiveData(file_des,arg,sizeof(arg),OTHER);
|
||||||
@ -2986,7 +2987,7 @@ int configure_mac(int file_des) {
|
|||||||
sprintf(mess,"Error reading from socket\n");
|
sprintf(mess,"Error reading from socket\n");
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
printf("222\n");
|
||||||
#ifdef MYTHEND
|
#ifdef MYTHEND
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,"Not applicable/implemented for this detector\n");
|
strcpy(mess,"Not applicable/implemented for this detector\n");
|
||||||
@ -2996,7 +2997,7 @@ int configure_mac(int file_des) {
|
|||||||
sscanf(arg[2], "%x", &udpport);
|
sscanf(arg[2], "%x", &udpport);
|
||||||
sscanf(arg[3], "%llx", &idetectormacadd);
|
sscanf(arg[3], "%llx", &idetectormacadd);
|
||||||
sscanf(arg[4], "%x", &detipad);
|
sscanf(arg[4], "%x", &detipad);
|
||||||
|
sscanf(arg[5], "%x", &udpport2);
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
@ -3006,7 +3007,8 @@ int configure_mac(int file_des) {
|
|||||||
printf("mess:%s\n",mess);
|
printf("mess:%s\n",mess);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef VERBOSE
|
printf("333\n");
|
||||||
|
//#ifdef VERBOSE
|
||||||
int i;
|
int i;
|
||||||
/*printf("\ndigital_test_bit in server %d\t",digitalTestBit);for gotthard*/
|
/*printf("\ndigital_test_bit in server %d\t",digitalTestBit);for gotthard*/
|
||||||
printf("\nipadd %x\t",ipad);
|
printf("\nipadd %x\t",ipad);
|
||||||
@ -3019,9 +3021,10 @@ int configure_mac(int file_des) {
|
|||||||
for (i=0;i<6;i++)
|
for (i=0;i<6;i++)
|
||||||
printf("detector mac adress %d is 0x%x \n",6-i,(unsigned int)(((idetectormacadd>>(8*i))&0xFF)));
|
printf("detector mac adress %d is 0x%x \n",6-i,(unsigned int)(((idetectormacadd>>(8*i))&0xFF)));
|
||||||
printf("detipad %x\n",detipad);
|
printf("detipad %x\n",detipad);
|
||||||
|
printf("udp port2:0x%x\n",udpport2);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Configuring MAC of module %d at port %x\n", imod, udpport);
|
printf("Configuring MAC of module %d at port %x\n", imod, udpport);
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
@ -3029,13 +3032,13 @@ int configure_mac(int file_des) {
|
|||||||
stopStateMachine();
|
stopStateMachine();
|
||||||
}
|
}
|
||||||
|
|
||||||
retval=configureMAC(ipad,imacadd,idetectormacadd,detipad,udpport,0); /*digitalTestBit);*/
|
retval=configureMAC(ipad,imacadd,idetectormacadd,detipad,udpport,udpport2,0); /*digitalTestBit);*/
|
||||||
if(retval==-1) ret=FAIL;
|
if(retval==-1) ret=FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("Configured MAC with retval %d\n", retval);
|
printf("Configured MAC with retval %d\n", retval);
|
||||||
#endif
|
//#endif
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
printf("configuring MAC of mod %d failed\n", imod);
|
printf("configuring MAC of mod %d failed\n", imod);
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ int receiverInterface::sendString(int fnum, char retval[], char arg[]){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int receiverInterface::sendUDPDetails(int fnum, char retval[], char arg[2][MAX_STR_LENGTH]){
|
int receiverInterface::sendUDPDetails(int fnum, char retval[], char arg[3][MAX_STR_LENGTH]){
|
||||||
char args[2][MAX_STR_LENGTH];
|
char args[3][MAX_STR_LENGTH];
|
||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
char mess[100] = "";
|
char mess[100] = "";
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
* @param arg value to send
|
* @param arg value to send
|
||||||
* \returns success of operation
|
* \returns success of operation
|
||||||
*/
|
*/
|
||||||
int sendUDPDetails(int fnum, char retval[], char arg[2][MAX_STR_LENGTH]);
|
int sendUDPDetails(int fnum, char retval[], char arg[3][MAX_STR_LENGTH]);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user