Commit b212daa4 authored by Rohit Gupta's avatar Rohit Gupta

doxygen support for BladeRF - PHY Interface

parent 8e1b5d26
......@@ -38,15 +38,26 @@
#include <inttypes.h>
#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;
}
/*@}*/
......@@ -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);
/*@}*/
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment