mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 09:10:01 +02:00
temporary solution is to restart and restop state machine many times till it works
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@635 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
b5fb6be6df
commit
34af5c9be0
@ -1486,7 +1486,7 @@ u_int32_t runState(void) {
|
|||||||
// State Machine
|
// State Machine
|
||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
|
int i;
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("*******Starting State Machine*******\n");
|
printf("*******Starting State Machine*******\n");
|
||||||
//#endif
|
//#endif
|
||||||
@ -1497,8 +1497,25 @@ int startStateMachine(){
|
|||||||
write_stop_sm(0);
|
write_stop_sm(0);
|
||||||
write_status_sm("Started");
|
write_status_sm("Started");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
for(i=0;i<100;i++){
|
||||||
|
//start state machine
|
||||||
bus_w16(CONTROL_REG, START_ACQ_BIT | START_EXPOSURE_BIT);
|
bus_w16(CONTROL_REG, START_ACQ_BIT | START_EXPOSURE_BIT);
|
||||||
bus_w16(CONTROL_REG, 0x0);
|
bus_w16(CONTROL_REG, 0x0);
|
||||||
|
//verify
|
||||||
|
if(bus_r(STATUS_REG) & RUN_BUSY_BIT)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
usleep(5000);
|
||||||
|
}
|
||||||
|
if(i!=0)
|
||||||
|
printf("tried to start state machine %d times\n",i);
|
||||||
|
if(i==100){
|
||||||
|
printf("\n***********COULD NOT START STATE MACHINE***************\n");
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
printf("statusreg=%08x\n",bus_r(STATUS_REG));
|
printf("statusreg=%08x\n",bus_r(STATUS_REG));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -1507,7 +1524,7 @@ int startStateMachine(){
|
|||||||
|
|
||||||
|
|
||||||
int stopStateMachine(){
|
int stopStateMachine(){
|
||||||
|
int i;
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("*******Stopping State Machine*******\n");
|
printf("*******Stopping State Machine*******\n");
|
||||||
//#endif
|
//#endif
|
||||||
@ -1515,28 +1532,32 @@ int stopStateMachine(){
|
|||||||
write_stop_sm(1);
|
write_stop_sm(1);
|
||||||
write_status_sm("Stopped");
|
write_status_sm("Stopped");
|
||||||
#endif
|
#endif
|
||||||
|
for(i=0;i<100;i++){
|
||||||
|
//stop state machine
|
||||||
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
|
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
|
||||||
bus_w16(CONTROL_REG, 0x0);
|
bus_w16(CONTROL_REG, 0x0);
|
||||||
/*
|
|
||||||
int i;
|
|
||||||
for(i=0;i<10;i++){
|
|
||||||
if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT)){
|
|
||||||
printf("stoppped\n");
|
|
||||||
break;
|
|
||||||
}else{
|
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
printf("trying to stop again\n");
|
//verify
|
||||||
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
|
if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT))
|
||||||
bus_w16(CONTROL_REG, 0x0);
|
break;
|
||||||
}
|
}
|
||||||
|
if(i!=0)
|
||||||
|
printf("tried to stop state machine %d times\n",i);
|
||||||
|
if(i==100){
|
||||||
|
printf("\n***********COULD NOT STOP STATE MACHINE***************\n");
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
/*
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
// if (!runBusy())
|
// if (!runBusy())
|
||||||
if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT))
|
if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT))
|
||||||
return OK;
|
return OK;
|
||||||
else
|
else
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
*/
|
||||||
|
printf("statusreg=%08x\n",bus_r(STATUS_REG));
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user