diff options
author | Josh Blum <josh@joshknows.com> | 2010-01-21 15:30:34 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-01-21 15:30:34 -0800 |
commit | e3483c7451d20b7ed1d8d4865e15751f18cdef78 (patch) | |
tree | f309a95a1b0ecd3dc3295ebc71ee5ad697c9f7a8 /include/usrp_uhd/props.hpp | |
parent | 5b42b774d9ac1e74fb2916bf58085fe19ecb6720 (diff) | |
download | uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.tar.gz uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.tar.bz2 uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.zip |
Added a usrp device abstration that creates usrp mboards.
Added a usrp mboard named test, its empty for now.
Diffstat (limited to 'include/usrp_uhd/props.hpp')
-rw-r--r-- | include/usrp_uhd/props.hpp | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/include/usrp_uhd/props.hpp b/include/usrp_uhd/props.hpp new file mode 100644 index 000000000..c66f40674 --- /dev/null +++ b/include/usrp_uhd/props.hpp @@ -0,0 +1,154 @@ +// +// Copyright 2010 Ettus Research LLC +// + +#include <boost/tuple/tuple.hpp> +#include <usrp_uhd/wax.hpp> +#include <complex> +#include <vector> + +#ifndef INCLUDED_USRP_UHD_PROPS_HPP +#define INCLUDED_USRP_UHD_PROPS_HPP + +namespace usrp_uhd{ + + /*! + * A time_spec_t holds a seconds and ticks time value. + * The temporal width of a tick depends on the device's clock rate. + * The time_spec_t can be used when setting the time on devices + * and for controlling the start of streaming for applicable dsps. + */ + struct time_spec_t{ + uint32_t secs; + uint32_t ticks; + + /*! + * Create a time_spec_t that holds a wildcard time. + * This will have implementation-specific meaning. + */ + time_spec_t(void){ + secs = ~0; + ticks = ~0; + } + + /*! + * Create a time_spec_t from seconds and ticks. + * \param new_secs the new seconds + * \param new_ticks the new ticks (default = 0) + */ + time_spec_t(uint32_t new_secs, uint32_t new_ticks = 0){ + secs = new_secs; + ticks = new_ticks; + } + }; + + //common typedefs for board properties + typedef float gain_t; + typedef double freq_t; + + //scalar types + typedef int int_scalar_t; + typedef float real_scalar_t; + typedef std::complex<real_scalar_t> complex_scalar_t; + + //vector types + typedef std::vector<int_scalar_t> int_vec_t; + typedef std::vector<real_scalar_t> real_vec_t; + typedef std::vector<complex_scalar_t> complex_vec_t; + + //typedef for addressing indexable components + typedef boost::tuple<wax::type, size_t> indexed_prop_t; + + /*! + * Possible device properties. + */ + enum device_prop_t{ + DEVICE_PROP_NAME, //ro, std::string + DEVICE_PROP_MBOARD, //ro, wax::obj + DEVICE_PROP_NUM_MBOARDS //ro, size_t + }; + + /*! + * Possible device mboard properties + */ + enum mboard_prop_t{ + MBOARD_PROP_NAME, //ro, std::string + MBOARD_PROP_MTU, //ro, size_t + MBOARD_PROP_CLOCK_RATE, //ro, freq_t + MBOARD_PROP_RX_DSP, //ro, wax::obj + MBOARD_PROP_NUM_RX_DSPS, //ro, size_t + MBOARD_PROP_TX_DSP, //ro, wax::obj + MBOARD_PROP_NUM_TX_DSPS, //ro, size_t + MBOARD_PROP_RX_DBOARD, //ro, wax::obj + MBOARD_PROP_NUM_RX_DBOARDS, //ro, size_t + MBOARD_PROP_TX_DBOARD, //ro, wax::obj + MBOARD_PROP_NUM_TX_DBOARDS, //ro, size_t + MBOARD_PROP_PPS_SOURCE, //rw, std::string (sma, mimo) + MBOARD_PROP_PPS_POLARITY, //rw, int, +/- 1 + MBOARD_PROP_REF_SOURCE, //rw, std::string (int, sma, mimo) + MBOARD_PROP_TIME_NOW, //wo, time_spec_t + MBOARD_PROP_TIME_NEXT_PPS //wo, time_spec_t + }; + + /*! + * Possible device dsp properties + */ + enum dsp_prop_t{ + DSP_PROP_NAME, //ro, std::string + DSP_PROP_FREQ, //rw, freq_t + DSP_PROP_TAPS, //rw, *_vec_t + DSP_PROP_RATE, //rw, *_scalar_t, decim/interp + DSP_PROP_SCALAR, //rw, *_scalar_t + DSP_PROP_ENABLED //rw, bool or time_spec_t + }; + + /*! + * Possible device dboard properties + */ + enum dboard_prop_t{ + DBOARD_PROP_NAME, //ro, std::string + DBOARD_PROP_SUBDEV, //ro, wax::obj + DBOARD_PROP_NUM_SUBDEVS, //ro, size_t + DBOARD_PROP_CODEC //ro, wax::obj + }; + + /*! + * Possible device codec properties + */ + enum codec_prop_t{ + CODEC_PROP_NAME, //ro, std::string + CODEC_PROP_GAIN, //rw, gain_t + CODEC_PROP_GAIN_MAX, //ro, gain_t + CODEC_PROP_GAIN_MIN, //ro, gain_t + CODEC_PROP_GAIN_STEP, //ro, gain_t + CODEC_PROP_NUM_GAINS, //ro, size_t + CODEC_PROP_CLOCK_RATE //ro, freq_t + }; + + /*! + * Possible device subdev properties + */ + enum subdev_prop_t{ + SUBDEV_PROP_NAME, //ro, std::string + SUBDEV_PROP_GAIN, //rw, gain_t + SUBDEV_PROP_GAIN_MAX, //ro, gain_t + SUBDEV_PROP_GAIN_MIN, //ro, gain_t + SUBDEV_PROP_GAIN_STEP, //ro, gain_t + SUBDEV_PROP_NUM_GAINS, //ro, size_t + SUBDEV_PROP_FREQ, //rw, freq_t + SUBDEV_PROP_FREQ_MAX, //ro, freq_t + SUBDEV_PROP_FREQ_MIN, //ro, freq_t + SUBDEV_PROP_ANTENNA, //rw, std::string + SUBDEV_PROP_ENABLED, //rw, bool + SUBDEV_PROP_QUADRATURE, //ro, bool + SUBDEV_PROP_IQ_SWAPPED, //ro, bool + SUBDEV_PROP_SPECTRUM_INVERTED, //ro, bool + SUBDEV_PROP_IS_TX, //ro, bool + SUBDEV_PROP_RSSI, //ro, gain_t + SUBDEV_PROP_BANDWIDTH, //rw, freq_t + SUBDEV_PROP_CLOCK_RATE //ro, freq_t + }; + +} //namespace usrp_uhd + +#endif /* INCLUDED_USRP_UHD_PROPS_HPP */ |