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

Loading...
Searching...
No Matches
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
19# include <uhd/types/metadata.hpp>
20# include <string>
21
22 struct uhd_rx_metadata_t
23{
24 uhd::rx_metadata_t rx_metadata_cpp;
25 std::string last_error;
26};
27
28 struct uhd_tx_metadata_t
29{
30 uhd::tx_metadata_t tx_metadata_cpp;
31 std::string last_error;
32};
33
34 struct uhd_async_metadata_t
35{
36 uhd::async_metadata_t async_metadata_cpp;
37 std::string last_error;
38};
39
40 extern "C" {
41#else
42 struct uhd_rx_metadata_t;
43 struct uhd_tx_metadata_t;
44 struct uhd_async_metadata_t;
45#endif
46
48
54 typedef struct uhd_rx_metadata_t* uhd_rx_metadata_handle;
55
57
63 typedef struct uhd_tx_metadata_t* uhd_tx_metadata_handle;
64
66
72 typedef struct uhd_async_metadata_t* uhd_async_metadata_handle;
73
75
78 typedef enum {
80 UHD_RX_METADATA_ERROR_CODE_NONE = 0x0,
82 UHD_RX_METADATA_ERROR_CODE_TIMEOUT = 0x1,
84 UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND = 0x2,
86 UHD_RX_METADATA_ERROR_CODE_BROKEN_CHAIN = 0x4,
88 UHD_RX_METADATA_ERROR_CODE_OVERFLOW = 0x8,
90 UHD_RX_METADATA_ERROR_CODE_ALIGNMENT = 0xC,
92 UHD_RX_METADATA_ERROR_CODE_BAD_PACKET = 0xF
93} uhd_rx_metadata_error_code_t;
94
95
97 UHD_API uhd_error uhd_rx_metadata_make(uhd_rx_metadata_handle* handle);
98
100
103 UHD_API uhd_error uhd_rx_metadata_free(uhd_rx_metadata_handle* handle);
104
106 UHD_API uhd_error uhd_rx_metadata_has_time_spec(
107 uhd_rx_metadata_handle h, bool* result_out);
108
110 UHD_API uhd_error uhd_rx_metadata_time_spec(
111 uhd_rx_metadata_handle h, int64_t* full_secs_out, double* frac_secs_out);
112
114 UHD_API uhd_error uhd_rx_metadata_more_fragments(
115 uhd_rx_metadata_handle h, bool* result_out);
116
118 UHD_API uhd_error uhd_rx_metadata_fragment_offset(
119 uhd_rx_metadata_handle h, size_t* fragment_offset_out);
120
122 UHD_API uhd_error uhd_rx_metadata_start_of_burst(
123 uhd_rx_metadata_handle h, bool* result_out);
124
126 UHD_API uhd_error uhd_rx_metadata_end_of_burst(
127 uhd_rx_metadata_handle h, bool* result_out);
128
130 UHD_API uhd_error uhd_rx_metadata_out_of_sequence(
131 uhd_rx_metadata_handle h, bool* result_out);
132
134
142 UHD_API uhd_error uhd_rx_metadata_to_pp_string(
143 uhd_rx_metadata_handle h, char* pp_string_out, size_t strbuffer_len);
144
146 UHD_API uhd_error uhd_rx_metadata_error_code(
147 uhd_rx_metadata_handle h, uhd_rx_metadata_error_code_t* error_code_out);
148
150
163 UHD_API uhd_error uhd_rx_metadata_strerror(
164 uhd_rx_metadata_handle h, char* strerror_out, size_t strbuffer_len);
165
167
180 UHD_API uhd_error uhd_rx_metadata_last_error(
181 uhd_rx_metadata_handle h, char* error_out, size_t strbuffer_len);
182
184 UHD_API uhd_error uhd_tx_metadata_make(uhd_tx_metadata_handle* handle,
185 bool has_time_spec,
186 int64_t full_secs,
187 double frac_secs,
188 bool start_of_burst,
189 bool end_of_burst);
190
191
193
196 UHD_API uhd_error uhd_tx_metadata_free(uhd_tx_metadata_handle* handle);
197
199 UHD_API uhd_error uhd_tx_metadata_has_time_spec(
200 uhd_tx_metadata_handle h, bool* result_out);
201
203 UHD_API uhd_error uhd_tx_metadata_time_spec(
204 uhd_tx_metadata_handle h, int64_t* full_secs_out, double* frac_secs_out);
205
207 UHD_API uhd_error uhd_tx_metadata_start_of_burst(
208 uhd_tx_metadata_handle h, bool* result_out);
209
211 UHD_API uhd_error uhd_tx_metadata_end_of_burst(
212 uhd_tx_metadata_handle h, bool* result_out);
213
215
223 UHD_API uhd_error uhd_tx_metadata_last_error(
224 uhd_tx_metadata_handle h, char* error_out, size_t strbuffer_len);
225
227
230 typedef enum {
232 UHD_ASYNC_METADATA_EVENT_CODE_BURST_ACK = 0x1,
234 UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW = 0x2,
236 UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR = 0x4,
238 UHD_ASYNC_METADATA_EVENT_CODE_TIME_ERROR = 0x8,
240 UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW_IN_PACKET = 0x10,
242 UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR_IN_BURST = 0x20,
244 UHD_ASYNC_METADATA_EVENT_CODE_USER_PAYLOAD = 0x40
245} uhd_async_metadata_event_code_t;
246
248 UHD_API uhd_error uhd_async_metadata_make(uhd_async_metadata_handle* handle);
249
251
254 UHD_API uhd_error uhd_async_metadata_free(uhd_async_metadata_handle* handle);
255
257 UHD_API uhd_error uhd_async_metadata_channel(
258 uhd_async_metadata_handle h, size_t* channel_out);
259
261 UHD_API uhd_error uhd_async_metadata_has_time_spec(
262 uhd_async_metadata_handle h, bool* result_out);
263
265 UHD_API uhd_error uhd_async_metadata_time_spec(
266 uhd_async_metadata_handle h, int64_t* full_secs_out, double* frac_secs_out);
267
269 UHD_API uhd_error uhd_async_metadata_event_code(
270 uhd_async_metadata_handle h, uhd_async_metadata_event_code_t* event_code_out);
271
273 UHD_API uhd_error uhd_async_metadata_user_payload(
274 uhd_async_metadata_handle h, uint32_t user_payload_out[4]);
275
277
285 UHD_API uhd_error uhd_async_metadata_last_error(
286 uhd_async_metadata_handle h, char* error_out, size_t strbuffer_len);
287
288#ifdef __cplusplus
289}
290#endif
config.h
UHD_API
#define UHD_API
Definition config.h:87
error.h
uhd_error
uhd_error
UHD error codes.
Definition error.h:20
uhd_async_metadata_has_time_spec
UHD_API uhd_error uhd_async_metadata_has_time_spec(uhd_async_metadata_handle h, bool *result_out)
Has time specification?
uhd_rx_metadata_make
UHD_API uhd_error uhd_rx_metadata_make(uhd_rx_metadata_handle *handle)
Create a new RX metadata handle.
uhd_rx_metadata_end_of_burst
UHD_API uhd_error uhd_rx_metadata_end_of_burst(uhd_rx_metadata_handle h, bool *result_out)
End of burst?
uhd_rx_metadata_last_error
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_async_metadata_user_payload
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_tx_metadata_has_time_spec
UHD_API uhd_error uhd_tx_metadata_has_time_spec(uhd_tx_metadata_handle h, bool *result_out)
Has time specification?
uhd_rx_metadata_has_time_spec
UHD_API uhd_error uhd_rx_metadata_has_time_spec(uhd_rx_metadata_handle h, bool *result_out)
Has time specification?
uhd_async_metadata_channel
UHD_API uhd_error uhd_async_metadata_channel(uhd_async_metadata_handle h, size_t *channel_out)
Channel number in a MIMO configuration.
uhd_async_metadata_free
UHD_API uhd_error uhd_async_metadata_free(uhd_async_metadata_handle *handle)
Free an async metadata handle.
uhd_rx_metadata_handle
struct uhd_rx_metadata_t * uhd_rx_metadata_handle
RX metadata interface for describing sent IF data.
Definition metadata.h:54
uhd_async_metadata_last_error
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_rx_metadata_error_code
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
uhd_rx_metadata_error_code_t
Error condition on a receive call.
Definition metadata.h:78
UHD_RX_METADATA_ERROR_CODE_TIMEOUT
@ UHD_RX_METADATA_ERROR_CODE_TIMEOUT
No packet received, implementation timed out.
Definition metadata.h:82
UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND
@ UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND
A stream command was issued in the past.
Definition metadata.h:84
UHD_RX_METADATA_ERROR_CODE_NONE
@ UHD_RX_METADATA_ERROR_CODE_NONE
No error code associated with this metadata.
Definition metadata.h:80
UHD_RX_METADATA_ERROR_CODE_BAD_PACKET
@ UHD_RX_METADATA_ERROR_CODE_BAD_PACKET
The packet could not be parsed.
Definition metadata.h:92
UHD_RX_METADATA_ERROR_CODE_OVERFLOW
@ UHD_RX_METADATA_ERROR_CODE_OVERFLOW
Overflow or sequence error.
Definition metadata.h:88
UHD_RX_METADATA_ERROR_CODE_BROKEN_CHAIN
@ UHD_RX_METADATA_ERROR_CODE_BROKEN_CHAIN
Expected another stream command.
Definition metadata.h:86
UHD_RX_METADATA_ERROR_CODE_ALIGNMENT
@ UHD_RX_METADATA_ERROR_CODE_ALIGNMENT
Multi-channel alignment failed.
Definition metadata.h:90
uhd_rx_metadata_fragment_offset
UHD_API uhd_error uhd_rx_metadata_fragment_offset(uhd_rx_metadata_handle h, size_t *fragment_offset_out)
Fragmentation offset.
uhd_tx_metadata_handle
struct uhd_tx_metadata_t * uhd_tx_metadata_handle
TX metadata interface for describing received IF data.
Definition metadata.h:63
uhd_tx_metadata_start_of_burst
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
uhd_async_metadata_event_code_t
The type of event for a receive async message call.
Definition metadata.h:230
UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW
@ UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW
An internal send buffer has emptied.
Definition metadata.h:234
UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR_IN_BURST
@ UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR_IN_BURST
Packet loss within a burst.
Definition metadata.h:242
UHD_ASYNC_METADATA_EVENT_CODE_USER_PAYLOAD
@ UHD_ASYNC_METADATA_EVENT_CODE_USER_PAYLOAD
Some kind of custom user payload.
Definition metadata.h:244
UHD_ASYNC_METADATA_EVENT_CODE_TIME_ERROR
@ UHD_ASYNC_METADATA_EVENT_CODE_TIME_ERROR
Packet had time that was late.
Definition metadata.h:238
UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW_IN_PACKET
@ UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW_IN_PACKET
Underflow occurred inside a packet.
Definition metadata.h:240
UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR
@ UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR
Packet loss error between host and device.
Definition metadata.h:236
UHD_ASYNC_METADATA_EVENT_CODE_BURST_ACK
@ UHD_ASYNC_METADATA_EVENT_CODE_BURST_ACK
A burst was successfully transmitted.
Definition metadata.h:232
uhd_rx_metadata_to_pp_string
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_rx_metadata_start_of_burst
UHD_API uhd_error uhd_rx_metadata_start_of_burst(uhd_rx_metadata_handle h, bool *result_out)
Start of burst?
uhd_rx_metadata_more_fragments
UHD_API uhd_error uhd_rx_metadata_more_fragments(uhd_rx_metadata_handle h, bool *result_out)
Fragmentation flag.
uhd_rx_metadata_out_of_sequence
UHD_API uhd_error uhd_rx_metadata_out_of_sequence(uhd_rx_metadata_handle h, bool *result_out)
Result out of sequence?
uhd_tx_metadata_end_of_burst
UHD_API uhd_error uhd_tx_metadata_end_of_burst(uhd_tx_metadata_handle h, bool *result_out)
End of burst?
uhd_tx_metadata_time_spec
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_rx_metadata_strerror
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_tx_metadata_last_error
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_tx_metadata_make
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.
uhd_async_metadata_handle
struct uhd_async_metadata_t * uhd_async_metadata_handle
Interface for describing transmit-related events.
Definition metadata.h:72
uhd_tx_metadata_free
UHD_API uhd_error uhd_tx_metadata_free(uhd_tx_metadata_handle *handle)
Free an TX metadata handle.
uhd_async_metadata_make
UHD_API uhd_error uhd_async_metadata_make(uhd_async_metadata_handle *handle)
Create a new async metadata handle.
uhd_async_metadata_time_spec
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_rx_metadata_free
UHD_API uhd_error uhd_rx_metadata_free(uhd_rx_metadata_handle *handle)
Free an RX metadata handle.
uhd_async_metadata_event_code
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_rx_metadata_time_spec
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.
metadata.hpp