]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Code fitted to the philosophy orf rich and hwsam. Slightly faster. Needs new h file.
authorhadaq <hadaq>
Fri, 19 Apr 2002 19:15:16 +0000 (19:15 +0000)
committerhadaq <hadaq>
Fri, 19 Apr 2002 19:15:16 +0000 (19:15 +0000)
W. Koenig

hadaq/hwship.c

index c42eea1c893cf8848a09bdb8edea110cc293f2c7..5cd2f004155cff50c168138bd248a2c80fc8128b 100644 (file)
@@ -1,4 +1,4 @@
-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>
@@ -16,10 +16,7 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada
 #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) {
@@ -59,8 +56,7 @@ int conHwShip(HwShip * my, const char *name, const Param *param)
   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;
 }
 
@@ -79,17 +75,17 @@ void HwShip_requestBuffer(HwShip *my) {
 #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) {
@@ -97,26 +93,20 @@ 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