From 3f5304cabee4f851ec341d5b017acfc8ba461403 Mon Sep 17 00:00:00 2001 From: muench Date: Mon, 1 Nov 1999 08:33:00 +0000 Subject: [PATCH] *** empty log message *** --- hadaq/ctrlctu.c | 9 ++- hadaq/evt.h | 2 +- hadaq/hwrace.c | 36 +++++---- hadaq/hwrich.c | 49 ++++++------ hadaq/hwship.c | 196 ++++++++++++++++++++++++++++-------------------- hadaq/hwship.h | 1 + hadaq/hwshow.c | 62 ++++++++------- hadaq/hwtof.c | 37 ++++----- hadaq/hwv488.c | 12 ++- hadaq/param.tcl | 10 +-- 10 files changed, 233 insertions(+), 181 deletions(-) diff --git a/hadaq/ctrlctu.c b/hadaq/ctrlctu.c index f4bb30d..1e3311a 100644 --- a/hadaq/ctrlctu.c +++ b/hadaq/ctrlctu.c @@ -70,14 +70,15 @@ int main(int argc, char *argv[]) } Worker_initEnd(worker); - system("ctuctrl reset"); - system("ctuctrl rate 1"); - system("ctuctrl start"); + sleep(1); + system("/home/hades/bin/ctuctrl reset"); + system("/home/hades/bin/ctuctrl rate 1"); + system("/home/hades/bin/ctuctrl start"); (*ctuEnabled) = 1; if (0 == setjmp(terminateJmp)) { sleep(32767); } - system("ctuctrl stop"); + system("/home/hades/bin/ctuctrl stop"); (*ctuEnabled) = 0; Worker_fini(worker); diff --git a/hadaq/evt.h b/hadaq/evt.h index f644df8..a7fa41f 100644 --- a/hadaq/evt.h +++ b/hadaq/evt.h @@ -13,7 +13,7 @@ static const int evtBlockSize = 8 * 1024; enum EvtId { - EvtId_data, + EvtId_data = 1, EvtId_runStart = 0x00010002, EvtId_runStop = 0x00010003 }; diff --git a/hadaq/hwrace.c b/hadaq/hwrace.c index d030242..6a56ace 100644 --- a/hadaq/hwrace.c +++ b/hadaq/hwrace.c @@ -1,4 +1,4 @@ -static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.1 1999-08-31 10:37:23 muench Exp $"; +static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.2 1999-11-01 08:35:36 muench Exp $"; #define _POSIX_C_SOURCE 199309L #include @@ -46,10 +46,6 @@ static void acquireMode(HwRace *my) Rc_ClrCtrs(my->rc); Rc_writeStatusid(my->rc, 0x55); Rc_setMemfull(my->rc, 0x1f4); - Rc_writeSedec_high(my->rc, 0x0002); - Rc_writeSedec_low(my->rc, 0x0001); - Rc_writeSeid_high(my->rc, 0x0000); - Rc_writeSeid_low(my->rc, 113); Rc_setMsel(my->rc); /* Rc_writeMskreg(my->rc, 0xff); */ Rc_clrMsel(my->rc); @@ -65,6 +61,8 @@ int conHwRace(HwRace *my, const char *name, const Param *param) strcpy(my->name, name); + my->trigNr = 0; + cardBase = Param_getVal(param, my->name, "cardbase"); my->rc = allocMem(sizeof(Rc)); @@ -118,25 +116,25 @@ int HwRace_readSubEvt(HwRace *my, void *subEvt) int firstAddr; int size; - if (my->currAddr == 0) { - size = endOfData(my) - my->currAddr; - if (0 > LBma_read(my->lbma, 0, 0, size)) { - msglog(LOG_DEBUG, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno)); - } + size = Rc_readMem(my->rc, my->currAddr); +#if 1 + if ( 1 || my->currAddr == 0) { + struct timespec tS, *t = &tS; + t->tv_sec = 0; + t->tv_nsec = 020000000; + nanosleep(t, NULL); } - size = *(my->buf + my->currAddr / 4); +#endif + msglog(LOG_DEBUG, "size: %x, currAddr: %x\n", size, my->currAddr); /* copy one sub evt from RC to memory */ - memcpy(data, my->buf + my->currAddr / 4, size); - my->currAddr += size; - data += size / 4; + for (firstAddr = my->currAddr; my->currAddr - firstAddr < size; my->currAddr += 4) { + *data++ = Rc_readMem(my->rc, my->currAddr); + } /* normal extension of trigger tag */ - if (SubEvt_trigNr(subEvt) < (my->trigNr & 0xff)) { - my->trigNr += 0x100; - } - my->trigNr = (my->trigNr & 0xffffff00) | (SubEvt_trigNr(subEvt) & 0x000000ff); - SubEvt_setTrigNr(subEvt, my->trigNr); + SubEvt_setTrigNr(subEvt, my->trigNr << 8 | SubEvt_trigNr(subEvt)); + my->trigNr++; /* align currAddr to next page */ if ((my->currAddr & 0xff) != 0) { diff --git a/hadaq/hwrich.c b/hadaq/hwrich.c index b365301..2a13087 100644 --- a/hadaq/hwrich.c +++ b/hadaq/hwrich.c @@ -1,4 +1,4 @@ -static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.2 1999-09-05 20:23:22 hades Exp $"; +static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.3 1999-11-01 08:35:36 muench Exp $"; #define _POSIX_C_SOURCE 199309L #include @@ -12,19 +12,17 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had #include "subevt.h" #include "hwrace.h" +/* Set number of RCs here */ +#define NRACES 1 + struct HardwareS { size_t maxSubEvtSize; - void *specific; + HwRace *race[NRACES]; + unsigned raceToRead; }; #include "hardware.h" -#define NRACES 2 - -typedef struct ModulesS { - HwRace *race[NRACES]; -} - size_t Hardware_maxSubEvtSize(const Hardware *my) { return my->maxSubEvtSize; @@ -39,7 +37,6 @@ Hardware *newHardware(void) { Hardware *my; Param paramS, *param = ¶mS; - HwRace *race; int i; if (0 > conParam(param, "param.tcl")) { @@ -47,21 +44,19 @@ Hardware *newHardware(void) return NULL; } my = allocMem(sizeof(Hardware)); - my->specific = allocMem(sizeof(Modules)); - my->maxSubEvtSize = SubEvt_hdrSize() + (2564 * sizeof(UInt4)); + my->maxSubEvtSize = SubEvt_hdrSize() + (0x2010 * sizeof(UInt4)); + my->raceToRead = 0; - (HwRace *) my->specific = race; for (i = 0; i < NRACES; i++) { char buf[16]; - race[i] = allocMem(sizeof(HwRace)); + my->race[i] = allocMem(sizeof(HwRace)); sprintf(buf, "race%d", i); - if (0 > conHwRace(race[i], buf, param)) { + if (0 > conHwRace(my->race[i], buf, param)) { msglog(LOG_DEBUG, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno)); return NULL; } - ((Modules *) my->specific)->race[i] = race[i]; } @@ -71,24 +66,21 @@ Hardware *newHardware(void) void deleteHardware(Hardware *my) { - HwRace **race = ((Modules *) my->specific)->race; int i; for (i = 0; i < NRACES; i++) { - desHwRace(race[i]); - freeMem(race[i]); + desHwRace(my->race[i]); + freeMem(my->race[i]); } freeMem(my); } -void Hardware_waitForTrigger(const Hardware *my, void *subEvt) +void Hardware_waitForTrigger(Hardware *my, void *subEvt) { - HwRace **race = ((Modules *) my->specific)->race; - - if (HwRace_isEmpty(race)) { - HwRace_requestBuffer(race); - while (HwRace_isBusy(race)) { + if (HwRace_isEmpty(my->race[my->raceToRead])) { + HwRace_requestBuffer(my->race[my->raceToRead]); + while (HwRace_isBusy(my->race[my->raceToRead])) { #if 1 struct timespec tS, *t = &tS; t->tv_sec = 0; @@ -99,9 +91,10 @@ void Hardware_waitForTrigger(const Hardware *my, void *subEvt) } } -void Hardware_readout(const Hardware *my, void *subEvt) +void Hardware_readout(Hardware *my, void *subEvt) { - HwRace **race = ((Modules *) my->specific)->race; - - HwRace_readSubEvt(race, subEvt); + HwRace_readSubEvt(my->race[my->raceToRead], subEvt); + if (++my->raceToRead == NRACES ) { + my->raceToRead = 0; + } } diff --git a/hadaq/hwship.c b/hadaq/hwship.c index 664708f..979a7e3 100644 --- a/hadaq/hwship.c +++ b/hadaq/hwship.c @@ -1,4 +1,3 @@ - #include #include @@ -11,31 +10,25 @@ #include "ipc_basis.h" #include "hwship.h" -#define SHIP_SUBEVTSIZE (4 * 2 * 386) - -static int bankRequested(HwShip *my) -{ +static int bankRequested(HwShip *my) { UInt2 val; val = LVme_tstBitW(my->lvme, LVL2_STAT_READ, 6); return val; } -static int bankConfirmed(HwShip *my) -{ +static int bankConfirmed(HwShip *my) { UInt2 val; val = LVme_tstBitW(my->lvme, LVL2_STAT_READ, 8); return val; } -static int endOfData(HwShip *my) -{ - return ((LVme_getL(my->lvme, LVL2_OFFSET) & 0x7f) + 1) * SHIP_SUBEVTSIZE + LVL2_OFFSET; +static int endOfData(HwShip *my) { + return (LVme_getL(my->lvme, LVL2_OFFSET) - 2 + LVL2_OFFSET); } -static void standbyMode(HwShip *my) -{ +static void standbyMode(HwShip *my) { LVme_setW(my->lvme, ID_CTR_ACCESS_ON, 0); LVme_setW(my->lvme, ID_CTR_STANDBY_MODE, 0); LVme_setW(my->lvme, ID_CTR_SW_TO_LUT12, 0); @@ -60,8 +53,7 @@ static void standbyMode(HwShip *my) LVme_setW(my->lvme, ADDON_ACCESS_OFF, 0); } -static void acquireMode(HwShip *my) -{ +static void acquireMode(HwShip *my) { LVme_setW(my->lvme, ID_CTR_ACCESS_ON, 0); LVme_setW(my->lvme, ID_CTR_STANDBY_MODE, 0); LVme_setW(my->lvme, ID_CTR_SW_TO_LUT12, 0); @@ -88,82 +80,126 @@ static void acquireMode(HwShip *my) LVme_setW(my->lvme, LVL2_ACCESS_ON, 0); } -int conHwShip(HwShip *my, const char *name, const Param *param) +int conHwShip(HwShip * my, const char *name, const Param *param) { - unsigned long cardBase; - int i; - - assert(my != NULL); - - strcpy(my->name, name); - - cardBase = Param_getVal(param, my->name, "cardbase"); - my->lvme = allocMem(sizeof(LVme)); - if (0 > conLVme(my->lvme, cardBase, 0x400000UL, 0x39UL, 0, 0)) { - msglog(LOG_ERR, "HwShip on %p not found\n", cardBase); - return -1; - } - standbyMode(my); - acquireMode(my); - return 0; -} + unsigned long cardBase; + int i; -void desHwShip(HwShip *my) -{ - standbyMode(my); - desLVme(my->lvme); -} + assert(my != NULL); -void HwShip_requestBuffer(HwShip *my) -{ - int i; + strcpy(my->name, name); - msglog(LOG_DEBUG, "%s:%d:%x\n", __FILE__, __LINE__, LVme_getW(my->lvme, LVL2_STAT_READ)); - while ((LVme_getW(my->lvme, LVL2_STAT_READ) >> 9 & 0x7f) < 2) { - } - msglog(LOG_DEBUG, "%s:%d:%x\n", __FILE__, __LINE__, LVme_getW(my->lvme, LVL2_STAT_READ)); - i = bankRequested(my) == 1 ? 0 : 1; - msglog(LOG_DEBUG, "%s:%d:%x\n", __FILE__, __LINE__, i); - LVme_setW(my->lvme, LVL2_STAT_WRITE, i << 1); + cardBase = Param_getVal(param, my->name, "cardbase"); + my->lvme = allocMem(sizeof(LVme)); + if (0 > conLVme(my->lvme, cardBase, 0x400000UL, 0x39UL, 0, 0)) { + msglog(LOG_ERR, "HwShip on %p not found\n", cardBase); + return -1; + } + my->trigNr = 0; - my->currAddr = 0x18 + LVL2_OFFSET; + standbyMode(my); + acquireMode(my); + return 0; } -int HwShip_isBusy(HwShip *my) +void desHwShip(HwShip * my) { - msglog(LOG_DEBUG, "%s:%d:%x\n", __FILE__, __LINE__, LVme_getW(my->lvme, LVL2_STAT_READ)); - return bankRequested(my) != bankConfirmed(my); + standbyMode(my); + desLVme(my->lvme); } -int HwShip_isEmpty(HwShip *my) -{ - return my->currAddr >= endOfData(my); +void HwShip_requestBuffer(HwShip *my) { + int i; +#if 0 + static UInt1 oldBankConfirmed; + + if (oldBankConfirmed == bankConfirmed(my)) { + msglog(LOG_ERR, "same bank twice: 0x%02x\n", oldBankConfirmed); + } + oldBankConfirmed = bankConfirmed(my); +#endif + + msglog(LOG_DEBUG, "wait for data\n"); + while ((LVme_getW(my->lvme, LVL2_STAT_READ) >> 9 & 0x7f) < 5) { +#if 1 + struct timespec tS, *t = &tS; + t->tv_sec = 0; + t->tv_nsec = 020000000; + nanosleep(t, NULL); +#endif + } + msglog(LOG_DEBUG, "data available\n"); + i = bankRequested(my) == 1 ? 0 : 1; + LVme_setW(my->lvme, LVL2_STAT_WRITE, i << 1); + + my->currAddr = 0x10 + LVL2_OFFSET; } -int HwShip_readSubEvt(HwShip *my, void *subEvt) -{ - UInt4 *data = (UInt4 *) subEvt; - static UInt1 trigTag; - int firstAddr; - int size; - - size = SHIP_SUBEVTSIZE; - - if ((trigTag + 2) != (LVme_getL(my->lvme, my->currAddr) & 0xff)) { - msglog(LOG_ERR, "0x%08x != 0x%08x\n", trigTag + 2, LVme_getL(my->lvme, my->currAddr)); - } - trigTag = LVme_getL(my->lvme, my->currAddr); - - if (LVme_getL(my->lvme, my->currAddr) & 0xff != LVme_getL(my->lvme, my->currAddr + 4 * 388) & 0xff) { - msglog(LOG_ERR, "0x%08x != 0x%08x\n", LVme_getL(my->lvme, my->currAddr), LVme_getL(my->lvme, my->currAddr + 4 * 388)); - } - *data++ = size + 16; - *data++ = 0x00020001; - *data++ = 456; - *data++ = LVme_getL(my->lvme, my->currAddr); - /* copy one sub evt from RC to memory */ - for (firstAddr = my->currAddr; my->currAddr - firstAddr < size; my->currAddr += 4) { - *data++ = LVme_getL(my->lvme, my->currAddr); - } - return 0; +int HwShip_isBusy(HwShip *my) { + return bankRequested(my) != bankConfirmed(my); +} + +int HwShip_isEmpty(HwShip *my) { + return my->currAddr >= endOfData(my); +} + +int HwShip_readSubEvt(HwShip *my, void *subEvt) { + UInt4 *data = (UInt4 *)subEvt; + int firstAddr; + int size; + UInt1 trigTag; + static UInt1 oldTrigTag; + UInt1 checkTrigTag; + + checkTrigTag = LVme_getL(my->lvme, my->currAddr + 0x610); + + size = LVme_getL(my->lvme, my->currAddr); + my->currAddr += 4; + size -= 4; + + trigTag = LVme_getL(my->lvme, my->currAddr) & 0xff; +#if 0 + oldTrigTag += 1; + if (oldTrigTag != trigTag) { + msglog(LOG_ERR, "trigTag sequence: 0x%02x != 0x%02x\n", oldTrigTag, trigTag); + oldTrigTag = trigTag; + } +#endif + my->currAddr += 4; + size -= 4; + +#if 1 + if (checkTrigTag != trigTag) { + msglog(LOG_ERR, "trigTag consistency: 0x%02x != 0x%02x\n", checkTrigTag, trigTag); + } +#endif + my->currAddr += 4; + size -= 4; + + /* BUGBUG workaround missing subEvtHdr in Hardware, set const in Software */ + *data++ = size + 16; + *data++ = 0x00020001; + *data++ = 300 + my->name[4] - '0'; + *data++ = trigTag; + + /* copy one sub evt from RC to memory */ + for (firstAddr = my->currAddr; my->currAddr - firstAddr < size; my->currAddr += 4) { + *data++ = LVme_getL(my->lvme, my->currAddr); + } + + /* BUGBUG if soft & hardware trigNr differ, HW gets precedence */ + trigTag = SubEvt_trigNr(subEvt); +#if 0 + if (trigTag != (my->trigNr & 0xff)) { + msglog(LOG_EMERG,"readSubEvt trigTag differ\n"); + } +#endif + if (trigTag < (my->trigNr & 0xff)) { + my->trigNr += 0x100; + } + my->trigNr = (my->trigNr & 0xffffff00) | trigTag; + SubEvt_setTrigNr(subEvt, my->trigNr << 8 | trigTag); + my->trigNr++; + + return 0; } diff --git a/hadaq/hwship.h b/hadaq/hwship.h index 68a10b0..6405145 100644 --- a/hadaq/hwship.h +++ b/hadaq/hwship.h @@ -9,6 +9,7 @@ typedef struct HwShipS { char name[16]; LVme *lvme; int currAddr; + unsigned trigNr; } HwShip; diff --git a/hadaq/hwshow.c b/hadaq/hwshow.c index 6c9fc7c..935f6dd 100644 --- a/hadaq/hwshow.c +++ b/hadaq/hwshow.c @@ -1,15 +1,24 @@ +static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwshow.c,v 6.2 1999-11-01 08:33:00 muench Exp $"; #define _POSIX_C_SOURCE 199309L #include + +#include +#include +#include #include #include "param.h" #include "subevt.h" #include "hwship.h" +/* Set number of RCs here */ +#define NSHIPS 2 + struct HardwareS { size_t maxSubEvtSize; - void *specific; + HwShip *ship[NSHIPS]; + unsigned shipToRead; }; #include "hardware.h" @@ -28,7 +37,6 @@ Hardware *newHardware(void) { Hardware *my; Param paramS, *param = ¶mS; - HwShip *ship; int i; if (0 > conParam(param, "param.tcl")) { @@ -36,16 +44,20 @@ Hardware *newHardware(void) return NULL; } my = allocMem(sizeof(Hardware)); - my->specific = allocMem(sizeof(ship)); - my->maxSubEvtSize = SubEvt_hdrSize(); + my->maxSubEvtSize = SubEvt_hdrSize() + (0x2010 * sizeof(UInt4)); + my->shipToRead = 0; - ship = allocMem(sizeof(HwShip)); - if (0 > conHwShip(ship, "ship", param)) { - msglog(LOG_DEBUG, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno)); - return NULL; + for (i = 0; i < NSHIPS; i++) { + char buf[16]; + + my->ship[i] = allocMem(sizeof(HwShip)); + sprintf(buf, "ship%d", i); + if (0 > conHwShip(my->ship[i], buf, param)) { + msglog(LOG_DEBUG, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno)); + return NULL; + } } - (HwShip *) my->specific = ship; desParam(param); @@ -54,37 +66,35 @@ Hardware *newHardware(void) void deleteHardware(Hardware *my) { - HwShip *ship = (HwShip *) my->specific; + int i; - desHwShip(ship); - freeMem(ship); + for (i = 0; i < NSHIPS; i++) { + desHwShip(my->ship[i]); + freeMem(my->ship[i]); + } freeMem(my); } -void Hardware_waitForTrigger(const Hardware *my, void *subEvt) +void Hardware_waitForTrigger(Hardware *my, void *subEvt) { - HwShip *ship = (HwShip *) my->specific; - - if (HwShip_isEmpty(ship)) { - msglog(LOG_DEBUG, "switchRequest\n"); - HwShip_requestBuffer(ship); - while (HwShip_isBusy(ship)) { -#if 0 + if (HwShip_isEmpty(my->ship[my->shipToRead])) { + HwShip_requestBuffer(my->ship[my->shipToRead]); + while (HwShip_isBusy(my->ship[my->shipToRead])) { +#if 1 struct timespec tS, *t = &tS; t->tv_sec = 0; t->tv_nsec = 020000000; nanosleep(t, NULL); #endif } - msglog(LOG_DEBUG, "switchComplete\n"); } } -void Hardware_readout(const Hardware *my, void *subEvt) +void Hardware_readout(Hardware *my, void *subEvt) { - HwShip *ship = (HwShip *) my->specific; - - HwShip_readSubEvt(ship, subEvt); - msglog(LOG_DEBUG, "subEvt read\n"); + HwShip_readSubEvt(my->ship[my->shipToRead], subEvt); + if (++my->shipToRead == NSHIPS ) { + my->shipToRead = 0; + } } diff --git a/hadaq/hwtof.c b/hadaq/hwtof.c index 037b19d..5074106 100644 --- a/hadaq/hwtof.c +++ b/hadaq/hwtof.c @@ -1,4 +1,4 @@ -static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtof.c,v 1.6 1999-09-05 11:31:37 hades Exp $"; +static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtof.c,v 1.7 1999-11-01 08:33:00 muench Exp $"; #define _POSIX_C_SOURCE 199309L #include @@ -23,7 +23,7 @@ struct HardwareS { #include "hardware.h" -#define NV775S 2 +#define NV775S 4 #define NV878S 4 typedef struct ModulesS { @@ -59,6 +59,9 @@ Hardware *newHardware(void) HwV878 *v878[NV878S]; int i; +#if 0 + system("cd /home/hades/ht99/slow; ./tof init >/dev/null 2>&1"); +#endif if (0 > conParam(param, "param.tcl")) { msglog(LOG_DEBUG, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno)); return NULL; @@ -156,7 +159,7 @@ void deleteHardware(Hardware *my) freeMem(my); } -void Hardware_waitForTrigger(const Hardware *my, void *subEvt) +void Hardware_waitForTrigger(Hardware *my, void *subEvt) { HwDtu *dtu = ((Modules *) my->specific)->dtu; static int nextId = SubEvtId_trigCode; @@ -177,7 +180,7 @@ void Hardware_waitForTrigger(const Hardware *my, void *subEvt) } HwDtu_read(dtu); msglog(LOG_DEBUG, "Dtu: tag: 0x%02x, code: 0x%02x\n", dtu->trigTag, dtu->trigCode); - switch (dtu->trigCode) { + switch (dtu->trigCode & 0x7) { case 0x02: case 0x03: trigTag = dtu->trigTag; @@ -192,13 +195,6 @@ void Hardware_waitForTrigger(const Hardware *my, void *subEvt) SubEvt_setDecoding(subEvt, SubEvtDecoding_32bitData); SubEvt_setTrigNr(subEvt, trigNr << 8 | trigTag); SubEvt_setId(subEvt, SubEvtId_trigCode); - nextId = SubEvtId_trigInfo; - break; - case SubEvtId_trigInfo: - SubEvt_setSize(subEvt, SubEvt_hdrSize()); - SubEvt_setDecoding(subEvt, SubEvtDecoding_16bitData); - SubEvt_setTrigNr(subEvt, trigNr << 8 | trigTag); - SubEvt_setId(subEvt, SubEvtId_trigInfo); nextId = SubEvtId_tofTest; break; case SubEvtId_tofTest: @@ -206,6 +202,13 @@ void Hardware_waitForTrigger(const Hardware *my, void *subEvt) SubEvt_setDecoding(subEvt, SubEvtDecoding_32bitData); SubEvt_setTrigNr(subEvt, trigNr << 8 | trigTag); SubEvt_setId(subEvt, SubEvtId_tofTest); + nextId = SubEvtId_trigInfo; + break; + case SubEvtId_trigInfo: + SubEvt_setSize(subEvt, SubEvt_hdrSize()); + SubEvt_setDecoding(subEvt, SubEvtDecoding_16bitData); + SubEvt_setTrigNr(subEvt, trigNr << 8 | trigTag); + SubEvt_setId(subEvt, SubEvtId_trigInfo); nextId = SubEvtId_trigCode; trigTag = dtu->trigTag; trigNr++; @@ -224,7 +227,7 @@ static void readoutDummy(void *subEvt) } -void Hardware_readout(const Hardware *my, void *subEvt) +void Hardware_readout(Hardware *my, void *subEvt) { int i; HwDtu *dtu = ((Modules *) my->specific)->dtu; @@ -238,11 +241,6 @@ void Hardware_readout(const Hardware *my, void *subEvt) case SubEvtId_trigCode: readoutDummy(subEvt); break; - case SubEvtId_trigInfo: - HwV488_readData(v556, subEvt); - HwV488_readData(v488, subEvt); - HwSis3801_readData(sis3801, subEvt); - break; case SubEvtId_tofTest: for (i = 0; i < NV775S; i++) { HwV775_readData(v775[i], subEvt); @@ -251,5 +249,10 @@ void Hardware_readout(const Hardware *my, void *subEvt) HwV878_readData(v878[i], subEvt); } break; + case SubEvtId_trigInfo: + HwV488_readData(v556, subEvt); + HwV488_readData(v488, subEvt); + HwSis3801_readData(sis3801, subEvt); + break; } } diff --git a/hadaq/hwv488.c b/hadaq/hwv488.c index 09c1588..55db627 100644 --- a/hadaq/hwv488.c +++ b/hadaq/hwv488.c @@ -1,4 +1,4 @@ -static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv488.c,v 1.2 1999-09-05 11:31:55 hades Exp $"; +static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwv488.c,v 1.3 1999-11-01 08:33:00 muench Exp $"; #define _POSIX_C_SOURCE 199309L #include @@ -16,6 +16,8 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had #include "param.h" #include "hwv488.h" +#define V556_BROKEN + int conHwV488(HwV488 * my, const char *name, const Param *param) { unsigned long cardBase; @@ -61,7 +63,15 @@ int HwV488_readData(HwV488 * my, void *subEvt) UInt1 trigTag; msglog(LOG_DEBUG, "V488 Readout\n"); +#ifdef V556_BROKEN + if (LVme_getW(my->lvme, V488_SERIAL) != 0x2005) { + *data++ = 0x1007; + } else { + *data++ = LVme_getW(my->lvme, V488_SERIAL); + } +#else *data++ = LVme_getW(my->lvme, V488_SERIAL); +#endif if (!HwV488_isEmpty(my)) { *data++ = hdr = LVme_getW(my->lvme, V488_OUT_BUF); if ((hdr & 0x8000) != 0x8000) { diff --git a/hadaq/param.tcl b/hadaq/param.tcl index 1a44afc..02a1acb 100644 --- a/hadaq/param.tcl +++ b/hadaq/param.tcl @@ -2,7 +2,7 @@ set soft(size) 1024 set dtu(cardbase) 0x44500000 -set tdc0(cardbase) 0x22020000 +set tdc0(cardbase) 0x22000000 set tdc0(threshold00) 0 set tdc0(threshold01) 0 set tdc0(threshold02) 0 @@ -39,7 +39,7 @@ set tdc0(range) 254 set tdc0(vset) 255 set tdc0(voff) 0 -set tdc1(cardbase) 0x22040000 +set tdc1(cardbase) 0x22020000 set tdc1(threshold00) 0 set tdc1(threshold01) 0 set tdc1(threshold02) 0 @@ -76,7 +76,7 @@ set tdc1(range) 254 set tdc1(vset) 255 set tdc1(voff) 0 -set tdc2(cardbase) 3993239552 ;# 0xee000000 +set tdc2(cardbase) 0x22040000 set tdc2(threshold00) 0 set tdc2(threshold01) 0 set tdc2(threshold02) 0 @@ -113,7 +113,7 @@ set tdc2(range) 255 set tdc2(vset) 254 set tdc2(voff) 0 -set tdc3(cardbase) 3993370624 ;# 0xee000000 +set tdc3(cardbase) 0x22060000 set tdc3(threshold00) 0 set tdc3(threshold01) 0 set tdc3(threshold02) 0 @@ -306,7 +306,7 @@ set tdc8(cardbase) 0x200000 set tdc8(ctrl) 0x00ff set tdc8(thrl) 1 set tdc8(thrh) 198 -set tdc8(range) 192 ;# 0 = 90ns, 224 = 770ns +set tdc8(range) 144 ;# 0 = 90ns, 224 = 770ns set adc0(cardbase) 0x000000 set adc0(ctrl) 0x00ff -- 2.43.0