]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
DTU busy is set during buffer request and during readout. Does not really help
authorhadaq <hadaq>
Fri, 19 Apr 2002 19:11:01 +0000 (19:11 +0000)
committerhadaq <hadaq>
Fri, 19 Apr 2002 19:11:01 +0000 (19:11 +0000)
to fix the noise problems. W. Koenig

hadaq/hwrich.c

index 8b79e091e47273d2276fa798874ddf0c5b4ff4cd..bd140140be5696e4597f41c88ea925b35aea37fe 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.21 2001-11-18 13:10:35 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.22 2002-04-19 19:11:01 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -22,6 +22,7 @@ struct HardwareS {
        size_t maxSubEvtSize;
        HwRace *race[NRACES];
        LInt *lInt[NRACES];
+       LVme *dtu;
 };
 
 #include "hardware.h"
@@ -61,6 +62,12 @@ Hardware *newHardware(void)
                }
                my->lInt[i] = malloc(sizeof(LInt));
                conLInt(my->lInt[i], 100 + i);
+
+       }
+       my->dtu = malloc(sizeof(LVme));
+       if(0 > conLVme(my->dtu, 0x44100000, 0x10000, 0x09, 0x3c, 1)) {
+               syslog(LOG_DEBUG,"Rich DTU not found");
+               return -1;
        }
 
        desParam(param);
@@ -77,6 +84,9 @@ void deleteHardware(Hardware *my)
                desHwRace(my->race[i]);
                free(my->race[i]);
        }
+       desLVme(my->dtu);
+       free(my->dtu);
+
        free(my);
 }
 
@@ -84,12 +94,18 @@ void Hardware_waitForTrigger(Hardware *my, void *subEvt)
 {
        int i;
 
+       LVme_setL(my->dtu,0x00 ,0x22); /* dtu busy on */
        for (i = 0; i < NRACES; i++) {
                if (HwRace_isEmpty(my->race[i])) {
                        HwRace_requestBuffer(my->race[i]);
 #ifndef NDEBUG
                        syslog(LOG_DEBUG, "%d buffer requested", i);
 #endif
+               }
+       }
+       LVme_setL(my->dtu,0x00 ,0x02); /* dtu busy off */
+       for (i = 0; i < NRACES; i++) {
+               if(HwRace_BufIsRequested(my->race[i])) {
                        LInt_wait(my->lInt[i]);
 #ifndef NDEBUG
                        syslog(LOG_DEBUG, "%d irq received", i);
@@ -110,6 +126,7 @@ void Hardware_readout(Hardware *my, void *partEvt)
        SubEvt_setId(partEvt, 0);
 
        /* read all races, check for common trigger tag */
+       LVme_setL(my->dtu,0x00 ,0x22); /* dtu busy on */
        for (i = 0; i < NRACES; i++) {
                HwRace_readSubEvt(my->race[i], subEvt);
                if (i == 0) {
@@ -124,8 +141,9 @@ void Hardware_readout(Hardware *my, void *partEvt)
                }
                subEvt = SubEvt_next(partEvt, subEvt);
        }
+    LVme_setL(my->dtu,0x00 ,0x02); /* dtu busy off */
 
-    SubEvt_setTrigNr(partEvt, trigNr << 8 | trigTag);
+       SubEvt_setTrigNr(partEvt, trigNr << 8 | trigTag);
        SubEvt_setSize(partEvt, (char *)subEvt - (char *)partEvt);
     trigNr++;