From: hadaq Date: Tue, 15 Oct 2002 18:15:29 +0000 (+0000) Subject: minor stuff -- mm X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=ed23441a043a6321b8458884e78dbf412b3cafba;p=daqdata.git minor stuff -- mm --- diff --git a/hadaq/hwrace.c b/hadaq/hwrace.c index 73725e6..5868de2 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.20 2002-10-09 15:41:21 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.21 2002-10-15 18:15:29 hadaq Exp $"; #define _POSIX_C_SOURCE 199309L @@ -36,10 +36,9 @@ int conHwRace(HwRace *my, const char *name, const Param *param) 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->rc = malloc(sizeof(Rc)); if (0 > conRc(my->rc, "rc", cardBase)) { @@ -69,7 +68,7 @@ void HwRace_requestBuffer(HwRace *my) #define RACE_NODATASIZE 0x10 int HwRace_readSubEvt(HwRace *my, void *subEvt) { - uint32_t * data = (uint32_t *) subEvt; + uint32_t *data = (uint32_t *) subEvt; int lastAddr; int currAddr; int size; @@ -79,21 +78,18 @@ int HwRace_readSubEvt(HwRace *my, void *subEvt) lastAddr = my->currAddr + size; /* align my->currAddr to next page */ - if ((lastAddr & 0xff) != 0) { - my->currAddr = ((lastAddr >> RCPAGEBITSHIFT) + 1)<< RCPAGEBITSHIFT; - } else { - my->currAddr = lastAddr; - } - if (size <= RACE_NODATASIZE) return 0; + my->currAddr = lastAddr + (RCPAGESIZE - 1) & ~(RCPAGESIZE - 1); - /* copy one sub evt from RC to memory */ - *data++ = size; - while ((currAddr+=4) < lastAddr) { - *data++ = Rc_readMem(my->rc, currAddr); + if (size <= RACE_NODATASIZE) { + size = 0; + } else { + /* copy one sub evt from RC to memory */ + *data++ = size; + while ((currAddr += 4) < lastAddr) { + *data++ = Rc_readMem(my->rc, currAddr); + } + syslog(LOG_DEBUG, "subEvt: %s", SubEvt_2charP(subEvt)); } -#ifndef NDEBUG - syslog(LOG_DEBUG, "subEvt: %s", SubEvt_2charP(subEvt)); -#endif return size; } diff --git a/hadaq/hwrace.h b/hadaq/hwrace.h index 5073bfd..b68c566 100644 --- a/hadaq/hwrace.h +++ b/hadaq/hwrace.h @@ -1,3 +1,4 @@ + #ifndef HwRace_H #define HwRace_H @@ -7,15 +8,16 @@ #include typedef struct HwRaceS { - char name[12]; - Rc * rc; - LVme_L * buf; - int currAddr; - int endOfData; -} HwRace; + char name[12]; + Rc *rc; + LVme_L *buf; + int currAddr; + int endOfData; +} -#define RCPAGEBITSHIFT 8 -#define RCPAGESIZE (1 << RCPAGEBITSHIFT) +HwRace; + +#define RCPAGESIZE 0x100U int conHwRace(HwRace *my, const char *name, const Param *param); @@ -30,12 +32,13 @@ static int HwRace_isEmpty(HwRace *my) int HwRace_readSubEvt(HwRace *my, void *subEvt); -static int HwRace_isBufRequested(HwRace *my) { +static int HwRace_isBufRequested(HwRace *my) +{ return my->currAddr == 0; } static void HwRace_getEndOfData(HwRace *my) { - my->endOfData = (Rc_getPages(my->rc) << RCPAGEBITSHIFT); + my->endOfData = Rc_getPages(my->rc) * RCPAGESIZE; } #endif diff --git a/hadaq/indent.pro b/hadaq/indent.pro index 0439d91..fb1498c 100644 --- a/hadaq/indent.pro +++ b/hadaq/indent.pro @@ -1,4 +1,12 @@ -kr -ts4 -l80 +-T int8_t +-T int16_t +-T int32_t +-T uint8_t +-T uint16_t +-T uint32_t +-T size_t +-T sem_t -T Ctu -T Dtu -T HadTuQueue @@ -11,7 +19,6 @@ -T NetTrans -T Param -T PsxShm --T sem_t -T ShmTrans -T V488 -T V556 @@ -26,3 +33,10 @@ -T HwRace -T HwShip -T LVme +-T LVme_B +-T LVme_W +-T LVme_L +-T LVme_VB +-T LVme_VW +-T LVme_VL +-T Rc