Revert "Merge remote-tracking branch 'origin/calib-LimeSDR' into develop_integration_w06"
This reverts commitce14050bb4, reversing changes made to0ada1e9e32.
This commit is contained in:
@@ -137,13 +137,10 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
|
|||||||
printf("[PHY] symbol %d/%d offset %d (%p,%p -> %p)\n",i,nb_symbols,i*fftsize+(i*nb_prefix_samples),input,&input[i*fftsize],&output[(i*fftsize) + ((i)*nb_prefix_samples)]);
|
printf("[PHY] symbol %d/%d offset %d (%p,%p -> %p)\n",i,nb_symbols,i*fftsize+(i*nb_prefix_samples),input,&input[i*fftsize],&output[(i*fftsize) + ((i)*nb_prefix_samples)]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
#ifndef __AVX2__
|
#ifndef __AVX2__
|
||||||
// handle 128-bit alignment for 128-bit SIMD (SSE4,NEON,AltiVEC)
|
// handle 128-bit alignment for 128-bit SIMD (SSE4,NEON,AltiVEC)
|
||||||
idft((int16_t *)&input[i*fftsize],
|
idft((int16_t *)&input[i*fftsize],
|
||||||
/* TODO: we always use temp, TBC */
|
(fftsize==128) ? (int16_t *)temp : (int16_t *)&output[(i*fftsize) + ((1+i)*nb_prefix_samples)],
|
||||||
//(fftsize==128) ? (int16_t *)temp : (int16_t *)&output[(i*fftsize) + ((1+i)*nb_prefix_samples)],
|
|
||||||
(int16_t *)temp,
|
|
||||||
1);
|
1);
|
||||||
#else
|
#else
|
||||||
// on AVX2 need 256-bit alignment
|
// on AVX2 need 256-bit alignment
|
||||||
@@ -152,11 +149,7 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
|
|||||||
1);
|
1);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* #if 0 */
|
|
||||||
|
|
||||||
idft((int16_t *)&input[i*fftsize],
|
|
||||||
(int16_t *)temp,
|
|
||||||
1);
|
|
||||||
// Copy to frame buffer with Cyclic Extension
|
// Copy to frame buffer with Cyclic Extension
|
||||||
// Note: will have to adjust for synchronization offset!
|
// Note: will have to adjust for synchronization offset!
|
||||||
|
|
||||||
@@ -167,14 +160,10 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
|
|||||||
|
|
||||||
|
|
||||||
// msg("Doing cyclic prefix method\n");
|
// msg("Doing cyclic prefix method\n");
|
||||||
#if 0
|
|
||||||
/* TODO: we always use temp, TBC */
|
|
||||||
#ifndef __AVX2__
|
#ifndef __AVX2__
|
||||||
if (fftsize==128)
|
if (fftsize==128)
|
||||||
#else
|
|
||||||
if (fftsize<=512)
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* #if 0 */
|
|
||||||
{
|
{
|
||||||
for (j=0; j<fftsize ; j++) {
|
for (j=0; j<fftsize ; j++) {
|
||||||
output_ptr[j] = temp_ptr[j];
|
output_ptr[j] = temp_ptr[j];
|
||||||
|
|||||||
@@ -362,9 +362,6 @@ struct openair0_device_t {
|
|||||||
*/
|
*/
|
||||||
int (*trx_set_gains_func)(openair0_device* device, openair0_config_t *openair0_cfg);
|
int (*trx_set_gains_func)(openair0_device* device, openair0_config_t *openair0_cfg);
|
||||||
|
|
||||||
/*! \brief Indicator that device is running
|
|
||||||
*/
|
|
||||||
int trx_started;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* type of device init function, implemented in shared lib */
|
/* type of device init function, implemented in shared lib */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -132,37 +132,26 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|
||||||
int ret=0;
|
|
||||||
|
|
||||||
double rxg_ratio = openair0_cfg[0].rx_gain[0]/openair0_cfg[0].rx_gain_offset[0];
|
|
||||||
if (rxg_ratio > 1) {
|
|
||||||
printf("[LMS] Reduce RX Gain 0 by %f dB\n",openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
|
|
||||||
ret = -1;
|
|
||||||
rxg_ratio = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
LMS_SetNormalizedGain(lms_device, LMS_CH_TX, 0, openair0_cfg[0].tx_gain[0]/100.0);
|
LMS_SetNormalizedGain(lms_device, LMS_CH_TX, 0, openair0_cfg[0].tx_gain[0]/100.0);
|
||||||
LMS_SetNormalizedGain(lms_device, LMS_CH_RX, 0, .8*rxg_ratio);
|
|
||||||
/*
|
|
||||||
// RX gains, use low-level setting
|
// RX gains, use low-level setting
|
||||||
|
|
||||||
double gv = openair0_cfg[0].rx_gain[0] - openair0_cfg[0].rx_gain_offset[0];
|
double gv = openair0_cfg[0].rx_gain[0] - openair0_cfg[0].rx_gain_offset[0];
|
||||||
if (gv > 31) {
|
if (gv > 31) {
|
||||||
printf("RX Gain 0 too high, reduce by %f dB\n",gv-31);
|
printf("RX Gain 0 too high, reduce by %f dB\n",gv-31);
|
||||||
gv = 31;
|
gv = 31;
|
||||||
ret=-1;
|
|
||||||
}
|
}
|
||||||
if (gv < 0) {
|
if (gv < 0) {
|
||||||
printf("RX Gain 0 too low, increase by %f dB\n",-gv);
|
printf("RX Gain 0 too low, increase by %f dB\n",-gv);
|
||||||
gv = 0;
|
gv = 0;
|
||||||
ret=-1;
|
|
||||||
}
|
}
|
||||||
printf("[LMS] Setting 7002M G_PGA_RBB to %d\n", (int16_t)gv);
|
printf("[LMS] Setting 7002M G_PGA_RBB to %d\n", (int16_t)gv);
|
||||||
LMS7002M lms7;
|
LMS7002M lms7;
|
||||||
lms7.SetConnection(lms7.GetConnection());
|
lms7.SetConnection(lms7.GetConnection());
|
||||||
lms7.Modify_SPI_Reg_bits(LMS7param(G_PGA_RBB),(int16_t)gv);
|
lms7.Modify_SPI_Reg_bits(LMS7param(G_PGA_RBB),(int16_t)gv);
|
||||||
*/
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Start LMSSDR
|
/*! \brief Start LMSSDR
|
||||||
@@ -174,7 +163,6 @@ int trx_lms_start(openair0_device *device){
|
|||||||
lms_info_str_t list[16]={0};
|
lms_info_str_t list[16]={0};
|
||||||
|
|
||||||
int n= LMS_GetDeviceList(list);
|
int n= LMS_GetDeviceList(list);
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
fprintf(stderr, "No LimeSDR board found: %s\n", n < 0?LMS_GetLastErrorMessage():"");
|
fprintf(stderr, "No LimeSDR board found: %s\n", n < 0?LMS_GetLastErrorMessage():"");
|
||||||
@@ -224,9 +212,9 @@ int trx_lms_start(openair0_device *device){
|
|||||||
}
|
}
|
||||||
printf("Set TX frequency %f MHz\n",device->openair0_cfg[0].tx_freq[0]/1e6);
|
printf("Set TX frequency %f MHz\n",device->openair0_cfg[0].tx_freq[0]/1e6);
|
||||||
|
|
||||||
// printf("Override antenna settings to: RX1_H, TXA_2");
|
printf("Override antenna settings to: RX1_H, TXA_2");
|
||||||
// LMS_SetAntenna(lms_device, LMS_CH_RX, 0, 1);
|
LMS_SetAntenna(lms_device, LMS_CH_RX, 0, 1);
|
||||||
// LMS_SetAntenna(lms_device, LMS_CH_TX, 0, 2);
|
LMS_SetAntenna(lms_device, LMS_CH_TX, 0, 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -257,7 +245,7 @@ int trx_lms_start(openair0_device *device){
|
|||||||
tx_stream.dataFmt = lms_stream_t::LMS_FMT_I12;
|
tx_stream.dataFmt = lms_stream_t::LMS_FMT_I12;
|
||||||
tx_stream.isTx = true;
|
tx_stream.isTx = true;
|
||||||
|
|
||||||
if ((ret = trx_lms_set_gains(device, device->openair0_cfg))<0) return(-1);
|
trx_lms_set_gains(device, device->openair0_cfg);
|
||||||
|
|
||||||
if (LMS_SetupStream(lms_device, &tx_stream)!=0)
|
if (LMS_SetupStream(lms_device, &tx_stream)!=0)
|
||||||
printf("TX stream setup failed %s\n",LMS_GetLastErrorMessage());
|
printf("TX stream setup failed %s\n",LMS_GetLastErrorMessage());
|
||||||
@@ -271,7 +259,6 @@ int trx_lms_start(openair0_device *device){
|
|||||||
printf("Failed to start TX stream %s\n",LMS_GetLastErrorMessage());
|
printf("Failed to start TX stream %s\n",LMS_GetLastErrorMessage());
|
||||||
if (LMS_StartStream(&tx_stream)!=0)
|
if (LMS_StartStream(&tx_stream)!=0)
|
||||||
printf("Failed to start Rx stream %s\n",LMS_GetLastErrorMessage());
|
printf("Failed to start Rx stream %s\n",LMS_GetLastErrorMessage());
|
||||||
device->trx_started=1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +272,6 @@ int trx_lms_stop(openair0_device *device) {
|
|||||||
LMS_DestroyStream(lms_device,&rx_stream);
|
LMS_DestroyStream(lms_device,&rx_stream);
|
||||||
LMS_DestroyStream(lms_device,&tx_stream);
|
LMS_DestroyStream(lms_device,&tx_stream);
|
||||||
LMS_Close(lms_device);
|
LMS_Close(lms_device);
|
||||||
device->trx_started=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Set frequencies (TX/RX)
|
/*! \brief Set frequencies (TX/RX)
|
||||||
@@ -306,27 +292,19 @@ 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 */
|
/*! \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,62.0}, // on L PAD
|
|
||||||
{2300000000.0,62.0}, // on L PAD
|
|
||||||
{1880000000.0,64.0}, // on L PAD
|
|
||||||
{816000000.0,79.0}, // on W PAD
|
|
||||||
{-1,0}};
|
|
||||||
// V1.4 board
|
|
||||||
rx_gain_calib_table_t calib_table_lmssdr[] = {
|
rx_gain_calib_table_t calib_table_lmssdr[] = {
|
||||||
{3500000000.0,97.0}, // on H PAD
|
{3500000000.0,70.0},
|
||||||
{2660000000.0,110.0}, // on H PAD
|
{2660000000.0,80.0},
|
||||||
{2300000000.0,106.0}, // on H PAD
|
{2300000000.0,80.0},
|
||||||
{1880000000.0,106.0}, // on H PAD
|
{1880000000.0,74.0}, // on W PAD
|
||||||
{816000000.0,102.0}, // on W PAD
|
{816000000.0,76.0}, // on W PAD
|
||||||
{-1,0}};
|
{-1,0}};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Get LMSSDR Statistics
|
/*! \brief Get LMSSDR Statistics
|
||||||
* \param device the hardware to use
|
* \param device the hardware to use
|
||||||
* \returns 0 in success
|
* \returns 0 in success
|
||||||
@@ -354,7 +332,7 @@ int trx_lms_reset_stats(openair0_device* device) {
|
|||||||
*/
|
*/
|
||||||
void trx_lms_end(openair0_device *device) {
|
void trx_lms_end(openair0_device *device) {
|
||||||
|
|
||||||
device->trx_started=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -88,12 +88,6 @@ typedef struct
|
|||||||
//! Sampling rate
|
//! Sampling rate
|
||||||
double sample_rate;
|
double sample_rate;
|
||||||
|
|
||||||
//! rx RF frequency
|
|
||||||
double rx_RFfreq;
|
|
||||||
|
|
||||||
//! tx RF frequency
|
|
||||||
double tx_RFfreq;
|
|
||||||
|
|
||||||
//! time offset between transmiter timestamp and receiver timestamp;
|
//! time offset between transmiter timestamp and receiver timestamp;
|
||||||
double tdiff;
|
double tdiff;
|
||||||
|
|
||||||
@@ -143,8 +137,6 @@ static int trx_usrp_start(openair0_device *device)
|
|||||||
s->tx_count = 0;
|
s->tx_count = 0;
|
||||||
s->rx_timestamp = 0;
|
s->rx_timestamp = 0;
|
||||||
|
|
||||||
device->trx_started=1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*! \brief Terminate operation of the USRP transceiver -- free all associated resources
|
/*! \brief Terminate operation of the USRP transceiver -- free all associated resources
|
||||||
@@ -160,7 +152,7 @@ static void trx_usrp_end(openair0_device *device)
|
|||||||
s->tx_md.end_of_burst = true;
|
s->tx_md.end_of_burst = true;
|
||||||
s->tx_stream->send("", 0, s->tx_md);
|
s->tx_stream->send("", 0, s->tx_md);
|
||||||
s->tx_md.end_of_burst = false;
|
s->tx_md.end_of_burst = false;
|
||||||
device->trx_started=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Called to send samples to the USRP RF target
|
/*! \brief Called to send samples to the USRP RF target
|
||||||
@@ -396,45 +388,14 @@ int trx_usrp_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,
|
|||||||
usrp_state_t *s = (usrp_state_t*)device->priv;
|
usrp_state_t *s = (usrp_state_t*)device->priv;
|
||||||
pthread_t f_thread;
|
pthread_t f_thread;
|
||||||
|
|
||||||
double rx_off,tx_off;
|
printf("Setting USRP TX Freq %f, RX Freq %f\n",openair0_cfg[0].tx_freq[0],openair0_cfg[0].rx_freq[0]);
|
||||||
|
|
||||||
|
|
||||||
if (fabs(s->rx_RFfreq-openair0_cfg[0].rx_freq[0])<1e6) {
|
|
||||||
// induce use of digital tuning
|
|
||||||
rx_off = s->rx_RFfreq-openair0_cfg[0].rx_freq[0];
|
|
||||||
}
|
|
||||||
else { // allow UHD to select the frequnecy
|
|
||||||
rx_off = 0;
|
|
||||||
s->rx_RFfreq = openair0_cfg[0].rx_freq[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fabs(s->tx_RFfreq-openair0_cfg[0].tx_freq[0])<1e6) {
|
|
||||||
// induce use of digital tuning
|
|
||||||
tx_off = s->tx_RFfreq-openair0_cfg[0].tx_freq[0];
|
|
||||||
}
|
|
||||||
else { // allow UHD to select the frequnecy
|
|
||||||
tx_off = 0;
|
|
||||||
s->tx_RFfreq = openair0_cfg[0].tx_freq[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Setting USRP TX Freq %f (%f), RX Freq %f (%f)\n",s->tx_RFfreq,tx_off,s->rx_RFfreq,rx_off);
|
|
||||||
|
|
||||||
|
|
||||||
// spawn a thread to handle the frequency change to not block the calling thread
|
// spawn a thread to handle the frequency change to not block the calling thread
|
||||||
if (dont_block == 1)
|
if (dont_block == 1)
|
||||||
pthread_create(&f_thread,NULL,freq_thread,(void*)device);
|
pthread_create(&f_thread,NULL,freq_thread,(void*)device);
|
||||||
else {
|
else {
|
||||||
uhd::tune_request_t treq_rx(s->rx_RFfreq+rx_off);
|
s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[0]);
|
||||||
treq_rx.rf_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
|
s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[0]);
|
||||||
treq_rx.rf_freq = s->rx_RFfreq;
|
|
||||||
s->usrp->set_rx_freq(treq_rx);
|
|
||||||
|
|
||||||
|
|
||||||
uhd::tune_request_t treq_tx(s->tx_RFfreq+tx_off);
|
|
||||||
treq_tx.rf_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
|
|
||||||
treq_tx.rf_freq = s->tx_RFfreq;
|
|
||||||
s->usrp->set_tx_freq(treq_tx);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
@@ -492,7 +453,6 @@ int trx_usrp_set_gains(openair0_device* device,
|
|||||||
* \param card refers to the hardware index to use
|
* \param card refers to the hardware index to use
|
||||||
*/
|
*/
|
||||||
int trx_usrp_stop(openair0_device* device) {
|
int trx_usrp_stop(openair0_device* device) {
|
||||||
device->trx_started=0;
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -372,15 +372,14 @@ static void *UE_thread_synch(void *arg)
|
|||||||
while (sync_var<0)
|
while (sync_var<0)
|
||||||
pthread_cond_wait(&sync_cond, &sync_mutex);
|
pthread_cond_wait(&sync_cond, &sync_mutex);
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&sync_mutex);
|
||||||
|
printf("Started device, unlocked sync_mutex (UE_sync_thread)\n");
|
||||||
|
|
||||||
if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||||
LOG_E(HW,"Could not start the device\n");
|
LOG_E(HW,"Could not start the device\n");
|
||||||
oai_exit=1;
|
oai_exit=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&sync_mutex);
|
|
||||||
printf("Started device, unlocked sync_mutex (UE_sync_thread)\n");
|
|
||||||
|
|
||||||
while (oai_exit==0) {
|
while (oai_exit==0) {
|
||||||
|
|
||||||
if (pthread_mutex_lock(&UE->proc.mutex_synch) != 0) {
|
if (pthread_mutex_lock(&UE->proc.mutex_synch) != 0) {
|
||||||
@@ -497,14 +496,13 @@ static void *UE_thread_synch(void *arg)
|
|||||||
|
|
||||||
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
|
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
|
||||||
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
||||||
|
UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
||||||
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
sleep(1);
|
||||||
// sleep(1);
|
|
||||||
init_frame_parms(&UE->frame_parms,1);
|
init_frame_parms(&UE->frame_parms,1);
|
||||||
// if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||||
// LOG_E(HW,"Could not start the device\n");
|
LOG_E(HW,"Could not start the device\n");
|
||||||
// oai_exit=1;
|
oai_exit=1;
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UE->is_synchronized = 1;
|
UE->is_synchronized = 1;
|
||||||
@@ -952,9 +950,6 @@ void *UE_thread(void *arg) {
|
|||||||
itti_send_msg_to_task (TASK_NAS_UE, INSTANCE_DEFAULT, message_p);
|
itti_send_msg_to_task (TASK_NAS_UE, INSTANCE_DEFAULT, message_p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (UE->rfdevice.trx_started==0)
|
|
||||||
usleep(500);
|
|
||||||
|
|
||||||
while (!oai_exit) {
|
while (!oai_exit) {
|
||||||
|
|
||||||
if (UE->is_synchronized == 0) {
|
if (UE->is_synchronized == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user