-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
int conHwRace(HwRace *my, const char *name, const Param *param)
{
unsigned long cardBase;
+ unsigned long statusId;
int paramWasFound;
- int i;
assert(my != NULL);
Param_getInt(param, my->name, "cardbase", ¶mWasFound, &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", ¶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;
void desHwRace(HwRace *my)
{
+ desLInt(my->lInt);
+ free(my->lInt);
desRc(my->rc);
free(my->rc);
}
char name[12];
Rc *rc;
LVme_L *buf;
+ LInt *lInt;
int currAddr;
int endOfData;
}
}
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;
}
-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>
size_t maxSubEvtSize;
int nRaces;
HwRace **race;
- LInt **lInt;
};
#include "hardware.h"
}
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", ¶mWasFound, &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);
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);
}
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
}
}
}