USRP Hardware Driver and USRP Manual  Version: 4.4.0.HEAD-0-g5fac246b
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
19 #include <uhd/types/metadata.hpp>
20 #include <string>
21 
22 struct uhd_rx_metadata_t {
23  uhd::rx_metadata_t rx_metadata_cpp;
24  std::string last_error;
25 };
26 
27 struct uhd_tx_metadata_t {
28  uhd::tx_metadata_t tx_metadata_cpp;
29  std::string last_error;
30 };
31 
32 struct uhd_async_metadata_t {
33  uhd::async_metadata_t async_metadata_cpp;
34  std::string last_error;
35 };
36 
37 extern "C" {
38 #else
39 struct uhd_rx_metadata_t;
40 struct uhd_tx_metadata_t;
41 struct uhd_async_metadata_t;
42 #endif
43 
45 
51 typedef struct uhd_rx_metadata_t* uhd_rx_metadata_handle;
52 
54 
60 typedef struct uhd_tx_metadata_t* uhd_tx_metadata_handle;
61 
63 
69 typedef struct uhd_async_metadata_t* uhd_async_metadata_handle;
70 
72 
75 typedef enum {
91 
92 
96 );
97 
99 
103  uhd_rx_metadata_handle* handle
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 
212  uhd_tx_metadata_handle* handle,
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 
226  uhd_tx_metadata_handle* handle
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 
273 typedef 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
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_EVENT_CODE_USER_PAYLOAD
@ UHD_ASYNC_METADATA_EVENT_CODE_USER_PAYLOAD
Some kind of custom user payload.
Definition: metadata.h:287
uhd_async_metadata_handle
struct uhd_async_metadata_t * uhd_async_metadata_handle
Interface for describing transmit-related events.
Definition: metadata.h:69
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_ASYNC_METADATA_EVENT_CODE_BURST_ACK
@ UHD_ASYNC_METADATA_EVENT_CODE_BURST_ACK
A burst was successfully transmitted.
Definition: metadata.h:275
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_async_metadata_free
UHD_API uhd_error uhd_async_metadata_free(uhd_async_metadata_handle *handle)
Free an async metadata handle.
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_EVENT_CODE_SEQ_ERROR_IN_BURST
@ UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR_IN_BURST
Packet loss within a burst.
Definition: metadata.h:285
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_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_tx_metadata_free
UHD_API uhd_error uhd_tx_metadata_free(uhd_tx_metadata_handle *handle)
Free an TX metadata handle.
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_ERROR_CODE_LATE_COMMAND
@ UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND
A stream command was issued in the past.
Definition: metadata.h:81
UHD_API
#define UHD_API
Definition: config.h:87
UHD_ASYNC_METADATA_EVENT_CODE_TIME_ERROR
@ UHD_ASYNC_METADATA_EVENT_CODE_TIME_ERROR
Packet had time that was late.
Definition: metadata.h:281
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_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_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_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_error_code_t
uhd_rx_metadata_error_code_t
Error condition on a receive call.
Definition: metadata.h:75
uhd_tx_metadata_handle
struct uhd_tx_metadata_t * uhd_tx_metadata_handle
TX metadata interface for describing received IF data.
Definition: metadata.h:60
uhd::async_metadata_t
Definition: metadata.hpp:202
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.
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?
error.h
uhd_rx_metadata_handle
struct uhd_rx_metadata_t * uhd_rx_metadata_handle
RX metadata interface for describing sent IF data.
Definition: metadata.h:51
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_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR
@ UHD_ASYNC_METADATA_EVENT_CODE_SEQ_ERROR
Packet loss error between host and device.
Definition: metadata.h:279
UHD_RX_METADATA_ERROR_CODE_OVERFLOW
@ UHD_RX_METADATA_ERROR_CODE_OVERFLOW
Overflow or sequence error.
Definition: metadata.h:85
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_async_metadata_event_code_t
uhd_async_metadata_event_code_t
The type of event for a receive async message call.
Definition: metadata.h:273
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_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_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.
metadata.hpp
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_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_RX_METADATA_ERROR_CODE_NONE
@ UHD_RX_METADATA_ERROR_CODE_NONE
No error code associated with this metadata.
Definition: metadata.h:77
UHD_RX_METADATA_ERROR_CODE_ALIGNMENT
@ UHD_RX_METADATA_ERROR_CODE_ALIGNMENT
Multi-channel alignment failed.
Definition: metadata.h:87
UHD_RX_METADATA_ERROR_CODE_BAD_PACKET
@ UHD_RX_METADATA_ERROR_CODE_BAD_PACKET
The packet could not be parsed.
Definition: metadata.h:89
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_async_metadata_make
UHD_API uhd_error uhd_async_metadata_make(uhd_async_metadata_handle *handle)
Create a new async metadata handle.
UHD_RX_METADATA_ERROR_CODE_TIMEOUT
@ UHD_RX_METADATA_ERROR_CODE_TIMEOUT
No packet received, implementation timed out.
Definition: metadata.h:79
config.h
UHD_RX_METADATA_ERROR_CODE_BROKEN_CHAIN
@ UHD_RX_METADATA_ERROR_CODE_BROKEN_CHAIN
Expected another stream command.
Definition: metadata.h:83
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::rx_metadata_t
Definition: metadata.hpp:22
uhd::tx_metadata_t
Definition: metadata.hpp:162
UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW
@ UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW
An internal send buffer has emptied.
Definition: metadata.h:277
UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW_IN_PACKET
@ UHD_ASYNC_METADATA_EVENT_CODE_UNDERFLOW_IN_PACKET
Underflow occurred inside a packet.
Definition: metadata.h:283
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_end_of_burst
UHD_API uhd_error uhd_tx_metadata_end_of_burst(uhd_tx_metadata_handle h, bool *result_out)
End of burst?