From 001dd4a18aaf70c91c88d3e16826b000ba8a22ad Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 30 Aug 2001 09:06:48 +0000 Subject: [PATCH] Join between hwrich-with-irq branch and main branch after testing interrupt controlled readout of rich --- hadaq/hwrich.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/hadaq/hwrich.c b/hadaq/hwrich.c index e5fe782..7c036ab 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.18 2001-04-12 12:33:19 hades Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.19 2001-08-30 09:06:48 hades Exp $"; #define _POSIX_C_SOURCE 199309L @@ -20,6 +20,7 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada struct HardwareS { size_t maxSubEvtSize; HwRace *race[NRACES]; + LInt *lInt[NRACES]; }; #include "hardware.h" @@ -57,6 +58,8 @@ Hardware *newHardware(void) msglog(LOG_ERR, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno)); return NULL; } + my->lInt[i] = allocMem(sizeof(LInt)); + conLInt(my->lInt[i], 100 + i); } desParam(param); @@ -68,6 +71,8 @@ void deleteHardware(Hardware *my) int i; for (i = 0; i < NRACES; i++) { + desLInt(my->lInt[i]); + freeMem(my->lInt[i]); desHwRace(my->race[i]); freeMem(my->race[i]); } @@ -81,20 +86,12 @@ void Hardware_waitForTrigger(Hardware *my, void *subEvt) for (i = 0; i < NRACES; i++) { if (HwRace_isEmpty(my->race[i])) { HwRace_requestBuffer(my->race[i]); - } - } - for (i = 0; i < NRACES; i++) { - while (HwRace_isBusy(my->race[i])) { -#if 0 -/* -* This sleep prevents a tight loop which stops work on real -* time systems if the priority of readout is not lowered. -* When not using the sleep use option -p -2 for daq_readout. -*/ - struct timespec tS, *t = &tS; - t->tv_sec = 0; - t->tv_nsec = 020000000; - nanosleep(t, NULL); +#ifndef NDEBUG + msglog(LOG_DEBUG, "%d buffer requested\n", i); +#endif + LInt_wait(my->lInt[i]); +#ifndef NDEBUG + msglog(LOG_DEBUG, "%d irq received\n", i); #endif } } -- 2.43.0