Skip to content

Commit 9ec522d

Browse files
committed
Change TDC5 recognition
Now it has own magic value 0x5552 in the begin. Rest is ignored for the moment
1 parent 2802888 commit 9ec522d

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

plugins/dogma/dogma/defines.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#define DOGMA_MAGIC 0xecc1701d
2626

27+
#define TDC5_MAGIC 0x55520000
28+
2729
#define SWAP_VALUE(v) (((v & 0xFF) << 24) | ((v & 0xFF00) << 8) | ((v & 0xFF0000) >> 8) | ((v & 0xFF000000) >> 24))
2830

2931
namespace dogma {
@@ -47,12 +49,12 @@ namespace dogma {
4749

4850
inline bool IsMagic() const { return (SWAP_VALUE(tuMagic) & 0xffffff00) == (DOGMA_MAGIC & 0xffffff00); }
4951

52+
inline bool IsMagicTdc5() const { return (SWAP_VALUE(tuMagic) & 0xffff0000) == (TDC5_MAGIC & 0xffff0000); }
53+
5054
inline uint32_t GetMagicType() const { return SWAP_VALUE(tuMagic) & 0xff; }
5155

5256
inline bool IsMagicDefault() const { return GetMagicType() == (DOGMA_MAGIC & 0xff); }
5357

54-
inline bool IsMagicTdc5() const { return GetMagicType() == 0x1e; }
55-
5658
inline uint32_t GetMagic() const { return SWAP_VALUE(tuMagic); }
5759

5860
inline uint32_t GetAddr() const { return SWAP_VALUE(tuAddr); }
@@ -135,7 +137,7 @@ namespace dogma {
135137
uint32_t tuMagic = 0;
136138
uint32_t tuSeqId = 0;
137139
uint32_t tuTrigTypeNumber = 0;
138-
uint32_t tuLenPayload = 0; // paylod len in 4bytes words
140+
uint32_t tuLenPayload = 0; // payload len in 4bytes words
139141

140142
public:
141143

plugins/dogma/src/UdpTransport.cxx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,17 @@ bool dogma::UdpAddon::ReadUdp()
180180

181181
std::string errmsg;
182182

183-
if (!tu->IsMagic()) {
184-
fTotalDiscardMagic++;
185-
errmsg = "Magic number not match";
186-
DOUT0("Magic %08x", tu->GetMagic());
187-
} else if (tu->IsMagicDefault()) {
188-
msgsize = tu->GetSize(); // size must match with number of received bytes
189-
if (res != msgsize)
190-
errmsg = dabc::format("Send buffer %u differ from message size %u - ignore it", (unsigned) res, (unsigned) msgsize);
191-
} else if (tu->IsMagicTdc5()) {
183+
if (tu->IsMagicTdc5()) {
192184
msgsize = tu->SetTdc5PaketLength(res); // total size will be rounded by 4 bytes boundary
193185
if ((msgsize < res) || (msgsize > res + 3))
194186
errmsg = dabc::format("Failure by coding packet len %u in tu size %u - ignore it", (unsigned) res, (unsigned) msgsize);
195-
187+
} else if (tu->IsMagic() && tu->IsMagicDefault()) {
188+
msgsize = tu->GetSize(); // size must match with number of received bytes
189+
if (res != msgsize)
190+
errmsg = dabc::format("Send buffer %u differ from message size %u - ignore it", (unsigned) res, (unsigned) msgsize);
196191
} else {
197192
fTotalDiscardMagic++;
198193
errmsg = "Magic subtype not match";
199-
DOUT0("Magic %08x", tu->GetMagic());
200194
}
201195

202196
if (!errmsg.empty()) {

0 commit comments

Comments
 (0)