From: hades Date: Sun, 5 Sep 1999 11:08:34 +0000 (+0000) Subject: Initial revision X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=a378166ef478eac6119784225a2e8ad11e12f393;p=daqdata.git Initial revision --- diff --git a/hadaq/hwsis3801.c b/hadaq/hwsis3801.c new file mode 100644 index 0000000..e8e1a37 --- /dev/null +++ b/hadaq/hwsis3801.c @@ -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 + +#include +#include +#include +#include + +#include +#include + + +#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 index 0000000..69de85b --- /dev/null +++ b/hadaq/hwsis3801.h @@ -0,0 +1,31 @@ +#ifndef HWSIS3801_H +#define HWSIS3801_H + +#include +#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 index 0000000..d009de4 --- /dev/null +++ b/hadaq/writefile @@ -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