USRP Hardware Driver and USRP Manual  Version: 003.010.000.HEAD-0-g6e1ac3fc
UHD and USRP Manual
constants.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2014 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_LIBUHD_RFNOC_CONSTANTS_HPP
19 #define INCLUDED_LIBUHD_RFNOC_CONSTANTS_HPP
20 
21 #include <uhd/types/dict.hpp>
22 #include <boost/assign/list_of.hpp>
23 #include <boost/cstdint.hpp>
24 #include <string>
25 
26 namespace uhd {
27  namespace rfnoc {
28 
29 // All these configure the XML reader
31 static const std::string XML_DEFAULT_PATH = "share/uhd/rfnoc";
33 static const std::string XML_PATH_ENV = "UHD_RFNOC_DIR";
34 
36 static const std::string DEFAULT_BLOCK_NAME = "Block";
37 static const boost::uint64_t DEFAULT_NOC_ID = 0xFFFFFFFFFFFFFFFF;
38 
39 static const size_t MAX_PACKET_SIZE = 8000; // bytes
40 static const size_t DEFAULT_PACKET_SIZE = 1456; // bytes
41 
42 // One line in FPGA is 64 Bits
43 static const size_t BYTES_PER_LINE = 8;
44 
46 static const size_t DEFAULT_FC_XBAR_PKTS_PER_ACK = 2;
48 static const size_t DEFAULT_FC_RX_RESPONSE_FREQ = 64; // ACKs per flow control window
50 static const size_t DEFAULT_FC_TX_RESPONSE_FREQ = 8; // ACKs per flow control window
52 // Why not 100% full? Because we need to have some headroom to account for the inaccuracy
53 // when computing the window size. We compute the flow control window based on the frame
54 // size but the buffer can have overhead due to things like UDP headers, page alignment,
55 // housekeeping info, etc. This number has to be transport agnostic so 20% of headroom is safe.
56 static const double DEFAULT_FC_RX_SW_BUFF_FULL_FACTOR = 0.80;
57 
58 // Common settings registers.
59 static const boost::uint32_t SR_FLOW_CTRL_CYCS_PER_ACK = 0;
60 static const boost::uint32_t SR_FLOW_CTRL_PKTS_PER_ACK = 1;
61 static const boost::uint32_t SR_FLOW_CTRL_WINDOW_SIZE = 2;
62 static const boost::uint32_t SR_FLOW_CTRL_WINDOW_EN = 3;
63 static const boost::uint32_t SR_ERROR_POLICY = 4;
64 static const boost::uint32_t SR_BLOCK_SID = 5; // TODO rename to SRC_SID
65 static const boost::uint32_t SR_NEXT_DST_SID = 6;
66 static const boost::uint32_t SR_RESP_IN_DST_SID = 7;
67 static const boost::uint32_t SR_RESP_OUT_DST_SID = 8;
68 
69 static const boost::uint32_t SR_READBACK_ADDR = 124;
70 static const boost::uint32_t SR_READBACK = 127;
71 
72 static const boost::uint32_t SR_CLEAR_RX_FC = 125;
73 static const boost::uint32_t SR_CLEAR_TX_FC = 126;
74 
79  SR_READBACK_REG_FIFOSIZE = 2, // fifo size
83  /* 6 currently unused */
84 };
85 
86 // AXI stream configuration bus (output master bus of axi wrapper) registers
87 static const boost::uint32_t AXI_WRAPPER_BASE = 128;
88 static const boost::uint32_t AXIS_CONFIG_BUS = AXI_WRAPPER_BASE+1; // tdata with tvalid asserted
89 static const boost::uint32_t AXIS_CONFIG_BUS_TLAST = AXI_WRAPPER_BASE+2; // tdata with tvalid & tlast asserted
90 
91 // Named settings registers
92 static const uhd::dict<std::string, boost::uint32_t> DEFAULT_NAMED_SR = boost::assign::map_list_of
93  ("AXIS_CONFIG_BUS", AXIS_CONFIG_BUS)
94  ("AXIS_CONFIG_BUS_TLAST", AXIS_CONFIG_BUS_TLAST)
95 ;
96 
97 // Block ports
98 static const size_t ANY_PORT = size_t(~0);
99 static const size_t MAX_NUM_PORTS = 16;
100 
101 // Regular expressions
102 static const std::string VALID_BLOCKNAME_REGEX = "[A-Za-z][A-Za-z0-9]*";
103 static const std::string VALID_BLOCKID_REGEX = "(?:(\\d+)(?:/))?([A-Za-z][A-Za-z0-9]*)(?:(?:_)(\\d\\d?))?";
104 
105 }} /* namespace uhd::rfnoc */
106 
107 #endif /* INCLUDED_LIBUHD_RFNOC_CONSTANTS_HPP */
108 // vim: sw=4 et:
Definition: constants.hpp:78
Definition: constants.hpp:77
Definition: constants.hpp:79
Definition: dict.hpp:30
settingsbus_reg_t
Settings register readback.
Definition: constants.hpp:76
Definition: build_info.hpp:25
Definition: constants.hpp:82
Definition: constants.hpp:81
Definition: constants.hpp:80