diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-12-14 13:45:48 -0800 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2018-12-14 15:37:28 -0800 |
commit | d8c8cf3e5444c634a937391f4de60e28fac3603d (patch) | |
tree | 6fd67d9ad33aaead78a5dd0f1055b01ce4d1d9f8 | |
parent | 89868e5010187628ef00f8f4e67d6afdd583bb0c (diff) | |
download | uhd-d8c8cf3e5444c634a937391f4de60e28fac3603d.tar.gz uhd-d8c8cf3e5444c634a937391f4de60e28fac3603d.tar.bz2 uhd-d8c8cf3e5444c634a937391f4de60e28fac3603d.zip |
C API: Add support for Tx LO control
The Rx LO control was always there, but the Tx LO control was not
exposed into the C API.
-rw-r--r-- | host/include/uhd/usrp/usrp.h | 74 | ||||
-rw-r--r-- | host/lib/usrp/usrp_c.cpp | 89 |
2 files changed, 163 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/usrp.h b/host/include/uhd/usrp/usrp.h index 0ede389ef..ac551a2a9 100644 --- a/host/include/uhd/usrp/usrp.h +++ b/host/include/uhd/usrp/usrp.h @@ -1019,6 +1019,80 @@ UHD_API uhd_error uhd_usrp_get_fe_tx_freq_range( uhd_meta_range_handle freq_range_out ); +//! Get a list of possible LO stage names +/* + * See uhd::usrp::multi_usrp::get_tx_lo_names() for more details. + */ +UHD_API uhd_error uhd_usrp_get_tx_lo_names( + uhd_usrp_handle h, + size_t chan, + uhd_string_vector_handle *tx_lo_names_out +); + +//! Set the LO source for the USRP device +/* + * See uhd::usrp::multi_usrp::set_tx_lo_source() for more details. + */ +UHD_API uhd_error uhd_usrp_set_tx_lo_source( + uhd_usrp_handle h, + const char* src, + const char* name, + size_t chan +); + +//! Get the currently set LO source +UHD_API uhd_error uhd_usrp_get_tx_lo_source( + uhd_usrp_handle h, + const char* name, + size_t chan, + char* tx_lo_source_out, + size_t strbuffer_len +); + +//! Get a list of possible LO sources +UHD_API uhd_error uhd_usrp_get_tx_lo_sources( + uhd_usrp_handle h, + const char* name, + size_t chan, + uhd_string_vector_handle *tx_lo_sources_out +); + +//! Set whether the LO used by the USRP device is exported +/* + * See uhd::usrp::multi_usrp::set_tx_lo_enabled() for more details. + */ +UHD_API uhd_error uhd_usrp_set_tx_lo_export_enabled( + uhd_usrp_handle h, + bool enabled, + const char* name, + size_t chan +); + +//! Returns true if the currently selected LO is being exported. +UHD_API uhd_error uhd_usrp_get_tx_lo_export_enabled( + uhd_usrp_handle h, + const char* name, + size_t chan, + bool* result_out +); + +//! Set the Tx LO frequency. +UHD_API uhd_error uhd_usrp_set_tx_lo_freq( + uhd_usrp_handle h, + double freq, + const char* name, + size_t chan, + double* coerced_freq_out +); + +//! Get the current Tx LO frequency. +UHD_API uhd_error uhd_usrp_get_tx_lo_freq( + uhd_usrp_handle h, + const char* name, + size_t chan, + double* tx_lo_freq_out +); + //! Set the TX gain for the given channel and name UHD_API uhd_error uhd_usrp_set_tx_gain( uhd_usrp_handle h, diff --git a/host/lib/usrp/usrp_c.cpp b/host/lib/usrp/usrp_c.cpp index 94f0f4eba..f625113e4 100644 --- a/host/lib/usrp/usrp_c.cpp +++ b/host/lib/usrp/usrp_c.cpp @@ -1227,6 +1227,95 @@ uhd_error uhd_usrp_get_fe_tx_freq_range( ) } +UHD_API uhd_error uhd_usrp_get_tx_lo_names( + uhd_usrp_handle h, + size_t chan, + uhd_string_vector_handle *tx_lo_names_out +){ + UHD_SAFE_C_SAVE_ERROR(h, + (*tx_lo_names_out)->string_vector_cpp = USRP(h)->get_tx_lo_names(chan); + ) +} + +UHD_API uhd_error uhd_usrp_set_tx_lo_source( + uhd_usrp_handle h, + const char* src, + const char* name, + size_t chan +){ + UHD_SAFE_C_SAVE_ERROR(h, + USRP(h)->set_tx_lo_source(src, name, chan); + ) +} + +UHD_API uhd_error uhd_usrp_get_tx_lo_source( + uhd_usrp_handle h, + const char* name, + size_t chan, + char* tx_lo_source_out, + size_t strbuffer_len +){ + UHD_SAFE_C_SAVE_ERROR(h, + strncpy(tx_lo_source_out, USRP(h)->get_tx_lo_source(name, chan).c_str(), strbuffer_len); + ) +} + +UHD_API uhd_error uhd_usrp_get_tx_lo_sources( + uhd_usrp_handle h, + const char* name, + size_t chan, + uhd_string_vector_handle *tx_lo_sources_out +){ + UHD_SAFE_C_SAVE_ERROR(h, + (*tx_lo_sources_out)->string_vector_cpp = USRP(h)->get_tx_lo_sources(name, chan); + ) +} + +UHD_API uhd_error uhd_usrp_set_tx_lo_export_enabled( + uhd_usrp_handle h, + bool enabled, + const char* name, + size_t chan +){ + UHD_SAFE_C_SAVE_ERROR(h, + USRP(h)->set_tx_lo_export_enabled(enabled, name, chan); + ) +} + +UHD_API uhd_error uhd_usrp_get_tx_lo_export_enabled( + uhd_usrp_handle h, + const char* name, + size_t chan, + bool* result_out +) { + UHD_SAFE_C_SAVE_ERROR(h, + *result_out = USRP(h)->get_tx_lo_export_enabled(name, chan); + ) +} + +UHD_API uhd_error uhd_usrp_set_tx_lo_freq( + uhd_usrp_handle h, + double freq, + const char* name, + size_t chan, + double* coerced_freq_out +){ + UHD_SAFE_C_SAVE_ERROR(h, + *coerced_freq_out = USRP(h)->set_tx_lo_freq(freq, name, chan); + ) +} + +UHD_API uhd_error uhd_usrp_get_tx_lo_freq( + uhd_usrp_handle h, + const char* name, + size_t chan, + double* tx_lo_freq_out +){ + UHD_SAFE_C_SAVE_ERROR(h, + *tx_lo_freq_out = USRP(h)->get_tx_lo_freq(name, chan); + ) +} + uhd_error uhd_usrp_set_tx_gain( uhd_usrp_handle h, double gain, |