clean-local:
rm -f agent.h online.h *_clnt.c *_svc.c *_xdr.c
-mini: daq_readout daq_evtbuild
-seb: daq_readout daq_memnet daq_agent
-eb: daq_netmem daq_evtbuild daq_agent
-anal: daq_sniff daq_anal
-manage: daq_manage
-xmanage: daq_xmanage anal
-
bin_PROGRAMS = @daq_xmanage_prog@ @daq_manage_prog@ daq_agent daq_memnet daq_netmem daq_evtbuild daq_sniff daq_anal daq_ctrlctu
-noinst_PROGRAMS = daq_readout
EXTRA_PROGRAMS = daq_xmanage daq_manage
lib_LIBRARIES = libhadaq.a
-libhadaq_a_SOURCES = worker.c psxshm.c
-include_HEADERS = worker.h psxshm.h
+libhadaq_a_SOURCES = readout.c\
+ worker.c \
+ evt.c \
+ subevt.c \
+ shmtrans.c hadtuqueue.c \
+ psxshm.c \
+ hadtu.c
+include_HEADERS = worker.h subevt.h shmtrans.h hadtuqueue.h psxshm.h hadtu.h \
+ hardware.h
daq_xmanage_SOURCES = tcldaq.c tkAppInit.c \
agent_clnt.c agent_xdr.c worker.c psxshm.c
agent_clnt.c agent_xdr.c worker.c psxshm.c
daq_agent_SOURCES = agent.c agent_svc.c agent_xdr.c \
worker.c psxshm.c
-daq_readout_SOURCES = readout.c \
- worker.c \
- subevt.c \
- shmtrans.c hadtuqueue.c \
- psxshm.c \
- hadtu.c
-daq_readout_LDADD = @hw_objects@
-daq_readout_DEPENDENCIES = @hw_objects@
-EXTRA_daq_readout_SOURCES = hwsoft.c hwrich.c hwrace.c rc.c hwmdc.c hwsam.c hwshow.c hwship.c hwtrig.c hwtip.c
daq_memnet_SOURCES = memnet.c \
worker.c \
shmtrans.c hadtuqueue.c \
BUILT_SOURCES = agent.h online.h
bin_PROGRAMS = @daq_xmanage_prog@ @daq_manage_prog@ daq_agent daq_memnet daq_netmem daq_evtbuild daq_sniff daq_anal daq_ctrlctu
-noinst_PROGRAMS = daq_readout
EXTRA_PROGRAMS = daq_xmanage daq_manage
lib_LIBRARIES = libhadaq.a
-libhadaq_a_SOURCES = worker.c psxshm.c
-include_HEADERS = worker.h psxshm.h
+libhadaq_a_SOURCES = readout.c\
+ worker.c \
+ evt.c \
+ subevt.c \
+ shmtrans.c hadtuqueue.c \
+ psxshm.c \
+ hadtu.c
+
+include_HEADERS = worker.h subevt.h shmtrans.h hadtuqueue.h psxshm.h hadtu.h \
+ hardware.h
+
daq_xmanage_SOURCES = tcldaq.c tkAppInit.c \
agent_clnt.c agent_xdr.c worker.c psxshm.c
daq_agent_SOURCES = agent.c agent_svc.c agent_xdr.c \
worker.c psxshm.c
-daq_readout_SOURCES = readout.c \
- worker.c \
- subevt.c \
- shmtrans.c hadtuqueue.c \
- psxshm.c \
- hadtu.c
-
-daq_readout_LDADD = @hw_objects@
-daq_readout_DEPENDENCIES = @hw_objects@
-EXTRA_daq_readout_SOURCES = hwsoft.c hwrich.c hwrace.c rc.c hwmdc.c hwsam.c hwshow.c hwship.c hwtrig.c hwtip.c
daq_memnet_SOURCES = memnet.c \
worker.c \
shmtrans.c hadtuqueue.c \
libhadaq_a_AR = $(AR) cru
libhadaq_a_LIBADD =
-am_libhadaq_a_OBJECTS = worker.$(OBJEXT) psxshm.$(OBJEXT)
+am_libhadaq_a_OBJECTS = readout.$(OBJEXT) worker.$(OBJEXT) evt.$(OBJEXT) \
+ subevt.$(OBJEXT) shmtrans.$(OBJEXT) hadtuqueue.$(OBJEXT) \
+ psxshm.$(OBJEXT) hadtu.$(OBJEXT)
libhadaq_a_OBJECTS = $(am_libhadaq_a_OBJECTS)
EXTRA_PROGRAMS = daq_xmanage$(EXEEXT) daq_manage$(EXEEXT)
bin_PROGRAMS = @daq_xmanage_prog@ @daq_manage_prog@ daq_agent$(EXEEXT) \
daq_memnet$(EXEEXT) daq_netmem$(EXEEXT) daq_evtbuild$(EXEEXT) \
daq_sniff$(EXEEXT) daq_anal$(EXEEXT) daq_ctrlctu$(EXEEXT)
-noinst_PROGRAMS = daq_readout$(EXEEXT)
-PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+PROGRAMS = $(bin_PROGRAMS)
am_daq_agent_OBJECTS = agent.$(OBJEXT) agent_svc.$(OBJEXT) \
agent_xdr.$(OBJEXT) worker.$(OBJEXT) psxshm.$(OBJEXT)
daq_netmem_LDADD = $(LDADD)
daq_netmem_DEPENDENCIES =
daq_netmem_LDFLAGS =
-am_daq_readout_OBJECTS = readout.$(OBJEXT) worker.$(OBJEXT) \
- subevt.$(OBJEXT) shmtrans.$(OBJEXT) hadtuqueue.$(OBJEXT) \
- psxshm.$(OBJEXT) hadtu.$(OBJEXT)
-daq_readout_OBJECTS = $(am_daq_readout_OBJECTS)
-daq_readout_LDFLAGS =
am_daq_sniff_OBJECTS = sniff.$(OBJEXT) online_clnt.$(OBJEXT) \
online_xdr.$(OBJEXT)
daq_sniff_OBJECTS = $(am_daq_sniff_OBJECTS)
@AMDEP_TRUE@ ./$(DEPDIR)/evt.Po ./$(DEPDIR)/evtbuild.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/genid32.Po ./$(DEPDIR)/hadtu.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/hadtuqueue.Po ./$(DEPDIR)/hldread.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/hwmdc.Po ./$(DEPDIR)/hwrace.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/hwrich.Po ./$(DEPDIR)/hwsam.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/hwship.Po ./$(DEPDIR)/hwshow.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/hwsoft.Po ./$(DEPDIR)/hwtip.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/hwtrig.Po ./$(DEPDIR)/memnet.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/netmem.Po ./$(DEPDIR)/nettrans.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/online.Po ./$(DEPDIR)/online_clnt.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/memnet.Po ./$(DEPDIR)/netmem.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/nettrans.Po ./$(DEPDIR)/online.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/online_clnt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/online_svc.Po ./$(DEPDIR)/online_xdr.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/psxshm.Po ./$(DEPDIR)/rc.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/readout.Po ./$(DEPDIR)/shmtrans.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/showevt.Po ./$(DEPDIR)/sniff.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/subevt.Po ./$(DEPDIR)/tclAppInit.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tcldaq.Po ./$(DEPDIR)/tkAppInit.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/worker.Po
+@AMDEP_TRUE@ ./$(DEPDIR)/psxshm.Po ./$(DEPDIR)/readout.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/shmtrans.Po ./$(DEPDIR)/showevt.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/sniff.Po ./$(DEPDIR)/subevt.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tclAppInit.Po ./$(DEPDIR)/tcldaq.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tkAppInit.Po ./$(DEPDIR)/worker.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
$(daq_anal_SOURCES) $(daq_ctrlctu_SOURCES) \
$(daq_evtbuild_SOURCES) $(daq_manage_SOURCES) \
$(daq_memnet_SOURCES) $(daq_netmem_SOURCES) \
- $(daq_readout_SOURCES) $(EXTRA_daq_readout_SOURCES) \
$(daq_sniff_SOURCES) $(daq_xmanage_SOURCES)
HEADERS = $(include_HEADERS)
config/config.guess config/config.sub config/depcomp \
config/install-sh config/missing config/mkinstalldirs configure \
configure.in
-SOURCES = $(libhadaq_a_SOURCES) $(daq_agent_SOURCES) $(daq_anal_SOURCES) $(daq_ctrlctu_SOURCES) $(daq_evtbuild_SOURCES) $(daq_manage_SOURCES) $(daq_memnet_SOURCES) $(daq_netmem_SOURCES) $(daq_readout_SOURCES) $(EXTRA_daq_readout_SOURCES) $(daq_sniff_SOURCES) $(daq_xmanage_SOURCES)
+SOURCES = $(libhadaq_a_SOURCES) $(daq_agent_SOURCES) $(daq_anal_SOURCES) $(daq_ctrlctu_SOURCES) $(daq_evtbuild_SOURCES) $(daq_manage_SOURCES) $(daq_memnet_SOURCES) $(daq_netmem_SOURCES) $(daq_sniff_SOURCES) $(daq_xmanage_SOURCES)
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
-
-clean-noinstPROGRAMS:
- -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
daq_agent$(EXEEXT): $(daq_agent_OBJECTS) $(daq_agent_DEPENDENCIES)
@rm -f daq_agent$(EXEEXT)
$(LINK) $(daq_agent_LDFLAGS) $(daq_agent_OBJECTS) $(daq_agent_LDADD) $(LIBS)
daq_netmem$(EXEEXT): $(daq_netmem_OBJECTS) $(daq_netmem_DEPENDENCIES)
@rm -f daq_netmem$(EXEEXT)
$(LINK) $(daq_netmem_LDFLAGS) $(daq_netmem_OBJECTS) $(daq_netmem_LDADD) $(LIBS)
-daq_readout$(EXEEXT): $(daq_readout_OBJECTS) $(daq_readout_DEPENDENCIES)
- @rm -f daq_readout$(EXEEXT)
- $(LINK) $(daq_readout_LDFLAGS) $(daq_readout_OBJECTS) $(daq_readout_LDADD) $(LIBS)
daq_sniff$(EXEEXT): $(daq_sniff_OBJECTS) $(daq_sniff_DEPENDENCIES)
@rm -f daq_sniff$(EXEEXT)
$(LINK) $(daq_sniff_LDFLAGS) $(daq_sniff_OBJECTS) $(daq_sniff_LDADD) $(LIBS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hadtu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hadtuqueue.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hldread.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwmdc.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwrace.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwrich.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwsam.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwship.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwshow.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwsoft.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwtip.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwtrig.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memnet.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netmem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nettrans.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/online_svc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/online_xdr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psxshm.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readout.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shmtrans.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/showevt.Po@am__quote@
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libLIBRARIES clean-local \
- clean-noinstPROGRAMS mostlyclean-am
+ mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
uninstall-info-am uninstall-libLIBRARIES
.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \
- clean-generic clean-libLIBRARIES clean-local \
- clean-noinstPROGRAMS dist dist-all dist-gzip distcheck \
- distclean distclean-compile distclean-depend distclean-generic \
- distclean-tags distcleancheck distdir dvi dvi-am info info-am \
- install install-am install-binPROGRAMS install-data \
- install-data-am install-exec install-exec-am \
- install-includeHEADERS install-info install-info-am \
- install-libLIBRARIES install-man install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic tags uninstall uninstall-am \
- uninstall-binPROGRAMS uninstall-includeHEADERS \
+ clean-generic clean-libLIBRARIES clean-local dist dist-all \
+ dist-gzip distcheck distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags \
+ distcleancheck distdir dvi dvi-am info info-am install \
+ install-am install-binPROGRAMS install-data install-data-am \
+ install-exec install-exec-am install-includeHEADERS \
+ install-info install-info-am install-libLIBRARIES install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-includeHEADERS \
uninstall-info-am uninstall-libLIBRARIES
clean-local:
rm -f agent.h online.h *_clnt.c *_svc.c *_xdr.c
-
-mini: daq_readout daq_evtbuild
-seb: daq_readout daq_memnet daq_agent
-eb: daq_netmem daq_evtbuild daq_agent
-anal: daq_sniff daq_anal
-manage: daq_manage
-xmanage: daq_xmanage anal
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
<!-- test6 -->
<!-- test7 -->
<!-- test8 -->
+<!-- test9 -->
<html>
<head>
<title>
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-param=ARG use the given parameter source, default is "tcl"
- --with-hardware=ARG use the given readout code, default is "soft",
- possible values are rich, mdc, show, trig, soft
+ --with-hardware=ARG use the given readout code, default is "none",
+ possible values are rich, mdc, show, trig, none
\
--with-epics=ARG indicates the epics base directory, take
default from enviroment EPICS_BASE \
withval="$with_hardware"
else
- with_hardware="soft"
+ with_hardware="none"
fi;
# Check whether --with-epics or --without-epics was given.
elif test x$with_hardware = xtrig
then
hw_objects="hwtrig.o hwtip.o"
-elif test x$with_hardware = xsoft
+elif test x$with_hardware = xnone
then
- hw_objects="hwsoft.o"
+ hw_objects=""
else
{ { echo "$as_me:$LINENO: error: Unknown hardware $with_hardware" >&5
echo "$as_me: error: Unknown hardware $with_hardware" >&2;}
AC_ARG_ENABLE(xmanage, [ --enable-xmanage enable build of daq_xmanage, needs tk/X11])
AC_ARG_ENABLE(manage, [ --enable-manage enable build of daq_manage, needs tcl])
AC_ARG_WITH(param, [ --with-param[=ARG] use the given parameter source, default is "tcl"],,with_param="tcl")
-AC_ARG_WITH(hardware, [ --with-hardware[=ARG] use the given readout code, default is "soft",
- possible values are rich, mdc, show, trig, soft],,with_hardware="soft")
+AC_ARG_WITH(hardware, [ --with-hardware[=ARG] use the given readout code, default is "none",
+ possible values are rich, mdc, show, trig, none],,with_hardware="none")
AC_ARG_WITH(epics, \
[ --with-epics[=ARG] indicates the epics base directory, take
default from enviroment EPICS_BASE] \
then
LDFLAGS="-L$with_epics/lib/$EPICS_HOST_ARCH $LDFLAGS"
fi
-AC_SEARCH_LIBS(Tcl_CreateInterp, tcl)
+AC_SEARCH_LIBS([Tcl_CreateInterp], [tcl tcl8.3 tcl8.2 tcl8.0 tcl7.4])
AC_SEARCH_LIBS(conParam, caParam, LIBS="-lcaParam -lca -lCom $LIBS",, -lca -lCom)
elif test x$with_param = xfile
then
AC_SEARCH_LIBS(conParam, oraParam)
elif test x$with_param = xtcl
then
-AC_SEARCH_LIBS(Tcl_CreateInterp, tcl)
+AC_SEARCH_LIBS([Tcl_CreateInterp], [tcl tcl8.3 tcl8.2 tcl8.0 tcl7.4])
AC_SEARCH_LIBS(conParam, tclParam)
else
AC_ERROR([Unknown parameter source $with_param])
elif test x$with_hardware = xtrig
then
hw_objects="hwtrig.o hwtip.o"
-elif test x$with_hardware = xsoft
+elif test x$with_hardware = xnone
then
- hw_objects="hwsoft.o"
+ hw_objects=""
else
AC_ERROR([Unknown hardware $with_hardware])
fi
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/ctrlctu.c,v 6.16 2003-05-14 13:54:42 muench Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/ctrlctu.c,v 6.17 2003-08-27 12:29:30 muench Exp $";
#define _XOPEN_SOURCE
#define _POSIX_C_SOURCE 199506L
unsigned long value;
int oper;
unsigned long *ctuEnabled;
- struct timespec t1 =
- {1, 0};
- struct timespec t3 =
- {3, 0};
+ struct timespec t1 = { 1, 0 };
+ struct timespec t3 = { 3, 0 };
openlog(argv[0], LOG_PID | LOG_PERROR, LOG_LOCAL0);
setlogmask(LOG_UPTO(LOG_INFO));
priority = atoi(optarg);
break;
case 'v':
- for (i = 0; prioritynames[i].c_name != NULL
- && 0 != strcmp(prioritynames[i].c_name, optarg); i++) {
+ for (i = 0; prioritynames[i].c_name != NULL && 0 != strcmp(prioritynames[i].c_name, optarg); i++) {
}
if (prioritynames[i].c_name == NULL) {
usage(argv[0]);
typedef struct HardwareS Hardware;
+int readoutMain(int argc, char *argv[]);
+
Hardware *newHardware(); /* allowed as newHardware(void) and newHardware(const char *subsystem) UFN */
void deleteHardware(Hardware *my);
int Hardware_inSpill(const Hardware *my);
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwmdc.c,v 6.29 2003-02-14 11:54:40 sailer Exp $";
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <syslog.h>
-
-#include <allParam.h>
-#include "subevt.h"
-#include "hwsam.h"
-
-struct HardwareS {
- size_t maxSubEvtSize;
- int nSams;
- HwSam **sam;
-};
-
-#include "hardware.h"
-
-size_t Hardware_maxSubEvtSize(const Hardware *my)
-{
- return my->maxSubEvtSize;
-}
-
-int Hardware_inSpill(const Hardware *my)
-{
- return 0;
-}
-
-Hardware *newHardware(const char *subsystem)
-{
- Hardware *my;
- Param paramS, *param = ¶mS;
- int i;
- const char *ss;
- char cardsS[PARAM_MAX_ARRAY_LEN][PARAM_MAX_VALUE_LEN];
- char *cards[PARAM_MAX_ARRAY_LEN];
- int nCards;
-
- for (i = 0; i < PARAM_MAX_ARRAY_LEN; i++) {
- cards[i] = cardsS[i];
- }
-
- if (strcmp(subsystem, "unknown") == 0) {
- ss = "mdc0";
- syslog(LOG_NOTICE, "Subsystem not set, defaulting to %s", ss);
- } else {
- ss = subsystem;
- }
-
- if (0 > conSetupParam(param, getenv("DAQ_SETUP"))) {
- syslog(LOG_ERR, "Construction of parameter source failed: %s", strerror(errno));
- return NULL;
- }
- if (0 > getCards(param, ss, "sam", &nCards, cards)) {
- syslog(LOG_ERR, "Retrieval of card list failed");
- return NULL;
- }
- my = malloc(sizeof(Hardware));
- my->sam = malloc(nCards * sizeof(HwSam *));
- my->nSams = nCards;
-
- my->maxSubEvtSize = SubEvt_hdrSize() + (my->nSams * 2564 * sizeof(uint32_t));
-
- for (i = 0; i < my->nSams; i++) {
- my->sam[i] = malloc(sizeof(HwSam));
- if (0 > conHwSam(my->sam[i], cards[i], param)) {
- syslog(LOG_ERR, "Construction of card %s failed:%s", cards[i], strerror(errno));
- return NULL;
- }
- }
-
- desParam(param);
- return my;
-}
-
-void deleteHardware(Hardware *my)
-{
- int i;
-
- for (i = 0; i < my->nSams; i++) {
- desHwSam(my->sam[i]);
- free(my->sam[i]);
- }
-
- free(my->sam);
- free(my);
-}
-
-void Hardware_waitForTrigger(Hardware *my, void *partEvt)
-{
- int i;
- int nRequests = 0;
- int nPoll = 0;
- const int nPollMax = 60 / my->nSams;
- int firstSam = -1;
- void *subEvt = SubEvt_data(partEvt);
- static unsigned long trigNr = 0;
- unsigned trigTag;
- int dataError;
-
- /* init partial event, necessary for SubEvt_next() */
- SubEvt_setDecoding(partEvt, SubEvtDecoding_SubEvts);
- dataError = 0;
- SubEvt_setId(partEvt, 0);
-
- for (i = 0; i < my->nSams; i++) {
- if (HwSam_isEmpty(my->sam[i])) {
- HwSam_requestBuffer(my->sam[i]);
- ++nRequests;
- }
- }
-
- do {
- for (i = 0; i < my->nSams; i++) {
- if (HwSam_isBufRequested(my->sam[i])) {
- if (!HwSam_isBusy(my->sam[i])) {
- HwSam_getEndOfData(my->sam[i]);
- if (HwSam_readSubEvt(my->sam[i], subEvt) == 0) {
- if (SubEvt_dataError(subEvt)) {
- dataError = 1;
- }
- if (firstSam < 0) {
- trigTag = SubEvt_trigNr(subEvt) & 0xff;
- firstSam = i;
- } else {
- if (trigTag != (SubEvt_trigNr(subEvt) & 0xff)) {
- dataError = 1;
- syslog(LOG_ERR, "(%s)Trigger tag mismatch: 0x%08x (%d) != 0x%08x",
- my->sam[i]->name, trigTag, firstSam, SubEvt_trigNr(subEvt));
- }
- }
- subEvt = SubEvt_next(partEvt, subEvt);
- }
- --nRequests;
- }
- }
- }
-#if 1
-/*
-* This sleep prevents a tight loop which stops work on real
-* time systems if the priority of readout is not lowered.
-* When not using the sleep use option -p -2 for daq_readout.
-*/
- if (nRequests == my->nSams && nPoll++ >= nPollMax) {
- struct timespec tS, *t = &tS;
- t->tv_sec = 0;
- t->tv_nsec = 020000000;
- nanosleep(t, NULL);
- }
-#endif
- } while (nRequests);
-#if 0
- if (dataError) {
- SubEvt_setDataError(partEvt);
- }
-#endif
- SubEvt_setTrigNr(partEvt, trigNr << 8 | trigTag);
- SubEvt_setSize(partEvt, (char *) subEvt - (char *) partEvt);
- 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)
-{
- int i;
-
- /* read all sams, check for common trigger tag */
- for (i = 0; i < my->nSams; i++) {
- }
-}
+++ /dev/null
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.25 2002-11-19 02:32:53 hadaq Exp $";
-
-#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-
-#include <assert.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-#include <time.h>
-
-#include <allParam.h>
-#include <lvme.h>
-
-#include "subevt.h"
-#include "rc.h"
-#include "hwrace.h"
-
-int conHwRace(HwRace *my, const char *name, const Param *param)
-{
- unsigned long cardBase;
- unsigned long statusId;
- int paramWasFound;
-
- assert(my != NULL);
-
- strcpy(my->name, name);
-
- Param_getInt(param, my->name, "cardbase", ¶mWasFound, &cardBase);
- if (!paramWasFound) {
- syslog(LOG_ERR, "Parameter %s(cardbase) not found", my->name);
- return -1;
- }
- my->rc = malloc(sizeof(Rc));
- if (0 > conRc(my->rc, "rc", cardBase)) {
- syslog(LOG_ERR, "%s on %p not found", my->name, cardBase);
- return -1;
- }
- Param_getInt(param, my->name, "status_id", ¶mWasFound, &statusId);
- if (!paramWasFound) {
- syslog(LOG_ERR, "Parameter %s(status_id) not found", my->name);
- return -1;
- }
- my->lInt = malloc(sizeof(LInt));
- conLInt(my->lInt, statusId);
-
- my->currAddr = 0x7fffffff;
- my->endOfData = 0;
-
- return 0;
-}
-
-void desHwRace(HwRace *my)
-{
- desLInt(my->lInt);
- free(my->lInt);
- desRc(my->rc);
- free(my->rc);
-}
-
-void HwRace_requestBuffer(HwRace *my)
-{
- Rc_setSwrq(my->rc);
- Rc_clrSwrq(my->rc);
-
- my->currAddr = 0;
-
- /* to indicate a buffer request state which is cleared by getEndOfData */
- my->endOfData = 0;
-}
-
-#define RACE_NODATASIZE 0x00
-int HwRace_readSubEvt(HwRace *my, void *subEvt)
-{
- int readSubEvtR;
- unsigned long size;
- unsigned long lastAddr;
-
- size = Rc_readMem(my->rc, my->currAddr);
- lastAddr = my->currAddr + size;
-
- if (size <= RACE_NODATASIZE) {
- my->currAddr = lastAddr;
- readSubEvtR = 1;
- syslog(LOG_DEBUG, "subEvt: empty, skipped");
- } else {
- uint32_t *data = (uint32_t *) subEvt;
-
- /* copy one sub evt from RC to memory */
- while (my->currAddr < lastAddr) {
- *data++ = Rc_readMem(my->rc, my->currAddr);
- my->currAddr += 4;
- }
- readSubEvtR = 0;
- syslog(LOG_DEBUG, "subEvt: %s", SubEvt_2charP(subEvt));
- }
-
- /* align currAddr to next page */
- my->currAddr = lastAddr + (RCPAGESIZE - 1) & ~(RCPAGESIZE - 1);
-
- return readSubEvtR;
-}
+++ /dev/null
-
-#ifndef HwRace_H
-#define HwRace_H
-
-#include <lvme.h>
-
-#include <allParam.h>
-#include "rc.h"
-
-typedef struct HwRaceS {
- char name[12];
- Rc *rc;
- LInt *lInt;
- int currAddr;
- int endOfData;
-}
-
-HwRace;
-
-#define RCPAGESIZE 0x100U
-
-int conHwRace(HwRace *my, const char *name, const Param *param);
-void desHwRace(HwRace *my);
-
-void HwRace_requestBuffer(HwRace *my);
-
-static int HwRace_isEmpty(HwRace *my)
-{
- return my->currAddr >= my->endOfData;
-}
-
-int HwRace_readSubEvt(HwRace *my, void *subEvt);
-
-static int HwRace_isBufRequested(HwRace *my)
-{
- return my->endOfData == 0;
-}
-
-static void HwRace_getEndOfData(HwRace *my)
-{
- LInt_wait(my->lInt);
- syslog(LOG_DEBUG, "%s: irq received", my->name);
- my->endOfData = Rc_getPages(my->rc) * RCPAGESIZE;
-}
-
-#endif
+++ /dev/null
-
-
-
-
-
-
-
-#ifndef HwSam_H
-#define HwSam_H
-
-#include <lvme.h>
-#include <allParam.h>
-#include "sam_defs.h"
-
-typedef struct HwSamS {
- char name[12];
- LVme *cram;
- LVme *regs;
- int bankRequested;
- unsigned long currAddr;
- unsigned long endOfData;
-}
-
-HwSam;
-
-int conHwSam(HwSam *my, const char *name, const Param *param);
-void desHwSam(HwSam *my);
-int HwSam_readSubEvt(HwSam *my, void *subEvt);
-
-void HwSam_getEndOfData(HwSam *my);
-
-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);
-
-#endif
+++ /dev/null
-
-
-#ifndef HWTIP_H
-#define HWTIP_H
-
-#include <lvme.h>
-
-#include <allParam.h>
-#include "tof_defs.h"
-
-typedef struct HwTipS {
- char name[12];
- LVme *lvme;
- int bankRequested;
- int daqRq;
- int daqGr;
- int currAddr;
- int fifo;
- int endOfData;
-}
-
-HwTip;
-
-
-int conHwTip(HwTip *my, const char *name, const Param *param);
-void desHwTip(HwTip *my);
-
-static int HwTip_isBusy(HwTip *my)
-{
- return !LVme_tstBitL(my->lvme, CONFIG1BASE + CFG_MASTER_STATUS, my->daqGr);
-}
-static void HwTip_getEndOfData(HwTip *my)
-{
- my->endOfData = LVme_getL(my->lvme, my->fifo) + my->fifo;
-}
-
-static int HwTip_isEmpty(HwTip *my)
-{
- return my->currAddr >= my->endOfData;
-}
-
-void HwTip_requestBuffer(HwTip *my);
-int HwTip_readSubEvt(HwTip *my, void *subEvt);
-
-#endif
+++ /dev/null
-
-/* ------------------------------------------------------------
- - Header File for the Image Processing Card (Basis-Module) -
- ------------------------------------------------------------
-
- Date: 20/01/1999 Author: Markus Petri
-
- Remarks: LVL2_DATASTART added by W. Koenig Apr. 2002
-
- ~
- ~
- ~
-*/
-#if !defined(IPC_BASIS)
-
-#include <lvme.h>
-#define IPC_1_BASIS 0xc00000
-#define IPC_2_BASIS 0xc00000
-#define IPC_ASPACE 0x00100000
-
-#define LVL2_OFFSET 0x60000
-#define LVL2_DATASTART LVL2_OFFSET + 0x4
-#define LUT5_OFFSET 0x40000
-
-#define RC3_ACCESS_OFF 0x04022
-#define RC3_ACCESS_ON 0x04020
-#define RC3_VME_REG_B 0x0401a
-#define RC3_VME_REG_A 0x04018
-#define RC3_LM_BADDRREG 0x04016
-#define RC3_ERRREG_B 0x04014
-#define RC3_ERRREG_A 0x04012
-#define RC3_BYSREG_B 0x04010
-#define RC3_BYSREG_A 0x0400e
-#define RC3_DISPLAY_REG 0x0400c
-#define RC3_DISPLAY_RESET 0x0400a
-#define RC3_FIFO_RESET 0x04008
-#define RC3_SHOWER_MODE 0x04006
-#define RC3_TEST_MODE 0x04004
-#define RC3_CONF_MODE 0x04002
-#define RC3_STANDBY_MODE 0x04000
-
-#define ADDON_ACCESS_OFF 0x02012
-#define ADDON_ACCESS_ON 0x02010
-#define ADDON_SELECT_DEV 0x0213c
-#define ADDON_SUBEVT_ID_2 0x02126
-#define ADDON_SUBEVT_ID_1 0x02124
-#define ADDON_THRESHOLD_2 0x0211c
-#define ADDON_THRESHOLD_1 0x0211a
-#define ADDON_STATUS_2 0x02118
-#define ADDON_STATUS_1 0x02116
-#define ADDON_FIFO_LD_STR 0x02114
-#define ADDON_FIFO_LD_DISAB 0x02112
-#define ADDON_FIFO_LD_ENAB 0x02110
-#define ADDON_FIFO_RESET 0x02108
-#define ADDON_SHOWER_MODE 0x02106
-#define ADDON_TEST_MODE 0x02104
-#define ADDON_CONF_MODE 0x02102
-#define ADDON_STANDBY_MODE 0x02100
-
-#define LVL2_ACCESS_OFF 0x0101e
-#define LVL2_ACCESS_ON 0x0101c
-#define LVL2_ACCESS_VMEREG 0x0100c
-#define LVL2_SEL_VMEREG 0x0100a
-#define LVL2_VME_RCLK 0x01008
-#define LVL2_SHOWER_MODE 0x01006
-#define LVL2_TEST_MODE 0x01004
-#define LVL2_CONF_MODE 0x01002
-#define LVL2_STANDBY_MODE 0x01000
-
-#define PEDAS_ACCESS_OFF 0x00e02
-#define PEDAS_ACCESS_ON 0x00e00
-#define PEDAS_PEDCOR_OFF 0x00c0c
-#define PEDAS_PEDCOR_ON 0x00c0a
-#define PEDAS_FIFO_RESET 0x00c08
-#define PEDAS_SHOWER_MODE 0x00c06
-#define PEDAS_TEST_MODE 0x00c04
-#define PEDAS_CONF_MODE 0x00c02
-#define PEDAS_STANDBY_MODE 0x00c00
-
-#define RC1_ACCESS_OFF 0x00a1e
-#define RC1_ACCESS_ON 0x00a1c
-#define RC1_LD_F12_DISAB 0x00a10
-#define RC1_LD_F12_ENAB 0x00a0e
-#define RC1_FIFO_RCLK 0x00a0c
-#define RC1_VME_LVL2 0x00a0a
-#define RC1_FIFO_RESET 0x00a08
-#define RC1_SHOWER_MODE 0x00a06
-#define RC1_TEST_MODE 0x00a04
-#define RC1_CONF_MODE 0x00a02
-#define RC1_STANDBY_MODE 0x00a00
-
-#define ALT3456_CONF_ON 0x0081c
-#define ALT3456_CONF_OFF 0x0081a
-#define ALT3456_CONF_REG 0x00818
-
-#define ALT12_CONF_ON 0x00816
-#define ALT12_CONF_OFF 0x00814
-#define ALT12_CONF_REG 0x00812
-
-#define RESET_ADDON 0x00806
-#define RESET_LVL1 0x00804
-#define RESET_PEDAS 0x00802
-#define RESET_LUTS 0x00800
-
-#define ID_CTR_ACCESS_ON 0x00600
-#define ID_CTR_ACCESS_OFF 0x00200
-
-#define ID_CTR_SW_TO_ADDON 0x000e0
-#define ID_CTR_SHOWER_MODE 0x000c0
-#define ID_CTR_TEST_MODE 0x000a0
-#define ID_CTR_CONF_MODE 0x00080
-#define ID_CTR_STANDBY_MODE 0x00060
-#define ID_CTR_SW_TO_LUT12 0x00040
-#define ID_CTR_SW_TO_LUT34 0x00020
-
-#define LUT_CTR_STANDBY_MODE 0x00000
-#define LUT_CTR_CONF_MODE 0x00002
-#define LUT_CTR_TEST_MODE 0x00004
-#define LUT_CTR_SHOWER_MODE 0x00006
-#define LUT_CTR_REG_ADDR_A 0x00008
-#define LUT_CTR_REG_ADDR_B 0x0000a
-#define LUT_CTR_REG_DATA 0x0000c
-#define LUT1_WE 0x0000e /* bzw. LUT3_WE */
-#define LUT2_WE 0x00010 /* bzw. LUT4_WE */
-#define LUT12_WE 0x00012 /* bzw. LUT34_WE */
-#define LUT1234_READ 0x00014
-#define LUT_CTR_LD_F12_ENAB 0x00016
-#define LUT_CTR_LD_F12_DISAB 0x00018
-#define LUT_CTR_LD_REG 0x0001a
-#define LUT_CTR_LD_STR 0x0001e
-
-
-/* -- Operational Modes of the Image Processing Card --
-
-These codes/flags are just used by the controlling C-software
-
- - NORMAL_MODE : all address lines are exclusively decoded by the
- VME-Controller.
-
- - LUT_CONF_MODE : A9-A1 address lines are map to the ID-Controller
- and are used to control the ID-Controller and the
- Look up Table #1 through #4
-
- - xxxxxxxxx :
-*/
-
-#define STANDBY_MODE 0x0
-#define CONF_MODE 0x1
-#define TEST_MODE 0x2
-#define SHOWER_MODE 0x3
-#define LUT_CONF_MODE 0x4
-#define LUT_TEST_MODE 0x5
-#define LUT_STANDBY_MODE 0x6
-#define RESET 0x7
-#define NO_MODE_CHG 0x77
-
-#define TEST_VECTOR_SIZE 100000
-#define LUT5_SIZE 524287
-#define LUT1234_SIZE 131071
-#define LVL2_SIZE 65536
-#define EVENT_SIZE 388
-
-#define FILENAME_LENGTH 30
-#define CONF_VECTOR_SIZE 750000
-#define COL_WIDTH 3
-#define COLS_ALT3456 91
-#define COLS_ALT12 60
-
-#define ALTERA_3456 1
-#define ALTERA_12 0
-
-#define TDAT_RANDOM 1
-#define TDAT_ZERO 2
-
-#define INTACTIVE 1
-#define BATCH 0
-
-#define SRAM_A 0
-#define SRAM_B 1
-
-#define POS 1
-#define NEG 0
-
-#define END_PATTERN 0x23ad
-#define ZERO_SUPPRESSION_ON 0x8
-#define ZERO_SUPPRESSION_OFF 0x0
-#define PEDASTAL_ON 0x1
-#define PEDASTAL_OFF 0x0
-#define SEL_SRAM_A 0x0
-#define SEL_SRAM_B 0x2
-#define SEL_LVL2_PIPE 0x0
-#define SEL_LVL2_BUFFER 0x1
-#define SUBEVT_BUILDER_ID 0x7575
-
-/* VME accessible LVL2_Registers */
-#define LVL2_LVL2MODE_VMEREG 0x1
-#define LVL2_SUBID_VMEREG 0x2
-#define LVL2_SELMEM_VMEREG 0x3
-#define LVL2_STATUS_VMEREG 0x3
-#define LVL2_REVID_VMEREG 0x5
-
-/* Layers, Rows, Columns per Image Processing Card */
-#define IPC_LAYS 3
-#define IPC_ROWS 16
-#define IPC_COLS 32
-
-/* Layers, Rows, Columns per Readout Board */
-#define RB_LAYS 3
-#define RB_ROWS 32
-#define RB_COLS 16
-#define NUM_RBS 2 /* Number of RBs in current test 1 or 2 */
-#define NUM_RB_FIFOS 2 /* Number of fifos per RB */
-#define NUM_ROWS_RB_FIFO 8 /* Number of detector colmuns per RB fifo */
-
-#define MAX_LINE_CHARS 50
-
-void IPC_Conf_Display(LVme *lvme, unsigned long ul_dummy);
-void IPC_Write_Display(LVme *lvme, int char_pos, char character);
-void IPC_Reset_Display(LVme *lvme);
-int IPC_Status_FPGA(LVme *lvme, int mode, int dev_chain);
-void IPC_Set_OpMode(LVme *lvme, int i_choice);
-void IPC_Set_Lvl1_Depth(LVme *lvme, int i_thres);
-void IPC_Fifo_Reset(LVme *lvme, int i_mode);
-void IPC_Write_SubID(LVme *lvme, unsigned long ul_daten);
-void IPC_Set_Lvl2_MemBank(LVme *lvme, int i_l2ab);
-void IPC_Write_LMAddr(LVme *lvme, unsigned short us_lmbaddr,
- int i_mode);
-void IPC_Set_BsyErr_Mask(LVme *lvme, int i_bsymsk, int i_errmsk,
- int i_mode);
-void IPC_Set_Lvl2_Mode(LVme *lvme, unsigned long us_daten);
-void IPC_Set_PedMode(LVme *lvme, unsigned short us_pedes,
- int i_mode);
-void IPC_Clear_Lvl2(LVme *lvme, int i_mode);
-void IPC_Set_Shower_Threshold(LVme *lvme, int i_device,
- int i_shower_threshold, int i_mode);
-void IPC_Get_Shower_Threshold(LVme *lvme, int i_device,
- unsigned i_shower_threshold,
- int i_mode);
-void IPC_Set_Addon_Status(LVme *lvme, int i_device,
- int i_addon_status, int i_mode);
-void IPC_Get_Addon_Status(LVme *lvme, int i_device,
- int i_addon_status, int i_mode);
-void IPC_Set_Addon_SubID(LVme *lvme, int i_device,
- int i_subevt_id, int i_mode);
-void IPC_Get_Addon_SubID(LVme *lvme, int i_device,
- int i_subevt_id, int i_mode);
-void IPC_Conf_Lut1234(LVme *lvme, const char *filename, int i_calmode,
- int i_sector, int i_rbhigh, int i_mode);
-int IPC_Lut1234_Access(LVme *lvme, int i_layer, int i_row,
- int i_column, int i_ucal_pad, int i_cal_pad,
- int i_mode);
-void IPC_Conf_Lut5(LVme *lvme, const char *filename, int ipc_sector,
- int ipc_rbhigh, int i_mode);
-void IPC_Conf_FPGA(LVme *lvme, const char *filename, int dev_chain,
- int mode);
-int IPC_Status_FPGA(LVme *lvme, int dev_chain, int mode);
-void IPC_Init_FPGA(LVme *lvme, int mode, int dev_chain);
-void IPC_Read_Status_Regs(LVme *lvme);
-int IPC_GetPedestals(const char *pFileName, int iSector, int iRBHigh,
- unsigned char pedestals[][][]);
-void IPC_create_lut1234_daten();
-#endif
+++ /dev/null
-
-#ifndef RC_H
-#define RC_H
-
-#include <stddef.h>
-#include <lvme.h>
-
-typedef struct RcS {
- LVme *lvme;
-}
-
-Rc;
-
-/**********************************
- * INTERFACE3 Xilinx part *
- * based on ver3rev1, Feb. 2000 *
- **********************************/
-
-enum Rc_regions {
- memRegion = 0x100000,
- busRegion = 0x200000,
- regRegion = 0x300000,
- xcRegion = 0x400000,
- dprRegion = 0x500000
-};
-
-static const size_t Rc_addrSpace = 0x600000;
-
-/* Offsets for INTERFACE2 registers */
-static const ptrdiff_t ctrlReg = regRegion + 0x000;
-static const ptrdiff_t ctrlPad = regRegion + 0x002;
-static const ptrdiff_t trgReg = regRegion + 0x004;
-static const ptrdiff_t trgPad = regRegion + 0x006;
-static const ptrdiff_t trgCtr = regRegion + 0x008;
-static const ptrdiff_t prdoutCtr = regRegion + 0x00a;
-static const ptrdiff_t ardoutCtr = regRegion + 0x00c;
-static const ptrdiff_t adelCtr = regRegion + 0x00e;
-static const ptrdiff_t tagReg = regRegion + 0x010;
-static const ptrdiff_t lcReg = regRegion + 0x012;
-/* static const ptrdiff_t unused1 = regRegion + 0x014; */
-/* static const ptrdiff_t unused2 = regRegion + 0x016; */
-/* static const ptrdiff_t unused3 = regRegion + 0x018; */
-/* static const ptrdiff_t unused4 = regRegion + 0x01a; */
-static const ptrdiff_t giopReg = regRegion + 0x01c;
-static const ptrdiff_t giopPad = regRegion + 0x01e;
-
-/* CTRL register definitions */
-static unsigned short Rc_getCtrlReg(Rc *my)
-{
- return LVme_getW(my->lvme, ctrlReg);
-}
-static unsigned short Rc_getCtrlPad(Rc *my)
-{
- return LVme_getW(my->lvme, ctrlPad);
-}
-
-static void Rc_setReset(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 6);
-}
-static void Rc_clrReset(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 6);
-}
-static int Rc_getReset(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 6);
-}
-static int Rc_padReset(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 6);
-}
-
-static void Rc_setMwr(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 7);
-}
-static void Rc_clrMwr(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 7);
-}
-static int Rc_getMwr(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 7);
-}
-static int Rc_padMwr(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 7);
-}
-
-static void Rc_setMsel(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 8);
-}
-static void Rc_clrMsel(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 8);
-}
-static int Rc_getMsel(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 8);
-}
-static int Rc_padMsel(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 8);
-}
-
-static void Rc_setEvtend(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 9);
-}
-static void Rc_clrEvtend(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 9);
-}
-static int Rc_getEvtend(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 9);
-}
-static int Rc_padEvtend(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 9);
-}
-
-static void Rc_setEvtbeg(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 10);
-}
-static void Rc_clrEvtbeg(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 10);
-}
-static int Rc_getEvtbeg(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 10);
-}
-static int Rc_padEvtbeg(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 10);
-}
-
-static void Rc_setSysclk(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 11);
-}
-static void Rc_clrSysclk(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 11);
-}
-static int Rc_getSysclk(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 11);
-}
-static int Rc_padSysclk(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 11);
-}
-
-static void Rc_Cycle(Rc *my)
-{
- if (Rc_getSysclk(my)) {
- Rc_clrSysclk(my);
- Rc_setSysclk(my);
- } else {
- Rc_setSysclk(my);
- Rc_clrSysclk(my);
- }
-}
-
-static void Rc_setSwrq(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 12);
-}
-static void Rc_clrSwrq(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 12);
-}
-static int Rc_getSwrq(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 12);
-}
-static int Rc_padSwrq(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 12);
-}
-
-static void Rc_setStop(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 13);
-}
-static void Rc_clrStop(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 13);
-}
-static int Rc_getStop(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 13);
-}
-static int Rc_padStop(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 13);
-}
-
-/* Magic numbers */
-static const int PRDOUT = 0x00; /* Pattern readout (daisy chain) */
-static const int TEST = 0x01; /* Test Mode activation (buslike) */
-static const int ARDOUT = 0x02; /* Analog readout (daisy chain) */
-static const int ADEL = 0x03; /* Analog delete (buslike) */
-static const int RFIFO = 0x04; /* Reset FIFO (buslike) */
-static const int RDAISY = 0x05; /* Reset daisy chain (buslike) */
-static const int WCFG = 0x06; /* Write configuration (daisy chain) */
-static const int RCFG = 0x07; /* Read configuration (daisy chain) */
-static const int NOP = 0x0F; /* No OPeration - do nothing */
-
-/* Test mode is available only in the GUF (Grand Unified Frontend) */
-
-static void Rc_setFc(Rc *my, int fc)
-{
- unsigned short savedCtrlReg;
- savedCtrlReg = LVme_getW(my->lvme, ctrlReg);
- savedCtrlReg = (savedCtrlReg & 0xFFF0) | (fc & 0x000F);
- LVme_setW(my->lvme, ctrlReg, savedCtrlReg);
-}
-
-static int Rc_getFc(Rc *my)
-{
- return LVme_getW(my->lvme, ctrlReg) & 0x000f;
-}
-
-static void Rc_setError(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 4);
-}
-static void Rc_clrError(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 4);
-}
-static int Rc_getError(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 4);
-}
-static int Rc_padError(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 4);
-}
-
-static void Rc_setRcbsy(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 5);
-}
-static void Rc_clrRcbsy(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 5);
-}
-static int Rc_getRcbsy(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlReg, 5);
-}
-static int Rc_padRcbsy(Rc *my)
-{
- return LVme_tstBitW(my->lvme, ctrlPad, 5);
-}
-
-/* TRG register definitions */
-static unsigned short Rc_getTrgReg(Rc *my)
-{
- return LVme_getW(my->lvme, trgReg);
-}
-static unsigned short Rc_getTrgPad(Rc *my)
-{
- return LVme_getW(my->lvme, trgPad);
-}
-
-static void Rc_setStrb0(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 0);
-}
-static void Rc_clrStrb0(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 0);
-}
-static int Rc_getStrb0(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 0);
-}
-static int Rc_padStrb0(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 0);
-}
-
-static void Rc_setStrb1(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 1);
-}
-static void Rc_clrStrb1(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 1);
-}
-static int Rc_getStrb1(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 1);
-}
-static int Rc_padStrb1(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 1);
-}
-
-static void Rc_setStrb2(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 2);
-}
-static void Rc_clrStrb2(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 2);
-}
-static int Rc_getStrb2(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 2);
-}
-static int Rc_padStrb2(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 2);
-}
-
-static void Rc_setStrb3(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 3);
-}
-static void Rc_clrStrb3(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 3);
-}
-static int Rc_getStrb3(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 3);
-}
-static int Rc_padStrb3(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 3);
-}
-
-static void Rc_setStrb4(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 4);
-}
-static void Rc_clrStrb4(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 4);
-}
-static int Rc_getStrb4(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 4);
-}
-static int Rc_padStrb4(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 4);
-}
-
-static void Rc_setStrb5(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 5);
-}
-static void Rc_clrStrb5(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 5);
-}
-static int Rc_getStrb5(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 5);
-}
-static int Rc_padStrb5(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 5);
-}
-
-static void Rc_setStrb6(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 6);
-}
-static void Rc_clrStrb6(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 6);
-}
-static int Rc_getStrb6(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 6);
-}
-static int Rc_padStrb6(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 6);
-}
-
-static void Rc_setStrb7(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 7);
-}
-static void Rc_clrStrb7(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 7);
-}
-static int Rc_getStrb7(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 7);
-}
-static int Rc_padStrb7(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 7);
-}
-
-/* Range for port: 0...7; other values are dangerous and no checking for the correct value is done ! */
-static void Rc_setStrbPort(Rc *my, int port)
-{
- LVme_setBitW(my->lvme, trgReg, port & 0x07);
-}
-static void Rc_clrStrbPort(Rc *my, int port)
-{
- LVme_clrBitW(my->lvme, trgReg, port & 0x07);
-}
-static int Rc_getStrbPort(Rc *my, int port)
-{
- return LVme_tstBitW(my->lvme, trgReg, port & 0x07);
-}
-static int Rc_padStrbPort(Rc *my, int port)
-{
- return LVme_tstBitW(my->lvme, trgPad, port & 0x07);
-}
-
-static void Rc_StrobePort(Rc *my, int port)
-{
- Rc_clrStrbPort(my, port);
- Rc_setStrbPort(my, port);
-}
-
-static void Rc_setDecision(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 8);
-}
-static void Rc_clrDecision(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 8);
-}
-static int Rc_getDecision(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 8);
-}
-static int Rc_padDecision(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 8);
-}
-
-static void Rc_setArdout(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 9);
-}
-static void Rc_clrArdout(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 9);
-}
-static int Rc_getArdout(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 9);
-}
-static int Rc_padArdout(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 9);
-}
-
-static void Rc_setPrdout(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 10);
-}
-static void Rc_clrPrdout(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 10);
-}
-static int Rc_getPrdout(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 10);
-}
-static int Rc_padPrdout(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 10);
-}
-
-static void Rc_setBegrun(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 11);
-}
-static void Rc_clrBegrun(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 11);
-}
-static int Rc_getBegrun(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 11);
-}
-static int Rc_padBegrun(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 11);
-}
-
-static void Rc_setTagclk(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 12);
-}
-static void Rc_clrTagclk(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 12);
-}
-static int Rc_getTagclk(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 12);
-}
-static int Rc_padTagclk(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 12);
-}
-
-static void Rc_setTagdata(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 13);
-}
-static void Rc_clrTagdata(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 13);
-}
-static int Rc_getTagdata(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 13);
-}
-static int Rc_padTagdata(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 13);
-}
-
-static void Rc_setTbsy(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 14);
-}
-static void Rc_clrTbsy(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 14);
-}
-static int Rc_getTbsy(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 14);
-}
-static int Rc_padTbsy(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 14);
-}
-
-static void Rc_setTrg(Rc *my)
-{
- LVme_setBitW(my->lvme, trgReg, 15);
-}
-static void Rc_clrTrg(Rc *my)
-{
- LVme_clrBitW(my->lvme, trgReg, 15);
-}
-static int Rc_getTrg(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgReg, 15);
-}
-static int Rc_padTrg(Rc *my)
-{
- return LVme_tstBitW(my->lvme, trgPad, 15);
-}
-
-static void Rc_TriggerPort(Rc *my)
-{
- Rc_clrTrg(my);
- Rc_setTrg(my);
-}
-
-/* Status counter access */
-static unsigned short Rc_getTrgCtr(Rc *my)
-{
- return LVme_getW(my->lvme, trgCtr);
-}
-static unsigned short Rc_getPrdoutCtr(Rc *my)
-{
- return LVme_getW(my->lvme, prdoutCtr);
-}
-static unsigned short Rc_getArdoutCtr(Rc *my)
-{
- return LVme_getW(my->lvme, ardoutCtr);
-}
-static unsigned short Rc_getAdelCtr(Rc *my)
-{
- return LVme_getW(my->lvme, adelCtr);
-}
-
-static void Rc_setRctr(Rc *my)
-{
- LVme_setBitW(my->lvme, ctrlReg, 15);
-}
-static void Rc_clrRctr(Rc *my)
-{
- LVme_clrBitW(my->lvme, ctrlReg, 15);
-}
-
-static void Rc_ClrCtrs(Rc *my)
-{
- Rc_setRctr(my);
- Rc_clrRctr(my);
-}
-
-/* TAG register definitions */
-/* This register contains the last distributed SubEventTag */
-
-static unsigned short Rc_getTagReg(Rc *my)
-{
- return LVme_getW(my->lvme, tagReg);
-}
-
-/* LC register definitions */
-/* This register contains information on the last command delivered by the DTU_RICH as well */
-/* as the acknowledge of the RC99 hardware. By this register, a DTU_RICH lockup due to a */
-/* missing acknowledge of the RC99 hardware can be easily detected. */
-
-/* Do not use this function alone ! */
-static unsigned short Rc_getLcReg(Rc *my)
-{
- return LVme_getW(my->lvme, lcReg);
-}
-
-static unsigned short Rc_getLcStatus(Rc *my)
-{
- unsigned short LcStatus = 0x0000;
- return LcStatus = (Rc_getLcReg(my) & 0x001f);
-}
-
-/* GIOP register definitions */
-/* This register allows access to five free Xilinx pins equipped with a solder pad. */
-/* By default, these pads are unconnected and can be used for test purposes. */
-
-/* Do not use these functions alone ! */
-static unsigned short Rc_getgiopReg(Rc *my)
-{
- return LVme_getW(my->lvme, giopReg);
-}
-static unsigned short Rc_getgiopPad(Rc *my)
-{
- return LVme_getW(my->lvme, giopPad);
-}
-
-static unsigned short Rc_getInterfaceVersion(Rc *my)
-{
- short giopPadValue;
- giopPadValue = (0xFF00 & Rc_getgiopPad(my)) >> 8;
- return giopPadValue;
-}
-
-
-/*********************************
- * MEMORY3 Xilinx part *
- * based on ver7rev2 Feb. 2000 *
- *********************************/
-
-/* Offsets for MEMORY2 registers */
-static const ptrdiff_t statusid = regRegion + 0x100;
-static const ptrdiff_t bugreg = regRegion + 0x102;
-static const ptrdiff_t memreg = regRegion + 0x104;
-static const ptrdiff_t pages = regRegion + 0x106;
-static const ptrdiff_t sedec_high = regRegion + 0x108;
-static const ptrdiff_t sedec_low = regRegion + 0x10a;
-static const ptrdiff_t seid_high = regRegion + 0x10c;
-static const ptrdiff_t seid_low = regRegion + 0x10e;
-static const ptrdiff_t versionMem = regRegion + 0x110;
-static const ptrdiff_t swCtr = regRegion + 0x112;
-static const ptrdiff_t codeMem = regRegion + 0x114;
-/* static const ptrdiff_t unused3 = regRegion + 0x116; */
-/* static const ptrdiff_t unused4 = regRegion + 0x118; */
-/* static const ptrdiff_t unused5 = regRegion + 0x11a; */
-/* static const ptrdiff_t unused6 = regRegion + 0x11c; */
-/* static const ptrdiff_t unused7 = regRegion + 0x11e; */
-
-/* STATUSID register */
-static unsigned int Rc_readStatusid(Rc *my)
-{
- int realId;
- realId = 0x00FF & LVme_getW(my->lvme, statusid);
- return realId;
-}
-static void Rc_writeStatusid(Rc *my, unsigned char value)
-{
- unsigned short savedStatusId;
- savedStatusId = LVme_getW(my->lvme, statusid);
- savedStatusId = (savedStatusId & 0xFF00) | (value & 0x00FF);
- LVme_setW(my->lvme, statusid, savedStatusId);
-}
-static unsigned short Rc_getStatusID(Rc *my)
-{
- return LVme_getW(my->lvme, statusid);
-}
-
-static void Rc_setIrqR(Rc *my)
-{
- LVme_setBitW(my->lvme, statusid, 15);
-}
-static void Rc_clrIrqR(Rc *my)
-{
- LVme_clrBitW(my->lvme, statusid, 15);
-}
-static int Rc_getIrqR(Rc *my)
-{
- return LVme_tstBitW(my->lvme, statusid, 15);
-}
-static void Rc_setIrqS(Rc *my)
-{
- LVme_setBitW(my->lvme, statusid, 14);
-}
-static void Rc_clrIrqS(Rc *my)
-{
- LVme_clrBitW(my->lvme, statusid, 14);
-}
-static int Rc_getIrqS(Rc *my)
-{
- return LVme_tstBitW(my->lvme, statusid, 14);
-}
-
-static void Rc_IrqRon(Rc *my)
-{
- Rc_setIrqR(my);
-}
-static void Rc_IrqRoff(Rc *my)
-{
- Rc_clrIrqR(my);
-}
-static void Rc_IrqSon(Rc *my)
-{
- Rc_setIrqS(my);
-}
-static void Rc_IrqSoff(Rc *my)
-{
- Rc_clrIrqS(my);
-}
-
-/* BUG register */
-static unsigned short Rc_getBug(Rc *my)
-{
- return LVme_getW(my->lvme, bugreg);
-}
-
-/* MEMREG register */
-/* Do not use this function alone */
-static unsigned short Rc_readMemreg(Rc *my)
-{
- return LVme_getW(my->lvme, memreg);
-}
-
-/* Do not use this function alone */
-static void Rc_writeMemreg(Rc *my, unsigned short value)
-{
- LVme_setW(my->lvme, memreg, value);
-}
-static void Rc_setMemfull(Rc *my, unsigned short pages)
-{
- unsigned short realMemreg = 0x0000;
- pages = pages & 0x07FF; /* PAGES auf untere 11 bits begrenzen */
- if (pages == 0x0000) {
- pages++; /* PAGES muss groesser 1 sein (RCBSY) */
- }
- realMemreg = Rc_readMemreg(my); /* Altes Memreg retten */
- realMemreg = realMemreg & 0xF800; /* Alte PAGES loeschen */
- realMemreg = realMemreg | pages; /* Neue PAGES einblenden */
- Rc_writeMemreg(my, realMemreg); /* Memreg zurueckschreiben */
-}
-
-/* PAGES register */
-/* Do not use this function alone */
-static unsigned short Rc_readPages(Rc *my)
-{
- return LVme_getW(my->lvme, pages);
-}
-static unsigned short Rc_getPages(Rc *my)
-{
- unsigned short realPages = 0x0000;
- realPages = Rc_readPages(my); /* read PAGES content */
- realPages = realPages & 0x07ff; /* mask the number out */
- return realPages; /* return value */
-}
-static void Rc_waitSwitchcomplete(Rc *my)
-{
- unsigned short realPages = 0x0000;
- realPages = Rc_readPages(my); /* Altes Register retten */
- realPages = realPages & 0xc000; /* oberste zwei Bits anschauen */
- while ((realPages != 0x0000) || (realPages != 0xc000)) { /* Schleife, bis beide Bits gleich */
- realPages = (Rc_readPages(my) & 0xc000); /* immer wieder reingucken */
- }
-}
-static int Rc_bankRequested(Rc *my)
-{
- unsigned short realPages = 0x0000;
- realPages = Rc_readPages(my);
- realPages = ((realPages & 0x4000) >> 14);
- return (int) realPages;
-}
-static int Rc_bankConfirmed(Rc *my)
-{
- unsigned short realPages = 0x0000;
- realPages = Rc_readPages(my);
- realPages = ((realPages & 0x8000) >> 15);
- return (int) realPages;
-}
-static int Rc_SwitchStatus(Rc *my)
-{
- unsigned short realPages = 0x0000;
- realPages = Rc_readPages(my);
- realPages = ((realPages & 0xc0000) >> 14);
- return (int) realPages;
- /* 0x03: Bank A requested and activated
- 0x02: Bank B requested, request still pending
- 0x01: Bank A requested, request still pending
- 0x00: Bank B requested and activated */
-}
-static int Rc_testMemfull(Rc *my)
-{
- unsigned short realPages = 0x0000;
- realPages = Rc_readPages(my);
- realPages = (realPages & 0x2000) >> 13;
- return (int) realPages;
-}
-
-/* SEDEC_HIGH register */
-static unsigned short Rc_readSedec_high(Rc *my)
-{
- return LVme_getW(my->lvme, sedec_high);
-}
-static void Rc_writeSedec_high(Rc *my, unsigned short value)
-{
- LVme_setW(my->lvme, sedec_high, value);
-}
-
-/* SEDEC_LOW register */
-static unsigned short Rc_readSedec_low(Rc *my)
-{
- return LVme_getW(my->lvme, sedec_low);
-}
-static void Rc_writeSedec_low(Rc *my, unsigned short value)
-{
- LVme_setW(my->lvme, sedec_low, value);
-}
-
-/* SEID_HIGH register */
-static unsigned short Rc_readSeid_high(Rc *my)
-{
- return LVme_getW(my->lvme, seid_high);
-}
-static void Rc_writeSeid_high(Rc *my, unsigned short value)
-{
- LVme_setW(my->lvme, seid_high, value);
-}
-
-/* SEID_LOW register */
-static unsigned short Rc_readSeid_low(Rc *my)
-{
- return LVme_getW(my->lvme, seid_low);
-}
-static void Rc_writeSeid_low(Rc *my, unsigned short value)
-{
- LVme_setW(my->lvme, seid_low, value);
-}
-
-/* VERSIONMEM register */
-static unsigned short Rc_readVersionMem(Rc *my)
-{
- return LVme_getW(my->lvme, versionMem);
-}
-
-/* SWCTR register */
-static unsigned short Rc_readSwCtr(Rc *my)
-{
- return LVme_getW(my->lvme, swCtr);
-}
-
-/* CODEMEM register */
-static void Rc_HallOfMemory(Rc *my)
-{
- int i = 0;
- char low, high;
- unsigned short word;
- char fame[256];
-
- LVme_setW(my->lvme, codeMem, 0xc0de);
-
- do {
- word = LVme_getW(my->lvme, codeMem);
- low = word & 0xff;
- high = (word >> 8) & 0xff;
- fame[i++] = high;
- fame[i++] = low;
-
- }
- while (high != 0 || low != 0);
- printf(fame);
-}
-
-/***********************
- * TIMING2 Xilinx part *
- * based on verXrevY *
- ***********************/
-
-/* Keep in mind: TIMING2 is a 2nd class Xilinx -> busRegion */
-
-/* Offsets for TIMING2 registers */
-static const ptrdiff_t evtgReg = busRegion + 0x100;
-static const ptrdiff_t errReg = busRegion + 0x102;
-static const ptrdiff_t mskReg = busRegion + 0x104;
-static const ptrdiff_t stwReg = busRegion + 0x106;
-
-/* EVTG-Register read/write (16bit wide) */
-static unsigned short Rc_readEvtgreg(Rc *my)
-{
- return LVme_getW(my->lvme, evtgReg);
-}
-static void Rc_writeEvtgreg(Rc *my, unsigned short value)
-{
- LVme_setW(my->lvme, evtgReg, value);
-}
-
-/* ERR-Register read; write resets register to zero (8bit wide) */
-static int Rc_readErrreg(Rc *my)
-{
- return LVme_getW(my->lvme, errReg);
-}
-static void Rc_writeErrreg(Rc *my, int value)
-{
- unsigned short realValue = 0x0000;
- realValue = 0x0000 | value;
- LVme_setW(my->lvme, errReg, realValue);
-}
-
-/* MSK-Register read/write (8bit wide) */
-static int Rc_readMskreg(Rc *my)
-{
- return LVme_getW(my->lvme, mskReg);
-}
-static void Rc_writeMskreg(Rc *my, int value)
-{
- unsigned short realValue = 0x0000;
- realValue = 0x0000 | value;
- LVme_setW(my->lvme, mskReg, realValue);
-}
-
-/* STW-Register read/write (8bit wide) */
-static int Rc_readStwreg(Rc *my)
-{
- return LVme_getW(my->lvme, stwReg);
-}
-static void Rc_writeStwreg(Rc *my, int value)
-{
- unsigned short realValue = 0x0000;
- realValue = 0x0000 | value;
- LVme_setW(my->lvme, stwReg, realValue);
-}
-
-
-/****************
- * Port XC part *
- ****************/
-
-static const ptrdiff_t Pstatus = busRegion + 0x002;
-static const ptrdiff_t Pcontrol = busRegion + 0x008;
-static const ptrdiff_t portOffset = 0x020;
-
-static unsigned short Rc_getPstat(Rc *my, int port)
-{
- port = port & 0x07;
- return LVme_getW(my->lvme, (port * portOffset + Pstatus));
-}
-static unsigned short Rc_getPctrl(Rc *my, int port)
-{
- port = port & 0x07;
- return LVme_getW(my->lvme, (port * portOffset + Pcontrol));
-}
-
-/* ENXCFG bit: enable configuration of frontend FPGAs */
-static void Rc_setXcfg(Rc *my, int port)
-{
- LVme_setBitW(my->lvme, port * portOffset + Pcontrol, 0);
-}
-
-static void Rc_clrXcfg(Rc *my, int port)
-{
- LVme_clrBitW(my->lvme, port * portOffset + Pcontrol, 0);
-}
-
-static int Rc_getXcfg(Rc *my, int port)
-{
- return LVme_tstBitW(my->lvme, port * portOffset + Pcontrol, 0);
-}
-
-
-/***************
- * Memory part *
- * *
- ***************/
-
-static unsigned long Rc_readMem(Rc *my, unsigned long offsetValue)
-{
- return LVme_getL(my->lvme, memRegion + offsetValue);
-}
-static void Rc_writeMem(Rc *my, unsigned long offsetValue, unsigned long value)
-{
- LVme_setL(my->lvme, memRegion + offsetValue, value);
-}
-
-static void Rc_clearMem(Rc *my)
-{
- long i;
- const long memSize = 0x80000;
- const long clearValue = 0x00000000;
- for (i = 0; i < memSize; i = i + 0x04) {
- Rc_writeMem(my, i, clearValue);
- }
-}
-static long Rc_testMem(Rc *my)
-{
- long i;
- const long memSize = 0x80000;
- const long clearValue = 0x00000000;
- unsigned long different = 0x00000000;
- unsigned long memValue = 0x00000000;
- for (i = 0; i < memSize; i = i + 0x04) {
- memValue = Rc_readMem(my, i);
- if (memValue != clearValue) {
- different++;
- printf("A: 0x%08x: 0x%08x\n", i, memValue);
- }
- }
- return different;
-}
-
-
-/***********************
- * Dualported RAM part *
- * *
- ***********************/
-
-static unsigned short Rc_readDpr(Rc *my, unsigned long offsetValue)
-{
- unsigned long realValue = 0x00000000;
- realValue = LVme_getL(my->lvme, dprRegion + offsetValue);
- realValue = 0x0000FFFF & realValue;
- return realValue;
-}
-static void Rc_writeDpr(Rc *my, unsigned long offsetValue, unsigned short value)
-{
- unsigned long realValue;
- realValue = 0x0000FFFF & value;
- LVme_setL(my->lvme, dprRegion + offsetValue, realValue);
-}
-static void Rc_clearDpr(Rc *my)
-{
- unsigned short i;
- const unsigned short dprSize = 0x8000;
- const unsigned short clearValue = 0x0000;
- for (i = 0; i < dprSize; i = i + 0x04) {
- if (i % 256 == 0) {
- printf(".");
- }
- Rc_writeDpr(my, i, clearValue);
- }
- printf("\n");
-}
-static unsigned short Rc_testDpr(Rc *my)
-{
- unsigned short i;
- const unsigned short dprSize = 0x8000;
- const unsigned short clearValue = 0x0000;
- unsigned short different = 0x0000;
- unsigned short memValue = 0x0000;
- for (i = 0; i < dprSize; i = i + 0x04) {
- memValue = Rc_readDpr(my, i);
- if (memValue != clearValue) {
- different++;
- printf(" -> A: 0x%08x: 0x%04x\n", i, memValue);
- }
- }
- return different;
-}
-
-/************************
- * Internal DB bus part *
- * *
- ************************/
-
-static void Rc_writeDB(Rc *my, ptrdiff_t offset, unsigned short data)
-{
- LVme_setW(my->lvme, busRegion + offset, data);
-}
-static unsigned short Rc_readDB(Rc *my, ptrdiff_t offset)
-{
- return LVme_getW(my->lvme, busRegion + offset);
-}
-
-int Rc_invariant(Rc *my);
-int conRc(Rc *my, const char *name, unsigned long vmeBase);
-void desRc(Rc *my);
-
-
-
-/* This is a comment */
-
-
-
-#endif
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/readout.c,v 6.27 2003-05-14 13:54:45 muench Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/readout.c,v 6.28 2003-08-27 12:29:31 muench Exp $";
#define _POSIX_C_SOURCE 199309L
#define SYSLOG_NAMES
unsigned long queueSize;
char verbosity[PARAM_MAX_VALUE_LEN];
char subsystem[PARAM_MAX_VALUE_LEN];
-}
-
-TheArgs;
+} TheArgs;
static jmp_buf terminateJmp;
desParam(p);
}
-int main(int argc, char *argv[])
+int readoutMain(int argc, char *argv[])
{
int i;
TheArgs theArgsS, *theArgs = &theArgsS;
usage(argv[0]);
goto bailOut0;
}
- for (i = 0; prioritynames[i].c_name != NULL
- && 0 != strcmp(prioritynames[i].c_name, theArgs->verbosity); i++) {
+ for (i = 0; prioritynames[i].c_name != NULL && 0 != strcmp(prioritynames[i].c_name, theArgs->verbosity); i++) {
}
if (prioritynames[i].c_name == NULL) {
goto bailOut0;
goto bailOut1;
}
if (NULL == (shmTrans = ShmTrans_open("subevtqueue", 2 * theArgs->queueSize))) {
- syslog(LOG_ERR,
- "opening shared memory \"%s\": %s", "subevtqueue", strerror(errno));
+ syslog(LOG_ERR, "opening shared memory \"%s\": %s", "subevtqueue", strerror(errno));
goto bailOut2;
}
trigAccepted = Worker_addStatistic(worker, "trigAccepted");
hadTu = ShmTrans_alloc(shmTrans, transportSize);
#ifndef NDEBUG
- syslog(LOG_DEBUG,
- "shmTrans: %p = hadTu: %s", hadTu, HadTu_2charP(hadTu));
+ syslog(LOG_DEBUG, "shmTrans: %p = hadTu: %s", hadTu, HadTu_2charP(hadTu));
#endif
hadTuQueue = malloc(HadTuQueue_sizeOf());
conHadTuQueue(hadTuQueue, hadTu, transportSize);
- while (
- HadTuQueue_size(hadTuQueue) <= theArgs->waterMark
- && NULL != (subEvt = HadTuQueue_alloc(hadTuQueue, Hardware_maxSubEvtSize(hw)))
+ while (HadTuQueue_size(hadTuQueue) <= theArgs->waterMark
+ && NULL != (subEvt = HadTuQueue_alloc(hadTuQueue, Hardware_maxSubEvtSize(hw)))
) {
Hardware_waitForTrigger(hw, subEvt);
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.21 2003-06-04 06:59:25 sailer Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.22 2003-08-27 12:29:31 muench Exp $";
#define _POSIX_C_SOURCE 199309L
#include <unistd.h>
void Worker_stop(const char *name, int timeout)
{
Worker myS, *my = &myS;
- struct timespec t = { 1, 0 };
strcpy(my->name, name);
my->pid = my->statistics[0].value;
if (my->pid > 0) {
if (0 == kill(my->pid, SIGTERM)) {
- nanosleep(&t, NULL); /* LynxOS had problem without this */
- waitpid(my->pid, NULL, 0);
+ while (0 == kill(my->pid, 0)) {
+ struct timespec t = { 1, 0 };
+ nanosleep(&t, NULL);
+ }
}
}
closeStatShm(my);