My Project  v0.0.16
MP7Controller.hpp
Go to the documentation of this file.
1 /*
2  * File: MP7Controller.hpp
3  * Author: ale
4  *
5  * Created on July 17, 2014, 9:23 PM
6  */
7 
8 #ifndef __mp7_mp7controller_hpp__
9 #define __mp7_mp7controller_hpp__
10 
11 // uHAL Headers
12 #include "uhal/HwInterface.hpp"
13 
14 // Boost Headers
15 #include "boost/lexical_cast.hpp"
16 
17 namespace mp7 {
18 
19 
20 // Forward declarations
21 class CtrlNode;
22 
23 class ClockingNode;
24 class TTCNode;
25 
26 class DatapathNode;
27 class AlignmentNode;
28 class GTHQuadNode;
29 
30 class ChanBufferNode;
31 class MmcPipeInterface;
32 
33 class MP7Controller : public uhal::HwInterface {
34 public:
35 
36  class Parameters : public boost::unordered_map<std::string, std::string> {
37  public:
38  Parameters();
39  ~Parameters();
40 
41  template<typename T>
42  void set( const std::string& aKey, const T& aValue ) {
43  this->operator[](aKey) = boost::lexical_cast<std::string>(aValue);
44  }
45 
46  template<typename T>
47  T get(const std::string& aKey) const {
48  const_iterator it = this->find(aKey);
49  //TODO runtime_error -> dedicated error
50  if (it == this->end()) throw std::runtime_error("Parameter not found");
51 
52  return boost::lexical_cast<T>(it->second);
53  }
54 
55  };
56  MP7Controller(uhal::HwInterface aInterface);
57 
58  virtual ~MP7Controller();
59 
63  void reset(/* clock configuration options */);
68  boost::unordered_map<std::string, std::string> refClkReport();
69 
70 protected:
72  void configureTTC(bool aEnable, bool aBC0Internal);
73 
75  void configureClocking( bool aExternalClk40 = false, const std::string& aClkCfg="internal");
76 
77 private:
78 
79  void Constructor();
80 
82  boost::unordered_map<std::string, uint32_t> mGenerics;
83 
85  std::vector<uint32_t> mRegions;
86 
88  std::vector<uint32_t> mBufferRegions;
89 
91  std::vector<uint32_t> mMGTRegions;
92 
94  std::vector<uint32_t> mChannels;
95 
97  std::vector<uint32_t> mBufferChannels;
98 
100  std::vector<uint32_t> mMGTChannels;
101 
103  std::vector<uint32_t> mActiveChannels;
104 
106  const CtrlNode * mCtrl;
107  const ClockingNode * mClocking;
108  const TTCNode * mTTC;
109 
110  const DatapathNode * mDatapath;
111  const AlignmentNode * mAlign;
112  const GTHQuadNode * mMGT;
113 
114  const ChanBufferNode * mChanBuffer;
115  const MmcPipeInterface * mMmcPipe;
116 
118  boost::mutex mMutex;
119 };
120 
121 }
122 
123 #endif /* __mp7_mp7controller_hpp__ */
124 
std::vector<uint32_t> mBufferChannels
List of channels with buffers.
Definition: MP7Controller.hpp:97
-test-ipbusaccess
Definition: AlignmentNode.hpp:15
boost::unordered_map<std::string, uint32_t> mGenerics
Definition: MP7Controller.hpp:82
void Constructor()
Definition: MP7Controller.cpp:46
const TTCNode* mTTC
Definition: MP7Controller.hpp:108
void configureClocking( bool aExternalClk40 = false, const std::string& aClkCfg="internal")
Definition: MP7Controller.cpp:119
boost::mutex mMutex
Mutex for multithread-safe environment.
Definition: MP7Controller.hpp:118
void reset()
Definition: MP7Controller.cpp:78
virtual ~MP7Controller()
Definition: MP7Controller.cpp:42
const MmcPipeInterface* mMmcPipe
Definition: MP7Controller.hpp:115
std::vector<uint32_t> mBufferRegions
Regions with buffers.
Definition: MP7Controller.hpp:88
const ChanBufferNode* mChanBuffer
Definition: MP7Controller.hpp:114
const CtrlNode* mCtrl
Specialised Nodes.
Definition: MP7Controller.hpp:106
std::vector<uint32_t> mMGTRegions
Regions with buggers and MGTs.
Definition: MP7Controller.hpp:91
void configureTTC(bool aEnable, bool aBC0Internal)
Configures TTC block and waits for BC0 lock.
Definition: MP7Controller.cpp:102
MP7Controller(uhal::HwInterface aInterface)
Definition: MP7Controller.cpp:37
const GTHQuadNode* mMGT
Definition: MP7Controller.hpp:112
std::vector<uint32_t> mRegions
List of regions instantiated in firmware.
Definition: MP7Controller.hpp:85
const ClockingNode* mClocking
Definition: MP7Controller.hpp:107
const AlignmentNode* mAlign
Definition: MP7Controller.hpp:111
std::vector<uint32_t> mActiveChannels
MGT Input Mask.
Definition: MP7Controller.hpp:103
std::vector<uint32_t> mChannels
List of channels.
Definition: MP7Controller.hpp:94
std::vector<uint32_t> mMGTChannels
List of channels with mgt block.
Definition: MP7Controller.hpp:100
boost::unordered_map<std::string, std::string> refClkReport()
Definition: MP7Controller.cpp:143
const DatapathNode* mDatapath
Definition: MP7Controller.hpp:110