--- /dev/null
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwsis3801.c,v 1.1 1999-09-05 11:08:34 hades Stab $";
+
+#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 "hwsis3801.h"
+
+int conHwSis3801(HwSis3801 *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, SIS3801_MODID, 4)) {
+ msglog(LOG_DEBUG, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno));
+ return -1;
+ }
+ LVme_setL(my->lvme, SIS3801_RESET, 0);
+ LVme_setL(my->lvme, SIS3801_CLEAR, 0);
+ LVme_setL(my->lvme, SIS3801_ENABLE_CLOCK, 0);
+ LVme_setL(my->lvme, SIS3801_CTRL_REG, 0x00010000);
+ LVme_setL(my->lvme, SIS3801_NEXT_CLOCK, 0);
+
+ return 0;
+}
+
+void desHwSis3801(HwSis3801 *my)
+{
+ desLVme(my->lvme);
+ freeMem(my->lvme);
+}
+
+int HwSis3801_isEmpty(HwSis3801 *my)
+{
+ return LVme_tstBitL(my->lvme, SIS3801_CTRL_REG, 8);
+}
+
+int HwSis3801_readData(HwSis3801 *my, void *subEvt)
+{
+ UInt2 *data = SubEvt_end(subEvt);
+ UInt4 dummy;
+ int nWords;
+
+ msglog(LOG_DEBUG, "Sis3801 Readout\n");
+ dummy = LVme_getL(my->lvme, SIS3801_MODID);
+ *data++ = dummy >> 16;
+ nWords = SIS3801_NCHANNELS;
+ while (--nWords >= 0) {
+ dummy = LVme_getL(my->lvme, SIS3801_FIFO);
+ *data++ = dummy >> 16;
+ *data++ = dummy & 0xffff;
+ }
+ SubEvt_setSize(subEvt, (char *) data - (char *) subEvt);
+ return 0;
+}
--- /dev/null
+#ifndef HWSIS3801_H
+#define HWSIS3801_H
+
+#include <lvme.h>
+#include "rc.h"
+
+#include "param.h"
+
+typedef struct HwSis3801S {
+ char name[16];
+ LVme *lvme;
+ unsigned long trigNr;
+} HwSis3801;
+
+#define SIS3801_NCHANNELS 32
+
+#define SIS3801_CTRL_REG 0x00
+#define SIS3801_MODID 0x04
+#define SIS3801_CLEAR 0x20
+#define SIS3801_NEXT_CLOCK 0x24
+#define SIS3801_ENABLE_CLOCK 0x28
+#define SIS3801_RESET 0x60
+#define SIS3801_FIFO 0x100
+
+int conHwSis3801(HwSis3801 *my, const char *name, const Param *param);
+void desHwSis3801(HwSis3801 *my);
+
+int HwSis3801_isEmpty(HwSis3801 *my);
+int HwSis3801_readData(HwSis3801 *my, void *subEvt);
+
+#endif