]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Moved Interrupt handling from hwrich.c to hwrace -- mm
authorhadaq <hadaq>
Wed, 16 Oct 2002 11:38:49 +0000 (11:38 +0000)
committerhadaq <hadaq>
Wed, 16 Oct 2002 11:38:49 +0000 (11:38 +0000)
hadaq/hwrace.c
hadaq/hwrace.h
hadaq/hwrich.c

index 58507e6fe80fc0db074f54f26b81367d8beb0ee9..dcecb95bcc60d7fcaf5a6a0f35396c5beabb01e8 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.22 2002-10-16 08:09:40 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.23 2002-10-16 11:38:49 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -26,8 +26,8 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada
 int conHwRace(HwRace *my, const char *name, const Param *param)
 {
        unsigned long cardBase;
+       unsigned long statusId;
        int paramWasFound;
-       int i;
 
        assert(my != NULL);
 
@@ -35,16 +35,23 @@ int conHwRace(HwRace *my, const char *name, const Param *param)
 
        Param_getInt(param, my->name, "cardbase", &paramWasFound, &cardBase);
        if (!paramWasFound) {
-               syslog(LOG_WARNING,
-                        "Parameter %s(%s) not found, default = 0", my->name, "cardbase");
-               cardBase = 0;
+               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:%d:%s", __FILE__, __LINE__, strerror(errno));
                return -1;
        }
+
+       Param_getInt(param, my->name, "status_id", &paramWasFound, &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;
 
@@ -53,6 +60,8 @@ int conHwRace(HwRace *my, const char *name, const Param *param)
 
 void desHwRace(HwRace *my)
 {
+       desLInt(my->lInt);
+       free(my->lInt);
        desRc(my->rc);
        free(my->rc);
 }
index b68c5666b3cd8ceb06aef6928abf374bd34d9f17..551e66887cf2a1261d5b2c123cb8dc68383f7645 100644 (file)
@@ -11,6 +11,7 @@ typedef struct HwRaceS {
        char name[12];
        Rc *rc;
        LVme_L *buf;
+       LInt *lInt;
        int currAddr;
        int endOfData;
 }
@@ -38,6 +39,8 @@ static int HwRace_isBufRequested(HwRace *my)
 }
 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;
 }
 
index bf5bbe5cb67fc113b1258eb0d74944b41f98a430..ab783b19e1ee97b89ef41daa69e3c3a779925501 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.28 2002-10-16 08:09:40 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.29 2002-10-16 11:38:49 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -19,7 +19,6 @@ struct HardwareS {
        size_t maxSubEvtSize;
        int nRaces;
        HwRace **race;
-       LInt **lInt;
 };
 
 #include "hardware.h"
@@ -65,27 +64,16 @@ Hardware *newHardware(const char *subsystem)
        }
        my = malloc(sizeof(Hardware));
        my->race = malloc(nCards * sizeof(HwRace *));
-       my->lInt = malloc(nCards * sizeof(LInt));
 
        my->maxSubEvtSize = SubEvt_hdrSize() + (nCards * 2500 * sizeof(uint32_t));
        my->nRaces = nCards;
 
        for (i = 0; i < my->nRaces; i++) {
-               unsigned long statusId;
-               int paramWasFound;
-
                my->race[i] = malloc(sizeof(HwRace));
                if (0 > conHwRace(my->race[i], cards[i], param)) {
                        syslog(LOG_ERR, "Construction of card %s failed:%s", cards[i], strerror(errno));
                        return NULL;
                }
-               my->lInt[i] = malloc(sizeof(LInt));
-               Param_getInt(param, my->race[i]->name, "status_id", &paramWasFound, &statusId);
-               if (!paramWasFound) {
-                       syslog(LOG_ERR, "Parameter %s(status_id) not found", my->race[i]->name);
-                       return NULL;
-               }
-               conLInt(my->lInt[i], statusId);
        }
 
        desParam(param);
@@ -97,12 +85,9 @@ void deleteHardware(Hardware *my)
        int i;
 
        for (i = 0; i < my->nRaces; i++) {
-               desLInt(my->lInt[i]);
-               free(my->lInt[i]);
                desHwRace(my->race[i]);
                free(my->race[i]);
        }
-       free(my->lInt);
        free(my->race);
        free(my);
 }
@@ -122,11 +107,7 @@ void Hardware_waitForTrigger(Hardware *my, void *subEvt)
 
        for (i = 0; i < my->nRaces; i++) {
                if (HwRace_isBufRequested(my->race[i])) {
-                       LInt_wait(my->lInt[i]);
                        HwRace_getEndOfData(my->race[i]);
-#ifndef NDEBUG
-                       syslog(LOG_DEBUG, "%d irq received", i);
-#endif
                }
        }
 }