-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.14 2001-03-07 16:02:44 hades Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.15 2001-04-10 13:28:51 hades Exp $";
#define _POSIX_C_SOURCE 199309L
#include <string.h>
#include <sys/time.h>
-#undef SYNCHRONOUS
-
-#ifdef SYNCHRONOUS
-#include <lvme.h>
-
-#include "dtu_defs.h"
-
-#endif
#include <allParam.h>
#include "subevt.h"
#include "hwrace.h"
size_t maxSubEvtSize;
HwRace *race[NRACES];
unsigned raceToRead;
-#ifdef SYNCHRONOUS
- LVme *lvme;
-#endif
};
#include "hardware.h"
Hardware *my;
Param paramS, *param = ¶mS;
int i;
-#ifdef SYNCHRONOUS
- unsigned long cardBase;
-#endif
-
-#ifdef SYNCHRONOUS
- cardBase = 0x44100000;
-#endif
if (0 > conParam(param)) {
msglog(LOG_ERR, "%s:%d:%s\n", __FILE__, __LINE__, strerror(errno));
}
}
-#ifdef SYNCHRONOUS
- my->lvme = allocMem(sizeof(LVme));
- if (-1 == conLVme(my->lvme, cardBase, 0x100000, 0x09, 0, 0)) {
- return NULL;
- }
- /* set Lock Busy */
- LVme_setBitL(my->lvme, STATUS1, 4);
-#endif
-
desParam(param);
return my;
}
desHwRace(my->race[i]);
freeMem(my->race[i]);
}
-#ifdef SYNCHRONOUS
- desLVme(my->lvme);
-#endif
-
freeMem(my);
}
void Hardware_waitForTrigger(Hardware *my, void *subEvt)
{
-#ifdef SYNCHRONOUS
- static int beginRun = 1; /* eat 1 triggers at begin run */
-
- while (beginRun > 0) {
- /* wait for begin run trigger and release busy afterwards */
- while (!LVme_tstBitL(my->lvme, STATUS1, 6)) {
- struct timespec tS, *t = &tS;
- t->tv_sec = 0;
- t->tv_nsec = 020000000;
- nanosleep(t, NULL);
- }
- LVme_setL(my->lvme, RELEASE1, 0xee);
- sleep(1);
- beginRun--;
- }
-#endif
}
void Hardware_readout(Hardware *my, void *partEvt)
for (my->raceToRead = 0; my->raceToRead < NRACES; my->raceToRead++) {
if (HwRace_isEmpty(my->race[my->raceToRead])) {
-#ifdef SYNCHRONOUS
- LVme_setL(my->lvme, RELEASE1, 0xee);
- for (i = 0; i < 20000; i++) {
- j = 1 + 1;
- }
-#endif
HwRace_requestBuffer(my->race[my->raceToRead]);
-#ifdef SYNCHRONOUS
- for (i = 0; i < 20000; i++) {
- j = 1 + 1;
- }
-#endif
while (HwRace_isBusy(my->race[my->raceToRead])) {
#if 0
/*