From: hadaq Date: Wed, 16 Jun 2010 14:45:05 +0000 (+0000) Subject: SubEvt_word function getting debugging word added. Sergey. X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=7a87e8cecd87c7c3eee51ada46e8bb5bb54ae63c;p=daqdata.git SubEvt_word function getting debugging word added. Sergey. --- diff --git a/hadaq/subevt.c b/hadaq/subevt.c index 811d4f2..dcb6655 100644 --- a/hadaq/subevt.c +++ b/hadaq/subevt.c @@ -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 #include @@ -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];