-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwship.c,v 6.18 2001-11-18 11:56:21 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwship.c,v 6.19 2002-04-19 19:15:16 hadaq Exp $";
#include <assert.h>
#include <string.h>
#include "hwship.h"
static int bankRequested(HwShip *my) {
- uint16_t val;
-
- val = LVme_tstBitL(my->lvme, LVL2_ACCESS_VMEREG, 6);
- return val;
+ return my->bankRequested;
}
static int bankConfirmed(HwShip *my) {
LVme_setW(my->lvme, LVL2_SEL_VMEREG, LVL2_SELMEM_VMEREG);
my->trigNr = 0;
- my->currAddr = 0xffffffff; /* behind end of memory */
-
+ my->currAddr = 0x7fffffff; /* behind end of memory */
return 0;
}
#if 1
struct timespec tS, *t = &tS;
t->tv_sec = 0;
- t->tv_nsec = 020000000;
+ t->tv_nsec = 010000000;
nanosleep(t, NULL);
#endif
}
#ifndef NDEBUG
syslog(LOG_DEBUG, "data available");
#endif
- i = bankRequested(my) == 1 ? 0 : 1;
+ i = my->bankRequested == 1 ? 0 : 1;
LVme_setL(my->lvme, LVL2_ACCESS_VMEREG, i);
-
- my->currAddr = LVL2_OFFSET + 0x4;
+ my->bankRequested = i;
+ my->currAddr = LVL2_DATASTART;
}
int HwShip_isBusy(HwShip *my) {
}
int HwShip_isEmpty(HwShip *my) {
- int retVal;
-
- if (my->currAddr == 0xffffffff) {
- retVal = 1;
- } else {
- retVal = my->currAddr >= endOfData(my);
- }
- return retVal;
+ return my->currAddr >= endOfData(my);
}
int HwShip_readSubEvt(HwShip *my, void *subEvt) {
uint32_t *data = (uint32_t *)subEvt;
- int firstAddr;
+ int lastAddr;
size_t size;
size = LVme_getL(my->lvme, my->currAddr);
-
+ lastAddr = my->currAddr + size;
/* copy one sub evt from RC to memory */
- for (firstAddr = my->currAddr; my->currAddr - firstAddr < size; my->currAddr += 4) {
- *data++ = LVme_getL(my->lvme, my->currAddr);
+ *data++ = size;
+ while ((my->currAddr+=4) < lastAddr) {
+ *data++ = LVme_getL(my->lvme, my->currAddr);
}
#ifndef NDEBUG