mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
semaphores , no usleep in receiver
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@660 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -5990,6 +5990,29 @@ int slsDetector::stopReceiver(){
|
||||
|
||||
|
||||
|
||||
|
||||
slsDetectorDefs::runStatus slsDetector::startReceiverReadout(){
|
||||
int fnum=F_START_READOUT;
|
||||
int ret = FAIL;
|
||||
int retval=-1;
|
||||
runStatus s=ERROR;
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Starting Receiver Readout" << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK)
|
||||
ret=thisReceiver->getInt(fnum,retval);
|
||||
if(retval!=-1)
|
||||
s=(runStatus)retval;
|
||||
if(ret==FORCE_UPDATE)
|
||||
ret=updateReceiver();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::detectorSendToReceiver(bool set){
|
||||
int fnum;
|
||||
if(set) fnum=F_START_RECEIVER;
|
||||
|
@ -1474,6 +1474,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int stopReceiver();
|
||||
|
||||
/** Sets the receiver to start any readout remaining in the fifo and
|
||||
* change status to transmitting.
|
||||
* The status changes to run_finished when fifo is empty
|
||||
*/
|
||||
runStatus startReceiverReadout();
|
||||
|
||||
/** Sets(false) or Resets(true) the CPU bit in detector
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
|
@ -485,6 +485,12 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int setReadReceiverFrequency(int getFromReceiver, int i=-1)=0;
|
||||
|
||||
/** Sets the receiver to start any readout remaining in the fifo and
|
||||
* change status to transmitting.
|
||||
* The status changes to run_finished when fifo is empty
|
||||
*/
|
||||
virtual runStatus startReceiverReadout()=0;
|
||||
|
||||
|
||||
/** returns detector type string from detector type index
|
||||
\param t string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
|
||||
|
@ -311,8 +311,9 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
break;
|
||||
|
||||
|
||||
pthread_mutex_lock(&mg);
|
||||
|
||||
if(setReceiverOnline()==OFFLINE_FLAG){
|
||||
pthread_mutex_lock(&mg);
|
||||
// wait until data processing thread has finished the data
|
||||
|
||||
#ifdef VERBOSE
|
||||
@ -329,11 +330,21 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
if((*correctionMask)&(1<<WRITE_FILE))
|
||||
closeDataFile();
|
||||
}
|
||||
|
||||
}else
|
||||
stopReceiver();
|
||||
|
||||
pthread_mutex_unlock(&mg);
|
||||
}else{
|
||||
pthread_mutex_lock(&mg);
|
||||
if(startReceiverReadout() == TRANSMITTING){
|
||||
while(getReceiverStatus() != RUN_FINISHED){
|
||||
pthread_mutex_unlock(&mg);
|
||||
usleep(50000);
|
||||
pthread_mutex_lock(&mg);
|
||||
}
|
||||
}
|
||||
stopReceiver();
|
||||
pthread_mutex_unlock(&mg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
#define SVNURLLIB "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUIDLIB "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||
//#define SVNREV 0x658
|
||||
//#define SVNREV 0x659
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTHLIB "l_maliakal_d"
|
||||
#define SVNREVLIB 0x658
|
||||
#define SVNDATELIB 0x20130827
|
||||
#define SVNREVLIB 0x659
|
||||
#define SVNDATELIB 0x20130829
|
||||
//
|
||||
|
Reference in New Issue
Block a user