USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-gdca39145
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 // SPDX-License-Identifier: GPL-3.0
5 //
6 
7 #ifndef INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP
8 #define INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP
9 
10 #include <uhd/config.hpp>
11 #include <stdint.h>
12 #include <cstddef> //size_t
13 
14 namespace uhd{ namespace transport{
15 
16 namespace vrt{
17 
19  static const size_t num_vrl_words32 = 3;
20 
22  static const size_t max_if_hdr_words32 = 7; //hdr+sid+cid+tsi+tsf
23 
30  {
31  if_packet_info_t(void);
32 
33  //link layer type - always set for pack and unpack
35  {
36  LINK_TYPE_NONE = 0x0,
37  LINK_TYPE_CHDR = 0x1,
38  LINK_TYPE_VRLP = 0x2
39  } link_type;
40 
41  //packet type
43  {
44  // VRT language:
45  PACKET_TYPE_DATA = 0x0,
46  PACKET_TYPE_IF_EXT = 0x1,
47  PACKET_TYPE_CONTEXT = 0x2, //extension context: has_sid = true
48 
49  // CHDR language:
50  //PACKET_TYPE_DATA = 0x0, // Data
51  PACKET_TYPE_FC = 0x1, // Flow control
52  PACKET_TYPE_ACK = 0x1, // Flow control (ack)
53  PACKET_TYPE_CMD = 0x2, // Command
54  PACKET_TYPE_RESP = 0x3, // Command response
55  PACKET_TYPE_ERROR = 0x3 // Command response: Error (the EOB bit is raised in this case)
56  } packet_type;
57 
58  //size fields
59  size_t num_payload_words32; //required in pack, derived in unpack
60  size_t num_payload_bytes; //required in pack, derived in unpack
61  size_t num_header_words32; //derived in pack, derived in unpack
62  size_t num_packet_words32; //derived in pack, required in unpack
63 
64  //header fields
65  size_t packet_count;
67  bool sob, eob;
69  bool error;
70 
71  //optional fields
73  bool has_sid; uint32_t sid;
75  bool has_cid; uint64_t cid;
77  bool has_tsi; uint32_t tsi;
79  bool has_tsf; uint64_t tsf;
81  bool has_tlr; uint32_t tlr;
82  };
83 
109  UHD_API void if_hdr_pack_be(
110  uint32_t *packet_buff,
111  if_packet_info_t &if_packet_info
112  );
113 
148  const uint32_t *packet_buff,
149  if_packet_info_t &if_packet_info
150  );
151 
160  UHD_API void if_hdr_pack_le(
161  uint32_t *packet_buff,
162  if_packet_info_t &if_packet_info
163  );
164 
174  const uint32_t *packet_buff,
175  if_packet_info_t &if_packet_info
176  );
177 
179  link_type(LINK_TYPE_NONE),
180  packet_type(PACKET_TYPE_DATA),
181  num_payload_words32(0),
182  num_payload_bytes(0),
183  num_header_words32(0),
184  num_packet_words32(0),
185  packet_count(0),
186  sob(false), eob(false),
187  error(false),
188  has_sid(false), sid(0),
189  has_cid(false), cid(0),
190  has_tsi(false), tsi(0),
191  has_tsf(false), tsf(0),
192  has_tlr(false), tlr(0)
193  {}
194 
195 } //namespace vrt
196 
197 }} //namespace
198 
199 #endif /* INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP */
Definition: vrt_if_packet.hpp:29
size_t num_packet_words32
Definition: vrt_if_packet.hpp:62
UHD_API void if_hdr_unpack_le(const uint32_t *packet_buff, if_packet_info_t &if_packet_info)
if_packet_info_t(void)
Definition: vrt_if_packet.hpp:178
packet_type_t
Definition: vrt_if_packet.hpp:42
uint64_t tsf
Definition: vrt_if_packet.hpp:79
UHD_API void if_hdr_unpack_be(const uint32_t *packet_buff, if_packet_info_t &if_packet_info)
bool has_cid
Class ID.
Definition: vrt_if_packet.hpp:75
link_type_t
Definition: vrt_if_packet.hpp:34
uint32_t tlr
Definition: vrt_if_packet.hpp:81
Definition: build_info.hpp:14
uint32_t sid
Definition: vrt_if_packet.hpp:73
UHD_API void if_hdr_pack_be(uint32_t *packet_buff, if_packet_info_t &if_packet_info)
bool error
This is asserted for command responses that are errors (CHDR only)
Definition: vrt_if_packet.hpp:69
size_t num_payload_bytes
Definition: vrt_if_packet.hpp:60
#define UHD_INLINE
Definition: config.h:52
Definition: log.hpp:108
size_t packet_count
Definition: vrt_if_packet.hpp:65
#define UHD_API
Definition: config.h:62
size_t num_payload_words32
Definition: vrt_if_packet.hpp:59
UHD_API void if_hdr_pack_le(uint32_t *packet_buff, if_packet_info_t &if_packet_info)
size_t num_header_words32
Definition: vrt_if_packet.hpp:61
bool sob
Asserted for start- or end-of-burst.
Definition: vrt_if_packet.hpp:67
uint32_t tsi
Definition: vrt_if_packet.hpp:77