Skip to content

Commit

Permalink
soapy: Added API to query available clock rates
Browse files Browse the repository at this point in the history
  • Loading branch information
guruofquality committed Oct 14, 2015
1 parent 586b68b commit 554f320
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -10,7 +10,7 @@ enable_testing()
# gather version information
# packagers may specify -DSOAPY_SDR_EXTVER="foo" to replace the git hash
########################################################################
set(SOAPY_SDR_LIBVER "0.3.2")
set(SOAPY_SDR_LIBVER "0.4.0")

if (NOT SOAPY_SDR_EXTVER)
include(${PROJECT_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake)
Expand Down
5 changes: 5 additions & 0 deletions Changelog.txt
@@ -1,5 +1,10 @@
This this the changelog file for the SoapySDR project.

Release 0.4.0 (pending)
==========================

- Added API to query available clock rates

Release 0.3.2 (pending)
==========================

Expand Down
8 changes: 8 additions & 0 deletions include/SoapySDR/Device.h
Expand Up @@ -857,6 +857,14 @@ SOAPY_SDR_API char *SoapySDRDevice_setMasterClockRate(SoapySDRDevice *device, co
*/
SOAPY_SDR_API double SoapySDRDevice_getMasterClockRate(const SoapySDRDevice *device);

/*!
* Get the range of available master clock rates.
* \param device a pointer to a device instance
* \param [out] length the number of ranges
* \return a list of clock rate ranges in Hz
*/
SOAPY_SDR_API SoapySDRRange *SoapySDRDevice_getMasterClockRates(const SoapySDRDevice *device, size_t *length);

/*!
* Get the list of available clock sources.
* \param device a pointer to a device instance
Expand Down
6 changes: 6 additions & 0 deletions include/SoapySDR/Device.hpp
Expand Up @@ -772,6 +772,12 @@ class SOAPY_SDR_API Device
*/
virtual double getMasterClockRate(void) const;

/*!
* Get the range of available master clock rates.
* \return a list of clock rate ranges in Hz
*/
virtual RangeList getMasterClockRates(void) const;

/*!
* Get the list of available clock sources.
* \return a list of clock source names
Expand Down
7 changes: 6 additions & 1 deletion include/SoapySDR/Version.h
Expand Up @@ -14,7 +14,7 @@
/*!
* ABI Version Information - incremented when the ABI is changed.
*/
#define SOAPY_SDR_ABI_VERSION "0.3-0"
#define SOAPY_SDR_ABI_VERSION "0.4-0"

/*!
* Compatibility define for GPIO access API with masks
Expand All @@ -36,6 +36,11 @@
*/
#define SOAPY_SDR_API_HAS_CORRECTIONS_QUERY

/*!
* Compatibility define for clock rates query API
*/
#define SOAPY_SDR_API_HAS_CLOCK_RATES_QUERY

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
5 changes: 5 additions & 0 deletions lib/Device.cpp
Expand Up @@ -440,6 +440,11 @@ double SoapySDR::Device::getMasterClockRate(void) const
return 0.0;
}

SoapySDR::RangeList SoapySDR::Device::getMasterClockRates(void) const
{
return SoapySDR::RangeList();
}

std::vector<std::string> SoapySDR::Device::listClockSources(void) const
{
return std::vector<std::string>();
Expand Down
5 changes: 5 additions & 0 deletions lib/DeviceC.cpp
Expand Up @@ -453,6 +453,11 @@ double SoapySDRDevice_getMasterClockRate(const SoapySDRDevice *device)
return device->getMasterClockRate();
}

SoapySDRRange *SoapySDRDevice_getMasterClockRates(const SoapySDRDevice *device, size_t *length)
{
return toRangeList(device->getMasterClockRates(), length);
}

char **SoapySDRDevice_listClockSources(const SoapySDRDevice *device, size_t *length)
{
return toStrArray(device->listClockSources(), length);
Expand Down

0 comments on commit 554f320

Please sign in to comment.