From 020f08b37db6616df9cbf06af82c497c59ce9b06 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Wed, 30 Dec 2015 21:45:34 +0100 Subject: [PATCH 1/4] fixed to support doxygen --- targets/ARCH/COMMON/common_lib.h | 82 +++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 22 deletions(-) diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 156da0c4ce..5526118828 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -46,7 +46,7 @@ typedef int64_t openair0_timestamp; typedef volatile int64_t openair0_vtimestamp; -/* structrue holds the parameters to configure USRP devices*/ +/*!\brief structrue holds the parameters to configure USRP devices*/ typedef struct openair0_device_t openair0_device; @@ -68,7 +68,8 @@ typedef enum { /** @addtogroup _PHY_RF_INTERFACE_ * @{ */ - + +/*! \brief RF Gain clibration */ typedef struct { //! Frequency for which RX chain was calibrated double freq; @@ -76,10 +77,11 @@ typedef struct { double offset; } rx_gain_calib_table_t; +/*! \brief RF frontend parameters set by application */ typedef struct { //! Module ID for this configuration int Mod_id; - // device log level + //! device log level int log_level; //! duplexing mode duplex_mode_t duplex_mode; @@ -136,10 +138,11 @@ typedef struct { } openair0_config_t; +/*! \brief RF mapping */ typedef struct { - /* card id */ + //! card id int card; - /* rf chain id */ + //! rf chain id int chain; } openair0_rf_map; @@ -182,20 +185,21 @@ typedef enum { }func_type_t; +/*!\brief structrue holds the parameters to configure USRP devices */ struct openair0_device_t { - /* Module ID of this device */ + //! Module ID of this device int Mod_id; - /* Type of this device */ + //! Type of this device dev_type_t type; - /* Type of the device's host (BBU/RRH) */ + //! Type of the device's host (BBU/RRH) func_type_t func_type; - /* RF frontend parameters set by application */ + //! RF frontend parameters set by application openair0_config_t openair0_cfg; - /* Can be used by driver to hold internal structure*/ + //! Can be used by driver to hold internal structure void *priv; /* Functions API, which are called by the application*/ @@ -217,7 +221,7 @@ struct openair0_device_t { @param msg pointer to the message structure passed between BBU-RRH @param msg_len length of the message */ - int (*trx_reply_func)(openair0_device *openair0, void *msg, ssize_t msg_len); + int (*trx_reply_func)(openair0_device *device, void *msg, ssize_t msg_len); /*! \brief Called to send samples to the RF target @param device pointer to the device structure specific to the RF hardware target @@ -235,9 +239,9 @@ struct openair0_device_t { * was received. * \param device the hardware to use * \param[out] ptimestamp the time at which the first sample was received. - * \param[out] An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. + * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. - * \param cc Number of channels. If cc == 1, only buff[0] is filled with samples. + * \param antenna_id Index of antenna for which to receive samples * \returns the number of sample read */ int (*trx_read_func)(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps,int antenna_id); @@ -254,22 +258,29 @@ struct openair0_device_t { */ int (*trx_reset_stats_func)(openair0_device *device); - /*! \brief Terminate operation of the transceiver -- free all associated resources */ + /*! \brief Terminate operation of the transceiver -- free all associated resources + * \param device the hardware to use + */ void (*trx_end_func)(openair0_device *device); - /* Terminate operation */ + /*! \brief Stop operation of the transceiver + * \param card RF Card to use + */ int (*trx_stop_func)(int card); /* Functions API related to UE*/ /*! \brief Set RX feaquencies - * \param + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \param exmimo_dump_config dump EXMIMO configuration * \returns 0 in success */ int (*trx_set_freq_func)(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config); /*! \brief Set gains - * \param + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ int (*trx_set_gains_func)(openair0_device* device, openair0_config_t *openair0_cfg); @@ -282,20 +293,47 @@ extern "C" { #endif -/*! \brief Initialize Openair RF target. It returns 0 if OK */ + /*! \brief Initialize Openair RF target. It returns 0 if OK + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + */ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg); //USRP -/*! \brief Get the current timestamp of USRP */ + /*! \brief Get the current timestamp of USRP + * \param device the hardware to use + */ openair0_timestamp get_usrp_time(openair0_device *device); -/*! \brief Set the RX frequency of USRP RF TARGET */ + + /*! \brief Set the RX frequency of USRP RF TARGET + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + */ int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg); -//extern -/*! \brief Initialize Openair ETHERNET target. It returns 0 if OK */ + //extern functions + /*! \brief Initialize Openair ETHERNET target. It returns 0 if OK + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + */ int openair0_dev_init_eth(openair0_device *device, openair0_config_t *openair0_cfg); + + /*! \brief Initialize Openair BLADERF target. It returns 0 if OK + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + */ int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openair0_cfg); + + /*! \brief Initialize Openair USRP target. It returns 0 if OK + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + */ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_cfg); + + /*! \brief Initialize Openair EXMIMO target. It returns 0 if OK + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + */ int openair0_dev_init_exmimo(openair0_device *device, openair0_config_t *openair0_cfg); /*@}*/ From 51942ab13c440dd5d458e9889f7b40784fc9a0a7 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 31 Dec 2015 07:25:45 +0100 Subject: [PATCH 2/4] added doxygen support to main script --- cmake_targets/build_oai | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 25bec96b98..fb3bd7823b 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -53,7 +53,7 @@ VERBOSE_COMPILE=0 CFLAGS_PROCESSOR_USER="" RUN_GROUP=0 TEST_CASE_GROUP="" - +BUILD_DOXYGEN=0 trap handle_ctrl_c INT function print_help() { @@ -113,6 +113,8 @@ Options Shows detailed compilation instructions in makefile --cflags_processor Manually Add CFLAGS of processor if they are not detected correctly by script. Only add these flags if you know your processor supports them. Example flags: -msse3 -msse4.1 -msse4.2 -mavx2 +--build-doxygen + Builds doxygen based documentation. Usage (first build): oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files @@ -225,6 +227,10 @@ function main() { CFLAGS_PROCESSOR_USER=$2 echo_info "setting CPU FLAGS from USER to: $CFLAGS_PROCESSOR_USER" shift 2;; + --build-doxygen) + BUILD_DOXYGEN=1 + echo_info "Will build doxygen support" + shift;; -h | --help) print_help exit 1;; @@ -550,7 +556,22 @@ function main() { rrh_gw $dbin/rrh_gw fi - + # Doxygen Support + ##################### + if [ "$BUILD_DOXYGEN" = "1" ] ;then + doxygen_log=$OPENAIR_DIR/cmake_targets/log/doxygen.log + echo_info "Building doxygen based documentation. The documentation file is located here: $OPENAIR_DIR/targets/DOCS/html/index.html" + echo_info "Doxygen Generation log is located here: $doxygen_log" + echo_info "Generating doxygen files....please wait" + ( + [ "$CLEAN" = "1" ] && rm -rf $OPENAIR_DIR/cmake_targets/doxygen/build + mkdir -p $OPENAIR_DIR/cmake_targets/doxygen/build + cd $OPENAIR_DIR/cmake_targets/doxygen/build + cmake .. + make doc + ) >& $doxygen_log + fi + # Auto-tests ##################### if [ "$OAI_TEST" = "1" ]; then From 8e1b5d26d466918be68053134175c94bf2e6c3c5 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 31 Dec 2015 09:06:10 +0100 Subject: [PATCH 3/4] doxygen support for USRP PHY Interface --- openair1/PHY/impl_defs_top.h | 9 +- targets/ARCH/COMMON/common_lib.h | 8 +- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 107 +++++++++++++++++-- targets/DOCS/Doxyfile | 5 +- 4 files changed, 114 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h index c84b7d3ece..5fe559b80d 100755 --- a/openair1/PHY/impl_defs_top.h +++ b/openair1/PHY/impl_defs_top.h @@ -44,7 +44,14 @@ /** @defgroup _ref_implementation_ OpenAirInterface LTE Implementation * @{ - * @defgroup _PHY_RF_INTERFACE_ Generic PHY - RF Interface + * @defgroup _PHY_RF_INTERFACE_ PHY - RF Interface + * @ingroup _PHY_RF_INTERFACE_ + * @{ + * @defgroup _GENERIC_PHY_RF_INTERFACE_ Generic PHY - RF Interface + * @defgroup _USRP_PHY_RF_INTERFACE_ PHY - USRP RF Interface + * @defgroup _BLADERF_PHY_RF_INTERFACE_ PHY - BLADERF RF Interface + * @} + * * @ingroup _ref_implementation_ * @{ * This module is responsible for defining the generic interface between PHY and RF Target diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 5526118828..6f88641803 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -65,7 +65,7 @@ typedef enum { } duplex_mode_t; -/** @addtogroup _PHY_RF_INTERFACE_ +/** @addtogroup _GENERIC_PHY_RF_INTERFACE_ * @{ */ @@ -299,15 +299,15 @@ extern "C" */ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg); - //USRP - /*! \brief Get the current timestamp of USRP + /*! \brief Get current timestamp of USRP * \param device the hardware to use */ openair0_timestamp get_usrp_time(openair0_device *device); - /*! \brief Set the RX frequency of USRP RF TARGET + /*! \brief Set RX frequencies * \param device the hardware to use * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success */ int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg); diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index b12f7397f0..e9671b0770 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -29,7 +29,7 @@ /** usrp_lib.cpp * - * Author: HongliangXU : hong-liang-xu@agilent.com + * \author: HongliangXU : hong-liang-xu@agilent.com */ #include @@ -54,47 +54,71 @@ # include #endif +/** @addtogroup _USRP_PHY_RF_INTERFACE_ + * @{ + */ + +/*! \brief USRP Configuration */ typedef struct { // -------------------------------- // variables for USRP configuration // -------------------------------- + //! USRP device pointer uhd::usrp::multi_usrp::sptr usrp; //uhd::usrp::multi_usrp::sptr rx_usrp; //create a send streamer and a receive streamer + //! USRP TX Stream uhd::tx_streamer::sptr tx_stream; + //! USRP RX Stream uhd::rx_streamer::sptr rx_stream; + //! USRP TX Metadata uhd::tx_metadata_t tx_md; + //! USRP RX Metadata uhd::rx_metadata_t rx_md; + //! USRP Timestamp Information uhd::time_spec_t tm_spec; + //setup variables and allocate buffer + //! USRP Metadata uhd::async_metadata_t async_md; + //! Sampling rate double sample_rate; - // time offset between transmiter timestamp and receiver timestamp; + + //! time offset between transmiter timestamp and receiver timestamp; double tdiff; - // use usrp_time_offset to get this value + + //! TX forward samples. We use usrp_time_offset to get this value int tx_forward_nsamps; //166 for 20Mhz // -------------------------------- // Debug and output control // -------------------------------- + //! Number of underflows int num_underflows; + //! Number of overflows int num_overflows; + + //! Number of sequential errors int num_seq_errors; - + //! tx count int64_t tx_count; + //! rx count int64_t rx_count; + //! timestamp of RX packet openair0_timestamp rx_timestamp; } usrp_state_t; - +/*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error + @param device pointer to the device structure specific to the RF hardware target +*/ static int trx_usrp_start(openair0_device *device) { usrp_state_t *s = (usrp_state_t*)device->priv; @@ -117,7 +141,9 @@ static int trx_usrp_start(openair0_device *device) return 0; } - +/*! \brief Terminate operation of the USRP transceiver -- free all associated resources + * \param device the hardware to use + */ static void trx_usrp_end(openair0_device *device) { usrp_state_t *s = (usrp_state_t*)device->priv; @@ -131,6 +157,14 @@ static void trx_usrp_end(openair0_device *device) } +/*! \brief Called to send samples to the USRP RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples + @param nsamps number of samples to be sent + @param antenna_id index of the antenna if the device has multiple anteannas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied +*/ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { usrp_state_t *s = (usrp_state_t*)device->priv; @@ -152,6 +186,17 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, return 0; } +/*! \brief Receive samples from hardware. + * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for + * the first channel. *ptimestamp is the time at which the first sample + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param antenna_id Index of antenna for which to receive samples + * \returns the number of sample read +*/ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { usrp_state_t *s = (usrp_state_t*)device->priv; @@ -237,6 +282,9 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp return samples_received; } +/*! \brief Get current timestamp of USRP + * \param device the hardware to use +*/ openair0_timestamp get_usrp_time(openair0_device *device) { @@ -245,11 +293,21 @@ openair0_timestamp get_usrp_time(openair0_device *device) return s->usrp->get_time_now().to_ticks(s->sample_rate); } +/*! \brief Compares two variables within precision + * \param a first variable + * \param b second variable +*/ static bool is_equal(double a, double b) { return std::fabs(a-b) < std::numeric_limits::epsilon(); } +/*! \brief Set frequencies (TX/RX) + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \param dummy dummy variable not used + * \returns 0 in success + */ int trx_usrp_set_freq(openair0_device* device, openair0_config_t *openair0_cfg, int dummy) { usrp_state_t *s = (usrp_state_t*)device->priv; @@ -261,6 +319,11 @@ int trx_usrp_set_freq(openair0_device* device, openair0_config_t *openair0_cfg, } +/*! \brief Set RX frequencies + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success + */ int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg) { usrp_state_t *s = (usrp_state_t*)device->priv; @@ -278,6 +341,11 @@ int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *open } +/*! \brief Set Gains (TX/RX) + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success + */ int trx_usrp_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) { @@ -298,11 +366,14 @@ int trx_usrp_set_gains(openair0_device* device, return(0); } +/*! \brief Stop USRP + * \param card refers to the hardware index to use + */ int trx_usrp_stop(int card) { return(0); } - +/*! \brief USRPB210 RX calibration table */ rx_gain_calib_table_t calib_table_b210[] = { {3500000000.0,46.0}, {2660000000.0,53.0}, @@ -311,6 +382,7 @@ rx_gain_calib_table_t calib_table_b210[] = { {816000000.0,62.0}, {-1,0}}; +/*! \brief USRPx310 RX calibration table */ rx_gain_calib_table_t calib_table_x310[] = { {3500000000.0,77.0}, {2660000000.0,80.0}, @@ -319,6 +391,11 @@ rx_gain_calib_table_t calib_table_x310[] = { {816000000.0,85.0}, {-1,0}}; +/*! \brief Set RX gain offset + * \param openair0_cfg RF frontend parameters set by application + * \param chain_index RF chain to apply settings to + * \returns 0 in success + */ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) { int i=0; @@ -340,19 +417,30 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) { } - +/*! \brief print the USRP statistics +* \param device the hardware to use +* \returns 0 on success +*/ int trx_usrp_get_stats(openair0_device* device) { return(0); } + +/*! \brief Reset the USRP statistics +* \param device the hardware to use +* \returns 0 on success +*/ int trx_usrp_reset_stats(openair0_device* device) { return(0); } - +/*! \brief Initialize Openair USRP target. It returns 0 if OK +* \param device the hardware to use +* \param openair0_cfg RF frontend parameters set by application +*/ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_cfg) { uhd::set_thread_priority_safe(1.0); @@ -584,3 +672,4 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_ s->tx_forward_nsamps = 50; return 0; } +/*@}*/ diff --git a/targets/DOCS/Doxyfile b/targets/DOCS/Doxyfile index 0d32a3ffad..7ebc15f674 100644 --- a/targets/DOCS/Doxyfile +++ b/targets/DOCS/Doxyfile @@ -793,7 +793,10 @@ INPUT = $(OPENAIR1_DIR)/PHY/defs.h \ $(OPENAIR2_DIR)/LAYER2/RLC/UM_v9.3.0/rlc_um.h \ $(OPENAIR2_DIR)/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h \ $(OPENAIR2_DIR)/NETWORK_DRIVER/MESH/proto_extern.h \ - $(OPENAIR_TARGETS)/ARCH/COMMON/common_lib.h + $(OPENAIR_TARGETS)/ARCH/COMMON/common_lib.h \ + $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp \ + $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp \ + $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses From b212daa4d3470c7c67d00c6219b0382b8bc13d13 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 31 Dec 2015 09:48:26 +0100 Subject: [PATCH 4/4] doxygen support for BladeRF - PHY Interface --- .../ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c | 81 +++++++++++++++++-- .../ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h | 39 +++++++-- targets/DOCS/Doxyfile | 4 +- 3 files changed, 109 insertions(+), 15 deletions(-) diff --git a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c index d515a206ae..b9bcf8ed2a 100644 --- a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c +++ b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c @@ -38,15 +38,26 @@ #include #include "bladerf_lib.h" +/** @addtogroup _BLADERF_PHY_RF_INTERFACE_ + * @{ + */ + +//! Number of BladeRF devices int num_devices=0; + /*These items configure the underlying asynch stream used by the the sync interface. */ -int trx_brf_init(openair0_device *openair0) { +/*! \brief BladeRF Init function (not used at the moment) + * \param device RF frontend parameters set by application + */ +int trx_brf_init(openair0_device *device) { } - +/*! \brief get current timestamp + *\param device the hardware to use + */ openair0_timestamp trx_get_timestamp(openair0_device *device) { int status; struct bladerf_metadata meta; @@ -60,17 +71,29 @@ openair0_timestamp trx_get_timestamp(openair0_device *device) { return meta.timestamp; } - -int trx_brf_start(openair0_device *openair0) { +/*! \brief Start BladeRF + *\param device the hardware to use + */ +int trx_brf_start(openair0_device *device) { return 0; } +/*! \brief Get BladeRF stats + *\param device the hardware to use + */ static void trx_brf_stats(openair0_device *device){ } +/*! \brief Called to send samples to the BladeRF RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples + @param nsamps number of samples to be sent + @param cc index of the component carrier +*/ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp, void **buff, int nsamps, int cc) { int status, i; @@ -106,6 +129,16 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp, return(0); } +/*! \brief Receive samples from hardware. + * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for + * the first channel. *ptimestamp is the time at which the first sample + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param cc Index of component carrier +*/ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { int status, ret; @@ -140,6 +173,9 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp, } +/*! \brief Terminate operation of the BladeRF transceiver -- free all associated resources + * \param device the hardware to use + */ int trx_brf_end(openair0_device *device) { int status; @@ -155,36 +191,59 @@ int trx_brf_end(openair0_device *device) { return 0; } - +/*! \brief print the BladeRF statistics +* \param device the hardware to use +* \returns 0 on success +*/ int trx_brf_get_stats(openair0_device* device) { return(0); } +/*! \brief Reset the BladeRF statistics +* \param device the hardware to use +* \returns 0 on success +*/ int trx_brf_reset_stats(openair0_device* device) { return(0); } +/*! \brief Stop USRP + * \param device the hardware to use + */ int trx_brf_stop(openair0_device* device) { return(0); } +/*! \brief Set frequencies (TX/RX) + * \param device the hardware to use + * \returns 0 in success + */ int trx_brf_set_freq(openair0_device* device) { return(0); } + +/*! \brief Set Gains (TX/RX) + * \param device the hardware to use + * \returns 0 in success + */ int trx_brf_set_gains(openair0_device* device) { return(0); } +/*! \brief Initialize Openair BLADERF target. It returns 0 if OK + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + */ int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openair0_cfg) { int status; @@ -322,6 +381,9 @@ int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openai return 0; } +/*! \brief bladeRF error report + * \param status + */ int brf_error(int status) { //exit(-1); @@ -329,7 +391,9 @@ int brf_error(int status) { } - +/*! \brief Open BladeRF from serial port + * \param serial name of serial port on which to open BladeRF device + */ struct bladerf * open_bladerf_from_serial(const char *serial) { int status; @@ -356,6 +420,10 @@ struct bladerf * open_bladerf_from_serial(const char *serial) { return dev; } } + +/*! \brief Get BladeRF log level + * \param log_level log level + */ int get_brf_log_level(int log_level){ int level=BLADERF_LOG_LEVEL_INFO; @@ -384,3 +452,4 @@ int get_brf_log_level(int log_level){ } return level; } +/*@}*/ diff --git a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h index 15e1d39da7..3a05c80e5c 100644 --- a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h +++ b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h @@ -37,45 +37,69 @@ #include "common_lib.h" #include "log.h" +/** @addtogroup _BLADERF_PHY_RF_INTERFACE_ + * @{ + */ + +/*! \brief BladeRF specific data structure */ typedef struct { - // opaque BRF data struct + //! opaque BladeRF device struct. An empty ("") or NULL device identifier will result in the first encountered device being opened (using the first discovered backend) struct bladerf *dev; - // An empty ("") or NULL device identifier will result in the first encountered device being opened (using the first discovered backend) - + + //! Number of buffers unsigned int num_buffers; + //! Buffer size unsigned int buffer_size; + //! Number of transfers unsigned int num_transfers; + //! RX timeout unsigned int rx_timeout_ms; + //! TX timeout unsigned int tx_timeout_ms; - + //! Metadata for RX struct bladerf_metadata meta_rx; + //!Metadata for TX struct bladerf_metadata meta_tx; - + //! Sample rate unsigned int sample_rate; - // time offset between transmiter timestamp and receiver timestamp; + //! time offset between transmiter timestamp and receiver timestamp; double tdiff; - // use brf_time_offset to get this value + //! TX number of forward samples use brf_time_offset to get this value int tx_forward_nsamps; //166 for 20Mhz // -------------------------------- // Debug and output control // -------------------------------- + //! Number of underflows int num_underflows; + //! Number of overflows int num_overflows; + //! number of sequential errors int num_seq_errors; + //! number of RX errors int num_rx_errors; + //! Number of TX errors int num_tx_errors; + //! timestamp of current TX uint64_t tx_current_ts; + //! timestamp of current RX uint64_t rx_current_ts; + //! number of actual samples transmitted uint64_t tx_actual_nsamps; + //! number of actual samples received uint64_t rx_actual_nsamps; + //! number of TX samples uint64_t tx_nsamps; + //! number of RX samples uint64_t rx_nsamps; + //! number of TX count uint64_t tx_count; + //! number of RX count uint64_t rx_count; + //! timestamp of RX packet openair0_timestamp rx_timestamp; } brf_state_t; @@ -84,3 +108,4 @@ typedef struct { */ int brf_error(int status); +/*@}*/ diff --git a/targets/DOCS/Doxyfile b/targets/DOCS/Doxyfile index 7ebc15f674..ac6ee99480 100644 --- a/targets/DOCS/Doxyfile +++ b/targets/DOCS/Doxyfile @@ -795,8 +795,8 @@ INPUT = $(OPENAIR1_DIR)/PHY/defs.h \ $(OPENAIR2_DIR)/NETWORK_DRIVER/MESH/proto_extern.h \ $(OPENAIR_TARGETS)/ARCH/COMMON/common_lib.h \ $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp \ - $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp \ - $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp + $(OPENAIR_TARGETS)/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c \ + $(OPENAIR_TARGETS)/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses