USRP Hardware Driver and USRP Manual Version: 4.2.0.0
UHD and USRP Manual
metadata.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 Ettus Research
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.h>
11#include <uhd/error.h>
12
13#include <stdbool.h>
14#include <stdint.h>
15#include <stdlib.h>
16#include <time.h>
17
18#ifdef __cplusplus
20#include <string>
21
22struct uhd_rx_metadata_t {
23 uhd::rx_metadata_t rx_metadata_cpp;
24 std::string last_error;
25};
26
27struct uhd_tx_metadata_t {
28 uhd::tx_metadata_t tx_metadata_cpp;
29 std::string last_error;
30};
31
32struct uhd_async_metadata_t {
33 uhd::async_metadata_t async_metadata_cpp;
34 std::string last_error;
35};
36
37extern "C" {
38#else
39struct uhd_rx_metadata_t;
40struct uhd_tx_metadata_t;
41struct uhd_async_metadata_t;
42#endif
43
45
51typedef struct uhd_rx_metadata_t* uhd_rx_metadata_handle;
52
54
60typedef struct uhd_tx_metadata_t* uhd_tx_metadata_handle;
61
63
69typedef struct uhd_async_metadata_t* uhd_async_metadata_handle;
70
72
75typedef enum {
91
92
96);
97
99
104);
105
109 bool *result_out
110);
111
115 int64_t *full_secs_out,
116 double *frac_secs_out
117);
118
122 bool *result_out
123);
124
128 size_t *fragment_offset_out
129);
130
134 bool *result_out
135);
136
140 bool *result_out
141);
142
146 bool *result_out
147);
148
150
160 char* pp_string_out,
161 size_t strbuffer_len
162);
163
167 uhd_rx_metadata_error_code_t *error_code_out
168);
169
171
186 char* strerror_out,
187 size_t strbuffer_len
188);
189
191
206 char* error_out,
207 size_t strbuffer_len
208);
209
213 bool has_time_spec,
214 int64_t full_secs,
215 double frac_secs,
216 bool start_of_burst,
217 bool end_of_burst
218);
219
220
222
227);
228
232 bool *result_out
233);
234
238 int64_t *full_secs_out,
239 double *frac_secs_out
240);
241
245 bool *result_out
246);
247
251 bool *result_out
252);
253
255
265 char* error_out,
266 size_t strbuffer_len
267);
268
270
273typedef enum {
289
293);
294
296
301);
302
306 size_t *channel_out
307);
308
312 bool *result_out
313);
314
318 int64_t *full_secs_out,
319 double *frac_secs_out
320);
321
325 uhd_async_metadata_event_code_t *event_code_out
326);
327
331 uint32_t user_payload_out[4]
332);
333
335
345 char* error_out,
346 size_t strbuffer_len
347);
348
349#ifdef __cplusplus
350}
351#endif
#define UHD_API
Definition: config.h:87
uhd_error
UHD error codes.
Definition: error.h:20
UHD_API uhd_error uhd_async_metadata_has_time_spec(uhd_async_metadata_handle h, bool *result_out)
Has time specification?
UHD_API uhd_error uhd_rx_metadata_make(uhd_rx_metadata_handle *handle)
Create a new RX metadata handle.
UHD_API uhd_error uhd_rx_metadata_end_of_burst(uhd_rx_metadata_handle h, bool *result_out)
End of burst?
UHD_API uhd_error uhd_rx_metadata_last_error(uhd_rx_metadata_handle h, char *error_out, size_t strbuffer_len)
Get the last error logged by the RX metadata object.
UHD_API uhd_error uhd_async_metadata_user_payload(uhd_async_metadata_handle h, uint32_t user_payload_out[4])
Get payload from custom FPGA fabric.
UHD_API uhd_error uhd_tx_metadata_has_time_spec(uhd_tx_metadata_handle h, bool *result_out)
Has time specification?
UHD_API uhd_error uhd_rx_metadata_has_time_spec(uhd_rx_metadata_handle h, bool *result_out)
Has time specification?
UHD_API uhd_error uhd_async_metadata_channel(uhd_async_metadata_handle h, size_t *channel_out)
Channel number in a MIMO configuration.
UHD_API uhd_error uhd_async_metadata_free(uhd_async_metadata_handle *handle)
Free an async metadata handle.
struct uhd_rx_metadata_t * uhd_rx_metadata_handle
RX metadata interface for describing sent IF data.
Definition: metadata.h:51
UHD_API uhd_error uhd_async_metadata_last_error(uhd_async_metadata_handle h, char *error_out, size_t strbuffer_len)
Get the last error logged by the async metadata object.
UHD_API uhd_error uhd_rx_metadata_error_code(uhd_rx_metadata_handle h, uhd_rx_metadata_error_code_t *error_code_out)
Get the last error state of the RX metadata object.
uhd_rx_metadata_error_code_t
Error condition on a receive call.
Definition: metadata.h:75
@ UHD_RX_METADATA_ERROR_CODE_TIMEOUT
No packet received, implementation timed out.
Definition: metadata.h:79
@ UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND
A stream command was issued in the past.
Definition: metadata.h:81
@ UHD_RX_METADATA_ERROR_CODE_NONE
No error code associated with this metadata.
Definition: metadata.h:77
@ UHD_RX_METADATA_ERROR_CODE_BAD_PACKET
The packet could not be parsed.
Definition: metadata.h:89
@ UHD_RX_METADATA_ERROR_CODE_OVERFLOW
Overflow or sequence error.
Definition: metadata.h:85
@ UHD_RX_METADATA_ERROR_CODE_BROKEN_CHAIN
Expected another stream command.
Definition: metadata.h:83
@ UHD_RX_METADATA_ERROR_CODE_ALIGNMENT
Multi-channel alignment failed.
Definition: metadata.h:87
UHD_API uhd_error uhd_rx_metadata_fragment_offset(uhd_rx_metadata_handle h, size_t *fragment_offset_out)
Fragmentation offset.
struct uhd_tx_metadata_t * uhd_tx_metadata_handle
TX metadata interface for describing received IF data.
Definition: metadata.h:60
UHD_API uhd_error uhd_tx_metadata_start_of_burst(uhd_tx_metadata_handle h, bool *result_out)
Start of burst?
uhd_async_metadata_event_code_t
The type of event for a receive async message call.
Definition: metadata.h:273
@ UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW
An internal send buffer has emptied.
Definition: metadata.h:277
@ UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR_IN_BURST
Packet loss within a burst.
Definition: metadata.h:285
@ UHD_ASYNC_METADATA_EVENT_CODE_USER_PAYLOAD
Some kind of custom user payload.
Definition: metadata.h:287
@ UHD_ASYNC_METADATA_EVENT_CODE_TIME_ERROR
Packet had time that was late.
Definition: metadata.h:281
@ UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW_IN_PACKET
Underflow occurred inside a packet.
Definition: metadata.h:283
@ UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR
Packet loss error between host and device.
Definition: metadata.h:279
@ UHD_ASYNC_METADATA_EVENT_CODE_BURST_ACK
A burst was successfully transmitted.
Definition: metadata.h:275
UHD_API uhd_error uhd_rx_metadata_to_pp_string(uhd_rx_metadata_handle h, char *pp_string_out, size_t strbuffer_len)
Return a pretty-print representation of this metadata.
UHD_API uhd_error uhd_rx_metadata_start_of_burst(uhd_rx_metadata_handle h, bool *result_out)
Start of burst?
UHD_API uhd_error uhd_rx_metadata_more_fragments(uhd_rx_metadata_handle h, bool *result_out)
Fragmentation flag.
UHD_API uhd_error uhd_rx_metadata_out_of_sequence(uhd_rx_metadata_handle h, bool *result_out)
Result out of sequence?
UHD_API uhd_error uhd_tx_metadata_end_of_burst(uhd_tx_metadata_handle h, bool *result_out)
End of burst?
UHD_API uhd_error uhd_tx_metadata_time_spec(uhd_tx_metadata_handle h, int64_t *full_secs_out, double *frac_secs_out)
Get time specification.
UHD_API uhd_error uhd_rx_metadata_strerror(uhd_rx_metadata_handle h, char *strerror_out, size_t strbuffer_len)
Get a string representation of the last error state of the RX metadata object.
UHD_API uhd_error uhd_tx_metadata_last_error(uhd_tx_metadata_handle h, char *error_out, size_t strbuffer_len)
Get the last error logged by the TX metadata object.
UHD_API uhd_error uhd_tx_metadata_make(uhd_tx_metadata_handle *handle, bool has_time_spec, int64_t full_secs, double frac_secs, bool start_of_burst, bool end_of_burst)
Create a new TX metadata handle.
struct uhd_async_metadata_t * uhd_async_metadata_handle
Interface for describing transmit-related events.
Definition: metadata.h:69
UHD_API uhd_error uhd_tx_metadata_free(uhd_tx_metadata_handle *handle)
Free an TX metadata handle.
UHD_API uhd_error uhd_async_metadata_make(uhd_async_metadata_handle *handle)
Create a new async metadata handle.
UHD_API uhd_error uhd_async_metadata_time_spec(uhd_async_metadata_handle h, int64_t *full_secs_out, double *frac_secs_out)
Get time specification.
UHD_API uhd_error uhd_rx_metadata_free(uhd_rx_metadata_handle *handle)
Free an RX metadata handle.
UHD_API uhd_error uhd_async_metadata_event_code(uhd_async_metadata_handle h, uhd_async_metadata_event_code_t *event_code_out)
Get last event code.
UHD_API uhd_error uhd_rx_metadata_time_spec(uhd_rx_metadata_handle h, int64_t *full_secs_out, double *frac_secs_out)
Time of first sample.
Definition: metadata.hpp:203
Definition: metadata.hpp:23
Definition: metadata.hpp:163