Project
Loading...
Searching...
No Matches
PixelWords.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#ifndef ALICEO2_FOCAL_PIXELWORDS_H
12#define ALICEO2_FOCAL_PIXELWORDS_H
13
14#include <bitset>
15#include <cstdint>
16
17namespace o2::focal
18{
19
20namespace PixelWord
21{
22
23using Idle = uint8_t;
24using BusyOn = uint8_t;
25using BusyOff = uint8_t;
26
39
40struct ChipHeader {
41 union {
42 struct {
43 uint16_t mChipID : 4;
44 uint16_t mIdentifier : 4;
45 uint16_t mBunchCrossing : 8;
46 };
47 uint16_t mData;
48 };
49
50 bool isEmptyFrame() const { return mIdentifier == 0xe; }
51};
52
54 union {
55 struct {
56 uint8_t mReadoutFlags : 4;
57 uint8_t mIdentifier : 4;
58 };
59 uint8_t mData;
60 };
61};
62
64 union {
65 struct {
66 uint8_t mRegion : 5;
67 uint8_t mIdentifier : 3;
68 };
69 uint8_t mData;
70 };
71};
72
73struct Hitmap {
74 union {
75 struct {
76 uint8_t mHitmap : 7;
77 uint8_t mZeroed : 1;
78 };
79 uint8_t mData;
80 };
81
82 std::bitset<7> getHitmap() const { return std::bitset<7>(mHitmap); }
83};
84
85struct DataShort {
86 union {
87 struct {
88 uint16_t mAddress : 10;
89 uint16_t mEncoderID : 4;
90 uint16_t mIdentifier : 2;
91 };
92 uint16_t mData;
93 };
94 DataShort(const uint8_t* payload)
95 {
96 mData = (static_cast<uint16_t>(payload[0]) << 8) + static_cast<uint16_t>(payload[1]);
97 }
98 uint16_t getAddress() const { return mAddress; }
99 uint16_t getEncoder() const { return mEncoderID; }
100 uint16_t getIdentifier() const { return mIdentifier; }
101};
102} // namespace PixelWord
103
104} // namespace o2::focal
105#endif // ALICEO2_FOCAL_PIXELWORDS_H
DataShort(const uint8_t *payload)
Definition PixelWords.h:94
std::bitset< 7 > getHitmap() const
Definition PixelWords.h:82