μHAL (v2.6.5)
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 
52  /* namespace exception
53  {
54  // Exception class to handle the case where we are unable to parse a badly formed IPbus header.
55  ExceptionClass ( UnableToParseHeader , "Exception class to handle the case where we are unable to parse a badly formed IPbus header." )
56  ExceptionClass ( IllegalPacketHeader , "Exception class to handle the case where an illegal packet header is received." )
57  }
58  */
59 
63  template< uint8_t IPbus_major , uint8_t IPbus_minor >
65  {
66  public:
74  virtual ~HostToTargetInspector( );
75 
76  protected:
78  uint32_t mHeader;
82  uint32_t mWordCounter;
84  uint32_t mTransactionId;
86  uint8_t mResponseGood;
87 
89  uint32_t mPacketHeader;
91  uint32_t mPacketCounter;
93  uint32_t mPacketType;
94 
95  public:
103  bool analyze ( std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd , const bool& aContinueOnError = true );
104  protected:
108  virtual void bot();
113  virtual void ni_read ( const uint32_t& aAddress );
114 
119  virtual void read ( const uint32_t& aAddress );
120 
125  virtual void readConfigurationSpace ( const uint32_t& aAddress );
126 
133  virtual void ni_write ( const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd );
134 
141  virtual void write ( const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd );
142 
148  virtual void rmw_sum ( const uint32_t& aAddress , const uint32_t& aAddend );
149 
156  virtual void rmw_bits ( const uint32_t& aAddress , const uint32_t& aAndTerm , const uint32_t& aOrTerm );
157 
161  virtual void unknown_type();
162 
166  virtual bool control_packet_header ();
167 
171  virtual void status_packet_header();
172 
176  virtual void resend_packet_header();
177 
181  virtual void unknown_packet_header();
182 
183  };
184 
185 
186 
187 
188 
192  template< uint8_t IPbus_major , uint8_t IPbus_minor >
194  {
195  public:
203  virtual ~TargetToHostInspector( );
204 
205  protected:
207  uint32_t mHeader;
211  uint32_t mWordCounter;
213  uint32_t mTransactionId;
215  uint8_t mResponseGood;
216 
218  uint32_t mPacketHeader;
220  uint32_t mPacketCounter;
222  uint32_t mPacketType;
223 
224  public:
225 
233  bool analyze ( std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd , const bool& aContinueOnError = true );
234 
235  protected:
239  virtual void bot();
240 
246  virtual void ni_read ( std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd );
247 
253  virtual void read ( std::vector<uint32_t>::const_iterator& aIt , const std::vector<uint32_t>::const_iterator& aEnd );
257  virtual void ni_write ( );
261  virtual void write ( );
262 
267  virtual void rmw_sum ( const uint32_t& aNewValue );
268 
273  virtual void rmw_bits ( const uint32_t& aNewValue );
274 
278  virtual void unknown_type();
279 
283  virtual bool control_packet_header ();
284 
288  virtual void status_packet_header();
289 
293  virtual void unknown_packet_header();
294 
295  };
296 }
297 
298 
299 #endif
virtual void unknown_type()
Virtual callback function for the case where the header is unknown.
uint32_t mTransactionId
The current transaction id.
virtual void rmw_sum(const uint32_t &aAddress, const uint32_t &aAddend)
Virtual callback function called when a read-modify-write sum is observed.
uint32_t mPacketType
The current IPbus2 packet type.
Helper class to decode IPbus packets as passed from the Client to the Target.
eIPbusTransactionType
Enumerated type to define the IPbus transaction type.
virtual void read(const uint32_t &aAddress)
Virtual callback function called when an incrementing read is observed.
uint32_t mTransactionId
The current transaction id.
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.
uint32_t mHeader
The current raw transaction header.
uint32_t mPacketHeader
The current raw IPbus2 packet header.
virtual bool control_packet_header()
Virtual callback function called when an IPbus 2.0 control packet header is observed.
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.
uint32_t mWordCounter
The current word count.
Helper class to decode IPbus packets as passed from the Target to the Client.
virtual void ni_read(const uint32_t &aAddress)
Virtual callback function called when a non-incrementing read is observed.
eIPbusTransactionType mType
The current transaction type.
uint32_t mPacketType
The current IPbus2 packet type.
virtual void unknown_packet_header()
Virtual callback function called when an unknown IPbus 2.0 packet header is observed.
uint32_t mHeader
The current raw transaction header.
uint8_t mResponseGood
The current error code/flag.
eIPbusTransactionType mType
The current transaction type.
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.
virtual void resend_packet_header()
Virtual callback function called when an IPbus 2.0 resend packet header is observed.
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&#39;s.
virtual void status_packet_header()
Virtual callback function called when an IPbus 2.0 status packet header is observed.
HostToTargetInspector()
Default constructor.
virtual ~HostToTargetInspector()
Destructor.
uint32_t mPacketCounter
The current IPbus2 packet counter.
uint32_t mWordCounter
The current word count.
virtual void readConfigurationSpace(const uint32_t &aAddress)
Virtual callback function called when an incrementing "configuration space" read is observed...
uint8_t mResponseGood
The current error code/flag.
virtual void bot()
Virtual callback function called when a Byte-OrderTransaction is observed.
uint32_t mPacketCounter
The current IPbus2 packet counter.
uint32_t mPacketHeader
The current raw IPbus2 packet header.