Commit f65b478c authored by Rohit Gupta's avatar Rohit Gupta

Merge branch 'feature-42-doxygen' into develop

parents b9c9ff3b 42e245c9
......@@ -56,7 +56,7 @@ VERBOSE_COMPILE=0
CFLAGS_PROCESSOR_USER=""
RUN_GROUP=0
TEST_CASE_GROUP=""
BUILD_DOXYGEN=0
trap handle_ctrl_c INT
function print_help() {
......@@ -119,6 +119,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.
--disable-deadline
Disables deadline scheduler of Linux kernel (>=3.14.x).
--enable-deadline
......@@ -246,6 +248,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;;
--disable-deadline)
FORCE_LOWLATENCY_FLAG_USER="False"
echo_info "Disabling the usage of deadline scheduler"
......@@ -254,7 +260,6 @@ function main() {
FORCE_LOWLATENCY_FLAG_USER="True"
echo_info "Enabling the usage of deadline scheduler"
shift 1;;
-h | --help)
print_help
exit 1;;
......@@ -706,7 +711,22 @@ function main() {
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
......
......@@ -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
......
......@@ -38,6 +38,11 @@
#include <inttypes.h>
#include "bladerf_lib.h"
/** @addtogroup _BLADERF_PHY_RF_INTERFACE_
* @{
*/
//! Number of BladeRF devices
#ifdef __SSE4_1__
# include <smmintrin.h>
#endif
......@@ -47,13 +52,21 @@
#endif
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
*\param module the bladeRf module
*/
openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module module) {
int status;
......@@ -69,17 +82,29 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module mod
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;
......@@ -121,6 +146,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=0;
......@@ -157,6 +192,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;
......@@ -172,25 +210,39 @@ 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) {
int status;
......@@ -213,12 +265,19 @@ 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);
}
#define RXDCLENGTH 16384
int16_t cos_fsover8[8] = {2047, 1447, 0, -1448, -2047, -1448, 0, 1447};
int16_t cos_3fsover8[8] = {2047, -1448, 0, 1447, -2047, 1447, 0, -1448};
......@@ -822,6 +881,10 @@ void calibrate_rf(openair0_device *device) {
// write_output("blade_rf_test.m","rxs",calib_buff,RXDCLENGTH,1,1);
}
/*! \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 device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
int status;
int card=0;
......@@ -1025,6 +1088,9 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
return 0;
}
/*! \brief bladeRF error report
* \param status
*/
int brf_error(int status) {
//exit(-1);
......@@ -1032,7 +1098,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;
......@@ -1059,6 +1127,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;
......@@ -1087,3 +1159,4 @@ int get_brf_log_level(int log_level){
}
return level;
}
/*@}*/
......@@ -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);
/*@}*/
......@@ -55,7 +55,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;
......@@ -74,6 +74,10 @@ typedef enum {
} duplex_mode_t;
/** @addtogroup _GENERIC_PHY_RF_INTERFACE_
* @{
*/
/*!\brief RF device types
*/
typedef enum {
......@@ -117,10 +121,7 @@ typedef enum {
}host_type_t;
/** @addtogroup _PHY_RF_INTERFACE_
* @{
*/
/*! \brief RF Gain clibration */
typedef struct {
//! Frequency for which RX chain was calibrated
double freq;
......@@ -128,10 +129,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;
......@@ -196,10 +198,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;
......@@ -218,6 +221,7 @@ typedef struct {
} eth_params_t;
/*!\brief structure holds the parameters to configure USRP devices */
struct openair0_device_t {
/*!brief Module ID of this device */
int Mod_id;
......@@ -256,7 +260,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
......@@ -274,9 +278,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);
......@@ -293,22 +297,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);
......@@ -325,15 +336,23 @@ extern "C"
{
#endif
/*! \brief Initialize openair RF target. It returns 0 if OK */
/*! \brief Initialize openair RF target. It returns 0 if OK */
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg);
/*! \brief Initialize transport protocol . It returns 0 if OK */
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params);
//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);
/*@}*/
......
......@@ -29,7 +29,7 @@
/** usrp_lib.cpp
*
* Author: HongliangXU : hong-liang-xu@agilent.com
* \author: HongliangXU : hong-liang-xu@agilent.com
*/
#include <string.h>
......@@ -55,47 +55,71 @@
# include <immintrin.h>
#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;
......@@ -118,7 +142,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;
......@@ -132,6 +158,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;
......@@ -153,6 +187,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;
......@@ -238,6 +283,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)
{
......@@ -246,11 +294,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<double>::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;
......@@ -262,6 +320,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;
......@@ -279,6 +342,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) {
......@@ -299,11 +367,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,44.0},
{2660000000.0,49.0},
......@@ -312,6 +383,7 @@ rx_gain_calib_table_t calib_table_b210[] = {
{816000000.0,58.0},
{-1,0}};
/*! \brief USRPB210 RX calibration table */
rx_gain_calib_table_t calib_table_b210_38[] = {
{3500000000.0,44.0},
{2660000000.0,49.8},
......@@ -320,6 +392,7 @@ rx_gain_calib_table_t calib_table_b210_38[] = {
{816000000.0,57.0},
{-1,0}};
/*! \brief USRPx310 RX calibration table */
rx_gain_calib_table_t calib_table_x310[] = {
{3500000000.0,77.0},
{2660000000.0,81.0},
......@@ -328,6 +401,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 bw_gain_adjust) {
int i=0;
......@@ -373,12 +451,20 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
}
/*! \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);
......@@ -386,7 +472,12 @@ int trx_usrp_reset_stats(openair0_device* device) {
}
extern "C" {
/*! \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 device_init(openair0_device* device, openair0_config_t *openair0_cfg) {
uhd::set_thread_priority_safe(1.0);
......@@ -395,6 +486,7 @@ extern "C" {