Project
Loading...
Searching...
No Matches
CrateParameters.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
16#ifndef O2_MID_CRATEPARAMETERS_H
17#define O2_MID_CRATEPARAMETERS_H
18
19#include <cstdint>
20#include <array>
21
22namespace o2
23{
24namespace mid
25{
26namespace crateparams
27{
28static constexpr unsigned int sNCratesPerSide = 8;
29static constexpr unsigned int sNCrates = 2 * sNCratesPerSide;
30static constexpr unsigned int sNGBTsPerCrate = 2;
31static constexpr unsigned int sNGBTsPerSide = sNGBTsPerCrate * sNCratesPerSide;
32static constexpr unsigned int sNGBTs = 2 * sNGBTsPerSide;
33static constexpr unsigned int sMaxNBoardsInLink = 8;
34static constexpr unsigned int sMaxNBoardsInCrate = sMaxNBoardsInLink * sNGBTsPerCrate;
35static constexpr unsigned int sNELinksPerGBT = 10;
36
38inline uint16_t makeGBTUniqueId(uint8_t crateId, uint8_t gbtId) { return sNGBTsPerCrate * crateId + gbtId; }
40inline uint8_t getCrateIdFromGBTUniqueId(uint16_t gbtUniqueId) { return gbtUniqueId / sNGBTsPerCrate; }
42inline uint8_t getGBTIdInCrate(uint16_t gbtUniqueId) { return gbtUniqueId % sNGBTsPerCrate; }
44inline uint8_t getGBTIdFromBoardInCrate(uint8_t locId) { return locId / sMaxNBoardsInLink; }
46inline uint8_t getCrateId(bool isRightSide, uint8_t crateIdOneSide) { return isRightSide ? crateIdOneSide : crateIdOneSide + sNCratesPerSide; }
47// Gets the locId in crate from the loc position in the GBT
48inline uint8_t getLocIdInCrate(uint16_t gbtUniqueId, int iloc) { return getGBTIdInCrate(gbtUniqueId) * sMaxNBoardsInLink + iloc; }
50inline bool isRightSide(uint8_t crateId) { return (crateId / sNCratesPerSide) == 0; }
51} // namespace crateparams
52} // namespace mid
53} // namespace o2
54
55#endif /* O2_MID_CRATEPARAMETERS_H */
bool isRightSide(uint8_t crateId)
Tests if the crate is in the right side.
uint8_t getCrateIdFromGBTUniqueId(uint16_t gbtUniqueId)
Gets the crate ID from the GBT unique ID.
uint8_t getLocIdInCrate(uint16_t gbtUniqueId, int iloc)
uint8_t getGBTIdInCrate(uint16_t gbtUniqueId)
Gets the link ID in crate from the RO ID.
uint16_t makeGBTUniqueId(uint8_t crateId, uint8_t gbtId)
Builds the GBT unique ID from the crate ID and the GBT ID in the crate.
uint8_t getCrateId(bool isRightSide, uint8_t crateIdOneSide)
Gets the absolute crate ID.
uint8_t getGBTIdFromBoardInCrate(uint8_t locId)
Gets the link ID in crate from the board ID.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...