--- /dev/null
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwdtu.c,v 1.1 1999-09-03 07:35:06 hades Exp $";
+
+#define _POSIX_C_SOURCE 199309L
+#include <unistd.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <hadesstd.h>
+#include <lvme.h>
+
+
+#include "subevt.h"
+#include "param.h"
+#include "hwdtu.h"
+
+int conHwDtu(HwDtu *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));
+
+ if (0 > conLVme(my->lvme, cardBase, 0x10000, 0x09, DTU_MAGIC, 1)) {
+ msglog(LOG_DEBUG, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno));
+ return -1;
+ }
+ return 0;
+}
+
+void desHwDtu(HwDtu *my)
+{
+ desLVme(my->lvme);
+ freeMem(my->lvme);
+}
+
+int HwDTU_isEmpty(HwDtu *my)
+{
+ return LVme_tstBitB(my->lvme, DTU_FIFO_2, 0);
+}
+
+int HwDTU_read(HwDtu *my, void *subEvt)
+{
+ my->trigTag = LVme_getB(my->lvme, DTU_TRIG_TAG);
+ my->trigCode = LVme_getB(my->lvme, DTU_TRIG_CODE) & 0x0f;
+ LVme_setB(my->lvme, DTU_FIFO_1, 0);
+ LVme_setB(my->lvme, DTU_FIFO_2, 0);
+ return 0;
+}
--- /dev/null
+#ifndef HwDTU_H
+#define HwDTU_H
+
+#include <lvme.h>
+#include "rc.h"
+
+#include "param.h"
+
+typedef struct HwDtuS {
+ char name[16];
+ LVme *lvme;
+ unsigned long trigNr;
+ UInt1 trigTag;
+ UInt1 trigCode;
+} HwDtu;
+
+#define DTU_TRIG_CODE 0x18
+#define DTU_TRIG_TAG 0x1c
+#define DTU_FIFO_1 0x20
+#define DTU_FIFO_2 0x24
+#define DTU_MAGIC 0x3c
+
+int conHwDtu(HwDtu *my, const char *name, const Param *param);
+void desHwDtu(HwDtu *my);
+
+int HwDtu_isEmpty(HwDtu *my);
+int HwDtu_read(HwDtu *my, void *subEvt);
+
+#endif