diff --git a/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h b/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h index 328e8f20a..e66033aee 100644 --- a/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h +++ b/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h @@ -89,11 +89,6 @@ /* Status register */ #define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL) -#ifdef VIRTUAL // until firmware is ready -#define RUN_BUSY_OFST (0) -#define RUN_BUSY_MSK (0x00000001 << RUN_BUSY_OFST) -#endif - /* Look at me register, read only */ #define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL) //Not used in firmware or software, good to play with @@ -123,8 +118,8 @@ #define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST) #define CONTROL_STP_ACQSTN_OFST (1) #define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST) -#define CONTROL_RN_BSY_OFST (2) // assumed for MY3 TODO -#define CONTROL_RN_BSY_MSK (0x00000001 << CONTROL_RN_BSY_OFST) +//#define CONTROL_RN_BSY_OFST (2) // assumed for MY3 TODO +//#define CONTROL_RN_BSY_MSK (0x00000001 << CONTROL_RN_BSY_OFST) #define CONTROL_CRE_RST_OFST (10) #define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST) #define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10? diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer index 1fbe37cff..341023282 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 11e64b153..eae742e02 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -17,6 +17,9 @@ #include #include #endif +// ------------------------------------------ +#include +// ------------------------------------------ // Global variable from slsDetectorServer_funcs @@ -32,6 +35,9 @@ pthread_t pthread_virtual_tid; int virtual_status = 0; int virtual_stop = 0; #endif +// ------------------------------------------ +int temp_status = 0; +// ------------------------------------------ int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0, 0}; uint32_t clkFrequency[NUM_CLOCKS] = {0, 0, 0, 0, 0}; @@ -1225,7 +1231,10 @@ int startStateMachine(){ #endif FILE_LOG(logINFOBLUE, ("Starting State Machine\n")); cleanFifos(); - + + // ------------------------------------------ + temp_status = 1; + // ------------------------------------------ //start state machine bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK); @@ -1305,11 +1314,14 @@ enum runStatus getRunStatus(){ #endif FILE_LOG(logDEBUG1, ("Getting status\n")); - uint32_t retval = bus_r(STATUS_REG); - FILE_LOG(logINFO, ("Status Register: %08x\n",retval)); + // ------------------------------------------ + //uint32_t retval = bus_r(STATUS_REG); + //FILE_LOG(logINFO, ("Status Register: %08x\n",retval)); // running - if(retval & CONTROL_RN_BSY_MSK) { + if (temp_status) { + //if(retval & CONTROL_RN_BSY_MSK) { + // ------------------------------------------ FILE_LOG(logINFOBLUE, ("Status: Running\n")); return RUNNING; @@ -1319,9 +1331,28 @@ enum runStatus getRunStatus(){ void readFrame(int *ret, char *mess){ // wait for status to be done - while(runBusy()){ - usleep(500); - } + + // ------------------------------------------ + //while(runBusy()){ + // usleep(500); + //} + + int64_t periodns = getPeriod(); + int numFrames = getNumFrames(); + int frameNr = 0; + // loop over number of frames + for(frameNr=0; frameNr!= numFrames; ++frameNr ) { + // sleep for exposure time + struct timespec begin, end; + clock_gettime(CLOCK_REALTIME, &begin); + usleep(periodns / 1000); + clock_gettime(CLOCK_REALTIME, &end); + } + usleep(1 * 1000 * 1000); + temp_status = 0; + // ------------------------------------------ + + #ifdef VIRTUAL FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n")); return; @@ -1344,10 +1375,12 @@ u_int32_t runBusy() { return virtual_status; #endif - u_int32_t s = (bus_r(CONTROL_REG) & CONTROL_RN_BSY_OFST); - FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s)); - return s; - + // ------------------------------------------ + return temp_status; + //u_int32_t s = (bus_r(CONTROL_REG) & CONTROL_RN_BSY_OFST); + //FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s)); + //return s; + // ------------------------------------------ } /* common */ diff --git a/slsSupportLib/include/versionAPI.h b/slsSupportLib/include/versionAPI.h index 9afd74f5f..669855886 100644 --- a/slsSupportLib/include/versionAPI.h +++ b/slsSupportLib/include/versionAPI.h @@ -8,5 +8,5 @@ #define APIGOTTHARD 0x191111 #define APIJUNGFRAU 0x191111 #define APIEIGER 0x191111 -#define APIMYTHEN3 0x191119 #define APIGOTTHARD2 0x191119 +#define APIMYTHEN3 0x191120