+++ /dev/null
-/**** Headerfile for DTU registers */
-/**** E.Lins 16.6.99 */
-
-/* define certain detector system: _RICH, _MDC, _TOF, _SHOWER */
-
-#define _SHOWER
-
-
-
-/**** common DTU registers */
-
-#define STATUS1 0x00
-#define DEAD1 0x04
-#define CODE1 0x08
-#define TAG1 0x0c
-#define STATUS2 0x10
-#define DEAD2 0x14
-#define CODE2 0x18
-#define TAG2 0x1c
-#define FIFO1 0x20
-#define FIFO2 0x24
-#define RELEASE1 0x28
-#define RELEASE2 0x2c
-#define TESTMODE1 0x34
-#define TESTMODE2 0x38
-#define MAGIC 0x3c
-#define RICH_KILL 0x40
-
-
-
-/**** SHOWER registers*/
-
-#ifdef _SHOWER
-
-#define RB_DATA 0x40
-#define RB_COM 0x44
-#define RB_ACK 0x48
-#define LVL1_COM 0x4c
-#define IPC_DATA 0x50
-#define IPC_DATA_BCAST 0x54
-#define IPC_ADDR 0x58
-#define IPC_ADDR_BCAST 0x5c
-
-#endif
-
-/**** RICH registers */
-
-#ifdef _RICH
-#endif
-
-/**** MDC registers */
-
-#ifdef _MDC
-#endif
-
-/**** TOF registers */
-
-#ifdef _TOF
-#endif
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwdtu.c,v 1.8 2001-11-18 11:56:21 hadaq Exp $";
-
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <syslog.h>
-
-#include <lvme.h>
-
-
-#include "subevt.h"
-#include <allParam.h>
-#include "hwdtu.h"
-
-int conHwDtu(HwDtu *my, const char *name, const Param *param)
-{
- unsigned long cardBase;
- int paramWasFound;
- int i;
-
- assert(my != NULL);
-
- strcpy(my->name, name);
- my->trigNr = 0;
-
- Param_getInt(param, my->name, "cardbase", ¶mWasFound, &cardBase);
- if (!paramWasFound) {
- syslog(LOG_WARNING,
- "Parameter %s(%s) not found, default = 0", my->name, "cardbase");
- cardBase = 0;
- }
-
- my->lvme = malloc(sizeof(LVme));
-
- if (0 > conLVme(my->lvme, cardBase, 0x10000, 0x09, DTU_MAGIC, 1)) {
- syslog(LOG_DEBUG, "%s:%d:%s", __FILE__, __LINE__, strerror(errno));
- return -1;
- }
- return 0;
-}
-
-void desHwDtu(HwDtu *my)
-{
- desLVme(my->lvme);
- free(my->lvme);
-}
-
-int HwDtu_isEmpty(HwDtu *my)
-{
- return LVme_tstBitL(my->lvme, DTU_FIFO_2, 0);
-}
-
-int HwDtu_read(HwDtu *my)
-{
- my->trigTag = LVme_getL(my->lvme, DTU_TRIG_TAG);
- my->trigCode = LVme_getL(my->lvme, DTU_TRIG_CODE) & 0x0f;
- LVme_setL(my->lvme, DTU_FIFO_1, 0);
- LVme_setL(my->lvme, DTU_FIFO_2, 0);
- return 0;
-}
+++ /dev/null
-#ifndef HwDTU_H
-#define HwDTU_H
-
-#include <lvme.h>
-#include "rc.h"
-
-#include <allParam.h>
-
-typedef struct HwDtuS {
- char name[16];
- LVme *lvme;
- unsigned long trigNr;
- uint8_t trigTag;
- uint8_t 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);
-
-#endif
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwsis3801.c,v 1.5 2001-11-18 11:56:21 hadaq Exp $";
-
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <syslog.h>
-
-#include <stdint.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_getInt(param, my->name, "cardbase");
- my->lvme = malloc(sizeof(LVme));
-
- if (0 > conLVme(my->lvme, cardBase, 0x10000, 0x09, SIS3801_MODID, 4)) {
- syslog(LOG_DEBUG, "%s:%d:%s", __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);
- free(my->lvme);
-}
-
-int HwSis3801_isEmpty(HwSis3801 *my)
-{
- return LVme_tstBitL(my->lvme, SIS3801_CTRL_REG, 8);
-}
-
-int HwSis3801_readData(HwSis3801 *my, void *subEvt)
-{
- uint16_t *data = SubEvt_end(subEvt);
- uint32_t dummy;
- int nWords;
-
- syslog(LOG_DEBUG, "Sis3801 Readout");
- 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
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtbus.c,v 1.8 2001-11-18 11:56:21 hadaq Exp $";
-
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <allParam.h>
-#include "subevt.h"
-#include "hwdtu.h"
-
-#define NSUBEVTS 1
-
-struct HardwareS {
- size_t maxSubEvtSize;
- HwDtu *dtu;
-};
-
-#include "hardware.h"
-
-size_t Hardware_maxSubEvtSize(const Hardware *my)
-{
- return my->maxSubEvtSize;
-}
-
-
-Hardware *newHardware(void)
-{
- Hardware *my;
- Param paramS, *param = ¶mS;
- HwDtu *dtu;
-
- if (0 > conParam(param)) {
- syslog(LOG_DEBUG, "%s:%d:%s", __FILE__, __LINE__, strerror(errno));
- return NULL;
- }
- my = malloc(sizeof(Hardware));
-
- my->maxSubEvtSize = SubEvt_hdrSize() + 2000 * sizeof(uint32_t);
-
- my->dtu = malloc(sizeof(HwDtu));
- if (0 > conHwDtu(my->dtu, "dtu", param)) {
- syslog(LOG_DEBUG, "%s:%d:%s", __FILE__, __LINE__, strerror(errno));
- return NULL;
- }
-
- desParam(param);
- return my;
-}
-
-void deleteHardware(Hardware *my)
-{
- desHwDtu(my->dtu);
- free(my->dtu);
-
- free(my);
-}
-
-void Hardware_waitForTrigger(Hardware *my, void *subEvt)
-{
- static int nextId = SubEvtId_trigCode;
- static int doReadOut;
- static uint8_t trigTag = 0;
- static unsigned long trigNr = 0;
-
- switch (nextId) {
- case SubEvtId_trigCode:
- do {
- while (HwDtu_isEmpty(my->dtu)) {
-#if 1
- struct timespec tS, *t = &tS;
- t->tv_sec = 0;
- t->tv_nsec = 020000000;
- nanosleep(t, NULL);
-#endif
- }
- HwDtu_read(my->dtu);
- syslog(LOG_DEBUG, "Dtu: tag: 0x%02x, code: 0x%02x", my->dtu->trigTag, my->dtu->trigCode);
- switch (my->dtu->trigCode & 0x7) {
- case 0x02:
- case 0x03:
- trigTag = my->dtu->trigTag;
- doReadOut = 0;
- break;
- default:
- doReadOut = 1;
- break;
- }
- } while (!doReadOut);
- SubEvt_setSize(subEvt, SubEvt_hdrSize());
- SubEvt_setDecoding(subEvt, SubEvtDecoding_32bitData);
- SubEvt_setTrigNr(subEvt, trigNr << 8 | trigTag);
- SubEvt_setId(subEvt, SubEvtId_trigCode);
- nextId = SubEvtId_trigCode;
- trigTag = my->dtu->trigTag;
- trigNr++;
- break;
- }
-}
-
-void Hardware_readout(Hardware *my, void *subEvt)
-{
- uint32_t *data = SubEvt_data(subEvt);
- uint32_t *first = data;
- size_t size;
-
- switch (SubEvt_pureId(subEvt)) {
- case SubEvtId_trigCode:
- *data++ = my->dtu->trigCode;
-
- if (RAND_MAX / rand() > 2) {
- data += (int) ((500.0 * rand()) / RAND_MAX);
- data += (int) ((500.0 * rand()) / RAND_MAX);
- data += (int) ((500.0 * rand()) / RAND_MAX);
- data += (int) ((500.0 * rand()) / RAND_MAX);
- }
- break;
- }
- size = SubEvt_size(subEvt) + sizeof(uint32_t) * (data - first);
- if (size > my->maxSubEvtSize) {
- SubEvt_setId(subEvt, SubEvt_id(subEvt) | 0x80000000);
- size = my->maxSubEvtSize;
- }
- SubEvt_setSize(subEvt, size);
-}
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtof.c,v 1.20 2001-11-18 11:56:21 hadaq Exp $";
-
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <allParam.h>
-#include "subevt.h"
-#include "hwtip.h"
-
-/* Set number of RCs here */
-#define NCRATES 2
-#define NTIPS 1
-
-struct HardwareS {
- size_t maxSubEvtSize;
- HwTip *tip[NTIPS];
- unsigned tipToRead;
-};
-
-#include "hardware.h"
-
-size_t Hardware_maxSubEvtSize(const Hardware *my)
-{
- return my->maxSubEvtSize;
-}
-
-int Hardware_inSpill(const Hardware *my)
-{
- return 0;
-}
-
-Hardware *newHardware(void)
-{
- Hardware *my;
- Param paramS, *param = ¶mS;
- int i;
-
- if (0 > conParam(param)) {
- syslog(LOG_ERR, "%s:%d:%s", __FILE__, __LINE__, strerror(errno));
- return NULL;
- }
- my = malloc(sizeof(Hardware));
-
- my->maxSubEvtSize = SubEvt_hdrSize() + (NCRATES * 620 * sizeof(uint32_t));
- my->tipToRead = 0;
-
- for (i = 0; i < NTIPS; i++) {
- char buf[16];
-
- my->tip[i] = malloc(sizeof(HwTip));
- sprintf(buf, "tip%d", i);
- if (0 > conHwTip(my->tip[i], buf, param)) {
- syslog(LOG_ERR, "%s:%d:%s", __FILE__, __LINE__, strerror(errno));
- return NULL;
- }
- }
-
-
- desParam(param);
- return my;
-}
-
-void deleteHardware(Hardware *my)
-{
- int i;
-
- for (i = 0; i < NTIPS; i++) {
- desHwTip(my->tip[i]);
- free(my->tip[i]);
- }
-
- free(my);
-}
-
-void Hardware_waitForTrigger(Hardware *my, void *subEvt)
-{
- if (HwTip_isEmpty(my->tip[my->tipToRead])) {
- HwTip_requestBuffer(my->tip[my->tipToRead]);
- while (HwTip_isBusy(my->tip[my->tipToRead])) {
-#if 1
- struct timespec tS, *t = &tS;
- t->tv_sec = 0;
- t->tv_nsec = 020000000;
- nanosleep(t, NULL);
-#endif
- }
- }
-}
-
-void Hardware_readout(Hardware *my, void *partEvt)
-{
- static uint32_t trigNr = 0;
- uint8_t trigTag;
- void *subEvt = SubEvt_data(partEvt);
- int i;
-
- SubEvt_setDecoding(partEvt, SubEvtDecoding_SubEvts);
-
- for (i = 0; i < NCRATES; i++) {
- HwTip_readSubEvt(my->tip[my->tipToRead], subEvt);
- if (i == 0) {
- trigTag = SubEvt_trigNr(subEvt);
- }
- subEvt = SubEvt_next(partEvt, subEvt);
- }
-
- SubEvt_setSize(partEvt, (char *)subEvt - (char *)partEvt);
- SubEvt_setTrigNr(partEvt, (trigNr << 8) | trigTag);
- SubEvt_setId(partEvt, 0);
- trigNr++;
-#ifndef NDEBUG
- syslog(LOG_DEBUG, "partEvt: %s", SubEvt_2charP(partEvt));
-#endif
-}
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv488.c,v 1.8 2001-11-18 11:56:21 hadaq Exp $";
-
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <syslog.h>
-
-#include <stdint.h>
-
-#include <lvme.h>
-
-
-#include "subevt.h"
-#include "param.h"
-#include "hwv488.h"
-
-int conHwV488(HwV488 * my, const char *name, const Param *param)
-{
- unsigned long cardBase;
- int i;
-
- assert(my != NULL);
-
- strcpy(my->name, name);
- my->trigNr = 0;
-
- cardBase = Param_getInt(param, my->name, "cardbase");
- my->lvme = malloc(sizeof(LVme));
-
- if (0 > conLVme(my->lvme, cardBase, 0x10000, 0x39, V488_TYPE, 2)) {
- syslog(LOG_DEBUG, "%s:%d:%s", __FILE__, __LINE__, strerror(errno));
- return -1;
- }
- LVme_setW(my->lvme, V488_RESET, 0);
- LVme_setW(my->lvme, V488_FF_REG, 0);
- LVme_setW(my->lvme, V488_CTRL_REG, Param_getInt(param, my->name, "ctrl"));
- LVme_setW(my->lvme, V488_THRL, Param_getInt(param, my->name, "thrl"));
- LVme_setW(my->lvme, V488_THRH, Param_getInt(param, my->name, "thrh"));
- LVme_setW(my->lvme, V488_RANGE, Param_getInt(param, my->name, "range"));
- my->id = Param_getInt(param, my->name, "id");
-
- return 0;
-}
-
-void desHwV488(HwV488 * my)
-{
- desLVme(my->lvme);
- free(my->lvme);
-}
-
-int HwV488_isEmpty(HwV488 *my) {
- return !LVme_tstBitW(my->lvme, V488_CTRL_REG, 14);
-}
-
-int HwV488_readData(HwV488 * my, void *subEvt)
-{
- uint16_t *data = SubEvt_end(subEvt);
- uint16_t hdr;
- int nWords;
- uint8_t trigTag;
-
- syslog(LOG_DEBUG, "V488 Readout");
- *data++ = my->id;
- if (!HwV488_isEmpty(my)) {
- *data++ = hdr = LVme_getW(my->lvme, V488_OUT_BUF);
- if ((hdr & 0x8000) != 0x8000) {
- syslog(LOG_EMERG, "V488 First word not header: 0x%04x", hdr);
- } else {
- syslog(LOG_DEBUG, "V488 First word is header: 0x%04x", hdr);
- }
-
-#if 0
- trigTag = hdr & 0xff;
- if (trigTag != (SubEvt_trigNr(subEvt) & 0xff)) {
- syslog(LOG_EMERG, "%s trigNr mismatch: 0x%08x != 0x%02x ",
- my->name, SubEvt_trigNr(subEvt), trigTag);
- }
-#endif
-
- nWords = (hdr >> 12 & 0x07) + 1;
- while (--nWords >= 0) {
- *data++ = LVme_getW(my->lvme, V488_OUT_BUF);
- }
- }
- SubEvt_setSize(subEvt, (char *) data - (char *) subEvt);
- return 0;
-}
+++ /dev/null
-#ifndef HwV488_H
-#define HwV488_H
-
-#include <lvme.h>
-#include "rc.h"
-
-#include "param.h"
-
-typedef struct HwV488S {
- char name[16];
- uint16_t id;
- LVme *lvme;
- unsigned long trigNr;
-} HwV488;
-
-#define V488_OUT_BUF 0x18
-#define V488_CTRL_REG 0x1a
-#define V488_RANGE 0x14
-#define V488_THRH 0x12
-#define V488_THRL 0x10
-#define V488_RESET 0x1c
-#define V488_TYPE 0xfc
-#define V488_HF_REG 0x1e
-#define V488_FF_REG 0x16
-
-int conHwV488(HwV488 *my, const char *name, const Param *param);
-void desHwV488(HwV488 *my);
-
-int HwV488_isEmpty(HwV488 *my);
-int HwV488_readData(HwV488 *my, void *subEvt);
-
-#endif
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv775.c,v 1.13 2001-11-18 11:56:21 hadaq Exp $";
-
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <syslog.h>
-
-#include <stdint.h>
-
-#include <lvme.h>
-
-
-#include "subevt.h"
-#include "param.h"
-#include "hwv775.h"
-
-int conHwV775(HwV775 *my, const char *name, const Param *param)
-{
- unsigned long cardBase;
- int i;
-
- assert(my != NULL);
-
- strcpy(my->name, name);
-
- cardBase = Param_getInt(param, my->name, "cardbase");
- my->lvme = malloc(sizeof(LVme));
-
- if (0 > conLVme(my->lvme, cardBase, 0x10000, 0x09, V775_GEO_ADDR, 2)) {
- syslog(LOG_DEBUG, "%s:%d:%s", __FILE__, __LINE__, strerror(errno));
- return -1;
- }
- LVme_setW(my->lvme, V775_RESET, 0);
- /* clear data, don't change next 2 lines */
- LVme_setW(my->lvme, V775_BIT_CLR_2, 0xffff);
- LVme_setW(my->lvme, V775_BIT_SET_2, 0x0004);
- LVme_setW(my->lvme, V775_BIT_CLR_2, 0x0004);
- LVme_setW(my->lvme, V775_BIT_SET_2, 0x0020);
- LVme_setW(my->lvme, V775_CTRL_REG_2, 0x0003);
- LVme_setW(my->lvme, V775_CRATE_REG, 0x0000);
- LVme_setW(my->lvme, V775_RANGE_SET, Param_getInt(param, my->name, "range"));
- LVme_setW(my->lvme, V775_VSET, Param_getInt(param, my->name, "vset"));
- LVme_setW(my->lvme, V775_VOFF, Param_getInt(param, my->name, "voff"));
- for (i = 0; i < V775_NCHANNELS; i++) {
- char buf[16];
-
- sprintf(buf, "threshold%02d", i);
- LVme_setW(my->lvme,
- V775_THRESH + 2 * i, Param_getInt(param, my->name, buf));
- }
- return 0;
-}
-
-void desHwV775(HwV775 *my)
-{
- desLVme(my->lvme);
- free(my->lvme);
-}
-
-int HwV775_isEmpty(HwV775 *my)
-{
- return LVme_tstBitW(my->lvme, V775_STAT_REG_1, 0) == 0;
-}
-
-int HwV775_readData(HwV775 *my, void *subEvt)
-{
- uint32_t *data = SubEvt_end(subEvt);
- uint32_t hdr;
- uint32_t eob;
- int nWords;
- uint8_t trigTag;
-
- syslog(LOG_DEBUG, "V775 Readout");
- *data++ = hdr = LVme_getL(my->lvme, V775_OUT_BUF);
- if ((hdr & 0x07000000) != 0x02000000) {
- syslog(LOG_EMERG, "V775 First word not header: 0x%08x", hdr);
- } else {
- syslog(LOG_DEBUG, "V775 First word is header: 0x%08x", hdr);
- }
-
- nWords = hdr >> 8 & 0xff;
- while (--nWords >= 0) {
- *data++ = LVme_getL(my->lvme, V775_OUT_BUF);
- }
-
- *data++ = eob = LVme_getL(my->lvme, V775_OUT_BUF);
- if ((eob & 0x07000000) != 0x04000000) {
- syslog(LOG_EMERG, "V775 Last word not eob: 0x%08x", eob);
- } else {
- syslog(LOG_DEBUG, "V775 Last word is eob: 0x%08x", eob);
- }
-
- trigTag = eob & 0xff;
- if (trigTag != (SubEvt_trigNr(subEvt) & 0xff)) {
- SubEvt_setId(subEvt, SubEvt_id(subEvt) | 0x80000000);
- syslog(LOG_EMERG, "%s trigNr mismatch: 0x%08x != 0x%02x ",
- my->name, SubEvt_trigNr(subEvt), trigTag);
- }
- SubEvt_setSize(subEvt, (char *) data - (char *) subEvt);
- return 0;
-}
+++ /dev/null
-#ifndef HwV775_H
-#define HwV775_H
-
-#include <lvme.h>
-#include "rc.h"
-
-#include "param.h"
-
-#define V775_NCHANNELS 32
-
-typedef struct HwV775S {
- char name[16];
- LVme *lvme;
-} HwV775;
-
-#define V775_OUT_BUF 0x00
-#define V775_GEO_ADDR 0x04
-#define V775_BIT_SET_1 0x06
-#define V775_BIT_CLR_1 0x08
-#define V775_STAT_REG_1 0x0e
-#define V775_CTRL_REG_1 0x10
-#define V775_RESET 0x18
-#define V775_CTRL_REG_2 0x20
-#define V775_STAT_REG_2 0x22
-#define V775_RANGE_SET 0x2e
-#define V775_BIT_SET_2 0x32
-#define V775_BIT_CLR_2 0x34
-#define V775_CRATE_REG 0x3c
-#define V775_VSET 0x60
-#define V775_VOFF 0x62
-#define V775_THRESH 0x80
-
-
-int conHwV775(HwV775 *my, const char *name, const Param *param);
-void desHwV775(HwV775 *my);
-
-int HwV775_isEmpty(HwV775 *my);
-int HwV775_readSubEvt(HwV775 *my, void *subEvt);
-
-#endif
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv878.c,v 1.11 2001-11-18 11:56:21 hadaq Exp $";
-
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <syslog.h>
-
-#include <stdint.h>
-
-#include <lvme.h>
-
-
-#include "subevt.h"
-#include "param.h"
-#include "hwv878.h"
-
-int conHwV878(HwV878 *my, const char *name, const Param *param)
-{
- unsigned long cardBase;
- int i;
-
- assert(my != NULL);
-
- strcpy(my->name, name);
-
- cardBase = Param_getInt(param, my->name, "cardbase");
- my->lvme = malloc(sizeof(LVme));
-
- if (0 > conLVme(my->lvme, cardBase, 0x10000, 0x09, V878_GEO_ADDR, 2)) {
- syslog(LOG_DEBUG, "%s:%d:%s", __FILE__, __LINE__, strerror(errno));
- return -1;
- }
- /* reset, don't change next 2 lines */
- LVme_setW(my->lvme, V878_BIT_SET_1, 0x0080);
- LVme_setW(my->lvme, V878_BIT_CLR_1, 0x0080);
- /* clear data, don't change next 2 lines */
- LVme_setW(my->lvme, V878_BIT_CLR_2, 0xffff);
- LVme_setW(my->lvme, V878_BIT_SET_2, 0x0004);
- LVme_setW(my->lvme, V878_BIT_CLR_2, 0x0004);
- LVme_setW(my->lvme, V878_BIT_SET_2, 0xf800);
- LVme_setW(my->lvme, V878_CRATE_REG, 0x0000);
- LVme_setW(my->lvme, V878_SLIDE, 0);
- LVme_setW(my->lvme, V878_FCLR_WIN, Param_getInt(param, my->name, "fclr_win"));
- LVme_setW(my->lvme, V878_VSET, Param_getInt(param, my->name, "vset"));
- LVme_setW(my->lvme, V878_VOFF, Param_getInt(param, my->name, "voff"));
- LVme_setW(my->lvme, V878_CLR_TIME, Param_getInt(param, my->name, "clr_time"));
- for (i = 0; i < V878_NCHANNELS; i++) {
- char buf[16];
-
- sprintf(buf, "threshold%02d", i);
- LVme_setW(my->lvme,
- V878_THRESH + 2 * i, Param_getInt(param, my->name, buf));
- }
- return 0;
-}
-
-void desHwV878(HwV878 *my)
-{
- desLVme(my->lvme);
- free(my->lvme);
-}
-
-int HwV878_isEmpty(HwV878 *my)
-{
- return LVme_tstBitW(my->lvme, V878_STAT_REG_1, 0) == 0;
-}
-
-int HwV878_readData(HwV878 *my, void *subEvt)
-{
- uint32_t *data = SubEvt_end(subEvt);
- uint32_t hdr;
- uint32_t eob;
- int nWords;
- uint8_t trigTag;
-
- syslog(LOG_DEBUG, "V878 Readout");
- *data++ = hdr = LVme_getL(my->lvme, V878_OUT_BUF);
- if ((hdr & 0x07000000) != 0x02000000) {
- syslog(LOG_EMERG, "V878 First word not header: 0x%08x", hdr);
- } else {
- syslog(LOG_DEBUG, "V878 First word is header: 0x%08x", hdr);
- }
-
- nWords = hdr >> 8 & 0xff;
- while (--nWords >= 0) {
- *data++ = LVme_getL(my->lvme, V878_OUT_BUF);
- }
-
- *data++ = eob = LVme_getL(my->lvme, V878_OUT_BUF);
- if ((eob & 0x07000000) != 0x04000000) {
- syslog(LOG_EMERG, "V878 Last word not eob: 0x%08x", eob);
- } else {
- syslog(LOG_DEBUG, "V878 Last word is eob: 0x%08x", eob);
- }
-
- trigTag = eob & 0xff;
- if (trigTag != (SubEvt_trigNr(subEvt) & 0xff)) {
- SubEvt_setId(subEvt, SubEvt_id(subEvt) | 0x80000000);
- syslog(LOG_EMERG, "%s trigNr mismatch: 0x%08x != 0x%02x ",
- my->name, SubEvt_trigNr(subEvt), trigTag);
- }
- SubEvt_setSize(subEvt, (char *) data - (char *) subEvt);
- return 0;
-}
+++ /dev/null
-#ifndef HwV878_H
-#define HwV878_H
-
-#include <lvme.h>
-#include "rc.h"
-
-#include "param.h"
-
-#define V878_NCHANNELS 32
-
-typedef struct HwV878S {
- char name[16];
- LVme *lvme;
-} HwV878;
-
-#define V878_OUT_BUF 0x0000
-#define V878_GEO_ADDR 0x1002
-#define V878_BIT_SET_1 0x1006
-#define V878_BIT_CLR_1 0x1008
-#define V878_STAT_REG_1 0x100e
-#define V878_CTRL_REG_1 0x1010
-#define V878_STAT_REG_2 0x1022
-#define V878_FCLR_WIN 0x102E
-#define V878_BIT_SET_2 0x1032
-#define V878_BIT_CLR_2 0x1034
-#define V878_CRATE_REG 0x103c
-#define V878_VSET 0x1060
-#define V878_VOFF 0x1062
-#define V878_CLR_TIME 0x1066
-#define V878_SLIDE 0x106a
-#define V878_THRESH 0x1080
-
-
-int conHwV878(HwV878 *my, const char *name, const Param *param);
-void desHwV878(HwV878 *my);
-
-int HwV878_isEmpty(HwV878 *my);
-int HwV878_readSubEvt(HwV878 *my, void *subEvt);
-
-#endif