From 7a33fb12b531ed45dd1b34923a24ea459f80b964 Mon Sep 17 00:00:00 2001 From: hadaq Date: Fri, 19 Apr 2002 19:11:01 +0000 Subject: [PATCH] DTU busy is set during buffer request and during readout. Does not really help to fix the noise problems. W. Koenig --- hadaq/hwrich.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/hadaq/hwrich.c b/hadaq/hwrich.c index 8b79e09..bd14014 100644 --- a/hadaq/hwrich.c +++ b/hadaq/hwrich.c @@ -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++; -- 2.43.0