]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
buggy version, daq request must stay set until pipe is empty (as in
authorhades <hades>
Thu, 30 Aug 2001 16:37:37 +0000 (16:37 +0000)
committerhades <hades>
Thu, 30 Aug 2001 16:37:37 +0000 (16:37 +0000)
the former versions)

hadaq/hwtip.c

index dd764f9b20bc69062d9f98287106767920a3ea7e..ab6560737cbe91d6f71a9b04608431a516f9b5b4 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtip.c,v 1.18 2001-04-23 13:34:41 hades Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtip.c,v 1.19 2001-08-30 16:37:37 hades Exp $";
 
 #include <assert.h>
 #include <string.h>
@@ -145,16 +145,6 @@ void desHwTip(HwTip * my)
 void HwTip_requestBuffer(HwTip * my)
 {
 
-       LVme_clrBitL(my->lvme, CONFIG1BASE + CFG_MASTER_CONTROL, my->daqRq);
-
-       while (LVme_tstBitL(my->lvme, CONFIG1BASE + CFG_MASTER_STATUS, my->daqGr)) {
-#if 1
-               struct timespec tS, *t = &tS;
-               t->tv_sec = 0;
-               t->tv_nsec = 020000000;
-               nanosleep(t, NULL);
-#endif
-       }
        if (my->bankRequested == 0) {
                my->bankRequested = 1;
                my->pipeFull = _LVL2_PIPE2_FULL;
@@ -171,6 +161,8 @@ void HwTip_requestBuffer(HwTip * my)
 #ifndef NDEBUG
        msglog(LOG_DEBUG, "wait for data\n");
 #endif
+
+#if 0
        while (!LVme_tstBitL(my->lvme, CONFIG1BASE + CFG_MASTER_STATUS, my->pipeFull)) {
 #if 1
                struct timespec tS, *t = &tS;
@@ -179,9 +171,8 @@ void HwTip_requestBuffer(HwTip * my)
                nanosleep(t, NULL);
 #endif
        }
-#ifndef NDEBUG
-       msglog(LOG_DEBUG, "data available\n");
 #endif
+
        LVme_setBitL(my->lvme, CONFIG1BASE + CFG_MASTER_CONTROL, my->daqRq);
 
        my->currAddr = my->fifo + 0x4;
@@ -189,7 +180,26 @@ void HwTip_requestBuffer(HwTip * my)
 
 int HwTip_isBusy(HwTip * my)
 {
-       return !LVme_tstBitL(my->lvme, CONFIG1BASE + CFG_MASTER_STATUS, my->daqGr);
+       int isGranted;
+
+       isGranted = LVme_tstBitL(my->lvme, CONFIG1BASE + CFG_MASTER_STATUS, my->daqGr);
+
+       if (isGranted) {
+#ifndef NDEBUG
+               msglog(LOG_DEBUG, "data available\n");
+#endif
+               LVme_clrBitL(my->lvme, CONFIG1BASE + CFG_MASTER_CONTROL, my->daqRq);
+
+               while (LVme_tstBitL(my->lvme, CONFIG1BASE + CFG_MASTER_STATUS, my->daqGr)) {
+       #if 1
+                       struct timespec tS, *t = &tS;
+                       t->tv_sec = 0;
+                       t->tv_nsec = 020000000;
+                       nanosleep(t, NULL);
+       #endif
+               }
+       }
+       return !isGranted;
 }
 
 int HwTip_isEmpty(HwTip * my)