From: hadaq Date: Sun, 19 May 2002 23:17:03 +0000 (+0000) Subject: new version: suppresses headers if no data are delivered. WK X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=8c11523dd57cbd71c3257af507b8f46579dc878e;p=daqdata.git new version: suppresses headers if no data are delivered. WK --- diff --git a/hadaq/hwtip.c b/hadaq/hwtip.c index a7b4ead..18f1b7c 100644 --- a/hadaq/hwtip.c +++ b/hadaq/hwtip.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtip.c,v 1.21 2001-11-18 11:56:21 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtip.c,v 1.22 2002-05-19 23:17:03 hadaq Exp $"; #include #include @@ -104,6 +104,7 @@ static int endOfData(HwTip * my) return LVme_getL(my->lvme, my->fifo) + my->fifo; } +#define TIP_BUFSIZE 0x40000 int conHwTip(HwTip * my, const char *name, const Param *param) { unsigned long cardBase; @@ -134,7 +135,7 @@ int conHwTip(HwTip * my, const char *name, const Param *param) my->pipeFull = _LVL2_PIPE2_FULL; my->daqRq = _LVL2_PIPE2_RQ; my->daqGr = _LVL2_PIPE2_GR; - my->fifo = MEMBASE + 0x40000; + my->fifo = MEMBASE + TIP_BUFSIZE; return 0; } @@ -163,7 +164,7 @@ void HwTip_requestBuffer(HwTip * my) my->pipeFull = _LVL2_PIPE2_FULL; my->daqRq = _LVL2_PIPE2_RQ; my->daqGr = _LVL2_PIPE2_GR; - my->fifo = MEMBASE + 0x40000; + my->fifo = MEMBASE + TIP_BUFSIZE; } else { my->bankRequested = 0; my->pipeFull = _LVL2_PIPE1_FULL; @@ -186,24 +187,27 @@ int HwTip_isEmpty(HwTip * my) { return my->currAddr >= endOfData(my); } - +#define TIP_NODATASIZE 20 int HwTip_readSubEvt(HwTip * my, void *subEvt) { uint32_t *data = (uint32_t *) subEvt; - int firstAddr; + int lastAddr; size_t size; size = LVme_getL(my->lvme, my->currAddr); - if (size > 0x40000) { + lastAddr = my->currAddr + size; + if (size > TIP_BUFSIZE) { syslog(LOG_ERR, "found size: %.8x , address: %.8x, too long, fatal! ", size, my->currAddr); - exit(1); + my->currAddr = lastAddr; + return -1; + } + if( size <= TIP_NODATASIZE ) { + my->currAddr = lastAddr; + return 1; } /* copy one sub evt from RC to memory */ - firstAddr = my->currAddr; - /* take the size from above to use the check */ *data++ = size; - my->currAddr += 4; - for (; my->currAddr - firstAddr < size; my->currAddr += 4) { + while ((my->currAddr+=4) < lastAddr) { *data++ = LVme_getL(my->lvme, my->currAddr); }