| USRP Hardware Driver and Device Manual Version: 4.10.0.0 UHD and USRP Manual |

Loading...
Searching...
No Matches
metadata.hpp
Go to the documentation of this file.
1//
2// Copyright 2010-2012,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#pragma once
9
10#include <uhd/config.hpp>
11#include <uhd/types/time_spec.hpp>
12#include <stdint.h>
13#include <string>
14
15 namespace uhd {
16
22 struct UHD_API rx_metadata_t
23{
25 rx_metadata_t()
26 {
27 reset();
28 }
29
31 void reset()
32 {
33 has_time_spec = false;
34 time_spec = time_spec_t(0.0);
35 more_fragments = false;
36 fragment_offset = 0;
37 start_of_burst = false;
38 end_of_burst = false;
39 eov_positions = nullptr;
40 eov_positions_size = 0;
41 eov_positions_count = 0;
42 error_code = ERROR_CODE_NONE;
43 out_of_sequence = false;
44 }
45
47 bool has_time_spec;
48
50 time_spec_t time_spec;
51
59 bool more_fragments;
60
66 size_t fragment_offset;
67
69 bool start_of_burst;
70
72 bool end_of_burst;
73
90 size_t* eov_positions;
91 size_t eov_positions_size;
92
97 size_t eov_positions_count;
98
113 enum error_code_t {
115 ERROR_CODE_NONE = 0x0,
117 ERROR_CODE_TIMEOUT = 0x1,
119 ERROR_CODE_LATE_COMMAND = 0x2,
121 ERROR_CODE_BROKEN_CHAIN = 0x4,
131 ERROR_CODE_OVERFLOW = 0x8,
133 ERROR_CODE_ALIGNMENT = 0xc,
135 ERROR_CODE_BAD_PACKET = 0xf
136 } error_code;
137
140 bool out_of_sequence;
141
148 std::string to_pp_string(bool compact = true) const;
149
154 std::string strerror(void) const;
155};
156
162 struct UHD_API tx_metadata_t
163{
169 bool has_time_spec;
170
172 time_spec_t time_spec;
173
175 bool start_of_burst;
176
178 bool end_of_burst;
179
189 size_t* eov_positions = nullptr;
190 size_t eov_positions_size = 0;
191
196 tx_metadata_t(void);
197};
198
202 struct UHD_API async_metadata_t
203{
205 size_t channel;
206
208 bool has_time_spec;
209
211 time_spec_t time_spec;
212
216 enum event_code_t {
218 EVENT_CODE_OK = 0,
220 EVENT_CODE_BURST_ACK = 0x1,
222 EVENT_CODE_UNDERFLOW = 0x2,
224 EVENT_CODE_SEQ_ERROR = 0x4,
226 EVENT_CODE_TIME_ERROR = 0x8,
228 EVENT_CODE_UNDERFLOW_IN_PACKET = 0x10,
230 EVENT_CODE_SEQ_ERROR_IN_BURST = 0x20,
232 EVENT_CODE_USER_PAYLOAD = 0x40
233 } event_code;
234
238 uint32_t user_payload[4];
239
246 std::string to_pp_string(bool compact = true) const;
247
252 std::string strevent(void) const;
253};
254
255} // namespace uhd
uhd::time_spec_t
Definition time_spec.hpp:31
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
uhd
Definition build_info.hpp:12
uhd::async_metadata_t
Definition metadata.hpp:203
uhd::async_metadata_t::event_code_t
event_code_t
Definition metadata.hpp:216
uhd::async_metadata_t::EVENT_CODE_BURST_ACK
@ EVENT_CODE_BURST_ACK
A burst was successfully transmitted.
Definition metadata.hpp:220
uhd::async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET
@ EVENT_CODE_UNDERFLOW_IN_PACKET
Underflow occurred inside a packet.
Definition metadata.hpp:228
uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR
@ EVENT_CODE_SEQ_ERROR
Packet loss between host and device.
Definition metadata.hpp:224
uhd::async_metadata_t::EVENT_CODE_UNDERFLOW
@ EVENT_CODE_UNDERFLOW
An internal send buffer has emptied.
Definition metadata.hpp:222
uhd::async_metadata_t::EVENT_CODE_TIME_ERROR
@ EVENT_CODE_TIME_ERROR
Packet had time that was late.
Definition metadata.hpp:226
uhd::async_metadata_t::EVENT_CODE_USER_PAYLOAD
@ EVENT_CODE_USER_PAYLOAD
Some kind of custom user payload.
Definition metadata.hpp:232
uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR_IN_BURST
@ EVENT_CODE_SEQ_ERROR_IN_BURST
Packet loss within a burst.
Definition metadata.hpp:230
uhd::async_metadata_t::EVENT_CODE_OK
@ EVENT_CODE_OK
Status report without error code.
Definition metadata.hpp:218
uhd::async_metadata_t::has_time_spec
bool has_time_spec
Has time specification?
Definition metadata.hpp:208
uhd::async_metadata_t::user_payload
uint32_t user_payload[4]
Definition metadata.hpp:238
uhd::async_metadata_t::strevent
std::string strevent(void) const
uhd::async_metadata_t::to_pp_string
std::string to_pp_string(bool compact=true) const
uhd::async_metadata_t::channel
size_t channel
The channel number in a mimo configuration.
Definition metadata.hpp:205
uhd::async_metadata_t::time_spec
time_spec_t time_spec
When the async event occurred.
Definition metadata.hpp:211
uhd::rx_metadata_t::rx_metadata_t
rx_metadata_t()
Default constructor.
Definition metadata.hpp:25
uhd::rx_metadata_t::more_fragments
bool more_fragments
Definition metadata.hpp:59
uhd::rx_metadata_t::time_spec
time_spec_t time_spec
Time of the first sample.
Definition metadata.hpp:50
uhd::rx_metadata_t::out_of_sequence
bool out_of_sequence
Definition metadata.hpp:140
uhd::rx_metadata_t::strerror
std::string strerror(void) const
uhd::rx_metadata_t::end_of_burst
bool end_of_burst
End of burst will be true for the last packet in the chain.
Definition metadata.hpp:72
uhd::rx_metadata_t::has_time_spec
bool has_time_spec
Has time specification?
Definition metadata.hpp:47
uhd::rx_metadata_t::to_pp_string
std::string to_pp_string(bool compact=true) const
uhd::rx_metadata_t::reset
void reset()
Reset values.
Definition metadata.hpp:31
uhd::rx_metadata_t::eov_positions
size_t * eov_positions
Definition metadata.hpp:90
uhd::rx_metadata_t::start_of_burst
bool start_of_burst
Start of burst will be true for the first packet in the chain.
Definition metadata.hpp:69
uhd::rx_metadata_t::eov_positions_size
size_t eov_positions_size
Definition metadata.hpp:91
uhd::rx_metadata_t::error_code
enum uhd::rx_metadata_t::error_code_t error_code
uhd::rx_metadata_t::error_code_t
error_code_t
Definition metadata.hpp:113
uhd::rx_metadata_t::ERROR_CODE_LATE_COMMAND
@ ERROR_CODE_LATE_COMMAND
A stream command was issued in the past.
Definition metadata.hpp:119
uhd::rx_metadata_t::ERROR_CODE_BROKEN_CHAIN
@ ERROR_CODE_BROKEN_CHAIN
Expected another stream command.
Definition metadata.hpp:121
uhd::rx_metadata_t::ERROR_CODE_ALIGNMENT
@ ERROR_CODE_ALIGNMENT
Multi-channel alignment failed.
Definition metadata.hpp:133
uhd::rx_metadata_t::ERROR_CODE_NONE
@ ERROR_CODE_NONE
No error associated with this metadata.
Definition metadata.hpp:115
uhd::rx_metadata_t::ERROR_CODE_BAD_PACKET
@ ERROR_CODE_BAD_PACKET
The packet could not be parsed.
Definition metadata.hpp:135
uhd::rx_metadata_t::ERROR_CODE_TIMEOUT
@ ERROR_CODE_TIMEOUT
No packet received, implementation timed-out.
Definition metadata.hpp:117
uhd::rx_metadata_t::ERROR_CODE_OVERFLOW
@ ERROR_CODE_OVERFLOW
Definition metadata.hpp:131
uhd::rx_metadata_t::eov_positions_count
size_t eov_positions_count
Definition metadata.hpp:97
uhd::rx_metadata_t::fragment_offset
size_t fragment_offset
Definition metadata.hpp:66
uhd::tx_metadata_t::end_of_burst
bool end_of_burst
Set end of burst to true for the last packet in the chain.
Definition metadata.hpp:178
uhd::tx_metadata_t::tx_metadata_t
tx_metadata_t(void)
uhd::tx_metadata_t::eov_positions_size
size_t eov_positions_size
Definition metadata.hpp:190
uhd::tx_metadata_t::start_of_burst
bool start_of_burst
Set start of burst to true for the first packet in the chain.
Definition metadata.hpp:175
uhd::tx_metadata_t::time_spec
time_spec_t time_spec
When to send the first sample.
Definition metadata.hpp:172
uhd::tx_metadata_t::eov_positions
size_t * eov_positions
Definition metadata.hpp:189
uhd::tx_metadata_t::has_time_spec
bool has_time_spec
Definition metadata.hpp:169
time_spec.hpp