Project
Loading...
Searching...
No Matches
AdcClockMonitor.cxx
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
14
16#include <iostream>
17
18using namespace o2::tpc;
19
24
26 : mSampa(sampa), mPrevSequence(0), mTransition0(0), mTransition1(0), mSequenceCompleted(false), mSequencePosition(0), mState(state::error)
27{
28}
29
31
33
35{
36 mPrevSequence = 0;
37 mSequencePosition = 0;
38 mState = state::error;
39 LOG(info) << "ADC clock monitoring for SAMPA " << mSampa << " was resetted";
40}
41
42int AdcClockMonitor::addSequence(const short seq)
43{
44 // seq = seq & 0xF;
45 // std::cout << "SAMPA " << mSampa << ": " << std::hex << "0x" << std::setw(1) << (int)seq << std::dec << std::endl;
46
47 switch (mState) {
48 case state::error:
49 mSequenceCompleted = false;
50 if (seq == 0x1) {
51 mState = state::locked;
52 mSequencePosition = 0;
53 mTransition0 = 0xE;
54 mTransition1 = 0x1;
55 break;
56 }
57 if (seq == 0x3) {
58 mState = state::locked;
59 mSequencePosition = 0;
60 mTransition0 = 0xC;
61 mTransition1 = 0x3;
62 break;
63 }
64 if (seq == 0x7) {
65 mState = state::locked;
66 mSequencePosition = 0;
67 mTransition0 = 0x8;
68 mTransition1 = 0x7;
69 break;
70 }
71 if (seq == 0xF) {
72 if (mPrevSequence == 0) {
73 mState = state::locked;
74 mSequencePosition = 0;
75 mTransition0 = 0x0;
76 mTransition1 = 0xF;
77 break;
78 }
79 }
80 break;
81 case state::locked:
82 if (
83 mSequencePosition == 0 ||
84 mSequencePosition == 1 ||
85 mSequencePosition == 2) {
86 if (seq != 0xF) {
87 mState = state::error;
88 }
89 ++mSequencePosition;
90 break;
91 }
92 if (mSequencePosition == 3) {
93 if (seq != mTransition0) {
94 mState = state::error;
95 }
96 ++mSequencePosition;
97 break;
98 }
99 if (
100 mSequencePosition == 4 ||
101 mSequencePosition == 5 ||
102 mSequencePosition == 6) {
103 if (seq != 0x0) {
104 mState = state::error;
105 }
106 mSequencePosition++;
107 break;
108 }
109 if (mSequencePosition == 7) {
110 if (seq != mTransition1) {
111 mState = state::error;
112 }
113 ++mSequencePosition;
114 mSequenceCompleted = true;
115 break;
116 }
117
118 mState = state::error;
119 break;
120 }
121 mSequencePosition %= 8;
122 mPrevSequence = seq & 0xF;
123
124 return getState();
125}
Class to monitor the ADC smapling clock contained in the GBT frame.
Class to monitor the ADC smapling clock contained in the GBT frame.
AdcClockMonitor()
Default Constructor.
int addSequence(const short seq)
~AdcClockMonitor()
Destructor.
void reset()
Reset function to clear history.
Global TPC definitions and constants.
Definition SimTraits.h:167
VectorOfTObjectPtrs other
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"