#include <stddef.h>
+#include <errno.h>
#include <setjmp.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
-#include <types.h>
-#include <ces/vmelib.h>
-
#include <hadesstd.h>
-#include "ctu.h"
#include "worker.h"
static jmp_buf terminateJmp;
int main(int argc, char *argv[])
{
- Ctu *ctu;
Worker *worker;
int isStandalone;
int priority;
ptrdiff_t offset;
int i;
unsigned long value;
- struct pdparam_master paramS, *param = ¶mS;
int oper;
unsigned long *ctuEnabled;
}
}
- if (NULL == (worker = Worker_init(argv[0], sigHandler, priority, isStandalone))) {
+ if (NULL == (worker = Worker_initBegin(argv[0], sigHandler, priority, isStandalone))) {
msglog(LOG_ERR, "connecting to agent: %s\n", strerror(errno));
goto bailOut0;
}
msglog(LOG_ERR, "addingStatistic: %s\n", strerror(errno));
goto bailOut0;
}
- param->iack = 1;
- param->rdpref = 0;
- param->wrpost = 0;
- param->swap = 1;
+ Worker_initEnd(worker);
- ctu = allocMem(sizeof(Ctu));
- if (-1 == conCtu(ctu, 0x44000000)) {
- msglog(LOG_ERR, "Initializing Ctu: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
- Ctu_softBusy(ctu, 1);
- (*ctuEnabled) = 0;
- Ctu_clear(ctu);
- Ctu_wrDeadtime(ctu, 0x08);
- Ctu_wrDelay(ctu, 0x08);
- Ctu_inhibit(ctu, 1);
- Ctu_maskTrig(ctu, 1);
- Ctu_softBusy(ctu, 0);
+ system("ctuctrl reset");
+ system("ctuctrl rate 1");
+ system("ctuctrl start");
(*ctuEnabled) = 1;
- Ctu_softTrig(ctu, 0x10);
- Ctu_maskTrig(ctu, 0);
- msglog(LOG_DEBUG, "%s\n", Ctu_2charP(ctu));
if (0 == setjmp(terminateJmp)) {
sleep(32767);
}
- Ctu_maskTrig(ctu, 1);
- Ctu_softTrig(ctu, 0x20);
- msglog(LOG_DEBUG, "%s\n", Ctu_2charP(ctu));
- Ctu_softBusy(ctu, 1);
- Ctu_maskTrig(ctu, 0);
- Ctu_inhibit(ctu, 0);
+ system("ctuctrl stop");
(*ctuEnabled) = 0;
- desCtu(ctu);
Worker_fini(worker);
- freeMem(ctu);
exit(0);
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwdtu.c,v 1.1 1999-09-03 07:35:06 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwdtu.c,v 1.2 1999-09-05 11:20:08 hades Stab $";
#define _POSIX_C_SOURCE 199309L
#include <unistd.h>
freeMem(my->lvme);
}
-int HwDTU_isEmpty(HwDtu *my)
+int HwDtu_isEmpty(HwDtu *my)
{
- return LVme_tstBitB(my->lvme, DTU_FIFO_2, 0);
+ return LVme_tstBitL(my->lvme, DTU_FIFO_2, 0);
}
-int HwDTU_read(HwDtu *my, void *subEvt)
+int HwDtu_read(HwDtu *my)
{
- my->trigTag = LVme_getB(my->lvme, DTU_TRIG_TAG);
- my->trigCode = LVme_getB(my->lvme, DTU_TRIG_CODE) & 0x0f;
- LVme_setB(my->lvme, DTU_FIFO_1, 0);
- LVme_setB(my->lvme, DTU_FIFO_2, 0);
+ 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;
}