Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZhouShuya
OpenXG-RAN
Commits
fb75c980
Commit
fb75c980
authored
Jun 04, 2016
by
Rohit Gupta
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-42-doxygen' into develop
parents
3b7fde94
6bb5ed5c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
510 deletions
+123
-510
openair1/PHY/impl_defs_top.h
openair1/PHY/impl_defs_top.h
+1
-0
openair1/SCHED/phy_mac_stub.c
openair1/SCHED/phy_mac_stub.c
+0
-2
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
+39
-29
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h
+21
-0
targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
+60
-478
targets/DOCS/Doxyfile
targets/DOCS/Doxyfile
+2
-1
No files found.
openair1/PHY/impl_defs_top.h
View file @
fb75c980
...
@@ -50,6 +50,7 @@
...
@@ -50,6 +50,7 @@
* @defgroup _GENERIC_PHY_RF_INTERFACE_ Generic PHY - RF Interface
* @defgroup _GENERIC_PHY_RF_INTERFACE_ Generic PHY - RF Interface
* @defgroup _USRP_PHY_RF_INTERFACE_ PHY - USRP RF Interface
* @defgroup _USRP_PHY_RF_INTERFACE_ PHY - USRP RF Interface
* @defgroup _BLADERF_PHY_RF_INTERFACE_ PHY - BLADERF RF Interface
* @defgroup _BLADERF_PHY_RF_INTERFACE_ PHY - BLADERF RF Interface
* @defgroup _LMSSDR_PHY_RF_INTERFACE_ PHY - LMSSDR RF Interface
* @}
* @}
*
*
* @ingroup _ref_implementation_
* @ingroup _ref_implementation_
...
...
openair1/SCHED/phy_mac_stub.c
View file @
fb75c980
...
@@ -51,7 +51,6 @@
...
@@ -51,7 +51,6 @@
void
fill_dci
(
DCI_PDU
*
DCI_pdu
,
uint8_t
sched_subframe
,
PHY_VARS_eNB
*
phy_vars_eNB
)
void
fill_dci
(
DCI_PDU
*
DCI_pdu
,
uint8_t
sched_subframe
,
PHY_VARS_eNB
*
phy_vars_eNB
)
{
{
int
i
;
//uint8_t cooperation_flag = phy_vars_eNB->cooperation_flag;
//uint8_t cooperation_flag = phy_vars_eNB->cooperation_flag;
uint8_t
transmission_mode
=
phy_vars_eNB
->
transmission_mode
[
0
];
uint8_t
transmission_mode
=
phy_vars_eNB
->
transmission_mode
[
0
];
...
@@ -583,7 +582,6 @@ void fill_dci(DCI_PDU *DCI_pdu, uint8_t sched_subframe, PHY_VARS_eNB *phy_vars_e
...
@@ -583,7 +582,6 @@ void fill_dci(DCI_PDU *DCI_pdu, uint8_t sched_subframe, PHY_VARS_eNB *phy_vars_e
void
fill_dci_emos
(
DCI_PDU
*
DCI_pdu
,
uint8_t
subframe
,
PHY_VARS_eNB
*
phy_vars_eNB
)
void
fill_dci_emos
(
DCI_PDU
*
DCI_pdu
,
uint8_t
subframe
,
PHY_VARS_eNB
*
phy_vars_eNB
)
{
{
int
i
;
//uint8_t cooperation_flag = phy_vars_eNB->cooperation_flag;
//uint8_t cooperation_flag = phy_vars_eNB->cooperation_flag;
uint8_t
transmission_mode
=
phy_vars_eNB
->
transmission_mode
[
0
];
uint8_t
transmission_mode
=
phy_vars_eNB
->
transmission_mode
[
0
];
...
...
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
View file @
fb75c980
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <inttypes.h>
#include <inttypes.h>
#include "bladerf_lib.h"
#include "bladerf_lib.h"
#include "math.h"
/** @addtogroup _BLADERF_PHY_RF_INTERFACE_
/** @addtogroup _BLADERF_PHY_RF_INTERFACE_
* @{
* @{
...
@@ -58,14 +59,16 @@ int num_devices=0;
...
@@ -58,14 +59,16 @@ int num_devices=0;
/*! \brief BladeRF Init function (not used at the moment)
/*! \brief BladeRF Init function (not used at the moment)
* \param device RF frontend parameters set by application
* \param device RF frontend parameters set by application
* \returns 0 on success
*/
*/
int
trx_brf_init
(
openair0_device
*
device
)
{
int
trx_brf_init
(
openair0_device
*
device
)
{
return
0
;
}
}
/*! \brief get current timestamp
/*! \brief get current timestamp
*\param device the hardware to use
*\param device the hardware to use
*\param module the bladeRf module
*\param module the bladeRf module
*\returns timestamp of BladeRF
*/
*/
openair0_timestamp
trx_get_timestamp
(
openair0_device
*
device
,
bladerf_module
module
)
{
openair0_timestamp
trx_get_timestamp
(
openair0_device
*
device
,
bladerf_module
module
)
{
...
@@ -83,28 +86,22 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module mod
...
@@ -83,28 +86,22 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module mod
}
}
/*! \brief Start BladeRF
/*! \brief Start BladeRF
*\param device the hardware to use
* \param device the hardware to use
* \returns 0 on success
*/
*/
int
trx_brf_start
(
openair0_device
*
device
)
{
int
trx_brf_start
(
openair0_device
*
device
)
{
return
0
;
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
/*! \brief Called to send samples to the BladeRF RF target
@param device pointer to the device structure specific to the RF hardware 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 timestamp The timestamp at whicch the first sample MUST be sent
@param buff Buffer which holds the samples
\param buff Buffer which holds the samples
@param nsamps number of samples to be sent
\param nsamps number of samples to be sent
@param cc index of the component carrier
\param cc index of the component carrier
@param flags Ignored for the moment
\param flags Ignored for the moment
\returns 0 on success
*/
*/
static
int
trx_brf_write
(
openair0_device
*
device
,
openair0_timestamp
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
static
int
trx_brf_write
(
openair0_device
*
device
,
openair0_timestamp
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
...
@@ -156,6 +153,7 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp,
...
@@ -156,6 +153,7 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp,
* \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[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 nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte.
* \param cc Index of component carrier
* \param cc Index of component carrier
* \returns number of samples read
*/
*/
static
int
trx_brf_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
static
int
trx_brf_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
...
@@ -176,9 +174,10 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
...
@@ -176,9 +174,10 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
brf
->
num_rx_errors
++
;
brf
->
num_rx_errors
++
;
}
else
if
(
brf
->
meta_rx
.
status
&
BLADERF_META_STATUS_OVERRUN
)
{
}
else
if
(
brf
->
meta_rx
.
status
&
BLADERF_META_STATUS_OVERRUN
)
{
brf
->
num_overflows
++
;
brf
->
num_overflows
++
;
printf
(
"RX overrun (%d) is detected. t=
%u.
Got %u samples. nsymps %d
\n
"
,
printf
(
"RX overrun (%d) is detected. t=
"
"%"
PRIu64
"
Got %u samples. nsymps %d
\n
"
,
brf
->
num_overflows
,
brf
->
meta_rx
.
timestamp
,
brf
->
meta_rx
.
actual_count
,
nsamps
);
brf
->
num_overflows
,
brf
->
meta_rx
.
timestamp
,
brf
->
meta_rx
.
actual_count
,
nsamps
);
}
}
//printf("Current RX timestampe %u\n", brf->meta_rx.timestamp);
//printf("Current RX timestampe %u\n", brf->meta_rx.timestamp);
//printf("[BRF] (buff %p) ts=0x%"PRIu64" %s\n",samples, brf->meta_rx.timestamp,bladerf_strerror(status));
//printf("[BRF] (buff %p) ts=0x%"PRIu64" %s\n",samples, brf->meta_rx.timestamp,bladerf_strerror(status));
brf
->
rx_current_ts
=
brf
->
meta_rx
.
timestamp
;
brf
->
rx_current_ts
=
brf
->
meta_rx
.
timestamp
;
...
@@ -196,7 +195,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
...
@@ -196,7 +195,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
/*! \brief Terminate operation of the BladeRF transceiver -- free all associated resources
/*! \brief Terminate operation of the BladeRF transceiver -- free all associated resources
* \param device the hardware to use
* \param device the hardware to use
*/
*/
int
trx_brf_end
(
openair0_device
*
device
)
{
void
trx_brf_end
(
openair0_device
*
device
)
{
int
status
;
int
status
;
brf_state_t
*
brf
=
(
brf_state_t
*
)
device
->
priv
;
brf_state_t
*
brf
=
(
brf_state_t
*
)
device
->
priv
;
...
@@ -208,7 +207,6 @@ int trx_brf_end(openair0_device *device) {
...
@@ -208,7 +207,6 @@ int trx_brf_end(openair0_device *device) {
fprintf
(
stderr
,
"Failed to disable TX module: %s
\n
"
,
bladerf_strerror
(
status
));
fprintf
(
stderr
,
"Failed to disable TX module: %s
\n
"
,
bladerf_strerror
(
status
));
}
}
bladerf_close
(
brf
->
dev
);
bladerf_close
(
brf
->
dev
);
return
0
;
}
}
/*! \brief print the BladeRF statistics
/*! \brief print the BladeRF statistics
...
@@ -231,10 +229,11 @@ int trx_brf_reset_stats(openair0_device* device) {
...
@@ -231,10 +229,11 @@ int trx_brf_reset_stats(openair0_device* device) {
}
}
/*! \brief Stop USRP
/*! \brief Stop BladeRF
* \param device the hardware to use
* \param card the hardware to use
* \returns 0 in success
*/
*/
int
trx_brf_stop
(
openair0_device
*
device
)
{
int
trx_brf_stop
(
int
card
)
{
return
(
0
);
return
(
0
);
...
@@ -242,9 +241,11 @@ int trx_brf_stop(openair0_device* device) {
...
@@ -242,9 +241,11 @@ int trx_brf_stop(openair0_device* device) {
/*! \brief Set frequencies (TX/RX)
/*! \brief Set frequencies (TX/RX)
* \param device the hardware to use
* \param device the hardware to use
* \param openair0_cfg1 openair0 Config structure (ignored. It is there to comply with RF common API)
* \param exmimo_dump_config (ignored)
* \returns 0 in success
* \returns 0 in success
*/
*/
int
trx_brf_set_freq
(
openair0_device
*
device
)
{
int
trx_brf_set_freq
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg1
,
int
exmimo_dump_config
)
{
int
status
;
int
status
;
brf_state_t
*
brf
=
(
brf_state_t
*
)
device
->
priv
;
brf_state_t
*
brf
=
(
brf_state_t
*
)
device
->
priv
;
...
@@ -269,9 +270,10 @@ int trx_brf_set_freq(openair0_device* device) {
...
@@ -269,9 +270,10 @@ int trx_brf_set_freq(openair0_device* device) {
/*! \brief Set Gains (TX/RX)
/*! \brief Set Gains (TX/RX)
* \param device the hardware to use
* \param device the hardware to use
* \param openair0_cfg openair0 Config structure
* \returns 0 in success
* \returns 0 in success
*/
*/
int
trx_brf_set_gains
(
openair0_device
*
device
)
{
int
trx_brf_set_gains
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
return
(
0
);
return
(
0
);
...
@@ -283,12 +285,17 @@ int trx_brf_set_gains(openair0_device* device) {
...
@@ -283,12 +285,17 @@ int trx_brf_set_gains(openair0_device* device) {
int16_t
cos_fsover8
[
8
]
=
{
2047
,
1447
,
0
,
-
1448
,
-
2047
,
-
1448
,
0
,
1447
};
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
};
int16_t
cos_3fsover8
[
8
]
=
{
2047
,
-
1448
,
0
,
1447
,
-
2047
,
1447
,
0
,
-
1448
};
/*! \brief calibration table for BladeRF */
rx_gain_calib_table_t
calib_table_fx4
[]
=
{
rx_gain_calib_table_t
calib_table_fx4
[]
=
{
{
2300000000
.
0
,
53
.
5
},
{
2300000000
.
0
,
53
.
5
},
{
1880000000
.
0
,
57
.
0
},
{
1880000000
.
0
,
57
.
0
},
{
816000000
.
0
,
73
.
0
},
{
816000000
.
0
,
73
.
0
},
{
-
1
,
0
}};
{
-
1
,
0
}};
/*! \brief set RX gain offset from calibration table
* \param openair0_cfg RF frontend parameters set by application
* \param chain_index RF chain ID
*/
void
set_rx_gain_offset
(
openair0_config_t
*
openair0_cfg
,
int
chain_index
)
{
void
set_rx_gain_offset
(
openair0_config_t
*
openair0_cfg
,
int
chain_index
)
{
int
i
=
0
;
int
i
=
0
;
...
@@ -310,6 +317,9 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
...
@@ -310,6 +317,9 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
}
}
/*! \brief Calibrate LMSSDR RF
* \param device the hardware to use
*/
void
calibrate_rf
(
openair0_device
*
device
)
{
void
calibrate_rf
(
openair0_device
*
device
)
{
...
@@ -885,11 +895,10 @@ void calibrate_rf(openair0_device *device) {
...
@@ -885,11 +895,10 @@ void calibrate_rf(openair0_device *device) {
/*! \brief Initialize Openair BLADERF target. It returns 0 if OK
/*! \brief Initialize Openair BLADERF target. It returns 0 if OK
* \param device the hardware to use
* \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application
* \param openair0_cfg RF frontend parameters set by application
* \returns 0 on success
*/
*/
int
device_init
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
int
device_init
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
int
status
;
int
status
;
int
card
=
0
;
brf_state_t
*
brf
=
(
brf_state_t
*
)
malloc
(
sizeof
(
brf_state_t
));
brf_state_t
*
brf
=
(
brf_state_t
*
)
malloc
(
sizeof
(
brf_state_t
));
memset
(
brf
,
0
,
sizeof
(
brf_state_t
));
memset
(
brf
,
0
,
sizeof
(
brf_state_t
));
/* device specific */
/* device specific */
...
@@ -1063,8 +1072,6 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
...
@@ -1063,8 +1072,6 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
}
else
}
else
printf
(
"[BRF] RX module calibrated DC
\n
"
);
printf
(
"[BRF] RX module calibrated DC
\n
"
);
bladerf_log_set_verbosity
(
get_brf_log_level
(
openair0_cfg
->
log_level
));
bladerf_log_set_verbosity
(
get_brf_log_level
(
openair0_cfg
->
log_level
));
printf
(
"BLADERF: Initializing openair0_device
\n
"
);
printf
(
"BLADERF: Initializing openair0_device
\n
"
);
...
@@ -1091,16 +1098,18 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
...
@@ -1091,16 +1098,18 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
/*! \brief bladeRF error report
/*! \brief bladeRF error report
* \param status
* \param status
* \returns 0 on success
*/
*/
int
brf_error
(
int
status
)
{
int
brf_error
(
int
status
)
{
//exit(-1);
//exit(-1);
//return 1
; // or status error code
return
status
;
// or status error code
}
}
/*! \brief Open BladeRF from serial port
/*! \brief Open BladeRF from serial port
* \param serial name of serial port on which to open BladeRF device
* \param serial name of serial port on which to open BladeRF device
* \returns bladerf device structure
*/
*/
struct
bladerf
*
open_bladerf_from_serial
(
const
char
*
serial
)
{
struct
bladerf
*
open_bladerf_from_serial
(
const
char
*
serial
)
{
...
@@ -1131,6 +1140,7 @@ struct bladerf * open_bladerf_from_serial(const char *serial) {
...
@@ -1131,6 +1140,7 @@ struct bladerf * open_bladerf_from_serial(const char *serial) {
/*! \brief Get BladeRF log level
/*! \brief Get BladeRF log level
* \param log_level log level
* \param log_level log level
* \returns log level of BLADERF device
*/
*/
int
get_brf_log_level
(
int
log_level
){
int
get_brf_log_level
(
int
log_level
){
...
...
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h
View file @
fb75c980
...
@@ -106,6 +106,27 @@ typedef struct {
...
@@ -106,6 +106,27 @@ typedef struct {
/*
/*
* func prototypes
* func prototypes
*/
*/
/*! \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
);
/*! \brief Get BladeRF log level
* \param log_level log level
* \returns log level of BLADERF device
*/
int
get_brf_log_level
(
int
log_level
);
/*! \brief bladeRF error report
* \param status
* \returns 0 on success
*/
int
brf_error
(
int
status
);
int
brf_error
(
int
status
);
/*@}*/
/*@}*/
targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
View file @
fb75c980
...
@@ -49,6 +49,9 @@
...
@@ -49,6 +49,9 @@
#include <cmath>
#include <cmath>
/** @addtogroup _LMSSDR_PHY_RF_INTERFACE_
* @{
*/
///define for parameter enumeration if prefix might be needed
///define for parameter enumeration if prefix might be needed
#define LMS7param(id) id
#define LMS7param(id) id
...
@@ -69,6 +72,15 @@ extern "C"
...
@@ -69,6 +72,15 @@ extern "C"
int
write_output
(
const
char
*
fname
,
const
char
*
vname
,
void
*
data
,
int
length
,
int
dec
,
char
format
);
int
write_output
(
const
char
*
fname
,
const
char
*
vname
,
void
*
data
,
int
length
,
int
dec
,
char
format
);
}
}
/*! \brief Called to send samples to the LMSSDR 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
\param flags Ignored for the moment
\returns 0 on success
*/
int
trx_lms_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
antenna_id
,
int
flags
)
{
int
trx_lms_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
antenna_id
,
int
flags
)
{
LMS_TRxWrite
((
int16_t
*
)
buff
[
0
],
nsamps
,
0
,
timestamp
);
LMS_TRxWrite
((
int16_t
*
)
buff
[
0
],
nsamps
,
0
,
timestamp
);
...
@@ -76,7 +88,17 @@ int trx_lms_write(openair0_device *device, openair0_timestamp timestamp, void **
...
@@ -76,7 +88,17 @@ int trx_lms_write(openair0_device *device, openair0_timestamp timestamp, void **
return
nsamps
;
return
nsamps
;
}
}
/*! \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 port
* \returns number of samples read
*/
int
trx_lms_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
antenna_id
)
{
int
trx_lms_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
antenna_id
)
{
uint64_t
timestamp
;
uint64_t
timestamp
;
...
@@ -87,6 +109,11 @@ int trx_lms_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
...
@@ -87,6 +109,11 @@ int trx_lms_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
return
ret
;
return
ret
;
}
}
/*! \brief set RX gain offset from calibration table
* \param openair0_cfg RF frontend parameters set by application
* \param chain_index RF chain ID
*/
void
set_rx_gain_offset
(
openair0_config_t
*
openair0_cfg
,
int
chain_index
)
{
void
set_rx_gain_offset
(
openair0_config_t
*
openair0_cfg
,
int
chain_index
)
{
int
i
=
0
;
int
i
=
0
;
...
@@ -107,469 +134,12 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
...
@@ -107,469 +134,12 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
}
}
}
}
/*
void calibrate_rf(openair0_device *device) {
openair0_timestamp ptimestamp;
int16_t *calib_buffp,*calib_tx_buffp;
int16_t calib_buff[2*RXDCLENGTH];
int16_t calib_tx_buff[2*RXDCLENGTH];
int i,j;
int8_t offI,offQ,offIold,offQold,offInew,offQnew,offphase,offphaseold,offphasenew,offgain,offgainold,offgainnew;
int32_t meanI,meanQ,meanIold,meanQold;
int cnt=0,loop;
liblms7_status opStatus;
int16_t dcoffi;
int16_t dcoffq;
int16_t dccorri;
int16_t dccorrq;
const int16_t firCoefs[] =
{
-2531,
-517,
2708,
188,
-3059,
216,
3569,
-770,
-4199,
1541,
4886,
-2577,
-5552,
3909,
6108,
-5537,
-6457,
7440,
6507,
-9566,
-6174,
11845,
5391,
-14179,
-4110,
16457,
2310,
-18561,
0,
20369,
-2780,
-21752,
5963,
22610,
-9456,
-22859,
13127,
22444,
-16854,
-21319,
20489,
19492,
-23883,
-17002,
26881,
13902,
-29372,
-10313,
31226,
6345,
-32380,
-2141,
32767,
-2141,
-32380,
6345,
31226,
-10313,
-29372,
13902,
26881,
-17002,
-23883,
19492,
20489,
-21319,
-16854,
22444,
13127,
-22859,
-9456,
22610,
5963,
-21752,
-2780,
20369,
0,
-18561,
2310,
16457,
-4110,
-14179,
5391,
11845,
-6174,
-9566,
6507,
7440,
-6457,
-5537,
6108,
3909,
-5552,
-2577,
4886,
1541,
-4199,
-770,
3569,
216,
-3059,
188,
2708,
-517,
-2531
};
j=0;
for (i=0;i<RXDCLENGTH;i++) {
calib_tx_buff[j++] = cos_fsover8[i&7];
calib_tx_buff[j++] = cos_fsover8[(i+6)&7]; // sin
}
calib_buffp = &calib_buff[0];
calib_tx_buffp = &calib_tx_buff[0];
lms7->BackupAllRegisters();
uint8_t ch = (uint8_t)lms7->Get_SPI_Reg_bits(LMS7param(MAC));
//Stage 1
uint8_t sel_band1_trf = (uint8_t)lms7->Get_SPI_Reg_bits(LMS7param(SEL_BAND1_TRF));
uint8_t sel_band2_trf = (uint8_t)lms7->Get_SPI_Reg_bits(LMS7param(SEL_BAND2_TRF));
{
uint16_t requiredRegs[] = { 0x0400, 0x040A, 0x010D, 0x040C };
uint16_t requiredMask[] = { 0x6000, 0x3007, 0x0040, 0x00FF }; //CAPSEL, AGC_MODE, AGC_AVG, EN_DCOFF, Bypasses
uint16_t requiredValue[] = { 0x0000, 0x1007, 0x0040, 0x00BD };
lms7->Modify_SPI_Reg_mask(requiredRegs, requiredMask, requiredValue, 0, 3);
}
// opStatus = lms7->SetFrequencySX(LMS7002M::Rx, device->openair0_cfg[0].tx_freq[0]/1e6,30.72);
// put TX on fs/4
opStatus = lms7->CalibrateRxSetup(device->openair0_cfg[0].sample_rate/1e6);
if (opStatus != LIBLMS7_SUCCESS) {
printf("Cannot calibrate for %f MHz\n",device->openair0_cfg[0].sample_rate/1e6);
exit(-1);
}
// fill TX buffer with fs/8 complex sinusoid
offIold=offQold=64;
lms7->SetRxDCOFF(offIold,offQold);
LMS_RxStart();
for (i=0;i<NUMBUFF;i++)
trx_lms_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
for (meanIold=meanQold=i=j=0;i<RXDCLENGTH;i++) {
meanIold+=calib_buff[j++];
meanQold+=calib_buff[j++];
}
meanIold/=RXDCLENGTH;
meanQold/=RXDCLENGTH;
printf("[LMS] RX DC: (%d,%d) => (%d,%d)\n",offIold,offQold,meanIold,meanQold);
offI=offQ=-64;
lms7->SetRxDCOFF(offI,offQ);
for (i=0;i<NUMBUFF;i++)
trx_lms_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
meanI+=calib_buff[j++];
meanQ+=calib_buff[j++];
}
meanI/=RXDCLENGTH;
meanQ/=RXDCLENGTH;
printf("[LMS] RX DC: (%d,%d) => (%d,%d)\n",offI,offQ,meanI,meanQ);
while (cnt++ < 7) {
offInew=(offIold+offI)>>1;
offQnew=(offQold+offQ)>>1;
if (meanI*meanI < meanIold*meanIold) {
meanIold = meanI;
offIold = offI;
printf("[LMS] *** RX DC: offI %d => %d\n",offIold,meanI);
}
if (meanQ*meanQ < meanQold*meanQold) {
meanQold = meanQ;
offQold = offQ;
printf("[LMS] *** RX DC: offQ %d => %d\n",offQold,meanQ);
}
offI = offInew;
offQ = offQnew;
lms7->SetRxDCOFF(offI,offQ);
for (i=0;i<NUMBUFF;i++)
trx_lms_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
meanI+=calib_buff[j++];
meanQ+=calib_buff[j++];
}
meanI/=RXDCLENGTH;
meanQ/=RXDCLENGTH;
printf("[LMS] RX DC: (%d,%d) => (%d,%d)\n",offI,offQ,meanI,meanQ);
}
if (meanI*meanI < meanIold*meanIold) {
/*! \brief Set Gains (TX/RX) on LMSSDR
meanIold = meanI;
* \param device the hardware to use
offIold = offI;
* \param openair0_cfg openair0 Config structure
printf("[LMS] *** RX DC: offI %d => %d\n",offIold,meanI);
* \returns 0 in success
}
*/
if (meanQ*meanQ < meanQold*meanQold) {
meanQold = meanQ;
offQold = offQ;
printf("[LMS] *** RX DC: offQ %d => %d\n",offQold,meanQ);
}
printf("[LMS] RX DC: (%d,%d) => (%d,%d)\n",offIold,offQold,meanIold,meanQold);
lms7->SetRxDCOFF(offIold,offQold);
dcoffi = offIold;
dcoffq = offQold;
lms7->Modify_SPI_Reg_bits(LMS7param(MAC), ch);
lms7->Modify_SPI_Reg_bits(LMS7param(AGC_MODE_RXTSP), 1);
lms7->Modify_SPI_Reg_bits(LMS7param(CAPSEL), 0);
// TX LO leakage
offQold=offIold=127;
lms7->SPI_write(0x0204,(((int16_t)offIold)<<7)|offQold);
{
uint16_t requiredRegs[] = { 0x0400, 0x040A, 0x010D, 0x040C };
uint16_t requiredMask[] = { 0x6000, 0x3007, 0x0040, 0x00FF }; //CAPSEL, AGC_MODE, AGC_AVG, EN_DCOFF, Bypasses
uint16_t requiredValue[] = { 0x0000, 0x1007, 0x0040, 0x00BD };
lms7->Modify_SPI_Reg_mask(requiredRegs, requiredMask, requiredValue, 0, 3);
}
sel_band1_trf = (uint8_t)lms7->Get_SPI_Reg_bits(LMS7param(SEL_BAND1_TRF));
sel_band2_trf = (uint8_t)lms7->Get_SPI_Reg_bits(LMS7param(SEL_BAND2_TRF));
//B
lms7->Modify_SPI_Reg_bits(0x0100, 0, 0, 1); //EN_G_TRF 1
if (sel_band1_trf == 1)
{
lms7->Modify_SPI_Reg_bits(LMS7param(PD_RLOOPB_1_RFE), 0); //PD_RLOOPB_1_RFE 0
lms7->Modify_SPI_Reg_bits(LMS7param(EN_INSHSW_LB1_RFE), 0); //EN_INSHSW_LB1 0
}
if (sel_band2_trf == 1)
{
lms7->Modify_SPI_Reg_bits(LMS7param(PD_RLOOPB_2_RFE), 0); //PD_RLOOPB_2_RFE 0
lms7->Modify_SPI_Reg_bits(LMS7param(EN_INSHSW_LB2_RFE), 0); // EN_INSHSW_LB2 0
}
// FixRXSaturation();
lms7->Modify_SPI_Reg_bits(LMS7param(GFIR3_BYP_RXTSP), 0); //GFIR3_BYP 0
lms7->Modify_SPI_Reg_bits(LMS7param(HBD_OVR_RXTSP), 2);
lms7->Modify_SPI_Reg_bits(LMS7param(GFIR3_L_RXTSP), 7);
lms7->Modify_SPI_Reg_bits(LMS7param(GFIR3_N_RXTSP), 7);
lms7->SetGFIRCoefficients(LMS7002M::Rx, 2, firCoefs, sizeof(firCoefs) / sizeof(int16_t));
for (i=0;i<NUMBUFF;i++) {
trx_lms_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
trx_lms_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
}
write_output("calibrx.m","rxs",calib_buffp,RXDCLENGTH,1,1);
exit(-1);
for (meanIold=meanQold=i=j=0;i<RXDCLENGTH;i++) {
switch (i&3) {
case 0:
meanIold+=calib_buff[j++];
break;
case 1:
meanQold+=calib_buff[j++];
break;
case 2:
meanIold-=calib_buff[j++];
break;
case 3:
meanQold-=calib_buff[j++];
break;
}
}
// meanIold/=RXDCLENGTH;
// meanQold/=RXDCLENGTH;
printf("[LMS] TX DC (offI): %d => (%d,%d)\n",offIold,meanIold,meanQold);
offI=-128;
lms7->SPI_write(0x0204,(((int16_t)offI)<<7)|offQold);
for (i=0;i<NUMBUFF;i++) {
trx_lms_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
trx_lms_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
}
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
switch (i&3) {
case 0:
meanI+=calib_buff[j++];
break;
case 1:
meanQ+=calib_buff[j++];
break;
case 2:
meanI-=calib_buff[j++];
break;
case 3:
meanQ-=calib_buff[j++];
break;
}
}
// meanI/=RXDCLENGTH;
// meanQ/=RXDCLENGTH;
printf("[LMS] TX DC (offI): %d => (%d,%d)\n",offI,meanI,meanQ);
cnt = 0;
while (cnt++ < 8) {
offInew=(offIold+offI)>>1;
if (meanI*meanI+meanQ*meanQ < meanIold*meanIold +meanQold*meanQold) {
printf("[LMS] TX DC (offI): ([%d,%d]) => %d : %d\n",offIold,offI,offInew,meanI*meanI+meanQ*meanQ);
meanIold = meanI;
meanQold = meanQ;
offIold = offI;
}
offI = offInew;
lms7->SPI_write(0x0204,(((int16_t)offI)<<7)|offQold);
for (i=0;i<NUMBUFF;i++) {
trx_lms_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
trx_lms_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
}
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
switch (i&3) {
case 0:
meanI+=calib_buff[j++];
break;
case 1:
meanQ+=calib_buff[j++];
break;
case 2:
meanI-=calib_buff[j++];
break;
case 3:
meanQ-=calib_buff[j++];
break;
}
}
// meanI/=RXDCLENGTH;
// meanQ/=RXDCLENGTH;
// printf("[LMS] TX DC (offI): %d => (%d,%d)\n",offI,meanI,meanQ);
}
if (meanI*meanI+meanQ*meanQ < meanIold*meanIold +meanQold*meanQold) {
printf("[LMS] TX DC (offI): ([%d,%d]) => %d : %d\n",offIold,offI,offInew,meanI*meanI+meanQ*meanQ);
meanIold = meanI;
meanQold = meanQ;
offIold = offI;
}
offQ=-128;
lms7->SPI_write(0x0204,(((int16_t)offIold)<<7)|offQ);
for (i=0;i<NUMBUFF;i++) {
trx_lms_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
trx_lms_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
}
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
switch (i&3) {
case 0:
meanI+=calib_buff[j++];
break;
case 1:
meanQ+=calib_buff[j++];
break;
case 2:
meanI-=calib_buff[j++];
break;
case 3:
meanQ-=calib_buff[j++];
break;
}
}
// meanI/=RXDCLENGTH;
// meanQ/=RXDCLENGTH;
printf("[LMS] TX DC (offQ): %d => (%d,%d)\n",offQ,meanI,meanQ);
cnt=0;
while (cnt++ < 8) {
offQnew=(offQold+offQ)>>1;
if (meanI*meanI+meanQ*meanQ < meanIold*meanIold +meanQold*meanQold) {
printf("[LMS] TX DC (offQ): ([%d,%d]) => %d : %d\n",offQold,offQ,offQnew,meanI*meanI+meanQ*meanQ);
meanIold = meanI;
meanQold = meanQ;
offQold = offQ;
}
offQ = offQnew;
lms7->SPI_write(0x0204,(((int16_t)offIold)<<7)|offQ);
for (i=0;i<NUMBUFF;i++) {
trx_lms_read(device, &ptimestamp, (void **)&calib_buffp, RXDCLENGTH, 0);
trx_lms_write(device,ptimestamp+5*RXDCLENGTH, (void **)&calib_tx_buffp, RXDCLENGTH, 0, 0);
}
for (meanI=meanQ=i=j=0;i<RXDCLENGTH;i++) {
switch (i&3) {
case 0:
meanI+=calib_buff[j++];
break;
case 1:
meanQ+=calib_buff[j++];
break;
case 2:
meanI-=calib_buff[j++];
break;
case 3:
meanQ-=calib_buff[j++];
break;
}
}
// meanI/=RXDCLENGTH;
// meanQ/=RXDCLENGTH;
// printf("[LMS] TX DC (offQ): %d => (%d,%d)\n",offQ,meanI,meanQ);
}
LMS_RxStop();
printf("[LMS] TX DC: (%d,%d) => (%d,%d)\n",offIold,offQold,meanIold,meanQold);
dccorri = offIold;
dccorrq = offQold;
lms7->RestoreAllRegisters();
lms7->Modify_SPI_Reg_bits(LMS7param(MAC), ch);
lms7->Modify_SPI_Reg_bits(LMS7param(DCOFFI_RFE), dcoffi);
lms7->Modify_SPI_Reg_bits(LMS7param(DCOFFQ_RFE), dcoffq);
lms7->Modify_SPI_Reg_bits(LMS7param(DCCORRI_TXTSP), dccorri);
lms7->Modify_SPI_Reg_bits(LMS7param(DCCORRQ_TXTSP), dccorrq);
// lms7->Modify_SPI_Reg_bits(LMS7param(GCORRI_TXTSP), gcorri);
// lms7->Modify_SPI_Reg_bits(LMS7param(GCORRQ_TXTSP), gcorrq);
// lms7->Modify_SPI_Reg_bits(LMS7param(IQCORR_TXTSP), iqcorr);
// lms7->Modify_SPI_Reg_bits(LMS7param(DC_BYP_TXTSP), 0); //DC_BYP
lms7->Modify_SPI_Reg_bits(0x0208, 1, 0, 0); //GC_BYP PH_BYP
}
*/
int
trx_lms_set_gains
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
int
trx_lms_set_gains
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
...
@@ -589,6 +159,10 @@ int trx_lms_set_gains(openair0_device* device, openair0_config_t *openair0_cfg)
...
@@ -589,6 +159,10 @@ int trx_lms_set_gains(openair0_device* device, openair0_config_t *openair0_cfg)
return
(
0
);
return
(
0
);
}
}
/*! \brief Start LMSSDR
* \param device the hardware to use
* \returns 0 on success
*/
int
trx_lms_start
(
openair0_device
*
device
){
int
trx_lms_start
(
openair0_device
*
device
){
...
@@ -746,7 +320,10 @@ int trx_lms_start(openair0_device *device){
...
@@ -746,7 +320,10 @@ int trx_lms_start(openair0_device *device){
return
0
;
return
0
;
}
}
/*! \brief Stop LMSSDR
* \param card Index of the RF card to use
* \returns 0 on success
*/
int
trx_lms_stop
(
int
card
)
{
int
trx_lms_stop
(
int
card
)
{
/*
/*
LMS_DeviceClose(usbport);
LMS_DeviceClose(usbport);
...
@@ -756,6 +333,12 @@ int trx_lms_stop(int card) {
...
@@ -756,6 +333,12 @@ int trx_lms_stop(int card) {
*/
*/
}
}
/*! \brief Set frequencies (TX/RX)
* \param device the hardware to use
* \param openair0_cfg openair0 Config structure (ignored. It is there to comply with RF common API)
* \param exmimo_dump_config (ignored)
* \returns 0 in success
*/
int
trx_lms_set_freq
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
)
{
int
trx_lms_set_freq
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
)
{
//Control port must be connected
//Control port must be connected
...
@@ -768,6 +351,7 @@ int trx_lms_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,in
...
@@ -768,6 +351,7 @@ int trx_lms_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,in
}
}
// 31 = 19 dB => 105 dB total gain @ 2.6 GHz
// 31 = 19 dB => 105 dB total gain @ 2.6 GHz
/*! \brief calibration table for LMSSDR */
rx_gain_calib_table_t
calib_table_sodera
[]
=
{
rx_gain_calib_table_t
calib_table_sodera
[]
=
{
{
3500000000.0
,
70.0
},
{
3500000000.0
,
70.0
},
{
2660000000.0
,
80.0
},
{
2660000000.0
,
80.0
},
...
@@ -780,33 +364,30 @@ rx_gain_calib_table_t calib_table_sodera[] = {
...
@@ -780,33 +364,30 @@ rx_gain_calib_table_t calib_table_sodera[] = {
/*! \brief Get LMSSDR Statistics
* \param device the hardware to use
* \returns 0 in success
*/
int
trx_lms_get_stats
(
openair0_device
*
device
)
{
int
trx_lms_get_stats
(
openair0_device
*
device
)
{
return
(
0
);
return
(
0
);
}
}
/*! \brief Reset LMSSDR Statistics
* \param device the hardware to use
* \returns 0 in success
*/
int
trx_lms_reset_stats
(
openair0_device
*
device
)
{
int
trx_lms_reset_stats
(
openair0_device
*
device
)
{
return
(
0
);
return
(
0
);
}
}
int
openair0_set_gains
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
return
(
0
);
}
int
openair0_set_frequencies
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
dummy
)
{
return
(
0
);
}
/*! \brief Terminate operation of the LMSSDR transceiver -- free all associated resources
* \param device the hardware to use
*/
void
trx_lms_end
(
openair0_device
*
device
)
{
void
trx_lms_end
(
openair0_device
*
device
)
{
...
@@ -877,3 +458,4 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg){
...
@@ -877,3 +458,4 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg){
return
0
;
return
0
;
}
}
}
}
/*@}*/
targets/DOCS/Doxyfile
View file @
fb75c980
...
@@ -796,7 +796,8 @@ INPUT = $(OPENAIR1_DIR)/PHY/defs.h \
...
@@ -796,7 +796,8 @@ INPUT = $(OPENAIR1_DIR)/PHY/defs.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/BLADERF/USERSPACE/LIB/bladerf_lib.c \
$(OPENAIR_TARGETS)/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c \
$(OPENAIR_TARGETS)/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h
$(OPENAIR_TARGETS)/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h \
$(OPENAIR_TARGETS)/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
# This tag can be used to specify the character encoding of the source files
# 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
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment