Merge branch 'next' of github.com:softwareradiosystems/srsLTE into next

This commit is contained in:
Ismael Gomez 2018-05-03 11:42:25 +02:00
commit 3a9f144ff3
2 changed files with 11 additions and 10 deletions

View File

@ -41,13 +41,13 @@ int rf_get_available_devices(char **devnames, int max_strlen) {
double srslte_rf_set_rx_gain_th(srslte_rf_t *rf, double gain)
{
if (gain > rf->new_rx_gain + 2 || gain < rf->new_rx_gain - 2) {
if (gain > rf->cur_rx_gain + 2 || gain < rf->cur_rx_gain - 2){
pthread_mutex_lock(&rf->mutex);
rf->new_rx_gain = gain;
pthread_cond_signal(&rf->cond);
pthread_mutex_unlock(&rf->mutex);
}
return gain;
return rf->cur_rx_gain;
}
void srslte_rf_set_tx_rx_gain_offset(srslte_rf_t *rf, double offset) {
@ -65,8 +65,9 @@ static void* thread_gain_fcn(void *h) {
pthread_cond_wait(&rf->cond, &rf->mutex);
}
if (rf->new_rx_gain != rf->cur_rx_gain) {
rf->cur_rx_gain = rf->new_rx_gain;
srslte_rf_set_rx_gain(h, rf->cur_rx_gain);
srslte_rf_set_rx_gain(h, rf->new_rx_gain);
rf->cur_rx_gain = srslte_rf_get_rx_gain(h);
rf->new_rx_gain = rf->cur_rx_gain;
}
if (rf->tx_gain_same_rx) {
printf("setting also tx\n");
@ -80,17 +81,17 @@ static void* thread_gain_fcn(void *h) {
/* Create auxiliary thread and mutexes for AGC */
int srslte_rf_start_gain_thread(srslte_rf_t *rf, bool tx_gain_same_rx) {
rf->tx_gain_same_rx = tx_gain_same_rx;
rf->tx_rx_gain_offset = 0.0;
rf->tx_gain_same_rx = tx_gain_same_rx;
rf->tx_rx_gain_offset = 0.0;
if (pthread_mutex_init(&rf->mutex, NULL)) {
return -1;
return -1;
}
if (pthread_cond_init(&rf->cond, NULL)) {
return -1;
return -1;
}
if (pthread_create(&rf->thread_gain, NULL, thread_gain_fcn, rf)) {
perror("pthread_create");
return -1;
return -1;
}
return 0;
}

View File

@ -28,7 +28,7 @@
dl_earfcn = 3400
freq_offset = 0
tx_gain = 80
rx_gain = 40
#rx_gain = 40
#nof_rx_ant = 1
#device_name = auto