|
libpg2sdr
Host library for the ProStick Gen 2 SDR
|
The main pg2sdr header. More...
Go to the source code of this file.
Data Structures | |
| struct | pg2sdr_usb_device |
| Representation of an unopened PG2SDR device on the USB bus. More... | |
| struct | pg2sdr_sample_buffer |
| Sample buffer passed to pg2sdr_stream_callback. More... | |
| struct | pg2sdr_gain_table_t |
| Gain table entry. More... | |
| struct | pg2sdr_bandpass_table_t |
| Tuner bandpass filter table entry. More... | |
Macros | |
| #define | PG2SDR_API_VERSION 0x01000100U |
| Compile-time library API version. | |
| #define | PG2SDR_DECIMATION_AUTO (-1) |
| Decimation mode that auto-selects decimation to avoid bandpass filter issues. | |
Typedefs | |
| typedef struct pg2sdr__context | pg2sdr_context |
| An opaque handle for library state. | |
| typedef void(* | pg2sdr_log_callback) (pg2sdr_context *context, pg2sdr_log_level level, const char *message) |
| Callback function passed to pg2sdr_set_log_callback() | |
| typedef struct pg2sdr__device | pg2sdr_device |
| Opaque type representing the state of an opened PG2SDR device. | |
| typedef bool(* | pg2sdr_stream_callback) (pg2sdr_device *dev, pg2sdr_sample_buffer *buffer, void *user_data) |
| Callback type that receives sample buffers. | |
Functions | |
| uint32_t | pg2sdr_get_api_version (void) |
| Get runtime library API version. | |
| int | pg2sdr_init (pg2sdr_context **ctx) |
| Allocate a new library context. | |
| int | pg2sdr_exit (pg2sdr_context *ctx) |
| Free a library context. | |
| int | pg2sdr_set_log_callback (pg2sdr_context *ctx, pg2sdr_log_callback callback) |
| Set a callback to receive library logging. | |
| const char * | pg2sdr_strerror (int error) |
| Format a pg2sdr error code as a human-readable error message. | |
| const char * | pg2sdr_strerror_r (int error, char *buf, size_t buflen) |
| Format a pg2sdr error code as a human-readable error message. | |
| ssize_t | pg2sdr_discover_devices (pg2sdr_context *ctx, const char *match_serial_prefix, const char *match_ports, pg2sdr_usb_device ***usb_device_list) |
| Enumerate available pg2sdr devices. | |
| void | pg2sdr_free_device_list (pg2sdr_usb_device **usb_device_list) |
| Free a device list previously allocated by pg2sdr_discover_devices() | |
| int | pg2sdr_open_device (pg2sdr_context *ctx, pg2sdr_usb_device *usb_device, pg2sdr_device **device) |
| Open a device previously discovered by pg2sdr_discover_devices() | |
| int | pg2sdr_open_libusb_device (pg2sdr_context *ctx, libusb_device *lu_device, pg2sdr_device **device) |
| Open a device directly from a libusb device. | |
| int | pg2sdr_open_single_device (pg2sdr_context *ctx, const char *serial_prefix, const char *ports, pg2sdr_device **device) |
| Open a single device by serial number or port path. | |
| int | pg2sdr_close_device (pg2sdr_device *dev) |
| Close a pg2sdr device. | |
| const char * | pg2sdr_get_serial (pg2sdr_device *dev) |
| Get the serial number of an opened device. | |
| const char * | pg2sdr_get_ports (pg2sdr_device *dev) |
| Get the USB port path of an opened device. | |
| uint32_t | pg2sdr_get_firmware_version (pg2sdr_device *dev) |
| Get the firmware version of an opened device. | |
| int | pg2sdr_set_conversion_mode (pg2sdr_device *dev, pg2sdr_conversion_mode_t mode) |
| Set the conversion mode for sample data received by user callbacks. | |
| int | pg2sdr_get_conversion_mode (pg2sdr_device *dev, pg2sdr_conversion_mode_t *mode) |
| Get the current sample conversion mode. | |
| int | pg2sdr_set_buffer_size (pg2sdr_device *dev, size_t buffer_size) |
| Set size of sample buffer passed to user callbacks. | |
| int | pg2sdr_get_buffer_size (pg2sdr_device *dev, size_t *buffer_size) |
| Get size of sample buffer passed to user callbacks. | |
| int | pg2sdr_set_sample_rate (pg2sdr_device *dev, double rate) |
| Set the current requested user sampling rate. | |
| int | pg2sdr_get_sample_rate (pg2sdr_device *dev, double *requested, double *actual) |
| Get current user sampling rate. | |
| int | pg2sdr_set_decimation_mode (pg2sdr_device *dev, int decimation_mode) |
| Set current decimation mode. | |
| int | pg2sdr_get_decimation_mode (pg2sdr_device *dev, int *decimation_mode, unsigned *actual_decimation) |
| Get current decimation mode and/or actual number of decimation steps. | |
| int | pg2sdr_set_undersampling_mode (pg2sdr_device *dev, unsigned undersampling_mode) |
| Set the current undersampling mode. | |
| int | pg2sdr_get_undersampling_mode (pg2sdr_device *dev, unsigned *undersampling_mode) |
| Get current undersampling mode. | |
| int | pg2sdr_set_adc_limit (pg2sdr_device *dev, double adc_limit) |
| Set hardware ADC sampling rate limit. | |
| int | pg2sdr_get_adc_limit (pg2sdr_device *dev, double *adc_limit) |
| Get current hardware ADC sampling rate limit. | |
| int | pg2sdr_get_adc_rate (pg2sdr_device *dev, double *actual_adc_rate) |
| Get current ADC sampling rate. | |
| int | pg2sdr_set_sideband (pg2sdr_device *dev, pg2sdr_sideband_mode_t mode) |
| Set the current sideband tuning mode. | |
| int | pg2sdr_get_sideband (pg2sdr_device *dev, pg2sdr_sideband_mode_t *mode) |
| Get current sideband mode. | |
| int | pg2sdr_set_frequency (pg2sdr_device *dev, double frequency) |
| Set the center frequency of received data. | |
| int | pg2sdr_get_frequency (pg2sdr_device *dev, double *requested, double *actual) |
| Get current center frequency. | |
| int | pg2sdr_set_bandpass (pg2sdr_device *dev, double low, double high) |
| Set bandpass filter limits. | |
| int | pg2sdr_get_bandpass (pg2sdr_device *dev, double *req_low, double *req_high, double *actual_low, double *actual_high) |
| Get requested and actual bandpass filter settings. | |
| int | pg2sdr_apply_changes (pg2sdr_device *dev) |
| Apply pending configuration changes. | |
| int | pg2sdr_set_lna_gain (pg2sdr_device *dev, unsigned gain) |
| Set LNA stage gain step. | |
| int | pg2sdr_set_mix_gain (pg2sdr_device *dev, unsigned gain) |
| Set MIX stage gain step. | |
| int | pg2sdr_set_vga_gain (pg2sdr_device *dev, unsigned gain) |
| Set VGA stage gain step. | |
| int | pg2sdr_get_stage_gains (pg2sdr_device *dev, unsigned *lna, unsigned *mix, unsigned *vga) |
| Get per-stage gain step settings. | |
| int | pg2sdr_set_lna_gain_db (pg2sdr_device *dev, double gain_db) |
| Set LNA stage gain in dB. | |
| int | pg2sdr_set_mix_gain_db (pg2sdr_device *dev, double gain_db) |
| Set MIX stage gain in dB. | |
| int | pg2sdr_set_vga_gain_db (pg2sdr_device *dev, double gain_db) |
| Set VGA stage gain in dB. | |
| int | pg2sdr_get_stage_gains_db (pg2sdr_device *dev, double *lna_db, double *mix_db, double *vga_db) |
| Get per-stage gain settings in dB. | |
| int | pg2sdr_set_total_gain_db (pg2sdr_device *dev, double gain_db) |
| Set total gain, in dB. | |
| int | pg2sdr_get_total_gain_db (pg2sdr_device *dev, double *gain_db) |
| Get total gain setting, in dB. | |
| int | pg2sdr_set_gain_tables (pg2sdr_device *dev, const pg2sdr_gain_table_t *gain_table, size_t gain_table_size, const double *lna_table, const double *mix_table, const double *vga_table) |
| Set the gain tables used for the dB-based gain API. | |
| int | pg2sdr_get_gain_tables (pg2sdr_device *dev, pg2sdr_gain_table_t **gain_table, size_t *gain_table_size, double *lna_table, double *mix_table, double *vga_table) |
| Get the current gain tables used for the dB-based gain API. | |
| int | pg2sdr_set_bandpass_table (pg2sdr_device *dev, const pg2sdr_bandpass_table_t *bandpass_table, size_t bandpass_table_size) |
| Set the filter calibration tables used for bandpass filter selection. | |
| int | pg2sdr_get_bandpass_table (pg2sdr_device *dev, pg2sdr_bandpass_table_t **bandpass_table, size_t *bandpass_table_size) |
| Get the current filter calibration tables used for bandpass filter selection. | |
| int | pg2sdr_stream_data (pg2sdr_device *dev, pg2sdr_stream_callback callback, void *user_data) |
| Stream ADC data and pass converted samples to user callback. | |
| int | pg2sdr_stop_streaming (pg2sdr_device *dev) |
| Halt data streaming. | |
| void | pg2sdr_release_buffer (pg2sdr_sample_buffer *buffer) |
| Free a sample buffer previously passed to a pg2sdr_stream_callback callback. | |
The main pg2sdr header.
The public pg2sdr API is entirely contained in a single header file.