]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
SubEvt_word function getting debugging word added. Sergey.
authorhadaq <hadaq>
Wed, 16 Jun 2010 14:45:05 +0000 (14:45 +0000)
committerhadaq <hadaq>
Wed, 16 Jun 2010 14:45:05 +0000 (14:45 +0000)
hadaq/subevt.c

index 811d4f2b6cb7e9d0863679e911ce7d7c55dae939..dcb66552f5b074ac328d01176aa3c8c9fd6cf349 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/subevt.c,v 6.13 2010-06-14 14:37:09 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/subevt.c,v 6.14 2010-06-16 14:45:05 hadaq Exp $";
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -69,6 +69,37 @@ uint32_t SubEvt_errBit(const void *my)
        return val;
 }
 
+uint32_t SubEvt_debugWord(const void *my)
+{
+       unsigned i;
+       uint32_t val;
+       unsigned wordNumber = -1;
+
+       if (SubEvt_id(my) == 0x00008300UL || SubEvt_id(my) == 0x00008310UL || SubEvt_id(my) == 0x00008320UL) {
+               wordNumber = 2;
+       }
+
+       if (SubEvt_decoding(my) == SubEvtDecoding_32bitData) {
+               i = SubEvt_dataSize(my) / sizeof(uint32_t) - 1;
+       } else if (SubEvt_decoding(my) == SubEvtDecoding_16bitData) {
+               i = SubEvt_dataSize(my) / sizeof(uint16_t) - 1;
+       } else if (SubEvt_decoding(my) == SubEvtDecoding_8bitData) {
+               i = SubEvt_dataSize(my) / sizeof(uint8_t) - 1;
+       } else {
+               fprintf(stderr, " Unknown decoding: %i\n", SubEvt_decoding(my));
+       }
+
+       if (wordNumber == -1) {
+               val = 0;
+       } else if (i > wordNumber) {
+               val = SubEvt_dataValue(my, wordNumber - 1);
+       } else {
+               val = 0;
+       }
+
+       return val;
+}
+
 char *SubEvt_2charP(const void *my)
 {
        static char buf[132];