Merge branch 'develop' into RU-RAU-split
Conflicts: openair1/PHY/INIT/lte_init.c openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c openair1/PHY/LTE_TRANSPORT/dci.c openair1/PHY/LTE_TRANSPORT/dci_tools.c openair1/PHY/LTE_TRANSPORT/dlsch_coding.c openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c openair1/PHY/LTE_TRANSPORT/if4_tools.c openair1/PHY/LTE_TRANSPORT/if5_tools.c openair1/PHY/LTE_TRANSPORT/if5_tools.h openair1/PHY/LTE_TRANSPORT/pcfich.c openair1/PHY/LTE_TRANSPORT/phich.c openair1/PHY/LTE_TRANSPORT/prach.c openair1/PHY/LTE_TRANSPORT/rar_tools.c openair1/PHY/LTE_TRANSPORT/srs_modulation.c openair1/PHY/defs.h openair1/PHY/impl_defs_lte.h openair1/PHY/impl_defs_top.h openair1/SCHED/phy_procedures_lte_eNb.c openair1/SCHED/phy_procedures_lte_ue.c openair2/COMMON/mac_rrc_primitives.h openair2/ENB_APP/enb_config.c openair2/ENB_APP/enb_config.h openair2/LAYER2/MAC/config.c openair2/LAYER2/MAC/eNB_scheduler.c openair2/LAYER2/MAC/eNB_scheduler_dlsch.c openair2/LAYER2/MAC/eNB_scheduler_mch.c openair2/LAYER2/MAC/eNB_scheduler_primitives.c openair2/LAYER2/MAC/main.c openair2/LAYER2/MAC/proto.h openair2/RRC/LITE/MESSAGES/asn1_msg.c openair2/RRC/LITE/MESSAGES/asn1_msg.h openair2/RRC/LITE/rrc_UE.c openair2/RRC/LITE/rrc_common.c openair2/RRC/LITE/rrc_eNB.c targets/ARCH/COMMON/common_lib.c targets/ARCH/COMMON/common_lib.h targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.25PRB.lo.conf targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.if4p5.25PRB.oaisim.conf targets/RT/USER/lte-enb.c targets/RT/USER/lte-softmodem.c targets/RT/USER/lte-ue.c targets/RT/USER/rt_wrapper.h targets/SIMU/USER/channel_sim.c targets/SIMU/USER/init_lte.c targets/SIMU/USER/oaisim.c targets/SIMU/USER/oaisim_functions.c
This commit is contained in:
@@ -45,6 +45,14 @@ lms_device_t* lms_device;
|
||||
lms_stream_t rx_stream;
|
||||
lms_stream_t tx_stream;
|
||||
|
||||
/* We have a strange behavior when we just start reading
|
||||
* from the device (inconsistent values of the timestamp).
|
||||
* A quick solution is to discard the very first read packet
|
||||
* after a "start".
|
||||
* The following global variable "first_rx" serves that purpose.
|
||||
*/
|
||||
static int first_rx = 0;
|
||||
|
||||
#define RXDCLENGTH 4096
|
||||
#define NUMBUFF 32
|
||||
|
||||
@@ -94,6 +102,10 @@ int trx_lms_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
|
||||
meta.flushPartialPacket = false;
|
||||
|
||||
int ret;
|
||||
if (first_rx == 1) {
|
||||
first_rx = 0;
|
||||
ret = LMS_RecvStream(&rx_stream,buff[0],nsamps,&meta,50);
|
||||
}
|
||||
ret = LMS_RecvStream(&rx_stream,buff[0],nsamps,&meta,50);
|
||||
*ptimestamp = meta.timestamp;
|
||||
return ret;
|
||||
@@ -128,30 +140,20 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
|
||||
/*! \brief Set Gains (TX/RX) on LMSSDR
|
||||
* \param device the hardware to use
|
||||
* \param openair0_cfg openair0 Config structure
|
||||
* \returns 0 in success
|
||||
* \returns 0 in success, -1 on error
|
||||
*/
|
||||
int trx_lms_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) {
|
||||
int ret = 0;
|
||||
|
||||
LMS_SetNormalizedGain(lms_device, LMS_CH_TX, 0, openair0_cfg[0].tx_gain[0]/100.0);
|
||||
if (openair0_cfg->rx_gain[0] > 70+openair0_cfg->rx_gain_offset[0]) {
|
||||
printf("[LMS] Reduce RX Gain 0 by %f dB\n",openair0_cfg->rx_gain[0]-openair0_cfg->rx_gain_offset[0]-70);
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
LMS_SetGaindB(lms_device, LMS_CH_TX, 0, openair0_cfg->tx_gain[0]);
|
||||
LMS_SetGaindB(lms_device, LMS_CH_RX, 0, openair0_cfg->rx_gain[0]-openair0_cfg->rx_gain_offset[0]);
|
||||
|
||||
// RX gains, use low-level setting
|
||||
|
||||
double gv = openair0_cfg[0].rx_gain[0] - openair0_cfg[0].rx_gain_offset[0];
|
||||
if (gv > 31) {
|
||||
printf("RX Gain 0 too high, reduce by %f dB\n",gv-31);
|
||||
gv = 31;
|
||||
}
|
||||
if (gv < 0) {
|
||||
printf("RX Gain 0 too low, increase by %f dB\n",-gv);
|
||||
gv = 0;
|
||||
}
|
||||
printf("[LMS] Setting 7002M G_PGA_RBB to %d\n", (int16_t)gv);
|
||||
LMS7002M lms7;
|
||||
lms7.SetConnection(lms7.GetConnection());
|
||||
lms7.Modify_SPI_Reg_bits(LMS7param(G_PGA_RBB),(int16_t)gv);
|
||||
|
||||
|
||||
return(0);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*! \brief Start LMSSDR
|
||||
@@ -212,10 +214,11 @@ int trx_lms_start(openair0_device *device){
|
||||
}
|
||||
printf("Set TX frequency %f MHz\n",device->openair0_cfg[0].tx_freq[0]/1e6);
|
||||
|
||||
/*
|
||||
printf("Override antenna settings to: RX1_H, TXA_2");
|
||||
LMS_SetAntenna(lms_device, LMS_CH_RX, 0, 1);
|
||||
LMS_SetAntenna(lms_device, LMS_CH_TX, 0, 2);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
for (int i = 0; i< device->openair0_cfg->rx_num_channels; i++)
|
||||
@@ -232,6 +235,8 @@ int trx_lms_start(openair0_device *device){
|
||||
}
|
||||
|
||||
|
||||
first_rx = 1;
|
||||
|
||||
rx_stream.channel = 0;
|
||||
rx_stream.fifoSize = 256*1024;
|
||||
rx_stream.throughputVsLatency = 0.1;
|
||||
@@ -292,12 +297,21 @@ int trx_lms_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,in
|
||||
|
||||
// 31 = 19 dB => 105 dB total gain @ 2.6 GHz
|
||||
/*! \brief calibration table for LMSSDR */
|
||||
// V1.2 board
|
||||
rx_gain_calib_table_t calib_table_lmssdr_1v2[] = {
|
||||
{3500000000.0,44.0}, // on L PAD
|
||||
{2660000000.0,55.0}, // on L PAD
|
||||
{2300000000.0,54.0}, // on L PAD
|
||||
{1880000000.0,54.0}, // on L PAD
|
||||
{816000000.0,79.0}, // on W PAD
|
||||
{-1,0}};
|
||||
// V1.4 board
|
||||
rx_gain_calib_table_t calib_table_lmssdr[] = {
|
||||
{3500000000.0,70.0},
|
||||
{2660000000.0,80.0},
|
||||
{2300000000.0,80.0},
|
||||
{1880000000.0,74.0}, // on W PAD
|
||||
{816000000.0,76.0}, // on W PAD
|
||||
{3500000000.0,44.0}, // on H PAD
|
||||
{2660000000.0,55.0}, // on H PAD
|
||||
{2300000000.0,54.0}, // on H PAD
|
||||
{1880000000.0,54.0}, // on H PAD
|
||||
{816000000.0,79.0}, // on L PAD
|
||||
{-1,0}};
|
||||
|
||||
|
||||
@@ -343,6 +357,7 @@ extern "C" {
|
||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg){
|
||||
|
||||
device->type=LMSSDR_DEV;
|
||||
|
||||
printf("LMSSDR: Initializing openair0_device for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||
|
||||
switch ((int)openair0_cfg[0].sample_rate) {
|
||||
@@ -355,9 +370,9 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg){
|
||||
break;
|
||||
case 15360000:
|
||||
openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 70;
|
||||
openair0_cfg[0].tx_bw = 10e6;
|
||||
openair0_cfg[0].rx_bw = 10e6;
|
||||
openair0_cfg[0].tx_sample_advance = 50; /* TODO: to be refined */
|
||||
openair0_cfg[0].tx_bw = 15.36e6;
|
||||
openair0_cfg[0].rx_bw = 15.36e6;
|
||||
break;
|
||||
case 7680000:
|
||||
openair0_cfg[0].samples_per_packet = 1024;
|
||||
|
||||
Reference in New Issue
Block a user