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 CMVLinkID = 23;
32static constexpr FEEIDType SACLinkID = 25;
33
35static constexpr FEEIDType getFEEID(const FEEIDType cru, const FEEIDType endpoint, const FEEIDType link) { return FEEIDType((cru << 7) | ((endpoint & 1) << 6) | (link & 0x3F)); }
36template <typename T>
37static constexpr FEEIDType getFEEID(const T cru, const T endpoint, const T link)
38{
39 return getFEEID(FEEIDType(cru), FEEIDType(endpoint), FEEIDType(link));
40}
41
43static constexpr FEEIDType getCRU(const FEEIDType feeID) { return (feeID >> 7); }
44
46static constexpr FEEIDType getEndPoint(const FEEIDType feeID) { return (feeID >> 6) & 0x1; }
47
49static constexpr FEEIDType getLink(const FEEIDType feeID) { return feeID & 0x3F; }
50
52static constexpr void getMapping(const FEEIDType feeID, FEEIDType& cru, FEEIDType& endpoint, FEEIDType& link)
53{
54 cru = getCRU(feeID);
55 endpoint = getEndPoint(feeID);
56 link = getLink(feeID);
57}
58
60static constexpr bool isFromUserLogic(const FEEIDType feeID) { return (getLink(feeID) == UserLogicLinkID); }
61
63template <typename RDH>
64static constexpr FEEIDType getCRU(const RDH& rdh)
65{
66 return getCRU(RDHUtils::getFEEID(rdh));
67}
68
70template <typename RDH>
71static constexpr FEEIDType getEndPoint(const RDH& rdh)
72{
73 return getEndPoint(RDHUtils::getFEEID(rdh));
74}
75
77template <typename RDH>
78static constexpr FEEIDType getLink(const RDH& rdh)
79{
80 return getLink(RDHUtils::getFEEID(rdh));
81}
82
84template <typename RDH>
85static constexpr bool isFromUserLogic(const RDH& rdh)
86{
87 return isFromUserLogic(RDHUtils::getFEEID(rdh));
88}
89
90template <typename RDH, typename T>
91static constexpr void setFEEID(RDH& rdh, const T cru, const T endpoint, const T link)
92{
93 RDHUtils::setFEEID(rdh, getFEEID(cru, endpoint, link));
94}
95
97template <typename RDH>
98static constexpr void getMapping(const RDH& rdh, FEEIDType& cru, FEEIDType& endpoint, FEEIDType& link)
99{
100 cru = getCRU(rdh);
101 endpoint = getEndPoint(rdh);
102 link = getLink(rdh);
103}
104
105} // namespace rdh_utils
106} // namespace tpc
107} // namespace o2
108
109#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:148