]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
netmem: Added more detailled error output of missing subsystem from non delivered...
authorJörn Adamczewski-Musch <j.adamczewski@gsi.de>
Tue, 29 Apr 2014 06:28:06 +0000 (08:28 +0200)
committerJörn Adamczewski-Musch <j.adamczewski@gsi.de>
Tue, 29 Apr 2014 06:28:06 +0000 (08:28 +0200)
evtuild: extended trigger number mask to 20 bits

hadaq/evtbuild.c
hadaq/netmem.c

index a4617d5fd2fb3ba696a120835563e7ce7d34be6f..36c53fc7b729a313e736637844c9b870d70d38c6 100644 (file)
@@ -1279,8 +1279,8 @@ int main(int argc, char *argv[])
                        }
 
                        if (i == 0) {
-                               currTrigNr = (SubEvt_trigNr(subEvt) >> 8) & 0xffff;
-                                       /* JAM: use only 16 bit as workaround for TRB2/3 differences*/
+                               currTrigNr = (SubEvt_trigNr(subEvt) >> 8) & 0xfffff;
+                                       /* JAM: use only 20 bit as workaround for TRB2/3 differences*/
                                currTrigTag = SubEvt_trigNr(subEvt) & 0xff;
 
                                if (theArgs->evtId != 0)
@@ -1313,8 +1313,8 @@ int main(int argc, char *argv[])
 
                        }
 
-                       trigNr = (SubEvt_trigNr(subEvt) >> 8) & 0xffff;
-                                                               /* JAM: use only 16 bit as workaround for TRB2/3 differences*/
+                       trigNr = (SubEvt_trigNr(subEvt) >> 8) & 0xfffff;
+                                                               /* JAM: use only 20 bit as workaround for TRB2/3 differences*/
 
                        trigTag = SubEvt_trigNr(subEvt) & 0xff;
 #ifdef TRIGNO_DEBUG
index 7911b977d641643806637abc05ede33b8256df71..192b715eb26b25c90415831b315ae5bc3bcc3940 100644 (file)
@@ -20,6 +20,11 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada
 #include "shmtrans.h"
 
 #define MAXINPATH 100
+#define DESCLEN 64
+
+
+
+
 
 static char msglog[300];
 
@@ -61,6 +66,19 @@ typedef struct TheStatsS {
        unsigned long *coreNr;
 } TheStats;
 
+typedef struct dataSourceMapS {
+  unsigned long portNr; /* input port number*/
+  unsigned long subId; /* subevent id*/
+  char description[DESCLEN]; /* description of data sender hub*/
+  
+} dataSourceMap;
+
+
+
+static dataSourceMap theDataSenders[MAXINPATH];
+static int maxdatasource=0;
+
+
 static jmp_buf terminateJmp;
 
 void sigHandler(int sig)
@@ -319,10 +337,86 @@ void storeLogInfo(TheArgs *theArgs, const char *msg)
        }
 }
 
+
+
+static void InitDataSenders()
+{
+  int i;
+   FILE* fp; 
+   char *line = NULL;
+   size_t len = 0;
+   ssize_t read;
+   int subid;
+   int port;
+   int on;
+   char descriptor [DESCLEN];
+   char dummy [DESCLEN];
+
+  for(i=0; i< MAXINPATH; ++i)
+  {
+    theDataSenders[i].portNr=0;
+    theDataSenders[i].subId=0;
+    snprintf(theDataSenders[i].description, MAXINPATH, "unknown sender");
+  }
+  
+  
+   
+  
+  /* TODO: get subid and descriptions from hadesaq/main/data_sources.db
+     we add manually the port lsb here*/
+  fp = fopen("data_sources_ports.db", "r");
+  if(fp==NULL)
+    {
+       printf ("Could not read map of data sources data_sources_ports.db. \n");
+       return;    
+    }
+  i=0;
+  
+  while ((read = getline(&line, &len, fp)) != -1) {
+               
+              /*printf("Retrieved line of length %zu :\n", read);
+              printf("%s", line);*/
+               if (line[0]=='#') continue;
+               sscanf (line, "%x %d %x %s %s", &subid, &on, &port, descriptor, dummy);
+               theDataSenders[i].subId=subid;
+               theDataSenders[i].portNr=port;
+                snprintf(theDataSenders[i].description, DESCLEN, descriptor);
+              printf ("i:%d (0x%x), port:0x%x descriptor=%s \n",i,subid, port, descriptor);
+               ++i;
+               if(i>MAXINPATH) break;
+  }
+  maxdatasource=i;
+  free(line);
+  fclose(fp);
+  
+}
+
+/* find out subeventid and data sender description JAM*/
+static void getDataSender(unsigned portNum, unsigned int* subid, char* description)
+{
+int i;
+for(i=0; i<maxdatasource; ++i)
+  {
+    /*printf ("getDataSender Checking i:%d , port:0x%x descriptor=%s \n",i,theDataSenders[i].portNr , theDataSenders[i].description);*/    
+    if((unsigned long) (portNum & 0xFF) == theDataSenders[i].portNr)
+      {
+        *subid=theDataSenders[i].subId;
+        snprintf(description,DESCLEN,theDataSenders[i].description);
+        /*printf ("FOUND!\n");*/
+        return;  
+      }    
+  }
+}
+
+
 static int checkDataSources(TheArgs *theArgs, TheStats *theStats)
 {
        int ready2check = 0;
        int i;
+        unsigned port=0;
+        unsigned subid=0;
+        char descriptor[DESCLEN];
        static unsigned long dataSources[MAXINPATH];
        static int once = 1;
 
@@ -354,7 +448,11 @@ static int checkDataSources(TheArgs *theArgs, TheStats *theStats)
                if (ready2check) {
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                                if (dataSources[i] == 0) {
-                                       sprintf(msglog, "<E> daq_netmem: source %d, port %lu: no data received.", i, theArgs->portNr[i]);
+                                       /* here more precise information which source failed JAM*/
+                                        getDataSender(theArgs->portNr[i],&subid,descriptor);
+                                  
+                                       sprintf(msglog, "<E> daq_netmem: source %d, port %lu (0x%x) => subevent 0x%x (%s): no data received.", 
+                                                i, theArgs->portNr[i], theArgs->portNr[i], subid, descriptor);
                                        fprintf(stderr, "%s\n", msglog);
                                        storeLogInfo(theArgs, msglog);
 
@@ -621,7 +719,7 @@ int main(int argc, char *argv[])
 
        openlog(argv[0], LOG_PID | LOG_PERROR, LOG_LOCAL0);
        setlogmask(LOG_UPTO(LOG_INFO));
-
+        InitDataSenders();
        argsDefault(theArgs);
        argsFromParam(theArgs, argc, argv);
        if (0 > argsFromCL(theArgs, argc, argv)) {