-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwsam.c,v 6.14 2002-10-27 12:26:49 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwsam.c,v 6.15 2002-11-06 18:36:04 hadaq Exp $";
#include <assert.h>
#include <string.h>
/* 5 RC Headers + Subevent Header + some data */
#define SAM_NODATASIZE 0
-#define RC_HEADERLENGTH 12
int HwSam_readSubEvt(HwSam *my, void *subEvt)
{
- uint32_t * dataStart = (uint32_t *) subEvt;
- uint32_t * data;
+ uint32_t * data = (uint32_t *) subEvt;
int lastAddr;
int currAddr = my->currAddr;
- int size, rcSize;
- int rcSubEvt; /* pointer to length in rc sub-sub-event header */
+ int size;
#ifndef NDEBUG
syslog(LOG_DEBUG, "readSubEvt in");
syslog(LOG_DEBUG, "readSubEvt subevt: %s", SubEvt_2charP(subEvt));
#endif
/* copy one sub evt from Sam to memory */
- data = dataStart;
- /* copy remaining header */
- *++data = LVme_getL(my->cram, currAddr+=4);
- *++data = LVme_getL(my->cram, currAddr+=4);
- *++data = LVme_getL(my->cram, currAddr+=4);
-
- rcSubEvt = (currAddr+=4);
- while (rcSubEvt < lastAddr) {
- /*
- Skip rc subevent header if no data: tag, length, rc-id.
- This hack belongs into the RC code
- where tags should be compared to internal counters.
- If inconsistent, debug data can be inserted marked by the
- upermost bit on.
- */
- int rcSize16;
- rcSize = LVme_getL(my->cram, currAddr+4);
- rcSize16 = rcSize & 0xffff;
- rcSubEvt += rcSize16 * 4 + RC_HEADERLENGTH;
-
-/* if no data ... cut roc header */
-/*
- if( rcSize16 == 0) {
- size -= RC_HEADERLENGTH;
- currAddr += RC_HEADERLENGTH;
- } else {
-*/
- *++data = LVme_getL(my->cram, currAddr);
- *++data = rcSize;
- *++data = LVme_getL(my->cram, currAddr+=8);
- while((currAddr+=4) < rcSubEvt) {
- *++data = LVme_getL(my->cram, currAddr);
- }
-/*
- }
-*/
+ *data++ = size;
+ while ((currAddr+=4)<lastAddr) {
+ *data++ = LVme_getL(my->cram, currAddr);
}
- *dataStart = size;
#ifndef NDEBUG
syslog(LOG_DEBUG, "readSubEvt out");