mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-22 01:27:59 +02:00
module udpport2
This commit is contained in:
@ -52,6 +52,7 @@ void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num){
|
||||
bebInfo->src_port_1GbE=bebInfo->src_port_10GbE=0;
|
||||
}
|
||||
|
||||
|
||||
int BebInfo_SetSerialAddress(struct BebInfo* bebInfo, unsigned int a){
|
||||
//address pre shifted
|
||||
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]));
|
||||
|
||||
if(!Beb_WriteTo(i)) return 0;
|
||||
|
||||
printf("dst_port:%d\n",dst_port);
|
||||
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;
|
||||
printf("Setting Source MAC to %s\n",src_mac);
|
||||
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;
|
||||
printf("Setting Source port to %d\n",src_port);
|
||||
|
||||
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;
|
||||
printf("Setting Destination IP to %s\n",dst_ip);
|
||||
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);
|
||||
@ -392,8 +399,7 @@ int Beb_SetHeaderData1(char* src_mac, char* src_ip, unsigned int src_port, char*
|
||||
|
||||
|
||||
int Beb_SetMAC(char* mac, uint8_t* dst_ptr){
|
||||
|
||||
char macVal[50];strcpy(macVal,mac);
|
||||
char macVal[50];strcpy(macVal,mac);
|
||||
|
||||
int i = 0;
|
||||
char *pch = strtok (macVal,":");
|
||||
|
@ -28,6 +28,7 @@ struct BebInfo{
|
||||
|
||||
|
||||
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_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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
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){
|
||||
unsigned int i;
|
||||
mod->module_number = number;
|
||||
@ -159,9 +182,9 @@ void Feb_Control_ClearModules(){
|
||||
int Feb_Control_Init(){
|
||||
unsigned int i;
|
||||
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");
|
||||
|
||||
@ -216,10 +239,29 @@ int Feb_Control_ReadSetUpFileToAddModules(char* file_name){
|
||||
exit(0);
|
||||
}
|
||||
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);
|
||||
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);
|
||||
@ -315,7 +357,10 @@ int Feb_Control_AddModule1(unsigned int module_number, unsigned int top_address,
|
||||
struct Module mod,* m;
|
||||
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);
|
||||
|
||||
|
||||
@ -657,6 +702,7 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int*
|
||||
strncpy(temp, p1+3, (p2-p1));
|
||||
temp[p2-p1] = '\0';
|
||||
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)){
|
||||
printf("Error in dac_name \"%s\", module number %d not in list.\n",dac_str,number);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
*top = 1;
|
||||
*bottom = 1;
|
||||
/*
|
||||
@ -682,12 +729,12 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int*
|
||||
strcpy(local_s,p1+8);
|
||||
*top=0;
|
||||
}
|
||||
|
||||
*dac_ch = 0;
|
||||
if(!Feb_Control_GetDACNumber(local_s,dac_ch)){
|
||||
printf("Error in dac_name: %s (%s)\n",dac_str,local_s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -748,9 +795,9 @@ int Feb_Control_SetDAC(char* dac_str, int value, int is_a_voltage_mv){
|
||||
}
|
||||
|
||||
if(bottom&&Module_BottomAddressIsValid(&modules[module_index])){
|
||||
if(!Feb_Control_SendDACValue(Module_GetBottomRightAddress(&modules[module_index]),dac_ch,&v)) return 0;
|
||||
if(module_index!=0) Module_SetBottomDACValue(&modules[module_index],dac_ch,v);
|
||||
else for(i=0;i<moduleSize;i++) Module_SetBottomDACValue(&modules[i],dac_ch,v);
|
||||
if(!Feb_Control_SendDACValue(Module_GetBottomRightAddress(&modules[module_index]),dac_ch,&v))return 0;
|
||||
if(module_index!=0) Module_SetBottomDACValue(&modules[module_index],dac_ch,v);
|
||||
else for(i=0;i<moduleSize;i++) Module_SetBottomDACValue(&modules[i],dac_ch,v);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -935,7 +982,11 @@ unsigned int* Feb_Control_GetTrimbits(){
|
||||
|
||||
unsigned int Feb_Control_AddressToAll(){
|
||||
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){
|
||||
@ -978,10 +1029,23 @@ int Feb_Control_WaitForFinishedFlag(int sleep_time_us){
|
||||
}
|
||||
|
||||
int Feb_Control_AcquisitionInProgress(){
|
||||
unsigned int status_reg_r=0;
|
||||
unsigned int status_reg_r=0,status_reg_l=0;
|
||||
|
||||
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r)))
|
||||
|
||||
//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)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
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_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);
|
||||
unsigned int Module_GetModuleNumber(struct Module* mod);
|
||||
int Module_TopAddressIsValid(struct Module* mod);
|
||||
|
@ -1,6 +1,6 @@
|
||||
CC = powerpc-4xx-softfloat-gcc
|
||||
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++
|
||||
|
||||
PROGS = eigerDetectorServer
|
||||
|
Binary file not shown.
@ -50,6 +50,10 @@ unsigned int nimages_per_request=1;
|
||||
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 default_dac_values[16] = {0,2000,2000,1250,700,1278,500,500,2000,500,500,550,550,100,1000,775};
|
||||
|
||||
|
||||
|
||||
|
||||
int initDetector(){
|
||||
int imod,i,n;
|
||||
@ -106,10 +110,9 @@ int initDetector(){
|
||||
|
||||
//get dac values
|
||||
int retval[2];
|
||||
for(i=0;i<(detectorModules)->ndac;i++){
|
||||
setDAC((enum detDacIndex)i,-1,(detectorModules)->module,0,retval);
|
||||
(detectorModules)->dacs[i] = retval[0];
|
||||
}
|
||||
for(i=0;i<(detectorModules)->ndac;i++)
|
||||
setDAC((enum detDacIndex)i,default_dac_values[i],(detectorModules)->module,0,retval);
|
||||
|
||||
|
||||
/* initialize dynamic range etc. */
|
||||
|
||||
@ -127,6 +130,7 @@ int initDetector(){
|
||||
setTiming(AUTO_TIMING);
|
||||
int enable[2] = {0,1};
|
||||
setExternalGating(enable);//disable external gating
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -288,10 +292,10 @@ void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){
|
||||
if(val >= 0)
|
||||
Feb_Control_SetDAC(iname,val,mV);
|
||||
int k;
|
||||
Feb_Control_GetDAC(iname, &k,0);
|
||||
retval[0] = k;
|
||||
Feb_Control_GetDAC(iname,&k,1);
|
||||
retval[1] = k;
|
||||
Feb_Control_GetDAC(iname, &k,0);
|
||||
retval[0] = k;
|
||||
Feb_Control_GetDAC(iname,&k,1);
|
||||
retval[1] = k;
|
||||
|
||||
(detectorModules)->dacs[ind] = retval[0];
|
||||
|
||||
@ -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];
|
||||
int src_port = 0xE185;
|
||||
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>>0)&0xFF));
|
||||
|
||||
printf("Seting up Table Entry Left:\n");
|
||||
printf("src_port:%d\n",src_port);
|
||||
printf("dst_port:%d\n",dst_port);
|
||||
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("dst_mac:%s\n\n",dst_mac);
|
||||
|
||||
|
||||
int beb_num = 34;
|
||||
int header_number = 0;
|
||||
|
||||
int i=0;
|
||||
//EigerSetupTableEntryLeft(ipad, macad, detectormacadd, detipad, udpport);
|
||||
int i=0;
|
||||
/* for(i=0;i<32;i++){/** modified for Aldo*/
|
||||
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))
|
||||
printf("set up left ok\n");
|
||||
else return -1;
|
||||
/*}*/
|
||||
//EigerSetupTableEntryRight(ipad, macad, detectormacadd, detipad, udpport);
|
||||
|
||||
header_number = 32;
|
||||
dst_port = udpport +1;
|
||||
dst_port = udpport2;
|
||||
|
||||
/*for(i=0;i<32;i++){*//** modified for Aldo*/
|
||||
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))
|
||||
printf("set up right ok\n");
|
||||
else return -1;
|
||||
/*}*/
|
||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||
|
||||
on_dst = 0;
|
||||
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
|
Reference in New Issue
Block a user