USRP Hardware Driver and USRP Manual Version: 3.15.0.0-MacPorts-Release
UHD and USRP Manual
vrt_if_packet.hpp
Go to the documentation of this file.
1//
2// Copyright 2010-2014 Ettus Research LLC
3// Copyright 2018 Ettus Research, a National Instruments Company
4//
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
7
8#ifndef INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP
9#define INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP
10
11#include <uhd/config.hpp>
12#include <stdint.h>
13#include <cstddef> //size_t
14
15namespace uhd { namespace transport { namespace vrt {
16
18static const size_t num_vrl_words32 = 3;
19
21static const size_t max_if_hdr_words32 = 7; // hdr+sid+cid+tsi+tsf
22
29{
30 if_packet_info_t(void);
31
32 // link layer type - always set for pack and unpack
34 LINK_TYPE_NONE = 0x0,
35 LINK_TYPE_CHDR = 0x1,
36 LINK_TYPE_VRLP = 0x2
37 } link_type;
38
39 // packet type
41 // VRT language:
42 PACKET_TYPE_DATA = 0x0,
43 PACKET_TYPE_IF_EXT = 0x1,
44 PACKET_TYPE_CONTEXT = 0x2, // extension context: has_sid = true
45
46 // CHDR language:
47 // PACKET_TYPE_DATA = 0x0, // Data
48 PACKET_TYPE_FC = 0x1, // Flow control
49 PACKET_TYPE_ACK = 0x1, // Flow control (ack)
50 PACKET_TYPE_CMD = 0x2, // Command
51 PACKET_TYPE_RESP = 0x3, // Command response
52 PACKET_TYPE_ERROR =
53 0x3 // Command response: Error (the EOB bit is raised in this case)
54 } packet_type;
55
56 // size fields
57 size_t num_payload_words32; // required in pack, derived in unpack
58 size_t num_payload_bytes; // required in pack, derived in unpack
59 size_t num_header_words32; // derived in pack, derived in unpack
60 size_t num_packet_words32; // derived in pack, required in unpack
61
62 // header fields
65 bool sob, eob;
67 bool error;
69 bool fc_ack;
70
71 // optional fields
73 bool has_sid;
74 uint32_t sid;
76 bool has_cid;
77 uint64_t cid;
79 bool has_tsi;
80 uint32_t tsi;
82 bool has_tsf;
83 uint64_t tsf;
85 bool has_tlr;
86 uint32_t tlr;
87};
88
114UHD_API void if_hdr_pack_be(uint32_t* packet_buff, if_packet_info_t& if_packet_info);
115
150 const uint32_t* packet_buff, if_packet_info_t& if_packet_info);
151
160UHD_API void if_hdr_pack_le(uint32_t* packet_buff, if_packet_info_t& if_packet_info);
161
171 const uint32_t* packet_buff, if_packet_info_t& if_packet_info);
172
174 : link_type(LINK_TYPE_NONE)
175 , packet_type(PACKET_TYPE_DATA)
176 , num_payload_words32(0)
177 , num_payload_bytes(0)
178 , num_header_words32(0)
179 , num_packet_words32(0)
180 , packet_count(0)
181 , sob(false)
182 , eob(false)
183 , error(false)
184 , fc_ack(false)
185 , has_sid(false)
186 , sid(0)
187 , has_cid(false)
188 , cid(0)
189 , has_tsi(false)
190 , tsi(0)
191 , has_tsf(false)
192 , tsf(0)
193 , has_tlr(false)
194 , tlr(0)
195{
196}
197
198}}} // namespace uhd::transport::vrt
199
200#endif /* INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP */
#define UHD_INLINE
Definition: config.h:53
#define UHD_API
Definition: config.h:68
@ error
Definition: log.hpp:109
UHD_API void if_hdr_unpack_be(const uint32_t *packet_buff, if_packet_info_t &if_packet_info)
UHD_API void if_hdr_unpack_le(const uint32_t *packet_buff, if_packet_info_t &if_packet_info)
UHD_API void if_hdr_pack_be(uint32_t *packet_buff, if_packet_info_t &if_packet_info)
UHD_API void if_hdr_pack_le(uint32_t *packet_buff, if_packet_info_t &if_packet_info)
Definition: build_info.hpp:13
Definition: vrt_if_packet.hpp:29
bool has_tsf
Fractional timestamp.
Definition: vrt_if_packet.hpp:82
link_type_t
Definition: vrt_if_packet.hpp:33
uint64_t tsf
Definition: vrt_if_packet.hpp:83
uint32_t sid
Definition: vrt_if_packet.hpp:74
if_packet_info_t(void)
Definition: vrt_if_packet.hpp:173
bool eob
Definition: vrt_if_packet.hpp:65
size_t num_payload_bytes
Definition: vrt_if_packet.hpp:58
size_t num_packet_words32
Definition: vrt_if_packet.hpp:60
bool has_sid
Stream ID (SID). See uhd::sid_t.
Definition: vrt_if_packet.hpp:73
size_t packet_count
Definition: vrt_if_packet.hpp:63
packet_type_t
Definition: vrt_if_packet.hpp:40
bool fc_ack
This is asserted for flow control packets are ACKS (CHDR only)
Definition: vrt_if_packet.hpp:69
uint32_t tlr
Definition: vrt_if_packet.hpp:86
bool has_tsi
Integer timestamp.
Definition: vrt_if_packet.hpp:79
bool has_tlr
Trailer.
Definition: vrt_if_packet.hpp:85
bool has_cid
Class ID.
Definition: vrt_if_packet.hpp:76
uint32_t tsi
Definition: vrt_if_packet.hpp:80
size_t num_payload_words32
Definition: vrt_if_packet.hpp:57
uint64_t cid
Definition: vrt_if_packet.hpp:77
size_t num_header_words32
Definition: vrt_if_packet.hpp:59
bool error
This is asserted for command responses that are errors (CHDR only)
Definition: vrt_if_packet.hpp:67