soapysdr_sys/bindings.rs
1/* automatically generated by rust-bindgen 0.66.1, with edits */
2
3pub const SOAPY_SDR_TRUE: &[u8; 5] = b"true\0";
4pub const SOAPY_SDR_FALSE: &[u8; 6] = b"false\0";
5pub const SOAPY_SDR_TX: u32 = 0;
6pub const SOAPY_SDR_RX: u32 = 1;
7pub const SOAPY_SDR_END_BURST: u32 = 2;
8pub const SOAPY_SDR_HAS_TIME: u32 = 4;
9pub const SOAPY_SDR_END_ABRUPT: u32 = 8;
10pub const SOAPY_SDR_ONE_PACKET: u32 = 16;
11pub const SOAPY_SDR_MORE_FRAGMENTS: u32 = 32;
12pub const SOAPY_SDR_WAIT_TRIGGER: u32 = 64;
13pub const SOAPY_SDR_USER_FLAG0: u32 = 65536;
14pub const SOAPY_SDR_USER_FLAG1: u32 = 131072;
15pub const SOAPY_SDR_USER_FLAG2: u32 = 262144;
16pub const SOAPY_SDR_USER_FLAG3: u32 = 524288;
17pub const SOAPY_SDR_USER_FLAG4: u32 = 1048576;
18pub const SOAPY_SDR_TIMEOUT: i32 = -1;
19pub const SOAPY_SDR_STREAM_ERROR: i32 = -2;
20pub const SOAPY_SDR_CORRUPTION: i32 = -3;
21pub const SOAPY_SDR_OVERFLOW: i32 = -4;
22pub const SOAPY_SDR_NOT_SUPPORTED: i32 = -5;
23pub const SOAPY_SDR_TIME_ERROR: i32 = -6;
24pub const SOAPY_SDR_UNDERFLOW: i32 = -7;
25pub const SOAPY_SDR_CF64: &[u8; 5] = b"CF64\0";
26pub const SOAPY_SDR_CF32: &[u8; 5] = b"CF32\0";
27pub const SOAPY_SDR_CS32: &[u8; 5] = b"CS32\0";
28pub const SOAPY_SDR_CU32: &[u8; 5] = b"CU32\0";
29pub const SOAPY_SDR_CS16: &[u8; 5] = b"CS16\0";
30pub const SOAPY_SDR_CU16: &[u8; 5] = b"CU16\0";
31pub const SOAPY_SDR_CS12: &[u8; 5] = b"CS12\0";
32pub const SOAPY_SDR_CU12: &[u8; 5] = b"CU12\0";
33pub const SOAPY_SDR_CS8: &[u8; 4] = b"CS8\0";
34pub const SOAPY_SDR_CU8: &[u8; 4] = b"CU8\0";
35pub const SOAPY_SDR_CS4: &[u8; 4] = b"CS4\0";
36pub const SOAPY_SDR_CU4: &[u8; 4] = b"CU4\0";
37pub const SOAPY_SDR_F64: &[u8; 4] = b"F64\0";
38pub const SOAPY_SDR_F32: &[u8; 4] = b"F32\0";
39pub const SOAPY_SDR_S32: &[u8; 4] = b"S32\0";
40pub const SOAPY_SDR_U32: &[u8; 4] = b"U32\0";
41pub const SOAPY_SDR_S16: &[u8; 4] = b"S16\0";
42pub const SOAPY_SDR_U16: &[u8; 4] = b"U16\0";
43pub const SOAPY_SDR_S8: &[u8; 3] = b"S8\0";
44pub const SOAPY_SDR_U8: &[u8; 3] = b"U8\0";
45
46/// Definition for a min/max numeric range
47#[repr(C)]
48#[derive(Debug, Copy, Clone)]
49pub struct SoapySDRRange {
50 pub minimum: f64,
51 pub maximum: f64,
52 pub step: f64,
53}
54/// Definition for a key/value string map
55#[repr(C)]
56#[derive(Debug, Copy, Clone)]
57pub struct SoapySDRKwargs {
58 pub size: usize,
59 pub keys: *mut *mut ::std::os::raw::c_char,
60 pub vals: *mut *mut ::std::os::raw::c_char,
61}
62unsafe extern "C" {
63 /// Convert a markup string to a key-value map.
64 ///
65 /// The markup format is: "key0=value0, key1=value1"
66 pub fn SoapySDRKwargs_fromString(markup: *const ::std::os::raw::c_char) -> SoapySDRKwargs;
67}
68unsafe extern "C" {
69 /// Convert a key-value map to a markup string.
70 ///
71 /// The markup format is: "key0=value0, key1=value1"
72 pub fn SoapySDRKwargs_toString(args: *const SoapySDRKwargs) -> *mut ::std::os::raw::c_char;
73}
74
75/// Possible data types for argument info
76pub type SoapySDRArgInfoType = ::std::os::raw::c_uint;
77
78pub const SOAPY_SDR_ARG_INFO_BOOL: SoapySDRArgInfoType = 0;
79pub const SOAPY_SDR_ARG_INFO_INT: SoapySDRArgInfoType = 1;
80pub const SOAPY_SDR_ARG_INFO_FLOAT: SoapySDRArgInfoType = 2;
81pub const SOAPY_SDR_ARG_INFO_STRING: SoapySDRArgInfoType = 3;
82
83/// Definition for argument info
84#[repr(C)]
85#[derive(Debug, Copy, Clone)]
86pub struct SoapySDRArgInfo {
87 /// The key used to identify the argument (required)
88 pub key: *mut ::std::os::raw::c_char,
89 /// The default value of the argument when not specified (required)
90 ///
91 /// Numbers should use standard floating point and integer formats.
92 /// Boolean values should be represented as "true" and "false".
93 pub value: *mut ::std::os::raw::c_char,
94 /// The displayable name of the argument (optional, use key if empty)
95 pub name: *mut ::std::os::raw::c_char,
96 /// A brief description about the argument (optional)
97 pub description: *mut ::std::os::raw::c_char,
98 /// The units of the argument: dB, Hz, etc (optional)
99 pub units: *mut ::std::os::raw::c_char,
100 /// The data type of the argument (required)
101 pub type_: SoapySDRArgInfoType,
102 /// The range of possible numeric values (optional)
103 /// When specified, the argument should be restricted to this range.
104 /// The range is only applicable to numeric argument types.
105 pub range: SoapySDRRange,
106 /// The size of the options set, or 0 when not used.
107 pub numOptions: usize,
108 /// A discrete list of possible values (optional)
109 /// When specified, the argument should be restricted to this options set.
110 pub options: *mut *mut ::std::os::raw::c_char,
111 /// A discrete list of displayable names for the enumerated options (optional)
112 /// When not specified, the option value itself can be used as a display name.
113 pub optionNames: *mut *mut ::std::os::raw::c_char,
114}
115unsafe extern "C" {
116 /// Free a pointer allocated by SoapySDR.
117 ///
118 /// For most platforms this is a simple call around free()
119 pub fn SoapySDR_free(ptr: *mut ::std::os::raw::c_void);
120}
121unsafe extern "C" {
122 /// Clear the contents of a list of string
123 ///
124 /// Convenience call to deal with results that return a string list.
125 pub fn SoapySDRStrings_clear(elems: *mut *mut *mut ::std::os::raw::c_char, length: usize);
126}
127unsafe extern "C" {
128 /// Set a key/value pair in a kwargs structure.
129 ///
130 /// If the key exists, the existing entry will be modified;
131 /// otherwise a new entry will be appended to args.
132 /// On error, the elements of args will not be modified,
133 /// and args is guaranteed to be in a good state.
134 /// \return 0 for success, otherwise allocation error
135 pub fn SoapySDRKwargs_set(
136 args: *mut SoapySDRKwargs,
137 key: *const ::std::os::raw::c_char,
138 val: *const ::std::os::raw::c_char,
139 ) -> ::std::os::raw::c_int;
140}
141unsafe extern "C" {
142 /// Get a value given a key in a kwargs structure.
143 ///
144 /// \return the string or NULL if not found
145 pub fn SoapySDRKwargs_get(
146 args: *const SoapySDRKwargs,
147 key: *const ::std::os::raw::c_char,
148 ) -> *const ::std::os::raw::c_char;
149}
150unsafe extern "C" {
151 /// Clear the contents of a kwargs structure.
152 ///
153 /// This frees all the underlying memory and clears the members.
154 pub fn SoapySDRKwargs_clear(args: *mut SoapySDRKwargs);
155}
156unsafe extern "C" {
157 /// Clear a list of kwargs structures.
158 ///
159 /// This frees all the underlying memory and clears the members.
160 pub fn SoapySDRKwargsList_clear(args: *mut SoapySDRKwargs, length: usize);
161}
162unsafe extern "C" {
163 /// Clear the contents of a argument info structure.
164 ///
165 /// This frees all the underlying memory and clears the members.
166 pub fn SoapySDRArgInfo_clear(info: *mut SoapySDRArgInfo);
167}
168unsafe extern "C" {
169 /// Clear a list of argument info structures.
170 ///
171 /// This frees all the underlying memory and clears the members.
172 pub fn SoapySDRArgInfoList_clear(info: *mut SoapySDRArgInfo, length: usize);
173}
174unsafe extern "C" {
175 /// Convert a error code to a string for printing purposes.
176 ///
177 /// If the error code is unrecognized, errToStr returns "UNKNOWN".
178 /// \param errorCode a negative integer return code
179 /// \return a pointer to a string representing the error
180 pub fn SoapySDR_errToStr(errorCode: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
181}
182#[repr(C)]
183#[derive(Debug, Copy, Clone)]
184pub struct SoapySDRDevice {
185 _unused: [u8; 0],
186}
187#[repr(C)]
188#[derive(Debug, Copy, Clone)]
189pub struct SoapySDRStream {
190 _unused: [u8; 0],
191}
192unsafe extern "C" {
193 /// Get the last status code after a Device API call.
194 ///
195 /// The status code is cleared on entry to each Device call.
196 /// When an device API call throws, the C bindings catch
197 /// the exception, and set a non-zero last status code.
198 /// Use lastStatus() to determine success/failure for
199 /// Device calls without integer status return codes.
200 pub fn SoapySDRDevice_lastStatus() -> ::std::os::raw::c_int;
201}
202unsafe extern "C" {
203 /// Get the last error message after a device call fails.
204 ///
205 /// When an device API call throws, the C bindings catch
206 /// the exception, store its message in thread-safe storage,
207 /// and return a non-zero status code to indicate failure.
208 /// Use lastError() to access the exception's error message.
209 pub fn SoapySDRDevice_lastError() -> *const ::std::os::raw::c_char;
210}
211unsafe extern "C" {
212 /// Enumerate a list of available devices on the system.
213 ///
214 /// \param args device construction key/value argument filters
215 /// \param [out] length the number of elements in the result.
216 /// \return a list of arguments strings, each unique to a device
217 pub fn SoapySDRDevice_enumerate(
218 args: *const SoapySDRKwargs,
219 length: *mut usize,
220 ) -> *mut SoapySDRKwargs;
221}
222unsafe extern "C" {
223 /// Enumerate a list of available devices on the system.
224 ///
225 /// Markup format for args: "keyA=valA, keyB=valB".
226 /// \param args a markup string of key/value argument filters
227 /// \param [out] length the number of elements in the result.
228 /// \return a list of arguments strings, each unique to a device
229 pub fn SoapySDRDevice_enumerateStrArgs(
230 args: *const ::std::os::raw::c_char,
231 length: *mut usize,
232 ) -> *mut SoapySDRKwargs;
233}
234unsafe extern "C" {
235 /// Make a new Device object given device construction args.
236 ///
237 /// The device pointer will be stored in a table so subsequent calls
238 /// with the same arguments will produce the same device.
239 /// For every call to make, there should be a matched call to unmake.
240 /// \param args device construction key/value argument map
241 /// \return a pointer to a new Device object
242 pub fn SoapySDRDevice_make(args: *const SoapySDRKwargs) -> *mut SoapySDRDevice;
243}
244unsafe extern "C" {
245 /// Make a new Device object given device construction args.
246 ///
247 /// The device pointer will be stored in a table so subsequent calls
248 /// with the same arguments will produce the same device.
249 /// For every call to make, there should be a matched call to unmake.
250 /// \param args a markup string of key/value arguments
251 /// \return a pointer to a new Device object or null for error
252 pub fn SoapySDRDevice_makeStrArgs(args: *const ::std::os::raw::c_char) -> *mut SoapySDRDevice;
253}
254unsafe extern "C" {
255 /// Unmake or release a device object handle.
256 ///
257 /// \param device a pointer to a device object
258 /// \return 0 for success or error code on failure
259 pub fn SoapySDRDevice_unmake(device: *mut SoapySDRDevice) -> ::std::os::raw::c_int;
260}
261unsafe extern "C" {
262 /// Create a list of devices from a list of construction arguments.
263 ///
264 /// This is a convenience call to parallelize device construction,
265 /// and is fundamentally a parallel for loop of make(Kwargs).
266 /// \param argsList a list of device arguments per each device
267 /// \param length the length of the argsList array
268 /// \return a list of device pointers per each specified argument
269 pub fn SoapySDRDevice_make_list(
270 argsList: *const SoapySDRKwargs,
271 length: usize,
272 ) -> *mut *mut SoapySDRDevice;
273}
274unsafe extern "C" {
275 /// Create a list of devices from a list of construction arguments.
276 ///
277 /// This is a convenience call to parallelize device construction,
278 /// and is fundamentally a parallel for loop of makeStrArgs(args).
279 /// \param argsList a list of device arguments per each device
280 /// \param length the length of the argsList array
281 /// \return a list of device pointers per each specified argument
282 pub fn SoapySDRDevice_make_listStrArgs(
283 argsList: *const *const ::std::os::raw::c_char,
284 length: usize,
285 ) -> *mut *mut SoapySDRDevice;
286}
287unsafe extern "C" {
288 /// Unmake or release a list of device handles
289 ///
290 /// and free the devices array memory as well.
291 /// This is a convenience call to parallelize device destruction,
292 /// and is fundamentally a parallel for loop of unmake(Device *).
293 /// \param devices a list of pointers to device objects
294 /// \param length the length of the devices array
295 /// \return 0 for success or error code on failure
296 pub fn SoapySDRDevice_unmake_list(
297 devices: *mut *mut SoapySDRDevice,
298 length: usize,
299 ) -> ::std::os::raw::c_int;
300}
301unsafe extern "C" {
302 /// A key that uniquely identifies the device driver.
303 ///
304 /// This key identifies the underlying implementation.
305 /// Several variants of a product may share a driver.
306 /// \param device a pointer to a device instance
307 pub fn SoapySDRDevice_getDriverKey(
308 device: *const SoapySDRDevice,
309 ) -> *mut ::std::os::raw::c_char;
310}
311unsafe extern "C" {
312 /// A key that uniquely identifies the hardware.
313 ///
314 /// This key should be meaningful to the user
315 /// to optimize for the underlying hardware.
316 /// \param device a pointer to a device instance
317 pub fn SoapySDRDevice_getHardwareKey(
318 device: *const SoapySDRDevice,
319 ) -> *mut ::std::os::raw::c_char;
320}
321unsafe extern "C" {
322 /// Query a dictionary of available device information.
323 ///
324 /// This dictionary can any number of values like
325 /// vendor name, product name, revisions, serials...
326 /// This information can be displayed to the user
327 /// to help identify the instantiated device.
328 /// \param device a pointer to a device instance
329 pub fn SoapySDRDevice_getHardwareInfo(device: *const SoapySDRDevice) -> SoapySDRKwargs;
330}
331unsafe extern "C" {
332 /// Set the frontend mapping of available DSP units to RF frontends.
333 ///
334 /// This mapping controls channel mapping and channel availability.
335 /// \param device a pointer to a device instance
336 /// \param direction the channel direction RX or TX
337 /// \param mapping a vendor-specific mapping string
338 /// \return an error code or 0 for success
339 pub fn SoapySDRDevice_setFrontendMapping(
340 device: *mut SoapySDRDevice,
341 direction: ::std::os::raw::c_int,
342 mapping: *const ::std::os::raw::c_char,
343 ) -> ::std::os::raw::c_int;
344}
345unsafe extern "C" {
346 /// Get the mapping configuration string.
347 ///
348 /// \param device a pointer to a device instance
349 /// \param direction the channel direction RX or TX
350 /// \return the vendor-specific mapping string
351 pub fn SoapySDRDevice_getFrontendMapping(
352 device: *const SoapySDRDevice,
353 direction: ::std::os::raw::c_int,
354 ) -> *mut ::std::os::raw::c_char;
355}
356unsafe extern "C" {
357 /// Get a number of channels given the streaming direction
358 ///
359 /// \param device a pointer to a device instance
360 /// \param direction the channel direction RX or TX
361 /// \return the number of channels
362 pub fn SoapySDRDevice_getNumChannels(
363 device: *const SoapySDRDevice,
364 direction: ::std::os::raw::c_int,
365 ) -> usize;
366}
367unsafe extern "C" {
368 /// Get channel info given the streaming direction
369 ///
370 /// \param device a pointer to a device instance
371 /// \param direction the channel direction RX or TX
372 /// \param channel the channel number to get info for
373 /// \return channel information
374 pub fn SoapySDRDevice_getChannelInfo(
375 device: *const SoapySDRDevice,
376 direction: ::std::os::raw::c_int,
377 channel: usize,
378 ) -> SoapySDRKwargs;
379}
380unsafe extern "C" {
381 /// Find out if the specified channel is full or half duplex.
382 ///
383 /// \param device a pointer to a device instance
384 /// \param direction the channel direction RX or TX
385 /// \param channel an available channel on the device
386 /// \return true for full duplex, false for half duplex
387 pub fn SoapySDRDevice_getFullDuplex(
388 device: *const SoapySDRDevice,
389 direction: ::std::os::raw::c_int,
390 channel: usize,
391 ) -> bool;
392}
393unsafe extern "C" {
394 /// Query a list of the available stream formats.
395 ///
396 /// \param device a pointer to a device instance
397 /// \param direction the channel direction RX or TX
398 /// \param channel an available channel on the device
399 /// \param [out] length the number of format strings
400 /// \return a list of allowed format strings.
401 /// See SoapySDRDevice_setupStream() for the format syntax.
402 pub fn SoapySDRDevice_getStreamFormats(
403 device: *const SoapySDRDevice,
404 direction: ::std::os::raw::c_int,
405 channel: usize,
406 length: *mut usize,
407 ) -> *mut *mut ::std::os::raw::c_char;
408}
409unsafe extern "C" {
410 /// Get the hardware's native stream format for this channel.
411 ///
412 /// This is the format used by the underlying transport layer,
413 /// and the direct buffer access API calls (when available).
414 /// \param device a pointer to a device instance
415 /// \param direction the channel direction RX or TX
416 /// \param channel an available channel on the device
417 /// \param [out] fullScale the maximum possible value
418 /// \return the native stream buffer format string
419 pub fn SoapySDRDevice_getNativeStreamFormat(
420 device: *const SoapySDRDevice,
421 direction: ::std::os::raw::c_int,
422 channel: usize,
423 fullScale: *mut f64,
424 ) -> *mut ::std::os::raw::c_char;
425}
426unsafe extern "C" {
427 /// Query the argument info description for stream args.
428 ///
429 /// \param device a pointer to a device instance
430 /// \param direction the channel direction RX or TX
431 /// \param channel an available channel on the device
432 /// \param [out] length the number of argument infos
433 /// \return a list of argument info structures
434 pub fn SoapySDRDevice_getStreamArgsInfo(
435 device: *const SoapySDRDevice,
436 direction: ::std::os::raw::c_int,
437 channel: usize,
438 length: *mut usize,
439 ) -> *mut SoapySDRArgInfo;
440}
441
442unsafe extern "C" {
443 /// Initialize a stream given a list of channels and stream arguments.
444 ///
445 /// The implementation may change switches or power-up components.
446 /// All stream API calls should be usable with the new stream object
447 /// after setupStream() is complete, regardless of the activity state.
448 ///
449 /// The API allows any number of simultaneous TX and RX streams, but many dual-channel
450 /// devices are limited to one stream in each direction, using either one or both channels.
451 /// This call will return an error if an unsupported combination is requested,
452 /// or if a requested channel in this direction is already in use by another stream.
453 ///
454 /// When multiple channels are added to a stream, they are typically expected to have
455 /// the same sample rate. See SoapySDRDevice_setSampleRate().
456 ///
457 /// \param device a pointer to a device instance
458 /// \param direction the channel direction (`SOAPY_SDR_RX` or `SOAPY_SDR_TX`)
459 /// \param format A string representing the desired buffer format in `readStream()` / `writeStream()`.
460 ///
461 /// The first character selects the number type:
462 /// - "C" means complex
463 /// - "F" means floating point
464 /// - "S" means signed integer
465 /// - "U" means unsigned integer
466 ///
467 /// The type character is followed by the number of bits per number (complex is 2x this size per sample)
468 ///
469 /// Example format strings:
470 /// - "CF32" - complex float32 (8 bytes per element)
471 /// - "CS16" - complex int16 (4 bytes per element)
472 /// - "CS12" - complex int12 (3 bytes per element)
473 /// - "CS4" - complex int4 (1 byte per element)
474 /// - "S32" - int32 (4 bytes per element)
475 /// - "U8" - uint8 (1 byte per element)
476 ///
477 /// \param channels a list of channels or empty for automatic
478 /// \param numChans the number of elements in the channels array
479 /// \param args stream args or empty for defaults.
480 ///
481 /// Recommended keys to use in the args dictionary:
482 /// - "WIRE" - format of the samples between device and host
483 ///
484 /// \return the stream pointer or nullptr for failure.
485 ///
486 /// The returned stream is not required to have internal locking, and may not be used
487 /// concurrently from multiple threads.
488 pub fn SoapySDRDevice_setupStream(
489 device: *mut SoapySDRDevice,
490 direction: ::std::os::raw::c_int,
491 format: *const ::std::os::raw::c_char,
492 channels: *const usize,
493 numChans: usize,
494 args: *const SoapySDRKwargs,
495 ) -> *mut SoapySDRStream;
496}
497unsafe extern "C" {
498 /// Close an open stream created by setupStream
499 ///
500 /// \param device a pointer to a device instance
501 /// \param stream the opaque pointer to a stream handle
502 /// \return 0 for success or error code on failure
503 pub fn SoapySDRDevice_closeStream(
504 device: *mut SoapySDRDevice,
505 stream: *mut SoapySDRStream,
506 ) -> ::std::os::raw::c_int;
507}
508unsafe extern "C" {
509 /// Get the stream's maximum transmission unit (MTU) in number of elements.
510 ///
511 /// The MTU specifies the maximum payload transfer in a stream operation.
512 /// This value can be used as a stream buffer allocation size that can
513 /// best optimize throughput given the underlying stream implementation.
514 ///
515 /// \param device a pointer to a device instance
516 /// \param stream the opaque pointer to a stream handle
517 /// \return the MTU in number of stream elements (never zero)
518 pub fn SoapySDRDevice_getStreamMTU(
519 device: *const SoapySDRDevice,
520 stream: *mut SoapySDRStream,
521 ) -> usize;
522}
523unsafe extern "C" {
524 /// Activate a stream.
525 ///
526 /// Call activate to prepare a stream before using read/write().
527 /// The implementation control switches or stimulate data flow.
528 /// The timeNs is only valid when the flags have SOAPY_SDR_HAS_TIME.
529 /// The numElems count can be used to request a finite burst size.
530 /// The SOAPY_SDR_END_BURST flag can signal end on the finite burst.
531 /// Not all implementations will support the full range of options.
532 /// In this case, the implementation returns SOAPY_SDR_NOT_SUPPORTED.
533 ///
534 /// \param device pointer to a device instance
535 /// \param stream the opaque pointer to a stream handle
536 /// \param flags optional flag indicators about the stream
537 /// \param timeNs optional activation time in nanoseconds
538 /// \param numElems optional element count for burst control
539 /// \return 0 for success or error code on failure
540 pub fn SoapySDRDevice_activateStream(
541 device: *mut SoapySDRDevice,
542 stream: *mut SoapySDRStream,
543 flags: ::std::os::raw::c_int,
544 timeNs: ::std::os::raw::c_longlong,
545 numElems: usize,
546 ) -> ::std::os::raw::c_int;
547}
548unsafe extern "C" {
549 /// Deactivate a stream.
550 ///
551 /// Call deactivate when not using using read/write().
552 /// The implementation control switches or halt data flow.
553 /// The timeNs is only valid when the flags have SOAPY_SDR_HAS_TIME.
554 /// Not all implementations will support the full range of options.
555 /// In this case, the implementation returns SOAPY_SDR_NOT_SUPPORTED.
556 ///
557 /// \param device a pointer to a device instance
558 /// \param stream the opaque pointer to a stream handle
559 /// \param flags optional flag indicators about the stream
560 /// \param timeNs optional deactivation time in nanoseconds
561 /// \return 0 for success or error code on failure
562 pub fn SoapySDRDevice_deactivateStream(
563 device: *mut SoapySDRDevice,
564 stream: *mut SoapySDRStream,
565 flags: ::std::os::raw::c_int,
566 timeNs: ::std::os::raw::c_longlong,
567 ) -> ::std::os::raw::c_int;
568}
569unsafe extern "C" {
570 /// Read elements from a stream for reception.
571 ///
572 /// This is a multi-channel call, and buffs should be an array of void *,
573 /// where each pointer will be filled with data from a different channel.
574 ///
575 /// **Client code compatibility:**
576 /// The readStream() call should be well defined at all times,
577 /// including prior to activation and after deactivation.
578 /// When inactive, readStream() should implement the timeout
579 /// specified by the caller and return SOAPY_SDR_TIMEOUT.
580 ///
581 /// \param device a pointer to a device instae
582 /// \param stream the opaque pointer to a stream handle
583 /// \param buffs an array of void* buffers num chans in size
584 /// \param numElems the number of elements in each buffer
585 /// \param [out] flags optional flag indicators about the result
586 /// \param [out] timeNs the buffer's timestamp in nanoseconds
587 /// \param timeoutUs the timeout in microseconds
588 /// \return the number of elements read per buffer or error code
589 pub fn SoapySDRDevice_readStream(
590 device: *mut SoapySDRDevice,
591 stream: *mut SoapySDRStream,
592 buffs: *const *mut ::std::os::raw::c_void,
593 numElems: usize,
594 flags: *mut ::std::os::raw::c_int,
595 timeNs: *mut ::std::os::raw::c_longlong,
596 timeoutUs: ::std::os::raw::c_long,
597 ) -> ::std::os::raw::c_int;
598}
599unsafe extern "C" {
600 /// Write elements to a stream for transmission.
601 ///
602 /// This is a multi-channel call, and buffs should be an array of void *,
603 /// where each pointer will be filled with data for a different channel.
604 ///
605 /// **Client code compatibility:**
606 /// Client code relies on writeStream() for proper back-pressure.
607 /// The writeStream() implementation must enforce the timeout
608 /// such that the call blocks until space becomes available
609 /// or timeout expiration.
610 ///
611 /// \param device a pointer to a device instance
612 /// \param stream t opaque pointer to a stream handle
613 /// \param buffs an array of void* buffers num chans in size
614 /// \param numElems the number of elements in each buffer
615 /// \param [in,out] flags optional input flags and output flags
616 /// \param timeNs the buffer's timestamp in nanoseconds
617 /// \param timeoutUs the timeout in microseconds
618 /// \return the number of elements written per buffer or error
619 pub fn SoapySDRDevice_writeStream(
620 device: *mut SoapySDRDevice,
621 stream: *mut SoapySDRStream,
622 buffs: *const *const ::std::os::raw::c_void,
623 numElems: usize,
624 flags: *mut ::std::os::raw::c_int,
625 timeNs: ::std::os::raw::c_longlong,
626 timeoutUs: ::std::os::raw::c_long,
627 ) -> ::std::os::raw::c_int;
628}
629unsafe extern "C" {
630 /// Readback status information about a stream.
631 ///
632 /// This call is typically used on a transmit stream
633 /// to report time errors, underflows, and burst completion.
634 /// **Client code compatibility:**
635 /// Client code may continually poll readStreamStatus() in a loop.
636 /// Implementations of readStreamStatus() should wait in the call
637 /// for a status change event or until the timeout expiration.
638 /// When stream status is not implemented on a particular stream,
639 /// readStreamStatus() should return SOAPY_SDR_NOT_SUPPORT.
640 /// Client code may use this indication to disable a polling loop.
641 /// \param device a pointer to a device instance
642 /// \param stream the opaque pointer to a stream handle
643 /// \param chanMask to which channels this status applies
644 /// \param flags optional input flags and output flags
645 /// \param timeNs the buffer's timestamp in nanoseconds
646 /// \param timeoutUs the timeout in microseconds
647 /// \return 0 for success or error code like timeout
648 pub fn SoapySDRDevice_readStreamStatus(
649 device: *mut SoapySDRDevice,
650 stream: *mut SoapySDRStream,
651 chanMask: *mut usize,
652 flags: *mut ::std::os::raw::c_int,
653 timeNs: *mut ::std::os::raw::c_longlong,
654 timeoutUs: ::std::os::raw::c_long,
655 ) -> ::std::os::raw::c_int;
656}
657unsafe extern "C" {
658 /// How many direct access buffers can the stream provide?
659 ///
660 /// This is the number of times the user can call acquire()
661 /// on a stream without making subsequent calls to release().
662 /// A return value of 0 means that direct access is not supported.
663 /// \param device a pointer to a device instance
664 /// \param stream the opaque pointer to a stream handle
665 /// \return the number of direct access buffers or 0
666 pub fn SoapySDRDevice_getNumDirectAccessBuffers(
667 device: *mut SoapySDRDevice,
668 stream: *mut SoapySDRStream,
669 ) -> usize;
670}
671unsafe extern "C" {
672 /// Get the buffer addresses for a scatter/gather table entry.
673 ///
674 /// When the underlying DMA implementation uses scatter/gather
675 /// then this call provides the user addresses for that table.
676 /// Example: The caller may query the DMA memory addresses once
677 /// after stream creation to pre-allocate a re-usable ring-buffer.
678 /// \param device a pointer to a device instance
679 /// \param stream the opaque pointer to a stream handle
680 /// \param handle an index value between 0 and num direct buffers - 1
681 /// \param buffs array of void* buffers num chans in size
682 /// \return 0 for success or error code when not supported
683 pub fn SoapySDRDevice_getDirectAccessBufferAddrs(
684 device: *mut SoapySDRDevice,
685 stream: *mut SoapySDRStream,
686 handle: usize,
687 buffs: *mut *mut ::std::os::raw::c_void,
688 ) -> ::std::os::raw::c_int;
689}
690unsafe extern "C" {
691 /// Acquire direct buffers from a receive stream.
692 ///
693 /// This call is part of the direct buffer access API.
694 /// The buffs array will be filled with a stream pointer for each channel.
695 /// Each pointer can be read up to the number of return value elements.
696 /// The handle will be set by the implementation so that the caller
697 /// may later release access to the buffers with releaseReadBuffer().
698 /// Handle represents an index into the internal scatter/gather table
699 /// such that handle is between 0 and num direct buffe - 1.
700 /// \param device a pointer to a device instance
701 /// \param stream the opaque pointer to a stream handle
702 /// \param handle an index value used in the release() call
703 /// \param buffs an array of void* buffers num chans in size
704 /// \param flags optional flag indicators about the result
705 /// \param timeNs the buffer's timestamp in nanoseconds
706 /// \param timeoutUs the timeout in microseconds
707 /// \return the number of elements read per buffer or error code
708 pub fn SoapySDRDevice_acquireReadBuffer(
709 device: *mut SoapySDRDevice,
710 stream: *mut SoapySDRStream,
711 handle: *mut usize,
712 buffs: *mut *const ::std::os::raw::c_void,
713 flags: *mut ::std::os::raw::c_int,
714 timeNs: *mut ::std::os::raw::c_longlong,
715 timeoutUs: ::std::os::raw::c_long,
716 ) -> ::std::os::raw::c_int;
717}
718unsafe extern "C" {
719 /// Release an acquired buffer back to the receive stream.
720 ///
721 /// This call is part of the direct buffer access API.
722 /// \param device a pointer to a device instance
723 /// \param stream the opaque pointer to a stream handle
724 /// \param handle the opaque handle from the acquire() call
725 pub fn SoapySDRDevice_releaseReadBuffer(
726 device: *mut SoapySDRDevice,
727 stream: *mut SoapySDRStream,
728 handle: usize,
729 );
730}
731unsafe extern "C" {
732 /// Acquire direct buffers from a transmit stream.
733 ///
734 /// This call is part of the direct buffer access API.
735 /// The buffs array will be filled with a stream pointer for each channel.
736 /// Each pointer can be written up to the number of return value elements.
737 /// The handle will be set by the implementation so that the caller
738 /// may later release access to the buffers with releaseWriteBuffer().
739 /// Handle represents an index into the internal scatter/gather table
740 /// such that handle is between 0 and num dire buffers - 1.
741 /// \param device a pointer to a device instance
742 /// \param stream the opaque pointer to a stream handle
743 /// \param handle an index value used in the release() call
744 /// \param buffs an array of void* buffers num chans in size
745 /// \param timeoutUs the timeout in microseconds
746 /// \return the number of available elements per buffer or error
747 pub fn SoapySDRDevice_acquireWriteBuffer(
748 device: *mut SoapySDRDevice,
749 stream: *mut SoapySDRStream,
750 handle: *mut usize,
751 buffs: *mut *mut ::std::os::raw::c_void,
752 timeoutUs: ::std::os::raw::c_long,
753 ) -> ::std::os::raw::c_int;
754}
755unsafe extern "C" {
756 /// Release an acquired buffer back to the transmit stream.
757 ///
758 /// This call is part of the direct buffer access API.
759 /// Stream meta-data is provided as part of the release call,
760 /// and not the acquire call so that the caller may acquire
761 /// buffers without committing to the contents of the meta-data,
762 /// which can be determined by the user as the buffers are filled.
763 /// \param device a pointer to a device instance
764 /// \param stream the opaque pointer to a stream handle
765 /// \param handle the opaque handle fr the acquire() call
766 /// \param numElems the number of elements written to each buffer
767 /// \param flags optional input flags and output flags
768 /// \param timeNs the buffer's timestamp in nanoseconds
769 pub fn SoapySDRDevice_releaseWriteBuffer(
770 device: *mut SoapySDRDevice,
771 stream: *mut SoapySDRStream,
772 handle: usize,
773 numElems: usize,
774 flags: *mut ::std::os::raw::c_int,
775 timeNs: ::std::os::raw::c_longlong,
776 );
777}
778unsafe extern "C" {
779 /// Get a list of available antennas to select on a given chain.
780 ///
781 /// \param device a pointer to a device instance
782 /// \param direction the channel direction RX or TX
783 /// \param channel an available channel on the device
784 /// \param [out] length the number of antenna names
785 /// \return a list of available antenna names
786 pub fn SoapySDRDevice_listAntennas(
787 device: *const SoapySDRDevice,
788 direction: ::std::os::raw::c_int,
789 channel: usize,
790 length: *mut usize,
791 ) -> *mut *mut ::std::os::raw::c_char;
792}
793unsafe extern "C" {
794 /// Set the selected antenna on a chain.
795 ///
796 /// \param device a pointer to a device instance
797 /// \param direction the channel direction RX or TX
798 /// \param channel an available channel on the device
799 /// \param name the name of an available antenna
800 /// \return an error code or 0 for success
801 pub fn SoapySDRDevice_setAntenna(
802 device: *mut SoapySDRDevice,
803 direction: ::std::os::raw::c_int,
804 channel: usize,
805 name: *const ::std::os::raw::c_char,
806 ) -> ::std::os::raw::c_int;
807}
808unsafe extern "C" {
809 /// Get the selected antenna on a chain.
810 ///
811 /// \param device a pointer to a device instance
812 /// \param direction the channel direction RX or TX
813 /// \param channel an available channel on the device
814 /// \return the name of an available antenna
815 pub fn SoapySDRDevice_getAntenna(
816 device: *const SoapySDRDevice,
817 direction: ::std::os::raw::c_int,
818 channel: usize,
819 ) -> *mut ::std::os::raw::c_char;
820}
821unsafe extern "C" {
822 /// Does the device support automatic DC offset corrections?
823 ///
824 /// \param device a pointer to a device instance
825 /// \param direction the channel direction RX or TX
826 /// \param channel an available channel on the device
827 /// \return true if automatic corrections are supported
828 pub fn SoapySDRDevice_hasDCOffsetMode(
829 device: *const SoapySDRDevice,
830 direction: ::std::os::raw::c_int,
831 channel: usize,
832 ) -> bool;
833}
834unsafe extern "C" {
835 /// Set the automatic DC offset corrections mode.
836 ///
837 /// \param device a pointer to a device instance
838 /// \param direction the channel direction RX or TX
839 /// \param channel an available channel on the device
840 /// \param automatic true for automatic offset correction
841 /// \return an error code or 0 for success
842 pub fn SoapySDRDevice_setDCOffsetMode(
843 device: *mut SoapySDRDevice,
844 direction: ::std::os::raw::c_int,
845 channel: usize,
846 automatic: bool,
847 ) -> ::std::os::raw::c_int;
848}
849unsafe extern "C" {
850 /// Get the automatic DC offset corrections mode.
851 ///
852 /// \param device a pointer to a device instance
853 /// \param direction the channel direction RX or TX
854 /// \param channel an available channel on the device
855 /// \return true for automatic offset correction
856 pub fn SoapySDRDevice_getDCOffsetMode(
857 device: *const SoapySDRDevice,
858 direction: ::std::os::raw::c_int,
859 channel: usize,
860 ) -> bool;
861}
862unsafe extern "C" {
863 /// Does the device support frontend DC offset correction?
864 ///
865 /// \param device a pointer to a device instance
866 /// \param direction the channel direction RX or TX
867 /// \param channel an available channel on the device
868 /// \return true if DC offset corrections are supported
869 pub fn SoapySDRDevice_hasDCOffset(
870 device: *const SoapySDRDevice,
871 direction: ::std::os::raw::c_int,
872 channel: usize,
873 ) -> bool;
874}
875unsafe extern "C" {
876 /// Set the frontend DC offset correction.
877 ///
878 /// \param device a pointer to a device instance
879 /// \param direction the channel direction RX or TX
880 /// \param channel an available channel on the device
881 /// \param offsetI the relative correction (1.0 max)
882 /// \param offsetQ the relative correction (1.0 max)
883 /// \return an error code or 0 for success
884 pub fn SoapySDRDevice_setDCOffset(
885 device: *mut SoapySDRDevice,
886 direction: ::std::os::raw::c_int,
887 channel: usize,
888 offsetI: f64,
889 offsetQ: f64,
890 ) -> ::std::os::raw::c_int;
891}
892unsafe extern "C" {
893 /// Get the frontend DC offset correction.
894 ///
895 /// \param device a pointer to a device instance
896 /// \param direction the channel direction RX or TX
897 /// \param channel an available channel on the device
898 /// \param [out] offsetI the relative correction (1.0 max)
899 /// \param [out] offsetQ the relative correction (1.0 max)
900 /// \return 0 for success or error code on failure
901 pub fn SoapySDRDevice_getDCOffset(
902 device: *const SoapySDRDevice,
903 direction: ::std::os::raw::c_int,
904 channel: usize,
905 offsetI: *mut f64,
906 offsetQ: *mut f64,
907 ) -> ::std::os::raw::c_int;
908}
909unsafe extern "C" {
910 /// Does the device support frontend IQ balance correction?
911 ///
912 /// \param device a pointer to a device instance
913 /// \param direction the channel direction RX or TX
914 /// \param channel an available channel on the device
915 /// \return true if IQ balance corrections are supported
916 pub fn SoapySDRDevice_hasIQBalance(
917 device: *const SoapySDRDevice,
918 direction: ::std::os::raw::c_int,
919 channel: usize,
920 ) -> bool;
921}
922unsafe extern "C" {
923 /// Set the frontend IQ balance correction.
924 ///
925 /// \param device a pointer to a device instance
926 /// \param direction the channel direction RX or TX
927 /// \param channel an available channel on the device
928 /// \param balanceI the relative correction (1.0 max)
929 /// \param balanceQ the relative correction (1.0 max)
930 /// \return an error code or 0 for success
931 pub fn SoapySDRDevice_setIQBalance(
932 device: *mut SoapySDRDevice,
933 direction: ::std::os::raw::c_int,
934 channel: usize,
935 balanceI: f64,
936 balanceQ: f64,
937 ) -> ::std::os::raw::c_int;
938}
939unsafe extern "C" {
940 /// Get the frontend IQ balance correction.
941 ///
942 /// \param device a pointer to a device instance
943 /// \param direction the channel direction RX or TX
944 /// \param channel an available channel on the device
945 /// \param [out] balanceI the relative correction (1.0 max)
946 /// \param [out] balanceQ the relative correction (1.0 max)
947 /// \return 0 for success or error code on failure
948 pub fn SoapySDRDevice_getIQBalance(
949 device: *const SoapySDRDevice,
950 direction: ::std::os::raw::c_int,
951 channel: usize,
952 balanceI: *mut f64,
953 balanceQ: *mut f64,
954 ) -> ::std::os::raw::c_int;
955}
956unsafe extern "C" {
957 /// Does the device support automatic frontend IQ balance correction?
958 ///
959 /// \param device a pointer to a device instance
960 /// \param direction the channel direction RX or TX
961 /// \param channel an available channel on the device
962 /// \return true if automatic IQ balance corrections are supported
963 pub fn SoapySDRDevice_hasIQBalanceMode(
964 device: *const SoapySDRDevice,
965 direction: ::std::os::raw::c_int,
966 channel: usize,
967 ) -> bool;
968}
969unsafe extern "C" {
970 /// Set the automatic frontend IQ balance correction.
971 ///
972 /// \param device a pointer to a device instance
973 /// \param direction the channel direction RX or TX
974 /// \param channel an available channel on the device
975 /// \param automatic true for automatic correction
976 /// \return 0 for success or error code on failure
977 pub fn SoapySDRDevice_setIQBalanceMode(
978 device: *mut SoapySDRDevice,
979 direction: ::std::os::raw::c_int,
980 channel: usize,
981 automatic: bool,
982 ) -> ::std::os::raw::c_int;
983}
984unsafe extern "C" {
985 /// Get the automatic frontend IQ balance corrections mode.
986 ///
987 /// \param device a pointer to a device instance
988 /// \param direction the channel direction RX or TX
989 /// \param channel an available channel on the device
990 /// \return true for automatic correction
991 pub fn SoapySDRDevice_getIQBalanceMode(
992 device: *const SoapySDRDevice,
993 direction: ::std::os::raw::c_int,
994 channel: usize,
995 ) -> bool;
996}
997unsafe extern "C" {
998 /// Does the device support frontend frequency correction?
999 ///
1000 /// \param device a pointer to a device instance
1001 /// \param direction the channel direction RX or TX
1002 /// \param channel an available channel on the device
1003 /// \return true if frequency corrections are supported
1004 pub fn SoapySDRDevice_hasFrequencyCorrection(
1005 device: *const SoapySDRDevice,
1006 direction: ::std::os::raw::c_int,
1007 channel: usize,
1008 ) -> bool;
1009}
1010unsafe extern "C" {
1011 /// Fine tune the frontend frequency correction.
1012 ///
1013 /// \param device a pointer to a device instance
1014 /// \param direction the channel direction RX or TX
1015 /// \param channel an available channel on the device
1016 /// \param value the correction in PPM
1017 /// \return an error code or 0 for success
1018 pub fn SoapySDRDevice_setFrequencyCorrection(
1019 device: *mut SoapySDRDevice,
1020 direction: ::std::os::raw::c_int,
1021 channel: usize,
1022 value: f64,
1023 ) -> ::std::os::raw::c_int;
1024}
1025unsafe extern "C" {
1026 /// Get the frontend frequency correction value.
1027 ///
1028 /// \param device a pointer to a device instance
1029 /// \param direction the channel direction RX or TX
1030 /// \param channel an available channel on the device
1031 /// \return the correction value in PPM
1032 pub fn SoapySDRDevice_getFrequencyCorrection(
1033 device: *const SoapySDRDevice,
1034 direction: ::std::os::raw::c_int,
1035 channel: usize,
1036 ) -> f64;
1037}
1038unsafe extern "C" {
1039 /// List available amplification elements.
1040 ///
1041 /// Elements should be in order RF to baseband.
1042 /// \param device a pointer to a device instance
1043 /// \param direction the channel direction RX or TX
1044 /// \param channel an available channel
1045 /// \param [out] length the number of gain names
1046 /// \return a list of gain string names
1047 pub fn SoapySDRDevice_listGains(
1048 device: *const SoapySDRDevice,
1049 direction: ::std::os::raw::c_int,
1050 channel: usize,
1051 length: *mut usize,
1052 ) -> *mut *mut ::std::os::raw::c_char;
1053}
1054unsafe extern "C" {
1055 /// Does the device support automatic gain control?
1056 ///
1057 /// \param device a pointer to a device instance
1058 /// \param direction the channel direction RX or TX
1059 /// \param channel an available channel on the device
1060 /// \return true for automatic gain control
1061 pub fn SoapySDRDevice_hasGainMode(
1062 device: *const SoapySDRDevice,
1063 direction: ::std::os::raw::c_int,
1064 channel: usize,
1065 ) -> bool;
1066}
1067unsafe extern "C" {
1068 /// Set the automatic gain mode on the chain.
1069 ///
1070 /// \param device a pointer to a device instance
1071 /// \param direction the channel direction RX or TX
1072 /// \param channel an available channel on the device
1073 /// \param automatic true for automatic gain setting
1074 /// \return an error code or 0 for success
1075 pub fn SoapySDRDevice_setGainMode(
1076 device: *mut SoapySDRDevice,
1077 direction: ::std::os::raw::c_int,
1078 channel: usize,
1079 automatic: bool,
1080 ) -> ::std::os::raw::c_int;
1081}
1082unsafe extern "C" {
1083 /// Get the automatic gain mode on the chain.
1084 ///
1085 /// \param device a pointer to a device instance
1086 /// \param direction the channel direction RX or TX
1087 /// \param channel an available channel on the device
1088 /// \return true for automatic gain setting
1089 pub fn SoapySDRDevice_getGainMode(
1090 device: *const SoapySDRDevice,
1091 direction: ::std::os::raw::c_int,
1092 channel: usize,
1093 ) -> bool;
1094}
1095unsafe extern "C" {
1096 /// Set the overall amplification in a chain.
1097 ///
1098 /// The gain will be distributed automatically across available element.
1099 /// \param device a pointer to a device instance
1100 /// \param direction the channel direction RX or TX
1101 /// \param channel an available channel on the device
1102 /// \param value the new amplification value in dB
1103 /// \return an error code or 0 for success
1104 pub fn SoapySDRDevice_setGain(
1105 device: *mut SoapySDRDevice,
1106 direction: ::std::os::raw::c_int,
1107 channel: usize,
1108 value: f64,
1109 ) -> ::std::os::raw::c_int;
1110}
1111unsafe extern "C" {
1112 /// Set the value of a amplification element in a chain.
1113 ///
1114 /// \param device a pointer to a device instance
1115 /// \param direction the channel direction RX or TX
1116 /// \param channel an available channel on the device
1117 /// \param name the name of an amplification element
1118 /// \param value the new amplification value in dB
1119 /// \return an error code or 0 for success
1120 pub fn SoapySDRDevice_setGainElement(
1121 device: *mut SoapySDRDevice,
1122 direction: ::std::os::raw::c_int,
1123 channel: usize,
1124 name: *const ::std::os::raw::c_char,
1125 value: f64,
1126 ) -> ::std::os::raw::c_int;
1127}
1128unsafe extern "C" {
1129 /// Get the overall value of the gain elements in a chain.
1130 ///
1131 /// \param device a pointer to a device instance
1132 /// \param direction the channel direction RX or TX
1133 /// \param channel an available channel on the device
1134 /// \return the value of the gain in dB
1135 pub fn SoapySDRDevice_getGain(
1136 device: *const SoapySDRDevice,
1137 direction: ::std::os::raw::c_int,
1138 channel: usize,
1139 ) -> f64;
1140}
1141unsafe extern "C" {
1142 /// Get the value of an individual amplification element in a chain.
1143 ///
1144 /// \param device a pointer to a device instance
1145 /// \param direction the channel direction RX or TX
1146 /// \param channel an available channel on the device
1147 /// \param name the name of an amplification element
1148 /// \return the value of the gain in dB
1149 pub fn SoapySDRDevice_getGainElement(
1150 device: *const SoapySDRDevice,
1151 direction: ::std::os::raw::c_int,
1152 channel: usize,
1153 name: *const ::std::os::raw::c_char,
1154 ) -> f64;
1155}
1156unsafe extern "C" {
1157 /// Get the overall range of possible gain values.
1158 ///
1159 /// \param device a pointer to a device instance
1160 /// \param direction the channel direction RX or TX
1161 /// \param channel an available channel on the device
1162 /// \return the range of possible gain values for this channel in dB
1163 pub fn SoapySDRDevice_getGainRange(
1164 device: *const SoapySDRDevice,
1165 direction: ::std::os::raw::c_int,
1166 channel: usize,
1167 ) -> SoapySDRRange;
1168}
1169unsafe extern "C" {
1170 /// Get the range of possible gain values for a specific element.
1171 ///
1172 /// \param device a pointer to a device instance
1173 /// \param direction the channel direction RX or TX
1174 /// \param channel an available channel on the device
1175 /// \param name the name of an amplification element
1176 /// \return the range of possible gain values for the specified amplification element in dB
1177 pub fn SoapySDRDevice_getGainElementRange(
1178 device: *const SoapySDRDevice,
1179 direction: ::std::os::raw::c_int,
1180 channel: usize,
1181 name: *const ::std::os::raw::c_char,
1182 ) -> SoapySDRRange;
1183}
1184unsafe extern "C" {
1185 /// Set the center frequency of the chain.
1186 ///
1187 /// - For RX, this specifies the down-conversion frequency.
1188 /// - For TX, this specifies the up-conversion frequency.
1189 /// The default implementation of setFrequency() will tune the "RF"
1190 /// component as close as possible to the requested center frequency.
1191 /// Tuning inaccuracies will be compensated for with the "BB" component.
1192 /// The args can be used to augment the tuning algorithm.
1193 /// - Use "OFFSET" to specify an "RF" tuning offset,
1194 /// usually with t intention of moving the LO out of the passband.
1195 /// The offset will be compensated for using the "BB" component.
1196 /// - Use the name of a component for the key and a frequency in Hz
1197 /// as the value (any format) to enforce a specific frequency.
1198 /// The other components will be tuned with compensation
1199 /// to achieve the specified overall frequency.
1200 /// - Use the name of a component for the key and the value "IGNORE"
1201 /// so that the tuning algorithm will avoid altering the component.
1202 /// - Vendor specific implementations can also use the same args to augment
1203 /// tuning in other ways such as specifying fractional vs integer N tuning.
1204 ///
1205 /// \param device a pointer to a device instance
1206 /// \param direction the channel direction RX or TX
1207 /// \param channel an available channel on the device
1208 /// \param frequency the center frequency in Hz
1209 /// \param args optional tuner arguments
1210 /// \return an error code or 0 for success
1211 pub fn SoapySDRDevice_setFrequency(
1212 device: *mut SoapySDRDevice,
1213 direction: ::std::os::raw::c_int,
1214 channel: usize,
1215 frequency: f64,
1216 args: *const SoapySDRKwargs,
1217 ) -> ::std::os::raw::c_int;
1218}
1219unsafe extern "C" {
1220 /// Tune the center frequency of the specified element.
1221 ///
1222 /// - For RX, this specifies the down-conversion frequency.
1223 /// - For TX, this specifies the up-conversion frequency.
1224 /// Recommended names used to represent tunable components:
1225 /// - "CORR" - freq error correction in PPM
1226 /// - "RF" - frequency of the RF frontend
1227 /// - "BB" - frequency of the baseband DSP
1228 /// \param device a pointer to a device instance
1229 /// \param direction the channel direction RX or TX
1230 /// \param channel an available channel the device
1231 /// \param name the name of a tunable element
1232 /// \param frequency the center frequency in Hz
1233 /// \param args optional tuner arguments
1234 /// \return an error code or 0 for success
1235 pub fn SoapySDRDevice_setFrequencyComponent(
1236 device: *mut SoapySDRDevice,
1237 direction: ::std::os::raw::c_int,
1238 channel: usize,
1239 name: *const ::std::os::raw::c_char,
1240 frequency: f64,
1241 args: *const SoapySDRKwargs,
1242 ) -> ::std::os::raw::c_int;
1243}
1244unsafe extern "C" {
1245 /// Get the overall center frequency of the chain.
1246 ///
1247 /// - For RX, this specifies the down-conversion frequency.
1248 /// - For TX, this specifies the up-conversion frequency.
1249 /// \param device a pointer to a device instance
1250 /// \param direction the channel direction RX or TX
1251 /// \param channel an available channel on the device
1252 /// \return the center frequency in Hz
1253 pub fn SoapySDRDevice_getFrequency(
1254 device: *const SoapySDRDevice,
1255 direction: ::std::os::raw::c_int,
1256 channel: usize,
1257 ) -> f64;
1258}
1259unsafe extern "C" {
1260 /// Get the frequency of a tunable element in the chain.
1261 ///
1262 /// \param device a pointer to a device instance
1263 /// \param direction the channel direction RX or TX
1264 /// \param channel an available channel on the device
1265 /// \param name the name of a tunable element
1266 /// \return the tunable element's frequency in Hz
1267 pub fn SoapySDRDevice_getFrequencyComponent(
1268 device: *const SoapySDRDevice,
1269 direction: ::std::os::raw::c_int,
1270 channel: usize,
1271 name: *const ::std::os::raw::c_char,
1272 ) -> f64;
1273}
1274unsafe extern "C" {
1275 /// List available tunable elements in the chain.
1276 ///
1277 /// Elements should be in order RF to baseband.
1278 /// \param device a pointer to a device instance
1279 /// \param direction the channel direction RX or TX
1280 /// \param channel an available channel
1281 /// \param [out] length the number names
1282 /// \return a list of tunable elements by name
1283 pub fn SoapySDRDevice_listFrequencies(
1284 device: *const SoapySDRDevice,
1285 direction: ::std::os::raw::c_int,
1286 channel: usize,
1287 length: *mut usize,
1288 ) -> *mut *mut ::std::os::raw::c_char;
1289}
1290unsafe extern "C" {
1291 /// Get the range of overall frequency values.
1292 ///
1293 /// \param device a pointer to a device instance
1294 /// \param direction the channel direction RX or TX
1295 /// \param channel an available channel on the device
1296 /// \param [out] length the number of ranges
1297 /// \return a list of frequency ranges in Hz
1298 pub fn SoapySDRDevice_getFrequencyRange(
1299 device: *const SoapySDRDevice,
1300 direction: ::std::os::raw::c_int,
1301 channel: usize,
1302 length: *mut usize,
1303 ) -> *mut SoapySDRRange;
1304}
1305unsafe extern "C" {
1306 /// Get the range of tunable values for the specified element.
1307 ///
1308 /// \param device a pointer to a device instance
1309 /// \param direction the channel direction RX or TX
1310 /// \param channel an available channel on the device
1311 /// \param name the name of a tunable element
1312 /// \param [out] length the number of ranges
1313 /// \return a list of frequency ranges in Hz
1314 pub fn SoapySDRDevice_getFrequencyRangeComponent(
1315 device: *const SoapySDRDevice,
1316 direction: ::std::os::raw::c_int,
1317 channel: usize,
1318 name: *const ::std::os::raw::c_char,
1319 length: *mut usize,
1320 ) -> *mut SoapySDRRange;
1321}
1322unsafe extern "C" {
1323 /// Query the argument info description for tune args.
1324 ///
1325 /// \param device a pointer to a device instance
1326 /// \param direction the channel direction RX or TX
1327 /// \param channel an available channel on the device
1328 /// \param [out] length the number of argument infos
1329 /// \return a list of argument info structures
1330 pub fn SoapySDRDevice_getFrequencyArgsInfo(
1331 device: *const SoapySDRDevice,
1332 direction: ::std::os::raw::c_int,
1333 channel: usize,
1334 length: *mut usize,
1335 ) -> *mut SoapySDRArgInfo;
1336}
1337unsafe extern "C" {
1338 /// Set the baseband sample rate of the chain.
1339 ///
1340 /// \param device a pointer to a device instance
1341 /// \param direction the channel direction RX or TX
1342 /// \param channel an available channel on the device
1343 /// \param rate the sample rate in samples per second
1344 /// \return an error code or 0 for success
1345 pub fn SoapySDRDevice_setSampleRate(
1346 device: *mut SoapySDRDevice,
1347 direction: ::std::os::raw::c_int,
1348 channel: usize,
1349 rate: f64,
1350 ) -> ::std::os::raw::c_int;
1351}
1352unsafe extern "C" {
1353 /// Get the baseband sample rate of the chain.
1354 ///
1355 /// \param device a pointer to a device instance
1356 /// \param direction the channel direction RX or TX
1357 /// \param channel an available channel on the device
1358 /// \return the sample rate in samples per second
1359 pub fn SoapySDRDevice_getSampleRate(
1360 device: *const SoapySDRDevice,
1361 direction: ::std::os::raw::c_int,
1362 channel: usize,
1363 ) -> f64;
1364}
1365unsafe extern "C" {
1366 /// Get the range of possible baseband sample rates.
1367 ///
1368 /// \deprecated replaced by getSampleRateRange()
1369 /// \param device a pointer to a device instance
1370 /// \param direction the channel direction RX or TX
1371 /// \param channel an available channel on the device
1372 /// \param [out] length the number of sample rates
1373 /// \return a list of possible rates in samples per second
1374 pub fn SoapySDRDevice_listSampleRates(
1375 device: *const SoapySDRDevice,
1376 direction: ::std::os::raw::c_int,
1377 channel: usize,
1378 length: *mut usize,
1379 ) -> *mut f64;
1380}
1381unsafe extern "C" {
1382 /// Get the range of possible baseband sample rates.
1383 ///
1384 /// \param device a pointer to a device instance
1385 /// \param direction the channel direction RX or TX
1386 /// \param channel an available channel on the device
1387 /// \param [out] length the number of sample rates
1388 /// \return a list of sample rate ranges in samples per second
1389 pub fn SoapySDRDevice_getSampleRateRange(
1390 device: *const SoapySDRDevice,
1391 direction: ::std::os::raw::c_int,
1392 channel: usize,
1393 length: *mut usize,
1394 ) -> *mut SoapySDRRange;
1395}
1396unsafe extern "C" {
1397 /// Set the baseband filter width of the chain.
1398 ///
1399 /// \param device a pointer to a device instance
1400 /// \param direction the channel direction RX or TX
1401 /// \param channel an available channel on the device
1402 /// \param bw the baseband filter width in Hz
1403 /// \return an error code or 0 for success
1404 pub fn SoapySDRDevice_setBandwidth(
1405 device: *mut SoapySDRDevice,
1406 direction: ::std::os::raw::c_int,
1407 channel: usize,
1408 bw: f64,
1409 ) -> ::std::os::raw::c_int;
1410}
1411unsafe extern "C" {
1412 /// Get the baseband filter width of the chain.
1413 ///
1414 /// \param device a pointer to a device instance
1415 /// \param direction the channel direction RX or TX
1416 /// \param channel an available channel on the device
1417 /// \return the baseband filter width in Hz
1418 pub fn SoapySDRDevice_getBandwidth(
1419 device: *const SoapySDRDevice,
1420 direction: ::std::os::raw::c_int,
1421 channel: usize,
1422 ) -> f64;
1423}
1424unsafe extern "C" {
1425 /// Get the range of possible baseband filter widths.
1426 ///
1427 /// \deprecated replaced by getBandwidthRange()
1428 /// \param device a pointer to a device instance
1429 /// \param direction the channel direction RX or TX
1430 /// \param channel an available channel on the device
1431 /// \param [out] length the number of bandwidths
1432 /// \return a list of possible bandwidths in Hz
1433 pub fn SoapySDRDevice_listBandwidths(
1434 device: *const SoapySDRDevice,
1435 direction: ::std::os::raw::c_int,
1436 channel: usize,
1437 length: *mut usize,
1438 ) -> *mut f64;
1439}
1440unsafe extern "C" {
1441 /// Get the range of possible baseband filter widths.
1442 ///
1443 /// \param device a pointer to a device instance
1444 /// \param direction the channel direction RX or TX
1445 /// \param channel an available channel on the device
1446 /// \param [out] length the number of ranges
1447 /// \return a list of bandwidth ranges in Hz
1448 pub fn SoapySDRDevice_getBandwidthRange(
1449 device: *const SoapySDRDevice,
1450 direction: ::std::os::raw::c_int,
1451 channel: usize,
1452 length: *mut usize,
1453 ) -> *mut SoapySDRRange;
1454}
1455unsafe extern "C" {
1456 /// Set the master clock rate of the device.
1457 ///
1458 /// \param device a pointer to a device instance
1459 /// \param rate the clock rate in Hz
1460 /// \return an error code or 0 for success
1461 pub fn SoapySDRDevice_setMasterClockRate(
1462 device: *mut SoapySDRDevice,
1463 rate: f64,
1464 ) -> ::std::os::raw::c_int;
1465}
1466unsafe extern "C" {
1467 /// Get the master clock rate of the device.
1468 ///
1469 /// \param device a pointer to a device instance
1470 /// \return the clock rate in Hz
1471 pub fn SoapySDRDevice_getMasterClockRate(device: *const SoapySDRDevice) -> f64;
1472}
1473unsafe extern "C" {
1474 /// Get the range of available master clock rates.
1475 ///
1476 /// \param device a pointer to a device instance
1477 /// \param [out] length the number of ranges
1478 /// \return a list of clock rate ranges in Hz
1479 pub fn SoapySDRDevice_getMasterClockRates(
1480 device: *const SoapySDRDevice,
1481 length: *mut usize,
1482 ) -> *mut SoapySDRRange;
1483}
1484unsafe extern "C" {
1485 /// Set the reference clock rate of the device.
1486 ///
1487 /// \param device a pointer to a device instance
1488 /// \param rate the clock rate in Hz
1489 /// \return an error code or 0 for success
1490 pub fn SoapySDRDevice_setReferenceClockRate(
1491 device: *mut SoapySDRDevice,
1492 rate: f64,
1493 ) -> ::std::os::raw::c_int;
1494}
1495unsafe extern "C" {
1496 /// Get the reference clock rate of the device.
1497 ///
1498 /// \param device a pointer to a device instance
1499 /// \return the clock rate in Hz
1500 pub fn SoapySDRDevice_getReferenceClockRate(device: *const SoapySDRDevice) -> f64;
1501}
1502unsafe extern "C" {
1503 /// Get the range of available reference clock rates.
1504 ///
1505 /// \param device a pointer to a device instance
1506 /// \param [out] length the number of sources
1507 /// \return a list of clock rate ranges in Hz
1508 pub fn SoapySDRDevice_getReferenceClockRates(
1509 device: *const SoapySDRDevice,
1510 length: *mut usize,
1511 ) -> *mut SoapySDRRange;
1512}
1513unsafe extern "C" {
1514 /// Get the list of available clock sources.
1515 ///
1516 /// \param device a pointer to a device instance
1517 /// \param [out] length the number of sources
1518 /// \return a list of clock source names
1519 pub fn SoapySDRDevice_listClockSources(
1520 device: *const SoapySDRDevice,
1521 length: *mut usize,
1522 ) -> *mut *mut ::std::os::raw::c_char;
1523}
1524unsafe extern "C" {
1525 /// Set the clock source on the device
1526 ///
1527 /// \param device a pointer to a device instance
1528 /// \param source the name of a clock source
1529 /// \return an error code or 0 for success
1530 pub fn SoapySDRDevice_setClockSource(
1531 device: *mut SoapySDRDevice,
1532 source: *const ::std::os::raw::c_char,
1533 ) -> ::std::os::raw::c_int;
1534}
1535unsafe extern "C" {
1536 /// Get the clock source of the device
1537 ///
1538 /// \param device a pointer to a device instance
1539 /// \return the name of a clock source
1540 pub fn SoapySDRDevice_getClockSource(
1541 device: *const SoapySDRDevice,
1542 ) -> *mut ::std::os::raw::c_char;
1543}
1544unsafe extern "C" {
1545 /// Get the list of available time sources.
1546 ///
1547 /// \param device a pointer to a device instance
1548 /// \param [out] length the number of sources
1549 /// \return a list of time source names
1550 pub fn SoapySDRDevice_listTimeSources(
1551 device: *const SoapySDRDevice,
1552 length: *mut usize,
1553 ) -> *mut *mut ::std::os::raw::c_char;
1554}
1555unsafe extern "C" {
1556 /// Set the time source on the device
1557 ///
1558 /// \param device a pointer to a device instance
1559 /// \param source the name of a time source
1560 /// \return an error code or 0 for success
1561 pub fn SoapySDRDevice_setTimeSource(
1562 device: *mut SoapySDRDevice,
1563 source: *const ::std::os::raw::c_char,
1564 ) -> ::std::os::raw::c_int;
1565}
1566unsafe extern "C" {
1567 /// Get the time source of the device
1568 ///
1569 /// \param device a pointer to a device instance
1570 /// \return the name of a time source
1571 pub fn SoapySDRDevice_getTimeSource(
1572 device: *const SoapySDRDevice,
1573 ) -> *mut ::std::os::raw::c_char;
1574}
1575unsafe extern "C" {
1576 /// Does this device have a hardware clock?
1577 ///
1578 /// \param device a pointer to a device instance
1579 /// \param what optional argument
1580 /// \return true if the hardware clock exists
1581 pub fn SoapySDRDevice_hasHardwareTime(
1582 device: *const SoapySDRDevice,
1583 what: *const ::std::os::raw::c_char,
1584 ) -> bool;
1585}
1586unsafe extern "C" {
1587 /// Read the time from the hardware clock on the device.
1588 ///
1589 /// The what argument can refer to a specific time counter.
1590 /// \param device a pointer to a device instance
1591 /// \param what optional argument
1592 /// \return the time in nanoseconds
1593 pub fn SoapySDRDevice_getHardwareTime(
1594 device: *const SoapySDRDevice,
1595 what: *const ::std::os::raw::c_char,
1596 ) -> ::std::os::raw::c_longlong;
1597}
1598unsafe extern "C" {
1599 /// Write the time to the hardware clock on the device.
1600 ///
1601 /// The what argument can refer to a specific time counter.
1602 /// \param device a pointer to a device instance
1603 /// \param timeNs time in nanoseconds
1604 /// \param what optional argument
1605 /// \return 0 for success or error code on failure
1606 pub fn SoapySDRDevice_setHardwareTime(
1607 device: *mut SoapySDRDevice,
1608 timeNs: ::std::os::raw::c_longlong,
1609 what: *const ::std::os::raw::c_char,
1610 ) -> ::std::os::raw::c_int;
1611}
1612unsafe extern "C" {
1613 /// Set the time of subsequent configuration calls.
1614 ///
1615 /// The what argument can refer to a specific command queue.
1616 /// Implementations may use a time of 0 to clear.
1617 /// \deprecated replaced by setHardwareTime()
1618 /// \param device a pointer to a device instance
1619 /// \param timeNs time in nanoseconds
1620 /// \param what optional argument
1621 /// \return 0 for success or error code on failure
1622 pub fn SoapySDRDevice_setCommandTime(
1623 device: *mut SoapySDRDevice,
1624 timeNs: ::std::os::raw::c_longlong,
1625 what: *const ::std::os::raw::c_char,
1626 ) -> ::std::os::raw::c_int;
1627}
1628unsafe extern "C" {
1629 /// List the available global readback sensors.
1630 ///
1631 /// A sensor can represent a reference lock, RSSI, temperature.
1632 /// \param device a pointer to a device instance
1633 /// \param [out] length the number of sensor names
1634 /// \return a list of available sensor string names
1635 pub fn SoapySDRDevice_listSensors(
1636 device: *const SoapySDRDevice,
1637 length: *mut usize,
1638 ) -> *mut *mut ::std::os::raw::c_char;
1639}
1640unsafe extern "C" {
1641 /// Get meta-information about a sensor.
1642 ///
1643 /// Example: displayable name, type, range.
1644 /// \param device a pointer to a device instance
1645 /// \param key the ID name of an available sensor
1646 /// \return meta-information about a sensor
1647 pub fn SoapySDRDevice_getSensorInfo(
1648 device: *const SoapySDRDevice,
1649 key: *const ::std::os::raw::c_char,
1650 ) -> SoapySDRArgInfo;
1651}
1652unsafe extern "C" {
1653 /// Readback a global sensor given the name.
1654 ///
1655 /// The value returned is a string which can represent
1656 /// a boolean ("true"/"false"), an integer, or float.
1657 /// \param device a pointer to a device instance
1658 /// \param key the ID name of an available sensor
1659 /// \return the current value of the sensor
1660 pub fn SoapySDRDevice_readSensor(
1661 device: *const SoapySDRDevice,
1662 key: *const ::std::os::raw::c_char,
1663 ) -> *mut ::std::os::raw::c_char;
1664}
1665unsafe extern "C" {
1666 /// List the available channel readback sensors.
1667 ///
1668 /// A sensor can represent a reference lock, RSSI, temperature.
1669 /// \param device a pointer to a device instance
1670 /// \param direction the channel direction RX or TX
1671 /// \param channel an available channel on the device
1672 /// \param [out] length the number of sensor names
1673 /// \return a list of available sensor string names
1674 pub fn SoapySDRDevice_listChannelSensors(
1675 device: *const SoapySDRDevice,
1676 direction: ::std::os::raw::c_int,
1677 channel: usize,
1678 length: *mut usize,
1679 ) -> *mut *mut ::std::os::raw::c_char;
1680}
1681unsafe extern "C" {
1682 /// Get meta-information about a channel sensor.
1683 ///
1684 /// Example: displayable name, type, range.
1685 /// \param device a pointer to a device instance
1686 /// \param direction the channel direction RX or TX
1687 /// \param channel an available channel on the device
1688 /// \param key the ID name of an available sensor
1689 /// \return meta-information about a sensor
1690 pub fn SoapySDRDevice_getChannelSensorInfo(
1691 device: *const SoapySDRDevice,
1692 direction: ::std::os::raw::c_int,
1693 channel: usize,
1694 key: *const ::std::os::raw::c_char,
1695 ) -> SoapySDRArgInfo;
1696}
1697unsafe extern "C" {
1698 /// Readback a channel sensor given the name.
1699 ///
1700 /// The value returned is a string which can represent
1701 /// a boolean ("true"/"false"), an integer, or float.
1702 /// \param device a pointer to a device instance
1703 /// \param direction the channel direction RX or TX
1704 /// \param channel an available channel on the device
1705 /// \param key the ID name of an available sensor
1706 /// \return the current value of the sensor
1707 pub fn SoapySDRDevice_readChannelSensor(
1708 device: *const SoapySDRDevice,
1709 direction: ::std::os::raw::c_int,
1710 channel: usize,
1711 key: *const ::std::os::raw::c_char,
1712 ) -> *mut ::std::os::raw::c_char;
1713}
1714unsafe extern "C" {
1715 /// Get a list of available register interfaces by name.
1716 ///
1717 /// \param device a pointer to a device instance
1718 /// \param [out] length the number of interfaces
1719 /// \return a list of available register interfaces
1720 pub fn SoapySDRDevice_listRegisterInterfaces(
1721 device: *const SoapySDRDevice,
1722 length: *mut usize,
1723 ) -> *mut *mut ::std::os::raw::c_char;
1724}
1725unsafe extern "C" {
1726 /// Write a register on the device given the interface name.
1727 ///
1728 /// This can represent a register on a soft CPU, FPGA, IC;
1729 /// the interpretation is up the implementation to decide.
1730 /// \param device a pointer to a device instance
1731 /// \param name the name of a available register interface
1732 /// \param addr the register address
1733 /// \param value the register value
1734 /// \return 0 for success or error code on failure
1735 pub fn SoapySDRDevice_writeRegister(
1736 device: *mut SoapySDRDevice,
1737 name: *const ::std::os::raw::c_char,
1738 addr: ::std::os::raw::c_uint,
1739 value: ::std::os::raw::c_uint,
1740 ) -> ::std::os::raw::c_int;
1741}
1742unsafe extern "C" {
1743 /// Read a register on the device given the interface name.
1744 ///
1745 /// \param device a pointer to a device instance
1746 /// \param name the name of a available register interface
1747 /// \param addr the register address
1748 /// \return the register value
1749 pub fn SoapySDRDevice_readRegister(
1750 device: *const SoapySDRDevice,
1751 name: *const ::std::os::raw::c_char,
1752 addr: ::std::os::raw::c_uint,
1753 ) -> ::std::os::raw::c_uint;
1754}
1755unsafe extern "C" {
1756 /// Write a memory block on the device given the interface name.
1757 ///
1758 /// This can represent a memory block on a soft CPU, FPGA, IC;
1759 /// the interpretation is up the implementation to decide.
1760 /// \param device a pointer to a device instance
1761 /// \param name the name of a available memory block interface
1762 /// \param addr the memory block start address
1763 /// \param value the memory block content
1764 /// \param length the number of words in the block
1765 /// \return 0 for success or error code on failure
1766 pub fn SoapySDRDevice_writeRegisters(
1767 device: *mut SoapySDRDevice,
1768 name: *const ::std::os::raw::c_char,
1769 addr: ::std::os::raw::c_uint,
1770 value: *const ::std::os::raw::c_uint,
1771 length: usize,
1772 ) -> ::std::os::raw::c_int;
1773}
1774unsafe extern "C" {
1775 /// Read a memory block on the device given the interface name.
1776 ///
1777 /// Pass the number of words to be read in via length;
1778 /// length will be set to the number of actual words read.
1779 /// \param device a pointer to a device instance
1780 /// \param name the name of a available memory block interface
1781 /// \param addr the memory block start address
1782 /// \param [inout] length number of words to be read from memory block
1783 /// \return the memory block content
1784 pub fn SoapySDRDevice_readRegisters(
1785 device: *const SoapySDRDevice,
1786 name: *const ::std::os::raw::c_char,
1787 addr: ::std::os::raw::c_uint,
1788 length: *mut usize,
1789 ) -> *mut ::std::os::raw::c_uint;
1790}
1791unsafe extern "C" {
1792 /// Describe the allowed keys and values used for settings.
1793 ///
1794 /// \param device a pointer to a device instance
1795 /// \param [out] length the number of sensor names
1796 /// \return a list of argument info structures
1797 pub fn SoapySDRDevice_getSettingInfo(
1798 device: *const SoapySDRDevice,
1799 length: *mut usize,
1800 ) -> *mut SoapySDRArgInfo;
1801}
1802unsafe extern "C" {
1803 /// Get information on a specific setting.
1804 ///
1805 /// \param device a pointer to a device instance
1806 /// \param key the setting identifier
1807 /// \return a list of argument info structures
1808 pub fn SoapySDRDevice_getSettingInfoWithKey(
1809 device: *const SoapySDRDevice,
1810 key: *const ::std::os::raw::c_char,
1811 ) -> SoapySDRArgInfo;
1812}
1813unsafe extern "C" {
1814 /// Write an arbitrary setting on the device.
1815 ///
1816 /// The interpretation is up the implementation.
1817 /// \param device a pointer to a device instance
1818 /// \param key the setting identifier
1819 /// \param value the setting value
1820 /// \return 0 for success or error code on failure
1821 pub fn SoapySDRDevice_writeSetting(
1822 device: *mut SoapySDRDevice,
1823 key: *const ::std::os::raw::c_char,
1824 value: *const ::std::os::raw::c_char,
1825 ) -> ::std::os::raw::c_int;
1826}
1827unsafe extern "C" {
1828 /// Read an arbitrary setting on the device.
1829 ///
1830 /// \param device a pointer to a device instance
1831 /// \param key the setting identifier
1832 /// \return the setting value
1833 pub fn SoapySDRDevice_readSetting(
1834 device: *const SoapySDRDevice,
1835 key: *const ::std::os::raw::c_char,
1836 ) -> *mut ::std::os::raw::c_char;
1837}
1838unsafe extern "C" {
1839 /// Describe the allowed keys and values used for channel settings.
1840 ///
1841 /// \param device a pointer to a device instance
1842 /// \param direction the channel direction RX or TX
1843 /// \param channel an available channel on the device
1844 /// \param [out] length the number of sensor names
1845 /// \return a list of argument info structures
1846 pub fn SoapySDRDevice_getChannelSettingInfo(
1847 device: *const SoapySDRDevice,
1848 direction: ::std::os::raw::c_int,
1849 channel: usize,
1850 length: *mut usize,
1851 ) -> *mut SoapySDRArgInfo;
1852}
1853unsafe extern "C" {
1854 /// Get information on a specific channel setting.
1855 ///
1856 /// \param device a pointer to a device instance
1857 /// \param direction the channel direction RX or TX
1858 /// \param channel an available channel on the device
1859 /// \param key the setting identifier
1860 /// \return a list of argument info structures
1861 pub fn SoapySDRDevice_getChannelSettingInfoWithKey(
1862 device: *const SoapySDRDevice,
1863 direction: ::std::os::raw::c_int,
1864 channel: usize,
1865 key: *const ::std::os::raw::c_char,
1866 ) -> SoapySDRArgInfo;
1867}
1868unsafe extern "C" {
1869 /// Write an arbitrary channel setting on the device.
1870 ///
1871 /// The interpretation is up the implementation. \param device a pointer to a device instance
1872 /// \param direction the channel direction RX or TX
1873 /// \param channel an available channel on the device
1874 /// \param key the setting identifier
1875 /// \param value the setting value
1876 /// \return 0 for success or error code on failure
1877 pub fn SoapySDRDevice_writeChannelSetting(
1878 device: *mut SoapySDRDevice,
1879 direction: ::std::os::raw::c_int,
1880 channel: usize,
1881 key: *const ::std::os::raw::c_char,
1882 value: *const ::std::os::raw::c_char,
1883 ) -> ::std::os::raw::c_int;
1884}
1885unsafe extern "C" {
1886 /// Read an arbitrary channel setting on the device.
1887 ///
1888 /// \param device a pointer to a device instance
1889 /// \param direction the channel direction RX or TX
1890 /// \param channel an available channel on the device
1891 /// \param key the setting identifier
1892 /// \return the setting value
1893 pub fn SoapySDRDevice_readChannelSetting(
1894 device: *const SoapySDRDevice,
1895 direction: ::std::os::raw::c_int,
1896 channel: usize,
1897 key: *const ::std::os::raw::c_char,
1898 ) -> *mut ::std::os::raw::c_char;
1899}
1900unsafe extern "C" {
1901 /// Get a list of available GPIO banks by name.
1902 ///
1903 /// \param [out] length the number of GPIO banks
1904 /// \param device a pointer to a device instance
1905 pub fn SoapySDRDevice_listGPIOBanks(
1906 device: *const SoapySDRDevice,
1907 length: *mut usize,
1908 ) -> *mut *mut ::std::os::raw::c_char;
1909}
1910unsafe extern "C" {
1911 /// Write the value of a GPIO bank.
1912 ///
1913 /// \param device a pointer to a device instance
1914 /// \param bank the name of an available bank
1915 /// \param value an integer representing GPIO bits
1916 /// \return 0 for success or error code on failure
1917 pub fn SoapySDRDevice_writeGPIO(
1918 device: *mut SoapySDRDevice,
1919 bank: *const ::std::os::raw::c_char,
1920 value: ::std::os::raw::c_uint,
1921 ) -> ::std::os::raw::c_int;
1922}
1923unsafe extern "C" {
1924 /// Write the value of a GPIO bank with modification mask.
1925 ///
1926 /// \param device a pointer to a device instance
1927 /// \param bank the name of an available bank
1928 /// \param value an integer representing GPIO bits
1929 /// \param mask a modification mask where 1 = modify
1930 /// \return 0 for success or error code on failure
1931 pub fn SoapySDRDevice_writeGPIOMasked(
1932 device: *mut SoapySDRDevice,
1933 bank: *const ::std::os::raw::c_char,
1934 value: ::std::os::raw::c_uint,
1935 mask: ::std::os::raw::c_uint,
1936 ) -> ::std::os::raw::c_int;
1937}
1938unsafe extern "C" {
1939 /// Readback the value of a GPIO bank.
1940 ///
1941 /// \param device a pointer to a device instance
1942 /// \param bank the name of an available bank
1943 /// \return an integer representing GPIO bits
1944 pub fn SoapySDRDevice_readGPIO(
1945 device: *const SoapySDRDevice,
1946 bank: *const ::std::os::raw::c_char,
1947 ) -> ::std::os::raw::c_uint;
1948}
1949unsafe extern "C" {
1950 /// Write the data direction of a GPIO bank.
1951 ///
1952 /// 1 bits represent outputs, 0 bits represent inputs.
1953 /// \param device a pointer to a device instance
1954 /// \param bank the name of an available bank
1955 /// \param dir an integer representing data direction bits
1956 /// \return 0 for success or error code on failure
1957 pub fn SoapySDRDevice_writeGPIODir(
1958 device: *mut SoapySDRDevice,
1959 bank: *const ::std::os::raw::c_char,
1960 dir: ::std::os::raw::c_uint,
1961 ) -> ::std::os::raw::c_int;
1962}
1963unsafe extern "C" {
1964 /// Write the data direction of a GPIO bank with modification mask.
1965 ///
1966 /// 1 bits represent outputs, 0 bits represent inputs.
1967 /// \param device a pointer to a device instance
1968 /// \param bank the name of an available bank
1969 /// \param dir an integer representing data direction bits
1970 /// \param mask a modification mask where 1 = modify
1971 /// \return 0 for success or error code on failure
1972 pub fn SoapySDRDevice_writeGPIODirMasked(
1973 device: *mut SoapySDRDevice,
1974 bank: *const ::std::os::raw::c_char,
1975 dir: ::std::os::raw::c_uint,
1976 mask: ::std::os::raw::c_uint,
1977 ) -> ::std::os::raw::c_int;
1978}
1979unsafe extern "C" {
1980 /// Read the data direction of a GPIO bank.
1981 ///
1982 /// \param device a pointer to a device instance
1983 /// 1 bits represent outputs, 0 bits represent inputs.
1984 /// \param bank the name of an available bank
1985 /// \return an integer representing data direction bits
1986 pub fn SoapySDRDevice_readGPIODir(
1987 device: *const SoapySDRDevice,
1988 bank: *const ::std::os::raw::c_char,
1989 ) -> ::std::os::raw::c_uint;
1990}
1991unsafe extern "C" {
1992 /// Write to an available I2C slave.
1993 ///
1994 /// If the device contains multiple I2C masters,
1995 /// the address bits can encode which master.
1996 /// \param device a pointer to a device instance
1997 /// \param addr the address of the slave
1998 /// \param data an array of bytes write out
1999 /// \param numBytes the number of bytes to write
2000 /// \return 0 for success or error code on failure
2001 pub fn SoapySDRDevice_writeI2C(
2002 device: *mut SoapySDRDevice,
2003 addr: ::std::os::raw::c_int,
2004 data: *const ::std::os::raw::c_char,
2005 numBytes: usize,
2006 ) -> ::std::os::raw::c_int;
2007}
2008unsafe extern "C" {
2009 /// Read from an available I2C slave.
2010 ///
2011 /// If the device contains multiple I2C masters,
2012 /// the address bits can encode which master.
2013 /// Pass the number of bytes to be read in via numBytes;
2014 /// numBytes will be set to the number of actual bytes read.
2015 /// \param device a pointer to a device instance
2016 /// \param addr the address of the slave
2017 /// \param [inout] numBytes the number of bytes to read
2018 /// \return an array of bytes read from the slave
2019 pub fn SoapySDRDevice_readI2C(
2020 device: *mut SoapySDRDevice,
2021 addr: ::std::os::raw::c_int,
2022 numBytes: *mut usize,
2023 ) -> *mut ::std::os::raw::c_char;
2024}
2025unsafe extern "C" {
2026 /// Perform a SPI transaction and return the result.
2027 ///
2028 /// Its up to the implementation to set the clock rate,
2029 /// and read edge, and the write edge of the SPI core.
2030 /// SPI slaves without a readback pin will return 0.
2031 /// If the device contains multiple SPI masters,
2032 /// the address bits can encode which master.
2033 /// \param device a pointer to a device instance
2034 /// \param addr an address of an available SPI slave
2035 /// \param data the SPI data, numBits-1 is first out
2036 /// \param num Bits the number of bits to clock t
2037 /// \return the readback data, numBits-1 is first in
2038 pub fn SoapySDRDevice_transactSPI(
2039 device: *mut SoapySDRDevice,
2040 addr: ::std::os::raw::c_int,
2041 data: ::std::os::raw::c_uint,
2042 numBits: usize,
2043 ) -> ::std::os::raw::c_uint;
2044}
2045unsafe extern "C" {
2046 /// Enumerate the available UART devices.
2047 ///
2048 /// \param device a pointer to a device instance
2049 /// \param [out] length the number of UART names
2050 /// \return a list of names of available UARTs
2051 pub fn SoapySDRDevice_listUARTs(
2052 device: *const SoapySDRDevice,
2053 length: *mut usize,
2054 ) -> *mut *mut ::std::os::raw::c_char;
2055}
2056unsafe extern "C" {
2057 /// Write data to a UART device.
2058 ///
2059 /// Its up to the implementation to set the baud rate,
2060 /// carriage return settings, flushing on newline.
2061 /// \param device a pointer to a device instance
2062 /// \param which the name of an available UART
2063 /// \param data a null terminated array of bytes
2064 /// \return 0 for success or error code on failure
2065 pub fn SoapySDRDevice_writeUART(
2066 device: *mut SoapySDRDevice,
2067 which: *const ::std::os::raw::c_char,
2068 data: *const ::std::os::raw::c_char,
2069 ) -> ::std::os::raw::c_int;
2070}
2071unsafe extern "C" {
2072 /// Read bytes from a UART until timeout or newline.
2073 ///
2074 /// Its up to the implementation to set the baud rate,
2075 /// carriage return settings, flushing on newline.
2076 /// \param device a pointer to a device instance
2077 /// \param which the name of an available UART
2078 /// \param timeoutUs a timeout in microseconds
2079 /// \return a null terminated array of bytes
2080 pub fn SoapySDRDevice_readUART(
2081 device: *const SoapySDRDevice,
2082 which: *const ::std::os::raw::c_char,
2083 timeoutUs: ::std::os::raw::c_long,
2084 ) -> *mut ::std::os::raw::c_char;
2085}
2086unsafe extern "C" {
2087 /// A handle to the native device used by the driver.
2088 ///
2089 /// The implementation may return a null value if it does not support
2090 /// or does not wish to provide access to the native handle.
2091 /// \param device a pointer to a device instance
2092 /// \return a handle to the native device or null
2093 pub fn SoapySDRDevice_getNativeDeviceHandle(
2094 device: *const SoapySDRDevice,
2095 ) -> *mut ::std::os::raw::c_void;
2096}
2097
2098/// The available priority levels for log messages.
2099///
2100/// The default log level threshold is SOAPY_SDR_INFO.
2101/// Log messages with lower priorities are dropped.
2102/// The default threshold can be set via the
2103/// SOAPY_SDR_LOG_LEVEL environment variable.
2104/// Set SOAPY_SDR_LOG_LEVEL to the string value:
2105/// "WARNING", "ERROR", "DEBUG", etc...
2106/// or set it to the equivalent integer value.
2107pub type SoapySDRLogLevel = ::std::os::raw::c_uint;
2108
2109/// A fatal error. The application will most likely terminate. This is the highest priority.
2110pub const SOAPY_SDR_FATAL: SoapySDRLogLevel = 1;
2111/// A critical error. The application might not be able to continue running successfully.
2112pub const SOAPY_SDR_CRITICAL: SoapySDRLogLevel = 2;
2113/// An error. An operation did not complete successfully, but the application as a whole is not affected.
2114pub const SOAPY_SDR_ERROR: SoapySDRLogLevel = 3;
2115/// A warning. An operation completed with an unexpected result.
2116pub const SOAPY_SDR_WARNING: SoapySDRLogLevel = 4;
2117/// A notice, which is an information with just a higher priority.
2118pub const SOAPY_SDR_NOTICE: SoapySDRLogLevel = 5;
2119/// An informational message, usually denoting the successful completion of an operation.
2120pub const SOAPY_SDR_INFO: SoapySDRLogLevel = 6;
2121/// A debugging message.
2122pub const SOAPY_SDR_DEBUG: SoapySDRLogLevel = 7;
2123/// A tracing message. This is the lowest priority.
2124pub const SOAPY_SDR_TRACE: SoapySDRLogLevel = 8;
2125/// Streaming status indicators such as "U" (underflow) and "O" (overflow).
2126pub const SOAPY_SDR_SSI: SoapySDRLogLevel = 9;
2127
2128unsafe extern "C" {
2129 /// Send a message to the registered logger.
2130 ///
2131 /// \param logLevel a possible logging level
2132 /// \param message a logger message string
2133 pub fn SoapySDR_log(logLevel: SoapySDRLogLevel, message: *const ::std::os::raw::c_char);
2134}
2135/// Typedef for the registered log handler function.
2136pub type SoapySDRLogHandler = ::std::option::Option<
2137 unsafe extern "C" fn(logLevel: SoapySDRLogLevel, message: *const ::std::os::raw::c_char),
2138>;
2139unsafe extern "C" {
2140 /// Register a new system log handler.
2141 ///
2142 /// Platforms should call this to replace the default stdio handler.
2143 /// Passing `NULL` restores the default.
2144 pub fn SoapySDR_registerLogHandler(handler: SoapySDRLogHandler);
2145}
2146unsafe extern "C" {
2147 /// Set the log level threshold.
2148 ///
2149 /// Log messages with lower priority are dropped.
2150 pub fn SoapySDR_setLogLevel(logLevel: SoapySDRLogLevel);
2151}
2152unsafe extern "C" {
2153 /// Get the log level threshold.
2154 pub fn SoapySDR_getLogLevel() -> SoapySDRLogLevel;
2155}
2156unsafe extern "C" {
2157 /// Get the size of a single element in the specified format.
2158 ///
2159 /// \param format a supported format string
2160 /// \return the size of an element in bytes
2161 pub fn SoapySDR_formatToSize(format: *const ::std::os::raw::c_char) -> usize;
2162}
2163unsafe extern "C" {
2164 /// Query the root installation path
2165 pub fn SoapySDR_getRootPath() -> *const ::std::os::raw::c_char;
2166}
2167unsafe extern "C" {
2168 /// The list of paths automatically searched by loadModules().
2169 ///
2170 /// \param [out] length the number of elements in the result.
2171 /// \return a list of automatically searched file paths
2172 pub fn SoapySDR_listSearchPaths(length: *mut usize) -> *mut *mut ::std::os::raw::c_char;
2173}
2174unsafe extern "C" {
2175 /// List all modules found in default path.
2176 ///
2177 /// The result is an array of strings owned by the caller.
2178 /// \param [out] length the number of elements in the result.
2179 /// \return a list of file paths to loadable modules
2180 pub fn SoapySDR_listModules(length: *mut usize) -> *mut *mut ::std::os::raw::c_char;
2181}
2182unsafe extern "C" {
2183 /// List all modules found in the given path.
2184 ///
2185 /// The result is an array of strings owned by the caller.
2186 /// \param path a directory on the system
2187 /// \param [out] length the number of elements in the result.
2188 /// \return a list of file paths to loadable modules
2189 pub fn SoapySDR_listModulesPath(
2190 path: *const ::std::os::raw::c_char,
2191 length: *mut usize,
2192 ) -> *mut *mut ::std::os::raw::c_char;
2193}
2194unsafe extern "C" {
2195 /// Load a single module given its file system path.
2196 ///
2197 /// The caller must free the result error string.
2198 /// \param path the path to a specific module file
2199 /// \return an error message, empty on success
2200 pub fn SoapySDR_loadModule(path: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char;
2201}
2202unsafe extern "C" {
2203 /// List all registration loader errors for a given module path.
2204 ///
2205 /// The resulting dictionary contains all registry entry names
2206 /// provided by the specified module. The value of each entry
2207 /// is an error message string or empty on successful load.
2208 /// \param path the path to a specific module file
2209 /// \return a dictionary of registry names to error messages
2210 pub fn SoapySDR_getLoaderResult(path: *const ::std::os::raw::c_char) -> SoapySDRKwargs;
2211}
2212unsafe extern "C" {
2213 /// Get a version string for the specified module.
2214 ///
2215 /// Modules may optionally provide version strings.
2216 /// \param path the path to a specific module file
2217 /// \return a version string or empty if no version provided
2218 pub fn SoapySDR_getModuleVersion(
2219 path: *const ::std::os::raw::c_char,
2220 ) -> *mut ::std::os::raw::c_char;
2221}
2222unsafe extern "C" {
2223 /// Unload a module that was loaded with loadModule().
2224 ///
2225 /// The caller must free the result error string.
2226 /// \param path the path to a specific module file
2227 /// \return an error message, empty on success
2228 pub fn SoapySDR_unloadModule(
2229 path: *const ::std::os::raw::c_char,
2230 ) -> *mut ::std::os::raw::c_char;
2231}
2232unsafe extern "C" {
2233 /// Load the support modules installed on this system.
2234 ///
2235 /// This call will only actually perform the load once.
2236 /// Subsequent calls are a NOP.
2237 pub fn SoapySDR_loadModules();
2238}
2239unsafe extern "C" {
2240 /// Unload all currently loaded support modules.
2241 pub fn SoapySDR_unloadModules();
2242}
2243unsafe extern "C" {
2244 /// Convert a tick count into a time in nanoseconds using the tick rate.
2245 ///
2246 /// \param ticks a integer tick count
2247 /// \param rate the ticks per second
2248 /// \return the time in nanoseconds
2249 pub fn SoapySDR_ticksToTimeNs(
2250 ticks: ::std::os::raw::c_longlong,
2251 rate: f64,
2252 ) -> ::std::os::raw::c_longlong;
2253}
2254unsafe extern "C" {
2255 /// Convert a time in nanoseconds into a tick count using the tick rate.
2256 ///
2257 /// \param timeNs time in nanoseconds
2258 /// \param rate the ticks per second
2259 /// \return the integer tick count
2260 pub fn SoapySDR_timeNsToTicks(
2261 timeNs: ::std::os::raw::c_longlong,
2262 rate: f64,
2263 ) -> ::std::os::raw::c_longlong;
2264}
2265unsafe extern "C" {
2266 /// Get the SoapySDR library API version as a string.
2267 ///
2268 /// The format of the version string is <b>major.minor.increment</b>,
2269 /// where the digits are taken directly from <b>SOAPY_SDR_API_VERSION</b>.
2270 pub fn SoapySDR_getAPIVersion() -> *const ::std::os::raw::c_char;
2271}
2272unsafe extern "C" {
2273 /// Get the ABI version string that the library was built against.
2274 ///
2275 /// A client can compare <b>SOAPY_SDR_ABI_VERSION</b> to getABIVersion()
2276 /// to check for ABI incompatibility before using the library.
2277 /// If the values are not equal then the client code was
2278 /// compiled against a different ABI than the library.
2279 pub fn SoapySDR_getABIVersion() -> *const ::std::os::raw::c_char;
2280}
2281unsafe extern "C" {
2282 /// Get the library version and build information string.
2283 ///
2284 /// The format of the version string is <b>major.minor.patch-buildInfo</b>.
2285 /// This function is commonly used to identify the software back-end
2286 /// to the user for command-line utilities and graphical applications.
2287 pub fn SoapySDR_getLibVersion() -> *const ::std::os::raw::c_char;
2288}