USRP Hardware Driver and USRP Manual  Version: 003.009.004-0-g2b5a88bb
UHD and USRP Manual
vrt_if_packet.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-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_UHD_TRANSPORT_VRT_IF_PACKET_HPP
19 #define INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP
20 
21 #include <uhd/config.hpp>
22 #include <boost/cstdint.hpp>
23 #include <cstddef> //size_t
24 
25 namespace uhd{ namespace transport{
26 
27 namespace vrt{
28 
30  static const size_t num_vrl_words32 = 3;
31 
33  static const size_t max_if_hdr_words32 = 7; //hdr+sid+cid+tsi+tsf
34 
41  {
42  if_packet_info_t(void);
43 
44  //link layer type - always set for pack and unpack
46  {
47  LINK_TYPE_NONE = 0x0,
48  LINK_TYPE_CHDR = 0x1,
49  LINK_TYPE_VRLP = 0x2
50  } link_type;
51 
52  //packet type
54  {
55  // VRT language:
56  PACKET_TYPE_DATA = 0x0,
57  PACKET_TYPE_IF_EXT = 0x1,
58  PACKET_TYPE_CONTEXT = 0x2, //extension context: has_sid = true
59 
60  // CVITA language:
61  //PACKET_TYPE_DATA = 0x0, // Data
62  PACKET_TYPE_FC = 0x1, // Flow control
63  PACKET_TYPE_ACK = 0x1, // Flow control (ack)
64  PACKET_TYPE_CMD = 0x2, // Command
65  PACKET_TYPE_RESP = 0x3, // Command response
66  PACKET_TYPE_ERROR = 0x3 // Command response: Error (the EOB bit is raised in this case)
67  } packet_type;
68 
69  //size fields
70  size_t num_payload_words32; //required in pack, derived in unpack
71  size_t num_payload_bytes; //required in pack, derived in unpack
72  size_t num_header_words32; //derived in pack, derived in unpack
73  size_t num_packet_words32; //derived in pack, required in unpack
74 
75  //header fields
76  size_t packet_count;
78  bool sob, eob;
80  bool error;
81 
82  //optional fields
84  bool has_sid; boost::uint32_t sid;
86  bool has_cid; boost::uint64_t cid;
88  bool has_tsi; boost::uint32_t tsi;
90  bool has_tsf; boost::uint64_t tsf;
92  bool has_tlr; boost::uint32_t tlr;
93  };
94 
120  UHD_API void if_hdr_pack_be(
121  boost::uint32_t *packet_buff,
122  if_packet_info_t &if_packet_info
123  );
124 
159  const boost::uint32_t *packet_buff,
160  if_packet_info_t &if_packet_info
161  );
162 
171  UHD_API void if_hdr_pack_le(
172  boost::uint32_t *packet_buff,
173  if_packet_info_t &if_packet_info
174  );
175 
185  const boost::uint32_t *packet_buff,
186  if_packet_info_t &if_packet_info
187  );
188 
190  link_type(LINK_TYPE_NONE),
191  packet_type(PACKET_TYPE_DATA),
192  num_payload_words32(0),
193  num_payload_bytes(0),
194  num_header_words32(0),
195  num_packet_words32(0),
196  packet_count(0),
197  sob(false), eob(false),
198  error(false),
199  has_sid(false), sid(0),
200  has_cid(false), cid(0),
201  has_tsi(false), tsi(0),
202  has_tsf(false), tsf(0),
203  has_tlr(false), tlr(0)
204  {}
205 
206 } //namespace vrt
207 
208 }} //namespace
209 
210 #endif /* INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP */
boost::uint32_t tlr
Definition: vrt_if_packet.hpp:92
Definition: vrt_if_packet.hpp:40
boost::uint32_t tsi
Definition: vrt_if_packet.hpp:88
size_t num_packet_words32
Definition: vrt_if_packet.hpp:73
UHD_API void if_hdr_pack_le(boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
if_packet_info_t(void)
Definition: vrt_if_packet.hpp:189
packet_type_t
Definition: vrt_if_packet.hpp:53
boost::uint64_t tsf
Definition: vrt_if_packet.hpp:90
bool has_cid
Class ID.
Definition: vrt_if_packet.hpp:86
link_type_t
Definition: vrt_if_packet.hpp:45
UHD_API void if_hdr_unpack_be(const boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
UHD_API void if_hdr_pack_be(boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
Definition: convert.hpp:28
Definition: msg.hpp:52
bool error
This is asserted for command responses that are errors (CHDR only)
Definition: vrt_if_packet.hpp:80
size_t num_payload_bytes
Definition: vrt_if_packet.hpp:71
#define UHD_INLINE
Definition: config.h:56
UHD_API void if_hdr_unpack_le(const boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
size_t packet_count
Definition: vrt_if_packet.hpp:76
#define UHD_API
Definition: config.h:66
size_t num_payload_words32
Definition: vrt_if_packet.hpp:70
size_t num_header_words32
Definition: vrt_if_packet.hpp:72
bool sob
Asserted for start- or end-of-burst.
Definition: vrt_if_packet.hpp:78
boost::uint32_t sid
Definition: vrt_if_packet.hpp:84