mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
full module server works now, slave and master yet to be done
This commit is contained in:
@ -141,9 +141,11 @@ int Module_GetBottomDACValue(struct Module* mod,unsigned int i)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int Feb_Control_IsBottomModule(){
|
||||
if(Module_BottomAddressIsValid(&modules[1]))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Feb_Control_FebControl(){
|
||||
@ -711,31 +713,22 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int*
|
||||
}
|
||||
|
||||
|
||||
*top = 1;
|
||||
*top = 1;//make them both 1 instead of this
|
||||
*bottom = 1;
|
||||
/*
|
||||
if((p1 = local_s.find("top::"))!=string::npos){
|
||||
local_s = local_s.substr(p1+5);
|
||||
*bottom=0;
|
||||
}else if((p1 = local_s.find("bottom::"))!=string::npos){
|
||||
local_s = local_s.substr(p1+8);
|
||||
*top=0;
|
||||
}
|
||||
*/
|
||||
if(p1 = strstr(local_s,"top::")!=NULL){
|
||||
/*if(p1 = strstr(local_s,"top::")!=NULL){
|
||||
strcpy(local_s,p1+5);
|
||||
*bottom=0;
|
||||
}else if(p1 = strstr(local_s,"bottom::")!=NULL){
|
||||
strcpy(local_s,p1+8);
|
||||
*top=0;
|
||||
}
|
||||
/*
|
||||
}*/
|
||||
|
||||
if(Module_BottomAddressIsValid(&modules[*module_index]))
|
||||
*top=0;
|
||||
else
|
||||
*bottom=0;
|
||||
printf("*****************top %d bottom %d\n",*top,*bottom);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
*dac_ch = 0;
|
||||
@ -786,11 +779,11 @@ int Feb_Control_SetDAC(char* dac_str, int value, int is_a_voltage_mv){
|
||||
|
||||
unsigned int v = value;
|
||||
if(is_a_voltage_mv&&!Feb_Control_VoltageToDAC(value,&v,4096,0,2048)){
|
||||
printf("Waring: SetDac bad value, %d. The range is 0 to 2048 mV.\n",value);
|
||||
printf("Warning: SetDac bad value, %d. The range is 0 to 2048 mV.\n",value);
|
||||
return 0;
|
||||
}
|
||||
if(v<0||v>4095){
|
||||
printf("Waring: SetDac bad value, %d. The range is 0 to 4095.\n",v);
|
||||
printf("Warning: SetDac bad value, %d. The range is 0 to 4095.\n",v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -949,28 +942,41 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
|
||||
int i;
|
||||
for(i=0;i<8;i++){ // column loop i
|
||||
//printf("i:%d\t\t",i);
|
||||
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_l+i])<<((7-i)*4);//low
|
||||
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[row_set*16480+super_column_start_position_l+i])>>3)<<((7-i)*4);//upper
|
||||
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_r+i])<<((7-i)*4);//low
|
||||
trimbits_to_load_r[offset+chip_sc+32] |= ((0x38 & trimbits[row_set*16480+super_column_start_position_r+i])>>3)<<((7-i)*4);//upper
|
||||
/*
|
||||
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])<<((7-i)*4);//low
|
||||
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])>>3)<<((7-i)*4);//upper
|
||||
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])<<((7-i)*4);//low
|
||||
trimbits_to_load_r[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])>>3)<<((7-i)*4);//upper
|
||||
*/
|
||||
|
||||
if(Module_TopAddressIsValid(&modules[0])){
|
||||
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_l+i])<<((7-i)*4);//low
|
||||
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[row_set*16480+super_column_start_position_l+i])>>3)<<((7-i)*4);//upper
|
||||
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_r+i])<<((7-i)*4);//low
|
||||
trimbits_to_load_r[offset+chip_sc+32] |= ((0x38 & trimbits[row_set*16480+super_column_start_position_r+i])>>3)<<((7-i)*4);//upper
|
||||
}else{
|
||||
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])<<((7-i)*4);//low
|
||||
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])>>3)<<((7-i)*4);//upper
|
||||
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])<<((7-i)*4);//low
|
||||
trimbits_to_load_r[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])>>3)<<((7-i)*4);//upper
|
||||
|
||||
}
|
||||
} // end column loop i
|
||||
} //end supercolumn loop sc
|
||||
} //end row loop
|
||||
|
||||
|
||||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[1]),0,0,1024,trimbits_to_load_r)||
|
||||
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[1]),0,0,1024,trimbits_to_load_l)||
|
||||
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
|
||||
// !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
|
||||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
|
||||
printf(" some errror!\n");
|
||||
return 0;
|
||||
if(Module_TopAddressIsValid(&modules[0])){
|
||||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[1]),0,0,1024,trimbits_to_load_r)||
|
||||
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[1]),0,0,1024,trimbits_to_load_l)||
|
||||
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
|
||||
// !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
|
||||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
|
||||
printf(" some errror!\n");
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetBottomLeftAddress(&modules[1]),0,0,1024,trimbits_to_load_r)||
|
||||
!Feb_Interface_WriteMemoryInLoops(Module_GetBottomRightAddress(&modules[1]),0,0,1024,trimbits_to_load_l)||
|
||||
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
|
||||
// !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
|
||||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
|
||||
printf(" some errror!\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
} //end row_set loop (groups of 16 rows)
|
||||
@ -996,7 +1002,7 @@ unsigned int Feb_Control_AddressToAll(){
|
||||
//printf("************* bottom\n");
|
||||
return Module_GetBottomLeftAddress(&modules[0])|Module_GetBottomRightAddress(&modules[0]);
|
||||
}
|
||||
// printf("************* top\n");
|
||||
//printf("************* top\n");
|
||||
return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]);
|
||||
|
||||
}
|
||||
@ -1051,14 +1057,14 @@ int Feb_Control_AcquisitionInProgress(){
|
||||
//printf("************* bottom1\n");
|
||||
|
||||
if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[1]),&status_reg_r)))
|
||||
{printf("**idle\n");return 0;}
|
||||
return 0;
|
||||
}else{
|
||||
//printf("************* top1\n");
|
||||
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r)))
|
||||
{printf("**idle\n");return 0;}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) {printf("******running\n");return 1;}
|
||||
if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) return 1;
|
||||
|
||||
/*
|
||||
if(!(GetDAQStatusRegister(modules[i]->Module_GetTopLeftAddress(),status_reg_r)&&GetDAQStatusRegister(modules[i]->Module_GetTopRightAddress(),status_reg_l))){
|
||||
@ -1069,7 +1075,7 @@ int Feb_Control_AcquisitionInProgress(){
|
||||
}
|
||||
*/
|
||||
|
||||
printf("**idle\n");return 0; //i.e. not running (status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING;
|
||||
/*printf("**idle\n");*/return 0; //i.e. not running (status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING;
|
||||
}
|
||||
|
||||
int Feb_Control_Reset(){
|
||||
|
Reference in New Issue
Block a user