μHAL (v2.7.9)
Part of the IPbus software repository
IPbusInspector.hpp
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 
4  This file is part of uHAL.
5 
6  uHAL is a hardware access library and programming framework
7  originally developed for upgrades of the Level-1 trigger of the CMS
8  experiment at CERN.
9 
10  uHAL is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  uHAL is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with uHAL. If not, see <http://www.gnu.org/licenses/>.
22 
23 
24  Andrew Rose, Imperial College, London
25  email: awr01 <AT> imperial.ac.uk
26 
27  Marc Magrans de Abril, CERN
28  email: marc.magrans.de.abril <AT> cern.ch
29 
30 ---------------------------------------------------------------------------
31 */
32 
39 #ifndef _uhal_IPbusInspector_hpp_
40 #define _uhal_IPbusInspector_hpp_
41 
42 
43 #include <stdint.h>
44 #include <vector>
45 
47 
48 
49 namespace uhal
50 {
51 
53  template< uint8_t IPbus_major , uint8_t IPbus_minor >
55  {
56  public:
59 
61  virtual ~HostToTargetInspector( );
62 
63  protected:
65  uint32_t mHeader;
69  uint32_t mWordCounter;
71  uint32_t mTransactionId;
73  uint8_t mResponseGood;
74 
76  uint32_t mPacketHeader;
78  uint32_t mPacketCounter;
80  uint32_t mPacketType;
81 
82  public:
90  bool analyze ( std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd , const bool& aContinueOnError = true );
91 
92  protected:
94  virtual void bot();
95 
100  virtual void ni_read ( const uint32_t& aAddress );
101 
106  virtual void read ( const uint32_t& aAddress );
107 
112  virtual void readConfigurationSpace ( const uint32_t& aAddress );
113 
120  virtual void ni_write ( const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd );
121 
128  virtual void write ( const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd );
129 
135  virtual void rmw_sum ( const uint32_t& aAddress , const uint32_t& aAddend );
136 
143  virtual void rmw_bits ( const uint32_t& aAddress , const uint32_t& aAndTerm , const uint32_t& aOrTerm );
144 
146  virtual void unknown_type();
147 
149  virtual bool control_packet_header ();
150 
152  virtual void status_packet_header();
153 
155  virtual void resend_packet_header();
156 
158  virtual void unknown_packet_header();
159  };
160 
161 
162 
164  template< uint8_t IPbus_major , uint8_t IPbus_minor >
166  {
167  public:
171  virtual ~TargetToHostInspector( );
172 
173  protected:
175  uint32_t mHeader;
179  uint32_t mWordCounter;
181  uint32_t mTransactionId;
183  uint8_t mResponseGood;
184 
186  uint32_t mPacketHeader;
188  uint32_t mPacketCounter;
190  uint32_t mPacketType;
191 
192  public:
193 
201  bool analyze ( std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd , const bool& aContinueOnError = true );
202 
203  protected:
205  virtual void bot();
206 
212  virtual void ni_read ( std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd );
213 
219  virtual void read ( std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd );
220 
222  virtual void ni_write ( );
223 
225  virtual void write ( );
226 
231  virtual void rmw_sum ( const uint32_t& aNewValue );
232 
237  virtual void rmw_bits ( const uint32_t& aNewValue );
238 
240  virtual void unknown_type();
241 
243  virtual bool control_packet_header ();
244 
246  virtual void status_packet_header();
247 
249  virtual void unknown_packet_header();
250  };
251 
252 }
253 
254 
255 #endif
uhal::HostToTargetInspector::unknown_type
virtual void unknown_type()
Virtual callback function for the case where the header is unknown.
Definition: IPbusInspector.cpp:276
uhal::HostToTargetInspector::resend_packet_header
virtual void resend_packet_header()
Virtual callback function called when an IPbus 2.0 resend packet header is observed.
Definition: IPbusInspector.cpp:298
uhal::TargetToHostInspector::analyze
bool analyze(std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd, const bool &aContinueOnError=true)
Analyse an IPbus packet held as a vector of uint32_t's.
Definition: IPbusInspector.cpp:330
uhal::TargetToHostInspector::mResponseGood
uint8_t mResponseGood
The current error code/flag.
Definition: IPbusInspector.hpp:183
uhal::TargetToHostInspector::write
virtual void write()
Virtual callback function called when an incrementing write is observed.
Definition: IPbusInspector.cpp:479
uhal::TargetToHostInspector::control_packet_header
virtual bool control_packet_header()
Virtual callback function called when an IPbus 2.0 control packet header is observed.
Definition: IPbusInspector.cpp:509
uhal::HostToTargetInspector::HostToTargetInspector
HostToTargetInspector()
Default constructor.
Definition: IPbusInspector.cpp:46
uhal::TargetToHostInspector::bot
virtual void bot()
Virtual callback function called when a Byte-OrderTransaction is observed.
Definition: IPbusInspector.cpp:439
uhal::HostToTargetInspector::mType
IPbusTransactionType mType
The current transaction type.
Definition: IPbusInspector.hpp:67
uhal::TargetToHostInspector::mPacketCounter
uint32_t mPacketCounter
The current IPbus2 packet counter.
Definition: IPbusInspector.hpp:188
uhal::HostToTargetInspector::mHeader
uint32_t mHeader
The current raw transaction header.
Definition: IPbusInspector.hpp:65
uhal::TargetToHostInspector::mWordCounter
uint32_t mWordCounter
The current word count.
Definition: IPbusInspector.hpp:179
uhal::TargetToHostInspector::rmw_sum
virtual void rmw_sum(const uint32_t &aNewValue)
Virtual callback function called when a read-modify-write sum is observed.
Definition: IPbusInspector.cpp:486
uhal::TargetToHostInspector::mTransactionId
uint32_t mTransactionId
The current transaction id.
Definition: IPbusInspector.hpp:181
uhal::IPbusTransactionType
IPbusTransactionType
Enumerated type to define the IPbus transaction type.
Definition: ProtocolIPbusCore.hpp:74
uhal::HostToTargetInspector::readConfigurationSpace
virtual void readConfigurationSpace(const uint32_t &aAddress)
Virtual callback function called when an incrementing "configuration space" read is observed.
Definition: IPbusInspector.cpp:221
uhal::HostToTargetInspector::mResponseGood
uint8_t mResponseGood
The current error code/flag.
Definition: IPbusInspector.hpp:73
uhal::HostToTargetInspector::mTransactionId
uint32_t mTransactionId
The current transaction id.
Definition: IPbusInspector.hpp:71
uhal::HostToTargetInspector
Helper class to decode IPbus packets as passed from the Client to the Target.
Definition: IPbusInspector.hpp:55
uhal::HostToTargetInspector::read
virtual void read(const uint32_t &aAddress)
Virtual callback function called when an incrementing read is observed.
Definition: IPbusInspector.cpp:213
uhal::HostToTargetInspector::write
virtual void write(const uint32_t &aAddress, std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd)
Virtual callback function called when an incrementing write is observed.
Definition: IPbusInspector.cpp:243
uhal::TargetToHostInspector::ni_read
virtual void ni_read(std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd)
Virtual callback function called when a non-incrementing read is observed.
Definition: IPbusInspector.cpp:446
uhal::TargetToHostInspector::unknown_packet_header
virtual void unknown_packet_header()
Virtual callback function called when an unknown IPbus 2.0 packet header is observed.
Definition: IPbusInspector.cpp:524
uhal
Definition: HttpResponseGrammar.hpp:49
uhal::TargetToHostInspector::read
virtual void read(std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd)
Virtual callback function called when an incrementing read is observed.
Definition: IPbusInspector.cpp:459
uhal::TargetToHostInspector::~TargetToHostInspector
virtual ~TargetToHostInspector()
Destructor.
Definition: IPbusInspector.cpp:326
uhal::TargetToHostInspector::rmw_bits
virtual void rmw_bits(const uint32_t &aNewValue)
Virtual callback function called when a read-modify-write bits is observed.
Definition: IPbusInspector.cpp:494
uhal::HostToTargetInspector::mPacketCounter
uint32_t mPacketCounter
The current IPbus2 packet counter.
Definition: IPbusInspector.hpp:78
uhal::HostToTargetInspector::mPacketType
uint32_t mPacketType
The current IPbus2 packet type.
Definition: IPbusInspector.hpp:80
uhal::TargetToHostInspector::mHeader
uint32_t mHeader
The current raw transaction header.
Definition: IPbusInspector.hpp:175
uhal::HostToTargetInspector::rmw_sum
virtual void rmw_sum(const uint32_t &aAddress, const uint32_t &aAddend)
Virtual callback function called when a read-modify-write sum is observed.
Definition: IPbusInspector.cpp:257
uhal::TargetToHostInspector
Helper class to decode IPbus packets as passed from the Target to the Client.
Definition: IPbusInspector.hpp:166
uhal::TargetToHostInspector::mPacketHeader
uint32_t mPacketHeader
The current raw IPbus2 packet header.
Definition: IPbusInspector.hpp:186
uhal::HostToTargetInspector::control_packet_header
virtual bool control_packet_header()
Virtual callback function called when an IPbus 2.0 control packet header is observed.
Definition: IPbusInspector.cpp:283
ProtocolIPbusCore.hpp
uhal::HostToTargetInspector::status_packet_header
virtual void status_packet_header()
Virtual callback function called when an IPbus 2.0 status packet header is observed.
Definition: IPbusInspector.cpp:291
uhal::HostToTargetInspector::~HostToTargetInspector
virtual ~HostToTargetInspector()
Destructor.
Definition: IPbusInspector.cpp:58
uhal::TargetToHostInspector::mType
IPbusTransactionType mType
The current transaction type.
Definition: IPbusInspector.hpp:177
uhal::HostToTargetInspector::analyze
bool analyze(std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd, const bool &aContinueOnError=true)
Analyse an IPbus packet held as a vector of uint32_t's.
Definition: IPbusInspector.cpp:62
uhal::HostToTargetInspector::ni_write
virtual void ni_write(const uint32_t &aAddress, std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd)
Virtual callback function called when a non-incrementing write is observed.
Definition: IPbusInspector.cpp:229
uhal::HostToTargetInspector::mWordCounter
uint32_t mWordCounter
The current word count.
Definition: IPbusInspector.hpp:69
uhal::HostToTargetInspector::ni_read
virtual void ni_read(const uint32_t &aAddress)
Virtual callback function called when a non-incrementing read is observed.
Definition: IPbusInspector.cpp:205
uhal::TargetToHostInspector::status_packet_header
virtual void status_packet_header()
Virtual callback function called when an IPbus 2.0 status packet header is observed.
Definition: IPbusInspector.cpp:517
uhal::HostToTargetInspector::mPacketHeader
uint32_t mPacketHeader
The current raw IPbus2 packet header.
Definition: IPbusInspector.hpp:76
uhal::TargetToHostInspector::unknown_type
virtual void unknown_type()
Virtual callback function for the case where the header is unknown.
Definition: IPbusInspector.cpp:502
uhal::TargetToHostInspector::ni_write
virtual void ni_write()
Virtual callback function called when a non-incrementing write is observed.
Definition: IPbusInspector.cpp:472
uhal::HostToTargetInspector::rmw_bits
virtual void rmw_bits(const uint32_t &aAddress, const uint32_t &aAndTerm, const uint32_t &aOrTerm)
Virtual callback function called when a read-modify-write bits is observed.
Definition: IPbusInspector.cpp:266
uhal::TargetToHostInspector::mPacketType
uint32_t mPacketType
The current IPbus2 packet type.
Definition: IPbusInspector.hpp:190
uhal::TargetToHostInspector::TargetToHostInspector
TargetToHostInspector()
Default constructor.
Definition: IPbusInspector.cpp:314
uhal::HostToTargetInspector::unknown_packet_header
virtual void unknown_packet_header()
Virtual callback function called when an unknown IPbus 2.0 packet header is observed.
Definition: IPbusInspector.cpp:305
uhal::HostToTargetInspector::bot
virtual void bot()
Virtual callback function called when a Byte-OrderTransaction is observed.
Definition: IPbusInspector.cpp:198