From 0a739e128b6df392754563d5f71cb6babe283001 Mon Sep 17 00:00:00 2001 From: hadaq Date: Thu, 24 Oct 2002 16:45:39 +0000 Subject: [PATCH] MDC readout for sam3 in oct02, tested, working -- mm --- hadaq/hwmdc.c | 106 +++++++------- hadaq/hwsam.c | 209 ++++++++++++++------------ hadaq/hwsam.h | 32 +++- hadaq/indent.pro | 1 + hadaq/param.tcl | 372 +++++------------------------------------------ hadaq/sam_defs.h | 4 +- hadaq/startacq | 7 - hadaq/stopacq | 7 - 8 files changed, 238 insertions(+), 500 deletions(-) diff --git a/hadaq/hwmdc.c b/hadaq/hwmdc.c index 2e6ecbe..d29731f 100644 --- a/hadaq/hwmdc.c +++ b/hadaq/hwmdc.c @@ -1,4 +1,5 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwmdc.c,v 6.20 2002-10-09 12:42:17 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwmdc.c,v 6.21 2002-10-24 16:45:39 hadaq Exp $"; + #define _POSIX_C_SOURCE 199309L #include @@ -8,16 +9,14 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada #include #include #include -#include +#include #include #include #include "subevt.h" #include "hwsam.h" -#define NSAMS 12 - -#define SAMMASK ((1 << NSAMS) - 1) +#define NSAMS 18 struct HardwareS { size_t maxSubEvtSize; @@ -51,7 +50,7 @@ Hardware *newHardware(void) my->maxSubEvtSize = SubEvt_hdrSize() + (NSAMS * 2564 * sizeof(uint32_t)); for (i = 0; i < NSAMS; i++) { - char buf[16]; + char buf[12]; my->sam[i] = malloc(sizeof(HwSam)); sprintf(buf, "sam%d", i); @@ -78,69 +77,72 @@ void deleteHardware(Hardware *my) free(my); } +#define N_POLL_MAX 60/NSAMS void Hardware_waitForTrigger(Hardware *my, void *partEvt) { int i; - unsigned long anySamIsBusy; - - for (i = 0; i < NSAMS; i++) { - if (HwSam_isEmpty(my->sam[i])) { - HwSam_requestBuffer(my->sam[i]); - } - } - - /* make shure that all SAMS can deliver at least one sub event */ - anySamIsBusy = SAMMASK; - do { - for (i = 0; i < NSAMS; i++) { - if ((anySamIsBusy & (1 << i)) && !HwSam_isBusy(my->sam[i])) { - anySamIsBusy &= ~(1 << i); - } else { -#if 0 - struct timespec tS, *t = &tS; - t->tv_sec = 0; - t->tv_nsec = 020000000; - nanosleep(t, NULL); -#endif - } - } - } while (anySamIsBusy); -} - -void Hardware_readout(Hardware *my, void *partEvt) -{ - int i; + int nPoll = 0; + int nRequests; + int firstSam=-1; void *subEvt = SubEvt_data(partEvt); static uint32_t trigNr = 0; uint32_t trigTag; - /* init partial event, necessary for SubEvt_next() */ + for (i = 0; i < NSAMS; i++) { + HwSam_requestBuffer(my->sam[i]); + } + + /* init partial event, necessary for SubEvt_next() */ SubEvt_setDecoding(partEvt, SubEvtDecoding_SubEvts); SubEvt_setId(partEvt, 0); - /* read all sams, check for common trigger tag */ - for (i = 0; i < NSAMS; i++) { - - HwSam_readSubEvt(my->sam[i], subEvt); - if (i == 0) { - trigTag = SubEvt_trigNr(subEvt) & 0xff; - } else { - if (trigTag != (SubEvt_trigNr(subEvt) & 0xff)) { - SubEvt_setId(subEvt, SubEvt_id(subEvt) | 0x80000000UL); - SubEvt_setId(partEvt, SubEvt_id(partEvt) | 0x80000000UL); - syslog(LOG_ERR, "(%s)Trigger tag mismatch: 0x%08x != 0x%08x", - my->sam[i]->name,trigTag, SubEvt_trigNr(subEvt)); + /* make shure that all SAMS have delivered one sub event */ + /* check for common trigger tag */ + nRequests = NSAMS; + do { + for (i = 0; i < NSAMS; i++) { + if (HwSam_isBufRequested(my->sam[i])) { + if(!HwSam_isBusy(my->sam[i])) { + --nRequests; + if(HwSam_readSubEvt(my->sam[i], subEvt)==0) { + if (firstSam<0) { + trigTag = SubEvt_trigNr(subEvt) & 0xff; + firstSam=i; + } else { + if (trigTag != (SubEvt_trigNr(subEvt) & 0xff)) { + SubEvt_setId(subEvt, SubEvt_id(subEvt) | 0x80000000UL); + SubEvt_setId(partEvt, SubEvt_id(partEvt) | 0x80000000UL); + syslog(LOG_ERR, "(%s)Trigger tag mismatch: 0x%08x (%d) != 0x%08x", + my->sam[i]->name,trigTag,firstSam,SubEvt_trigNr(subEvt)); + } + } + subEvt=(void*)(((uint32_t)subEvt + *(uint32_t*)subEvt + 4) & 0xfffffff8); + } } + } } - subEvt = SubEvt_next(partEvt, subEvt); - } +#if 1 + if (nPoll >= N_POLL_MAX && firstSam < 0) { + struct timespec tS, *t = &tS; + t->tv_sec = 0; + t->tv_nsec = 020000000; + nanosleep(t, NULL); + } + ++nPoll; +#endif + } while (nRequests); - SubEvt_setTrigNr(partEvt, trigNr << 8 | trigTag); + SubEvt_setTrigNr(partEvt, trigNr << 8 | trigTag); SubEvt_setSize(partEvt, (char *)subEvt - (char *)partEvt); - trigNr++; + trigNr++; assert(SubEvt_size(partEvt) <= my->maxSubEvtSize); #ifndef NDEBUG syslog(LOG_DEBUG, "partEvt: %s", SubEvt_2charP(partEvt)); #endif } + +void Hardware_readout(Hardware *my, void *partEvt) +{ +/* code moved to waitForTrigger */ +} diff --git a/hadaq/hwsam.c b/hadaq/hwsam.c index baf0bfa..cb9520a 100644 --- a/hadaq/hwsam.c +++ b/hadaq/hwsam.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwsam.c,v 6.12 2002-10-09 12:42:18 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwsam.c,v 6.13 2002-10-24 16:45:40 hadaq Exp $"; #include #include @@ -15,124 +15,155 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada #include "subevt.h" #include "sam_defs.h" #include "hwsam.h" +#define SAM_BUFOFFSET 8 +#define SAM_BUFSIZE 0x4000 -#define BUFSIZE 0x1000 - -static int bankRequested(HwSam *my) { - return LVme_tstBitL(my->cram, CRR, 0); -} - -static int bankConfirmed(HwSam *my) { - return LVme_tstBitL(my->regs, VMSR, 0); -} - -static int endOfData(HwSam *my) { - int i; - - i = BUFSIZE * bankRequested(my); - return i + LVme_getL(my->cram, i); -} - -int conHwSam(HwSam * my, const char *name, const Param *param) +int conHwSam(HwSam *my, const char *name, const Param *param) { - unsigned long cardBase; + unsigned long cardBase; int paramWasFound; - int i; + int i; - assert(my != NULL); + assert(my != NULL); - strcpy(my->name, name); + strcpy(my->name, name); Param_getInt(param, my->name, "cardbase", ¶mWasFound, &cardBase); if (!paramWasFound) { syslog(LOG_WARNING, - "Parameter %s(%s) not found, default = 0", my->name, "cardbase"); + "Parameter %s(%s) not found, default = 0", my->name, "cardbase"); cardBase = 0; } + my->cram = malloc(sizeof(LVme)); + if (0 > conLVme(my->cram, cardBase, 0x10000L, 0x09, 0x0, 4)) { + syslog(LOG_ERR, "HwSam on %p not found", cardBase); + return -1; + } + my->regs = malloc(sizeof(LVme)); + if (0 > conLVme(my->regs, cardBase, 0x10000L, 0x09, 0x4, 4)) { + syslog(LOG_ERR, "HwSam on %p not found", cardBase); + return -1; + } + my->bankRequested = LVme_tstBitL(my->cram, CRR, 0); /* assumes that init is done by Sam */ + if(my->bankRequested == 1) { + syslog(LOG_ERR, "HwSam readout bit = 1, should be 0, intialization bug"); + } + my->currAddr = SAM_BUFSIZE; - my->cram = malloc(sizeof(LVme)); - if (0 > conLVme(my->cram, cardBase, 0x10000L, 0x09, 0x0, 4)) { - syslog(LOG_ERR, "HwSam on %p not found", cardBase); - return -1; - } - my->regs = malloc(sizeof(LVme)); - if (0 > conLVme(my->regs, cardBase + 0x01000000, 0x10000L, 0x09, 0x4, 4)) { - syslog(LOG_ERR, "HwSam on %p not found", cardBase); - return -1; - } - my->currAddr = BUFSIZE; - - return 0; + return 0; } -void desHwSam(HwSam * my) +void desHwSam(HwSam *my) { - desLVme(my->regs); - desLVme(my->cram); + desLVme(my->regs); + desLVme(my->cram); } -void HwSam_requestBuffer(HwSam *my) { - int i; +void HwSam_requestBuffer(HwSam *my) +{ + int i; #ifndef NDEBUG - syslog(LOG_DEBUG, "requestBuffer in"); + syslog(LOG_DEBUG, "requestBuffer in"); #endif - i = bankRequested(my) == 1 ? 0 : 1; - do { - if (i == 1) { - LVme_setBitL(my->cram, CRR, 0); - } else { - LVme_clrBitL(my->cram, CRR, 0); - } - } while (LVme_tstBitL(my->cram, CRR, 0) != i); - - my->currAddr = BUFSIZE * bankRequested(my) + 8; + i = my->bankRequested == 1 ? 0 : 1; + do { + if (i == 1) { + LVme_setBitL(my->cram, CRR, 0); + } else { + LVme_clrBitL(my->cram, CRR, 0); + } + } while (LVme_tstBitL(my->cram, CRR, 0) != i); + + my->currAddr = SAM_BUFSIZE * i + SAM_BUFOFFSET; + my->bankRequested = i; + my->endOfData = 0; #ifndef NDEBUG - syslog(LOG_DEBUG, "requestBuffer out"); + syslog(LOG_DEBUG, "requestBuffer out"); #endif } -int HwSam_isBusy(HwSam *my) { - return bankRequested(my) != bankConfirmed(my); -} - -int HwSam_isEmpty(HwSam *my) { - return my->currAddr >= endOfData(my); -} - -void *HwSam_readSubEvt(HwSam *my, void *subEvt) { - uint32_t *data = (uint32_t *)subEvt; - int firstAddr; - int size; +/* 5 RC Headers + Subevent Header + some data */ +#define SAM_NODATASIZE 0 +#define RC_HEADERLENGTH 12 +int HwSam_readSubEvt(HwSam *my, void *subEvt) +{ + uint32_t * dataStart = (uint32_t *) subEvt; + uint32_t * data; + int lastAddr; + int currAddr = my->currAddr; + int size, rcSize; + int rcSubEvt; /* pointer to length in rc sub-sub-event header */ #ifndef NDEBUG - syslog(LOG_DEBUG, "readSubEvt in"); -#endif - size = LVme_getL(my->cram, my->currAddr); -#ifndef NDEBUG - syslog(LOG_DEBUG, "readSubEvt currAddr: 0x%08x", my->currAddr); + syslog(LOG_DEBUG, "readSubEvt in"); + syslog(LOG_DEBUG, "currAddr: 0x%08x", currAddr); #endif - - if (my->currAddr + size > endOfData(my)) { - syslog(LOG_CRIT,"subEvt throw away : %d, %d", size, endOfData(my) - my->currAddr); - /* create impossible subEvt */ - SubEvt_setSize(subEvt, SubEvt_hdrSize()); - SubEvt_setDecoding(subEvt, SubEvtDecoding_16bitData); - SubEvt_setId(subEvt, SubEvtId_mdc); - SubEvt_setTrigNr(subEvt, 0x00000001); /* impossible with 1:1 */ - my->currAddr = endOfData(my); /* lie you have read whole bank */ - } else { - /* copy one sub evt from RC to memory */ - for (firstAddr = my->currAddr; my->currAddr - firstAddr < size; my->currAddr += 4) { - *data++ = LVme_getL(my->cram, my->currAddr); - } + size = LVme_getL(my->cram, currAddr); + lastAddr = currAddr + size; + my->endOfData = lastAddr; + + if (size > SAM_BUFSIZE - SAM_BUFOFFSET) { + syslog(LOG_CRIT, "subEvt throw away : %d, %d", size, SAM_BUFSIZE-SAM_BUFOFFSET); + /* damaged data, no repair possible, skip subevent*/ + return -1; + } + if(size <= SAM_NODATASIZE) { + /* skip dataless subevent */ + return 1; + } #ifndef NDEBUG - syslog(LOG_DEBUG, "readSubEvt subevt: %s", SubEvt_2charP(subEvt)); + syslog(LOG_DEBUG, "readSubEvt subevt: %s", SubEvt_2charP(subEvt)); #endif - } + /* copy one sub evt from Sam to memory */ + data = dataStart; + /* copy remaining header */ + *++data = LVme_getL(my->cram, currAddr+=4); + *++data = LVme_getL(my->cram, currAddr+=4); + *++data = LVme_getL(my->cram, currAddr+=4); + + rcSubEvt = (currAddr+=4); + while (rcSubEvt < lastAddr) { + /* + Skip rc subevent header if no data: tag, length, rc-id. + This hack belongs into the RC code + where tags should be compared to internal counters. + If inconsistent, debug data can be inserted marked by the + upermost bit on. + */ + int rcSize16; + rcSize = LVme_getL(my->cram, currAddr+4); + rcSize16 = rcSize & 0xffff; + rcSubEvt += rcSize16 * 4 + RC_HEADERLENGTH; + +/* if no data ... cut roc header */ +/* + if( rcSize16 == 0) { + size -= RC_HEADERLENGTH; + currAddr += RC_HEADERLENGTH; + } else { +*/ + *++data = LVme_getL(my->cram, currAddr); + *++data = rcSize; + *++data = LVme_getL(my->cram, currAddr+=8); + while((currAddr+=4) < rcSubEvt) { + *++data = LVme_getL(my->cram, currAddr); + } +/* + } +*/ + } + *dataStart = size; #ifndef NDEBUG - syslog(LOG_DEBUG, "readSubEvt out"); + syslog(LOG_DEBUG, "readSubEvt out"); #endif - return 0; + return 0; } + + + + + + + diff --git a/hadaq/hwsam.h b/hadaq/hwsam.h index 876f036..509f141 100644 --- a/hadaq/hwsam.h +++ b/hadaq/hwsam.h @@ -2,24 +2,42 @@ #define HwSam_H #include - #include +#include "sam_defs.h" typedef struct HwSamS { - char name[16]; + char name[12]; LVme *cram; LVme *regs; - int bufSize; + int bankRequested; int currAddr; + int endOfData; } HwSam; - int conHwSam(HwSam *my, const char *name, const Param *param); void desHwSam(HwSam *my); +int HwSam_readSubEvt(HwSam *my, void *subEvt); + +static int bankConfirmed(HwSam *my) +{ + return LVme_tstBitL(my->regs, VMSR, 0); +} + +static int HwSam_isBusy(HwSam *my) +{ + return my->bankRequested != bankConfirmed(my); +} + +static int HwSam_isEmpty(HwSam *my) +{ + return my->currAddr >= my->endOfData; +} + +static int HwSam_isBufRequested(HwSam *my) +{ + return my->endOfData == 0; +} void HwSam_requestBuffer(HwSam *my); -int HwSam_isBusy(HwSam *my); -int HwSam_isEmpty(HwSam *my); -void *HwSam_nextSubEvt(HwSam *my, void *subEvt); #endif diff --git a/hadaq/indent.pro b/hadaq/indent.pro index fb1498c..662ea32 100644 --- a/hadaq/indent.pro +++ b/hadaq/indent.pro @@ -30,6 +30,7 @@ -T HwV488 -T HwV556 -T HwDtu +-T HwSam -T HwRace -T HwShip -T LVme diff --git a/hadaq/param.tcl b/hadaq/param.tcl index 027c8cb..8fcb80c 100644 --- a/hadaq/param.tcl +++ b/hadaq/param.tcl @@ -20,18 +20,27 @@ set readout(file) ./daq_readout set readout(stndln) 0 set readout(priority) -2 -set sam0(cardbase) 0x1C000000 -set sam1(cardbase) 0x2C000000 -set sam2(cardbase) 0x3C000000 -set sam3(cardbase) 0x7C000000 -set sam4(cardbase) 0x8C000000 -set sam5(cardbase) 0x9C000000 -set sam6(cardbase) 0xaC000000 -set sam7(cardbase) 0xbC000000 -set sam8(cardbase) 0xcC000000 -set sam9(cardbase) 0xdC000000 -set sam10(cardbase) 0xeC000000 -set sam11(cardbase) 0xfC000000 +set sam0(cardbase) 0x01000000 +set sam1(cardbase) 0x01100000 +set sam2(cardbase) 0x02000000 +set sam3(cardbase) 0x02100000 +set sam4(cardbase) 0x03000000 +set sam5(cardbase) 0x03100000 + +set sam6(cardbase) 0x04000000 +set sam7(cardbase) 0x04100000 +set sam8(cardbase) 0x05000000 +set sam9(cardbase) 0x05100000 +set sam10(cardbase) 0x06000000 +set sam11(cardbase) 0x06100000 + +set sam12(cardbase) 0x07000000 +set sam13(cardbase) 0x07100000 +set sam14(cardbase) 0x08000000 +set sam15(cardbase) 0x08100000 + +set sam16(cardbase) 0x09000000 +set sam17(cardbase) 0x09100000 set soft(size) 1024 @@ -133,327 +142,18 @@ set race9(status_id) 103 set conc(cardbase) 0x18000000 set mu(cardbase) 0xd0000000 -set tdc0(cardbase) 0x22000000 -set tdc0(threshold00) 0 -set tdc0(threshold01) 0 -set tdc0(threshold02) 0 -set tdc0(threshold03) 0 -set tdc0(threshold04) 0 -set tdc0(threshold05) 0 -set tdc0(threshold06) 0 -set tdc0(threshold07) 0 -set tdc0(threshold08) 0 -set tdc0(threshold09) 0 -set tdc0(threshold10) 0 -set tdc0(threshold11) 0 -set tdc0(threshold12) 0 -set tdc0(threshold13) 0 -set tdc0(threshold14) 0 -set tdc0(threshold15) 0 -set tdc0(threshold16) 0 -set tdc0(threshold17) 0 -set tdc0(threshold18) 0 -set tdc0(threshold19) 0 -set tdc0(threshold20) 0 -set tdc0(threshold21) 0 -set tdc0(threshold22) 0 -set tdc0(threshold23) 0 -set tdc0(threshold24) 0 -set tdc0(threshold25) 0 -set tdc0(threshold26) 0 -set tdc0(threshold27) 0 -set tdc0(threshold28) 0 -set tdc0(threshold29) 0 -set tdc0(threshold30) 0 -set tdc0(threshold31) 0 -set tdc0(range) 254 -set tdc0(vset) 255 -set tdc0(voff) 0 - -set tdc1(cardbase) 0x22020000 -set tdc1(threshold00) 0 -set tdc1(threshold01) 0 -set tdc1(threshold02) 0 -set tdc1(threshold03) 0 -set tdc1(threshold04) 0 -set tdc1(threshold05) 0 -set tdc1(threshold06) 0 -set tdc1(threshold07) 0 -set tdc1(threshold08) 0 -set tdc1(threshold09) 0 -set tdc1(threshold10) 0 -set tdc1(threshold11) 0 -set tdc1(threshold12) 0 -set tdc1(threshold13) 0 -set tdc1(threshold14) 0 -set tdc1(threshold15) 0 -set tdc1(threshold16) 0 -set tdc1(threshold17) 0 -set tdc1(threshold18) 0 -set tdc1(threshold19) 0 -set tdc1(threshold20) 0 -set tdc1(threshold21) 0 -set tdc1(threshold22) 0 -set tdc1(threshold23) 0 -set tdc1(threshold24) 0 -set tdc1(threshold25) 0 -set tdc1(threshold26) 0 -set tdc1(threshold27) 0 -set tdc1(threshold28) 0 -set tdc1(threshold29) 0 -set tdc1(threshold30) 0 -set tdc1(threshold31) 0 -set tdc1(range) 254 -set tdc1(vset) 255 -set tdc1(voff) 0 - -set tdc2(cardbase) 0x22040000 -set tdc2(threshold00) 0 -set tdc2(threshold01) 0 -set tdc2(threshold02) 0 -set tdc2(threshold03) 0 -set tdc2(threshold04) 0 -set tdc2(threshold05) 0 -set tdc2(threshold06) 0 -set tdc2(threshold07) 0 -set tdc2(threshold08) 0 -set tdc2(threshold09) 0 -set tdc2(threshold10) 0 -set tdc2(threshold11) 0 -set tdc2(threshold12) 0 -set tdc2(threshold13) 0 -set tdc2(threshold14) 0 -set tdc2(threshold15) 0 -set tdc2(threshold16) 0 -set tdc2(threshold17) 0 -set tdc2(threshold18) 0 -set tdc2(threshold19) 0 -set tdc2(threshold20) 0 -set tdc2(threshold21) 0 -set tdc2(threshold22) 0 -set tdc2(threshold23) 0 -set tdc2(threshold24) 0 -set tdc2(threshold25) 0 -set tdc2(threshold26) 0 -set tdc2(threshold27) 0 -set tdc2(threshold28) 0 -set tdc2(threshold29) 0 -set tdc2(threshold30) 0 -set tdc2(threshold31) 0 -set tdc2(range) 255 -set tdc2(vset) 254 -set tdc2(voff) 0 - -set tdc3(cardbase) 0x22060000 -set tdc3(threshold00) 0 -set tdc3(threshold01) 0 -set tdc3(threshold02) 0 -set tdc3(threshold03) 0 -set tdc3(threshold04) 0 -set tdc3(threshold05) 0 -set tdc3(threshold06) 0 -set tdc3(threshold07) 0 -set tdc3(threshold08) 0 -set tdc3(threshold09) 0 -set tdc3(threshold10) 0 -set tdc3(threshold11) 0 -set tdc3(threshold12) 0 -set tdc3(threshold13) 0 -set tdc3(threshold14) 0 -set tdc3(threshold15) 0 -set tdc3(threshold16) 0 -set tdc3(threshold17) 0 -set tdc3(threshold18) 0 -set tdc3(threshold19) 0 -set tdc3(threshold20) 0 -set tdc3(threshold21) 0 -set tdc3(threshold22) 0 -set tdc3(threshold23) 0 -set tdc3(threshold24) 0 -set tdc3(threshold25) 0 -set tdc3(threshold26) 0 -set tdc3(threshold27) 0 -set tdc3(threshold28) 0 -set tdc3(threshold29) 0 -set tdc3(threshold30) 0 -set tdc3(threshold31) 0 -set tdc3(vset) 148 -set tdc3(voff) 0 -set tdc3(fclr_win) 254 -set tdc3(clr_time) 0x8085 - -set tdc4(cardbase) 0xdd000000 -set tdc4(threshold00) 0 -set tdc4(threshold01) 0 -set tdc4(threshold02) 0 -set tdc4(threshold03) 0 -set tdc4(threshold04) 0 -set tdc4(threshold05) 0 -set tdc4(threshold06) 0 -set tdc4(threshold07) 0 -set tdc4(threshold08) 0 -set tdc4(threshold09) 0 -set tdc4(threshold10) 0 -set tdc4(threshold11) 0 -set tdc4(threshold12) 0 -set tdc4(threshold13) 0 -set tdc4(threshold14) 0 -set tdc4(threshold15) 0 -set tdc4(threshold16) 0 -set tdc4(threshold17) 0 -set tdc4(threshold18) 0 -set tdc4(threshold19) 0 -set tdc4(threshold20) 0 -set tdc4(threshold21) 0 -set tdc4(threshold22) 0 -set tdc4(threshold23) 0 -set tdc4(threshold24) 0 -set tdc4(threshold25) 0 -set tdc4(threshold26) 0 -set tdc4(threshold27) 0 -set tdc4(threshold28) 0 -set tdc4(threshold29) 0 -set tdc4(threshold30) 0 -set tdc4(threshold31) 0 -set tdc4(vset) 148 -set tdc4(voff) 0 -set tdc4(fclr_win) 254 -set tdc4(clr_time) 0x8085 - -set tdc5(cardbase) 0xdd020000 -set tdc5(threshold00) 0 -set tdc5(threshold01) 0 -set tdc5(threshold02) 0 -set tdc5(threshold03) 0 -set tdc5(threshold04) 0 -set tdc5(threshold05) 0 -set tdc5(threshold06) 0 -set tdc5(threshold07) 0 -set tdc5(threshold08) 0 -set tdc5(threshold09) 0 -set tdc5(threshold10) 0 -set tdc5(threshold11) 0 -set tdc5(threshold12) 0 -set tdc5(threshold13) 0 -set tdc5(threshold14) 0 -set tdc5(threshold15) 0 -set tdc5(threshold16) 0 -set tdc5(threshold17) 0 -set tdc5(threshold18) 0 -set tdc5(threshold19) 0 -set tdc5(threshold20) 0 -set tdc5(threshold21) 0 -set tdc5(threshold22) 0 -set tdc5(threshold23) 0 -set tdc5(threshold24) 0 -set tdc5(threshold25) 0 -set tdc5(threshold26) 0 -set tdc5(threshold27) 0 -set tdc5(threshold28) 0 -set tdc5(threshold29) 0 -set tdc5(threshold30) 0 -set tdc5(threshold31) 0 -set tdc5(vset) 148 -set tdc5(voff) 0 -set tdc5(fclr_win) 254 -set tdc5(clr_time) 0x8085 - -set tdc6(cardbase) 0xdd040000 -set tdc6(threshold00) 0 -set tdc6(threshold01) 0 -set tdc6(threshold02) 0 -set tdc6(threshold03) 0 -set tdc6(threshold04) 0 -set tdc6(threshold05) 0 -set tdc6(threshold06) 0 -set tdc6(threshold07) 0 -set tdc6(threshold08) 0 -set tdc6(threshold09) 0 -set tdc6(threshold10) 0 -set tdc6(threshold11) 0 -set tdc6(threshold12) 0 -set tdc6(threshold13) 0 -set tdc6(threshold14) 0 -set tdc6(threshold15) 0 -set tdc6(threshold16) 0 -set tdc6(threshold17) 0 -set tdc6(threshold18) 0 -set tdc6(threshold19) 0 -set tdc6(threshold20) 0 -set tdc6(threshold21) 0 -set tdc6(threshold22) 0 -set tdc6(threshold23) 0 -set tdc6(threshold24) 0 -set tdc6(threshold25) 0 -set tdc6(threshold26) 0 -set tdc6(threshold27) 0 -set tdc6(threshold28) 0 -set tdc6(threshold29) 0 -set tdc6(threshold30) 0 -set tdc6(threshold31) 0 -set tdc6(vset) 148 -set tdc6(voff) 0 -set tdc6(fclr_win) 254 -set tdc6(clr_time) 0x8085 - -set tdc7(cardbase) 0xdd060000 -set tdc7(threshold00) 0 -set tdc7(threshold01) 0 -set tdc7(threshold02) 0 -set tdc7(threshold03) 0 -set tdc7(threshold04) 0 -set tdc7(threshold05) 0 -set tdc7(threshold06) 0 -set tdc7(threshold07) 0 -set tdc7(threshold08) 0 -set tdc7(threshold09) 0 -set tdc7(threshold10) 0 -set tdc7(threshold11) 0 -set tdc7(threshold12) 0 -set tdc7(threshold13) 0 -set tdc7(threshold14) 0 -set tdc7(threshold15) 0 -set tdc7(threshold16) 0 -set tdc7(threshold17) 0 -set tdc7(threshold18) 0 -set tdc7(threshold19) 0 -set tdc7(threshold20) 0 -set tdc7(threshold21) 0 -set tdc7(threshold22) 0 -set tdc7(threshold23) 0 -set tdc7(threshold24) 0 -set tdc7(threshold25) 0 -set tdc7(threshold26) 0 -set tdc7(threshold27) 0 -set tdc7(threshold28) 0 -set tdc7(threshold29) 0 -set tdc7(threshold30) 0 -set tdc7(threshold31) 0 -set tdc7(vset) 148 -set tdc7(voff) 0 -set tdc7(fclr_win) 254 -set tdc7(clr_time) 0x8085 - -set tdc8(cardbase) 0x200000 -set tdc8(id) 0x2005 -set tdc8(ctrl) 0x00ff -set tdc8(thrl) 1 -set tdc8(thrh) 198 -set tdc8(range) 120;# 0 = 90ns, 224 = 770ns - -set tdc9(cardbase) 0x400000 -set tdc9(id) 0x2006 -set tdc9(ctrl) 0x00ff -set tdc9(thrl) 1 -set tdc9(thrh) 198 -set tdc9(range) 120; #0 = 90 ns, 224 = 770ns - -set adc0(cardbase) 0x000000 -set adc0(id) 0x1007 -set adc0(ctrl) 0x00ff -set adc0(thrl) 1 -set adc0(thrh) 198 -set adc0(delay) 0 -set adc0(range) 0 - -set scaler0(cardbase) 0xa0000000 + + + + + + + + + + + + + + + diff --git a/hadaq/sam_defs.h b/hadaq/sam_defs.h index b9f859b..5ff20c8 100644 --- a/hadaq/sam_defs.h +++ b/hadaq/sam_defs.h @@ -1,9 +1,9 @@ #ifndef SAM_DEFS_H #define SAM_DEFS_H -#define VMSR 0x0008 +#define VMSR 0x8004 #define KSR 0x0004 #define CRAM 0x0000 -#define CRR 0x1ffc +#define CRR 0x8000 #endif diff --git a/hadaq/startacq b/hadaq/startacq index 1b51812..fbd34de 100644 --- a/hadaq/startacq +++ b/hadaq/startacq @@ -1,9 +1,4 @@ : -cd ../../slow -echo "reseting mdc..." -mdc_reset_sigbus -mdc start -cd - export DAQSLOW_PARAM_FILE=$HADES_BASE_DIR/mdc/hadaq/param.tcl ./daq_evtbuild -p -1 -v notice & @@ -14,6 +9,4 @@ echo $! >readout.pid sleep 1 export DAQSLOW_PARAM_FILE=$HADES_BASE_DIR/slow/mdc.tcl -$HADES_BASE_DIR/bin/$SYSTYPE/dtuctrl start mdcctu -export DAQSLOW_PARAM_FILE="" exit 0 diff --git a/hadaq/stopacq b/hadaq/stopacq index b22857c..22edc88 100644 --- a/hadaq/stopacq +++ b/hadaq/stopacq @@ -1,14 +1,7 @@ : -export DAQSLOW_PARAM_FILE=$HADES_BASE_DIR/slow/mdc.tcl -$HADES_BASE_DIR/bin/$SYSTYPE/dtuctrl stop mdcctu -sleep 1 kill $(cat readout.pid) rm readout.pid sleep 1 kill $(cat evtbuild.pid) rm evtbuild.pid -cd ../../slow -mdc stop -cd - -export DAQSLOW_PARAM_FILE="" exit 0 -- 2.43.0