]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Initial revision
authorhades <hades>
Sun, 5 Sep 1999 11:08:34 +0000 (11:08 +0000)
committerhades <hades>
Sun, 5 Sep 1999 11:08:34 +0000 (11:08 +0000)
hadaq/hwsis3801.c [new file with mode: 0644]
hadaq/hwsis3801.h [new file with mode: 0644]
hadaq/writefile [new file with mode: 0644]

diff --git a/hadaq/hwsis3801.c b/hadaq/hwsis3801.c
new file mode 100644 (file)
index 0000000..e8e1a37
--- /dev/null
@@ -0,0 +1,73 @@
+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;
+}
diff --git a/hadaq/hwsis3801.h b/hadaq/hwsis3801.h
new file mode 100644 (file)
index 0000000..69de85b
--- /dev/null
@@ -0,0 +1,31 @@
+#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
diff --git a/hadaq/writefile b/hadaq/writefile
new file mode 100644 (file)
index 0000000..d009de4
--- /dev/null
@@ -0,0 +1,10 @@
+:
+./daq_evtbuild -p -1 -s 3 -v notice -d file -o data.hld &
+echo $! >evtbuild.pid
+sleep 1;
+./daq_readout -p -2 -v notice &
+echo $! >readout.pid
+sleep 1;
+./daq_ctrlctu -v notice &
+echo $! >ctrlctu.pid
+exit 0