]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
BUGFIX: fixed bug introduced in last version. Readout needs to keep daqReq
authorhades <hades>
Fri, 31 Aug 2001 11:17:31 +0000 (11:17 +0000)
committerhades <hades>
Fri, 31 Aug 2001 11:17:31 +0000 (11:17 +0000)
set until it has read the whole buffer

hadaq/hwtip.c

index ab6560737cbe91d6f71a9b04608431a516f9b5b4..1df7c2fabb3f0751becd03b846cb6730981e5bba 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtip.c,v 1.19 2001-08-30 16:37:37 hades Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtip.c,v 1.20 2001-08-31 11:17:31 hades Exp $";
 
 #include <assert.h>
 #include <string.h>
@@ -145,6 +145,16 @@ 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;
@@ -158,20 +168,6 @@ void HwTip_requestBuffer(HwTip * my)
                my->daqGr = _LVL2_PIPE1_GR;
                my->fifo = MEMBASE;
        }
-#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;
-               t->tv_sec = 0;
-               t->tv_nsec = 020000000;
-               nanosleep(t, NULL);
-#endif
-       }
-#endif
 
        LVme_setBitL(my->lvme, CONFIG1BASE + CFG_MASTER_CONTROL, my->daqRq);
 
@@ -180,26 +176,7 @@ void HwTip_requestBuffer(HwTip * my)
 
 int HwTip_isBusy(HwTip * my)
 {
-       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;
+       return !LVme_tstBitL(my->lvme, CONFIG1BASE + CFG_MASTER_STATUS, my->daqGr);
 }
 
 int HwTip_isEmpty(HwTip * my)
@@ -216,7 +193,7 @@ int HwTip_readSubEvt(HwTip * my, void *subEvt)
        size = LVme_getL(my->lvme, my->currAddr);
        if (size > 0x40000) {
          msglog(LOG_ERR, "found size: %.8x , address: %.8x, too long, fatal! \n", size, my->currAddr);
-         exit(-1);
+         exit(1);
        }
        /* copy one sub evt from RC to memory */
        firstAddr = my->currAddr;