Project
Loading...
Searching...
No Matches
RDHUtils.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef AliceO2_TPC_RDHUtils_H
13#define AliceO2_TPC_RDHUtils_H
14
16//#include "Headers/RAWDataHeader.h"
17
18namespace o2
19{
20namespace tpc
21{
22namespace rdh_utils
23{
24
26using FEEIDType = uint16_t;
27static constexpr FEEIDType UserLogicLinkID = 15;
28static constexpr FEEIDType IDCLinkID = 20;
29static constexpr FEEIDType ILBZSLinkID = 21;
30static constexpr FEEIDType DLBZSLinkID = 22;
31static constexpr FEEIDType SACLinkID = 25;
32
34static constexpr FEEIDType getFEEID(const FEEIDType cru, const FEEIDType endpoint, const FEEIDType link) { return FEEIDType((cru << 7) | ((endpoint & 1) << 6) | (link & 0x3F)); }
35template <typename T>
36static constexpr FEEIDType getFEEID(const T cru, const T endpoint, const T link)
37{
38 return getFEEID(FEEIDType(cru), FEEIDType(endpoint), FEEIDType(link));
39}
40
42static constexpr FEEIDType getCRU(const FEEIDType feeID) { return (feeID >> 7); }
43
45static constexpr FEEIDType getEndPoint(const FEEIDType feeID) { return (feeID >> 6) & 0x1; }
46
48static constexpr FEEIDType getLink(const FEEIDType feeID) { return feeID & 0x3F; }
49
51static constexpr void getMapping(const FEEIDType feeID, FEEIDType& cru, FEEIDType& endpoint, FEEIDType& link)
52{
53 cru = getCRU(feeID);
54 endpoint = getEndPoint(feeID);
55 link = getLink(feeID);
56}
57
59static constexpr bool isFromUserLogic(const FEEIDType feeID) { return (getLink(feeID) == UserLogicLinkID); }
60
62template <typename RDH>
63static constexpr FEEIDType getCRU(const RDH& rdh)
64{
65 return getCRU(RDHUtils::getFEEID(rdh));
66}
67
69template <typename RDH>
70static constexpr FEEIDType getEndPoint(const RDH& rdh)
71{
72 return getEndPoint(RDHUtils::getFEEID(rdh));
73}
74
76template <typename RDH>
77static constexpr FEEIDType getLink(const RDH& rdh)
78{
79 return getLink(RDHUtils::getFEEID(rdh));
80}
81
83template <typename RDH>
84static constexpr bool isFromUserLogic(const RDH& rdh)
85{
86 return isFromUserLogic(RDHUtils::getFEEID(rdh));
87}
88
89template <typename RDH, typename T>
90static constexpr void setFEEID(RDH& rdh, const T cru, const T endpoint, const T link)
91{
92 RDHUtils::setFEEID(rdh, getFEEID(cru, endpoint, link));
93}
94
96template <typename RDH>
97static constexpr void getMapping(const RDH& rdh, FEEIDType& cru, FEEIDType& endpoint, FEEIDType& link)
98{
99 cru = getCRU(rdh);
100 endpoint = getEndPoint(rdh);
101 link = getLink(rdh);
102}
103
104} // namespace rdh_utils
105} // namespace tpc
106} // namespace o2
107
108#endif
uint8_t endpoint
Definition RawData.h:0
uint16_t FEEIDType
Definition RDHUtils.h:26
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static void setFEEID(RDHv4 &rdh, uint16_t v)
Definition RDHUtils.h:146