module acquisition works, edit getrunstatus, added a small code for master incomplete, adjusted server to look for element in position 1 instead of zero

This commit is contained in:
Maliakal Dhanya
2014-10-06 11:01:51 +02:00
parent d8c7201749
commit 347a36b7c1
6 changed files with 60 additions and 45 deletions

View File

@ -694,7 +694,7 @@ int Feb_Control_SendHighVoltage(unsigned int dst_num,float* value){
int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int* top, int* bottom, unsigned int* dac_ch){
char* local_s = dac_str;
char temp[50];
*module_index = 0;
*module_index = 1;
char* p1 = strstr(local_s,"mod");//size_t p1 = local_s.find("mod");
char* p2 = strstr(local_s,"::");//size_t p2 =local_s.find("::");
@ -729,6 +729,15 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int*
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;
if(!Feb_Control_GetDACNumber(local_s,dac_ch)){
printf("Error in dac_name: %s (%s)\n",dac_str,local_s);
@ -955,8 +964,8 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
} //end row loop
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[0]),0,0,1024,trimbits_to_load_r)||
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[0]),0,0,1024,trimbits_to_load_l)||
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)){
@ -982,11 +991,14 @@ unsigned int* Feb_Control_GetTrimbits(){
unsigned int Feb_Control_AddressToAll(){
if(moduleSize==0) return 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]);
if(Module_BottomAddressIsValid(&modules[0])){
//printf("************* bottom\n");
return Module_GetBottomLeftAddress(&modules[0])|Module_GetBottomRightAddress(&modules[0]);
}
// printf("************* top\n");
return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]);
}
int Feb_Control_SetCommandRegister(unsigned int cmd){
@ -1035,18 +1047,18 @@ int Feb_Control_AcquisitionInProgress(){
//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])){
if(Module_BottomAddressIsValid(&modules[1])){
//printf("************* bottom1\n");
if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[1]),&status_reg_r)))
return 0;
{printf("**idle\n");return 0;}
}else{
//printf("************* top1\n");
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r)))
return 0;
{printf("**idle\n");return 0;}
}
if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) return 1;
if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) {printf("******running\n");return 1;}
/*
if(!(GetDAQStatusRegister(modules[i]->Module_GetTopLeftAddress(),status_reg_r)&&GetDAQStatusRegister(modules[i]->Module_GetTopRightAddress(),status_reg_l))){
@ -1057,7 +1069,7 @@ int Feb_Control_AcquisitionInProgress(){
}
*/
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(){
@ -1370,7 +1382,7 @@ int Feb_Control_WriteNRead(char* message, int length, int max_length){
}
*/
int Feb_Control_StartAcquisition(){
int Feb_Control_StartAcquisition(){printf("****** starting acquisition********* \n");
static unsigned int reg_nums[20];
static unsigned int reg_vals[20];

View File

@ -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

View File

@ -53,7 +53,8 @@ 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
int default_dac_values[16] = {0,2000,2000,1250,700,1278,500,500,2000,500,500,550,550,100,1000,775};
enum masterFlags masterMode=NO_MASTER;
enum masterFlags trialMasterMode=NO_MASTER;
int initDetector(){
int imod,i,n;
@ -128,9 +129,12 @@ int initDetector(){
setHighVolage(150,0);
setIODelay(675,0);
setTiming(AUTO_TIMING);
setMaster(GET_MASTER);
int enable[2] = {0,1};
setExternalGating(enable);//disable external gating
if(getDetectorNumber() == 0xbeb031)
trialMasterMode = IS_MASTER;
return 1;
}
@ -453,8 +457,13 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
int startStateMachine(){
printf("Going to start acquisition\n");
if(Feb_Control_StartAcquisition()){
if(trialMasterMode == IS_MASTER)
Feb_Control_StartAcquisition();
printf("requesting images\n");
//RequestImages();
int ret_val = 0;
dst_requested[0] = 1;
@ -471,15 +480,19 @@ int startStateMachine(){
return FAIL;
else
return OK;
}
return FAIL;
}
int stopStateMachine(){
printf("Going to stop acquisition\n");
if(Feb_Control_StopAcquisition())
return OK;
if(trialMasterMode == IS_MASTER){
if(Feb_Control_StopAcquisition())
return OK;
}else return OK;
return FAIL;
}
@ -885,7 +898,10 @@ void setExternalGating(int enable[]){
enum masterFlags setMaster(enum masterFlags arg){
return NO_MASTER;
if(arg != GET_MASTER)
masterMode = arg;
return arg;
}