-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv775.c,v 1.4 1999-09-02 09:55:55 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv775.c,v 1.5 1999-09-02 11:19:15 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
 #include "param.h"
 #include "hwv775.h"
 
-int conHwV775(HwV775 * my, const char *name, const Param *param)
+int conHwV775(HwV775 *my, const char *name, const Param *param)
 {
        unsigned long cardBase;
        int i;
        assert(my != NULL);
 
        strcpy(my->name, name);
-       my->trigNr = 0;
 
        cardBase = Param_getVal(param, my->name, "cardbase");
        my->lvme = allocMem(sizeof(LVme));
        return 0;
 }
 
-void desHwV775(HwV775 * my)
+void desHwV775(HwV775 *my)
 {
        desLVme(my->lvme);
        freeMem(my->lvme);
 }
 
-void HwV775_requestBuffer(HwV775 * my)
-{
-}
-
-int HwV775_isBusy(HwV775 * my)
-{
-       return HwV775_isEmpty(my);
-}
-
-int HwV775_isEmpty(HwV775 * my)
+int HwV775_isEmpty(HwV775 *my)
 {
        return LVme_tstBitW(my->lvme, V775_STAT_REG_1, 0) == 0;
 }
 
-int HwV775_readSubEvt(HwV775 * my, void *subEvt)
+int HwV775_readData(HwV775 *my, void *subEvt)
 {
-       UInt4 *data = subEvt;
+       UInt4 *data = SubEvt_end(subEvt);
+       UInt4 *first = data;
        UInt4 hdr;
        UInt4 eob;
        int nWords;
        }
 
        trigTag = eob & 0xff;
-
-       SubEvt_setSize(subEvt, (char *) data - (char *) subEvt);
-       SubEvt_setDecoding(subEvt, SubEvtDecoding_32bitData);
-       SubEvt_setId(subEvt, SubEvtId_tofTest);
-       SubEvt_setTrigNr(subEvt, my->trigNr << 24 | trigTag);
-       my->trigNr++;
-
+       if (trigTag != (SubEvt_trigNr(subEvt) & 0xff)) {
+               msglog(LOG_EMERG, "%s trigNr mismatch: 0x%08x != 0x%02x \n",
+                          my->name, SubEvt_trigNr(subEvt), trigTag);
+       }
+       SubEvt_setSize(subEvt, SubEvt_size(subEvt) + (char *) data - (char *) first);
        return 0;
 }
 
 typedef struct HwV775S {
   char name[16];
   LVme *lvme;
-  unsigned long trigNr;
 } HwV775;
 
 #define V775_OUT_BUF 0x00
 int conHwV775(HwV775 *my, const char *name, const Param *param);
 void desHwV775(HwV775 *my);
 
-void HwV775_requestBuffer(HwV775 *my);
-int HwV775_isBusy(HwV775 *my);
 int HwV775_isEmpty(HwV775 *my);
 int HwV775_readSubEvt(HwV775 *my, void *subEvt);
 
 
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv878.c,v 1.2 1999-09-02 09:55:55 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv878.c,v 1.3 1999-09-02 11:19:15 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
 #include "param.h"
 #include "hwv878.h"
 
-int conHwV878(HwV878 * my, const char *name, const Param *param)
+int conHwV878(HwV878 *my, const char *name, const Param *param)
 {
        unsigned long cardBase;
        int i;
        assert(my != NULL);
 
        strcpy(my->name, name);
-       my->trigNr = 0;
 
        cardBase = Param_getVal(param, my->name, "cardbase");
        my->lvme = allocMem(sizeof(LVme));
        return 0;
 }
 
-void desHwV878(HwV878 * my)
+void desHwV878(HwV878 *my)
 {
        desLVme(my->lvme);
        freeMem(my->lvme);
 }
 
-void HwV878_requestBuffer(HwV878 * my)
-{
-}
-
-int HwV878_isBusy(HwV878 * my)
-{
-       return HwV878_isEmpty(my);
-}
-
-int HwV878_isEmpty(HwV878 * my)
+int HwV878_isEmpty(HwV878 *my)
 {
        return LVme_tstBitW(my->lvme, V878_STAT_REG_1, 0) == 0;
 }
 
-int HwV878_readSubEvt(HwV878 * my, void *subEvt)
+int HwV878_readData(HwV878 *my, void *subEvt)
 {
-       UInt4 *data = subEvt;
+       UInt4 *data = SubEvt_end(subEvt);
+       UInt4 *first = data;
        UInt4 hdr;
        UInt4 eob;
        int nWords;
        }
 
        trigTag = eob & 0xff;
-
-       SubEvt_setSize(subEvt, (char *) data - (char *) subEvt);
-       SubEvt_setDecoding(subEvt, SubEvtDecoding_32bitData);
-       SubEvt_setId(subEvt, SubEvtId_tofTest);
-       SubEvt_setTrigNr(subEvt, my->trigNr << 24 | trigTag);
-       my->trigNr++;
-
+       if (trigTag != (SubEvt_trigNr(subEvt) & 0xff)) {
+               msglog(LOG_EMERG, "%s trigNr mismatch: 0x%08x != 0x%02x \n",
+                          my->name, SubEvt_trigNr(subEvt), trigTag);
+       }
+       SubEvt_setSize(subEvt, SubEvt_size(subEvt) + (char *) data - (char *) first);
        return 0;
 }
 
 typedef struct HwV878S {
   char name[16];
   LVme *lvme;
-  unsigned long trigNr;
 } HwV878;
 
 #define V878_OUT_BUF 0x0000
 int conHwV878(HwV878 *my, const char *name, const Param *param);
 void desHwV878(HwV878 *my);
 
-void HwV878_requestBuffer(HwV878 *my);
-int HwV878_isBusy(HwV878 *my);
 int HwV878_isEmpty(HwV878 *my);
 int HwV878_readSubEvt(HwV878 *my, void *subEvt);