Correction RF module for supporting Rx diversity in the UE

master
Xavier Arteaga 7 years ago
parent 7e9e9a6a7d
commit e22a526350

@ -99,12 +99,6 @@ SRSLTE_API int srslte_rf_open_devname_multi(srslte_rf_t *h,
char *args, char *args,
uint32_t nof_rx_antennas); uint32_t nof_rx_antennas);
SRSLTE_API int srslte_rf_open_devname_multi2(srslte_rf_t *rf,
char *devname,
char *args,
uint32_t nof_tx_antennas,
uint32_t nof_rx_antennas);
SRSLTE_API const char *srslte_rf_name(srslte_rf_t *h); SRSLTE_API const char *srslte_rf_name(srslte_rf_t *h);
SRSLTE_API int srslte_rf_start_gain_thread(srslte_rf_t *rf, SRSLTE_API int srslte_rf_start_gain_thread(srslte_rf_t *rf,
@ -221,6 +215,15 @@ SRSLTE_API int srslte_rf_send_timed2(srslte_rf_t *h,
bool is_start_of_burst, bool is_start_of_burst,
bool is_end_of_burst); bool is_end_of_burst);
SRSLTE_API int srslte_rf_send_timed_multi(srslte_rf_t *rf,
void *data[4],
int nsamples,
time_t secs,
double frac_secs,
bool blocking,
bool is_start_of_burst,
bool is_end_of_burst);
SRSLTE_API int srslte_rf_send_multi(srslte_rf_t *rf, SRSLTE_API int srslte_rf_send_multi(srslte_rf_t *rf,
void *data[4], void *data[4],
int nsamples, int nsamples,

@ -178,7 +178,7 @@ float rf_blade_get_rssi(void *h)
return 0; return 0;
} }
int rf_blade_open_multi(char *args, void **h, uint32_t nof_tx_antennas, uint32_t nof_rx_antennas) int rf_blade_open_multi(char *args, void **h, uint32_t nof_channels)
{ {
return rf_blade_open(args, h); return rf_blade_open(args, h);
} }

@ -34,7 +34,7 @@ SRSLTE_API int rf_blade_open(char *args,
void **handler); void **handler);
SRSLTE_API int rf_blade_open_multi(char *args, SRSLTE_API int rf_blade_open_multi(char *args,
void **handler, uint32_t nof_tx_antennas, uint32_t nof_rx_antennas); void **handler, uint32_t nof_channels);
SRSLTE_API char* rf_blade_devname(void *h); SRSLTE_API char* rf_blade_devname(void *h);

@ -38,7 +38,7 @@ typedef struct {
void (*srslte_rf_suppress_stdout)(void *h); void (*srslte_rf_suppress_stdout)(void *h);
void (*srslte_rf_register_error_handler)(void *h, srslte_rf_error_handler_t error_handler); void (*srslte_rf_register_error_handler)(void *h, srslte_rf_error_handler_t error_handler);
int (*srslte_rf_open)(char *args, void **h); int (*srslte_rf_open)(char *args, void **h);
int (*srslte_rf_open_multi)(char *args, void **h, uint32_t nof_tx_antennas, uint32_t nof_rx_antennas); int (*srslte_rf_open_multi)(char *args, void **h, uint32_t nof_channels);
int (*srslte_rf_close)(void *h); int (*srslte_rf_close)(void *h);
void (*srslte_rf_set_master_clock_rate)(void *h, double rate); void (*srslte_rf_set_master_clock_rate)(void *h, double rate);
bool (*srslte_rf_is_master_clock_dynamic)(void *h); bool (*srslte_rf_is_master_clock_dynamic)(void *h);

@ -102,11 +102,7 @@ int srslte_rf_open_devname(srslte_rf_t *rf, char *devname, char *args) {
return srslte_rf_open_devname_multi(rf, devname, args, 1); return srslte_rf_open_devname_multi(rf, devname, args, 1);
} }
int srslte_rf_open_devname_multi(srslte_rf_t *rf, char *devname, char *args, uint32_t nof_rx_antennas) { int srslte_rf_open_devname_multi(srslte_rf_t *rf, char *devname, char *args, uint32_t nof_channels) {
return srslte_rf_open_devname_multi2(rf, devname, args, 1, nof_rx_antennas);
}
int srslte_rf_open_devname_multi2(srslte_rf_t *rf, char *devname, char *args, uint32_t nof_tx_antennas, uint32_t nof_rx_antennas) {
/* Try to open the device if name is provided */ /* Try to open the device if name is provided */
if (devname) { if (devname) {
if (devname[0] != '\0') { if (devname[0] != '\0') {
@ -114,7 +110,7 @@ int srslte_rf_open_devname_multi2(srslte_rf_t *rf, char *devname, char *args, ui
while(available_devices[i] != NULL) { while(available_devices[i] != NULL) {
if (!strcmp(available_devices[i]->name, devname)) { if (!strcmp(available_devices[i]->name, devname)) {
rf->dev = available_devices[i]; rf->dev = available_devices[i];
return available_devices[i]->srslte_rf_open_multi(args, &rf->handler, nof_tx_antennas, nof_rx_antennas); return available_devices[i]->srslte_rf_open_multi(args, &rf->handler, nof_channels);
} }
i++; i++;
} }
@ -125,7 +121,7 @@ int srslte_rf_open_devname_multi2(srslte_rf_t *rf, char *devname, char *args, ui
/* If in auto mode or provided device not found, try to open in order of apperance in available_devices[] array */ /* If in auto mode or provided device not found, try to open in order of apperance in available_devices[] array */
int i=0; int i=0;
while(available_devices[i] != NULL) { while(available_devices[i] != NULL) {
if (!available_devices[i]->srslte_rf_open_multi(args, &rf->handler, nof_tx_antennas, nof_rx_antennas)) { if (!available_devices[i]->srslte_rf_open_multi(args, &rf->handler, nof_channels)) {
rf->dev = available_devices[i]; rf->dev = available_devices[i];
return 0; return 0;
} }
@ -198,11 +194,6 @@ int srslte_rf_open_multi(srslte_rf_t *h, char *args, uint32_t nof_rx_antennas)
return srslte_rf_open_devname_multi(h, NULL, args, nof_rx_antennas); return srslte_rf_open_devname_multi(h, NULL, args, nof_rx_antennas);
} }
int srslte_rf_open_multi2(srslte_rf_t *h, char *args, uint32_t nof_tx_antennas, uint32_t nof_rx_antennas)
{
return srslte_rf_open_devname_multi2(h, NULL, args, nof_tx_antennas, nof_rx_antennas);
}
int srslte_rf_close(srslte_rf_t *rf) int srslte_rf_close(srslte_rf_t *rf)
{ {
return ((rf_dev_t*) rf->dev)->srslte_rf_close(rf->handler); return ((rf_dev_t*) rf->dev)->srslte_rf_close(rf->handler);
@ -310,6 +301,20 @@ int srslte_rf_send_timed3(srslte_rf_t *rf,
has_time_spec, blocking, is_start_of_burst, is_end_of_burst); has_time_spec, blocking, is_start_of_burst, is_end_of_burst);
} }
int srslte_rf_send_timed_multi(srslte_rf_t *rf,
void *data[4],
int nsamples,
time_t secs,
double frac_secs,
bool blocking,
bool is_start_of_burst,
bool is_end_of_burst)
{
return ((rf_dev_t*) rf->dev)->srslte_rf_send_timed_multi(rf->handler, data, nsamples, secs, frac_secs,
true, blocking, is_start_of_burst, is_end_of_burst);
}
int srslte_rf_send_multi(srslte_rf_t *rf, int srslte_rf_send_multi(srslte_rf_t *rf,
void *data[4], void *data[4],
int nsamples, int nsamples,
@ -318,8 +323,7 @@ int srslte_rf_send_multi(srslte_rf_t *rf,
bool is_end_of_burst) bool is_end_of_burst)
{ {
return ((rf_dev_t*) rf->dev)->srslte_rf_send_timed_multi(rf->handler, data, nsamples, 0, 0, return srslte_rf_send_timed_multi(rf, data, nsamples, 0, 0, blocking, is_start_of_burst, is_end_of_burst);
false, blocking, is_start_of_burst, is_end_of_burst);
} }
int srslte_rf_send(srslte_rf_t *rf, void *data, uint32_t nsamples, bool blocking) int srslte_rf_send(srslte_rf_t *rf, void *data, uint32_t nsamples, bool blocking)

@ -286,10 +286,10 @@ float rf_uhd_get_rssi(void *h) {
int rf_uhd_open(char *args, void **h) int rf_uhd_open(char *args, void **h)
{ {
return rf_uhd_open_multi(args, h, 1, 1); return rf_uhd_open_multi(args, h, 1);
} }
int rf_uhd_open_multi(char *args, void **h, uint32_t nof_tx_antennas, uint32_t nof_rx_antennas) int rf_uhd_open_multi(char *args, void **h, uint32_t nof_channels)
{ {
if (h) { if (h) {
*h = NULL; *h = NULL;
@ -395,11 +395,11 @@ int rf_uhd_open_multi(char *args, void **h, uint32_t nof_tx_antennas, uint32_t n
.otw_format = "sc16", .otw_format = "sc16",
.args = "", .args = "",
.channel_list = channel, .channel_list = channel,
.n_channels = (nof_tx_antennas > nof_rx_antennas)?nof_tx_antennas:nof_rx_antennas, .n_channels = nof_channels,
}; };
handler->nof_rx_channels = nof_rx_antennas; handler->nof_rx_channels = nof_channels;
handler->nof_tx_channels = nof_tx_antennas; handler->nof_tx_channels = nof_channels;
/* Initialize rx and tx stremers */ /* Initialize rx and tx stremers */
uhd_rx_streamer_make(&handler->rx_stream); uhd_rx_streamer_make(&handler->rx_stream);
error = uhd_usrp_get_rx_stream(handler->usrp, &stream_args, handler->rx_stream); error = uhd_usrp_get_rx_stream(handler->usrp, &stream_args, handler->rx_stream);
@ -664,7 +664,7 @@ int rf_uhd_send_timed_multi(void *h,
rf_uhd_handler_t* handler = (rf_uhd_handler_t*) h; rf_uhd_handler_t* handler = (rf_uhd_handler_t*) h;
/* Resets the USRP time FIXME: this might cause problems for burst transmissions */ /* Resets the USRP time FIXME: this might cause problems for burst transmissions */
if (is_start_of_burst && handler->nof_tx_channels > 1) { if (!has_time_spec && is_start_of_burst && handler->nof_tx_channels > 1) {
uhd_usrp_set_time_now(handler->usrp, 0, 0, 0); uhd_usrp_set_time_now(handler->usrp, 0, 0, 0);
uhd_tx_metadata_set_time_spec(&handler->tx_md, 0, 0.1); uhd_tx_metadata_set_time_spec(&handler->tx_md, 0, 0.1);
} }

@ -39,8 +39,7 @@ SRSLTE_API int rf_uhd_open(char *args,
SRSLTE_API int rf_uhd_open_multi(char *args, SRSLTE_API int rf_uhd_open_multi(char *args,
void **handler, void **handler,
uint32_t nof_tx_antennas, uint32_t nof_channels);
uint32_t nof_rx_antennas);
SRSLTE_API char* rf_uhd_devname(void *h); SRSLTE_API char* rf_uhd_devname(void *h);

@ -169,6 +169,8 @@ bool radio::has_rssi()
bool radio::tx(void* buffer, uint32_t nof_samples, srslte_timestamp_t tx_time) bool radio::tx(void* buffer, uint32_t nof_samples, srslte_timestamp_t tx_time)
{ {
void *iq_samples[4] = {(void *) zeros, (void *) zeros, (void *) zeros, (void *) zeros};
if (!tx_adv_negative) { if (!tx_adv_negative) {
srslte_timestamp_sub(&tx_time, 0, tx_adv_sec); srslte_timestamp_sub(&tx_time, 0, tx_adv_sec);
} else { } else {
@ -181,7 +183,7 @@ bool radio::tx(void* buffer, uint32_t nof_samples, srslte_timestamp_t tx_time)
srslte_timestamp_copy(&tx_time_pad, &tx_time); srslte_timestamp_copy(&tx_time_pad, &tx_time);
srslte_timestamp_sub(&tx_time_pad, 0, burst_preamble_time_rounded); srslte_timestamp_sub(&tx_time_pad, 0, burst_preamble_time_rounded);
save_trace(1, &tx_time_pad); save_trace(1, &tx_time_pad);
srslte_rf_send_timed2(&rf_device, zeros, burst_preamble_samples, tx_time_pad.full_secs, tx_time_pad.frac_secs, true, false); srslte_rf_send_timed_multi(&rf_device, iq_samples, burst_preamble_samples, tx_time_pad.full_secs, tx_time_pad.frac_secs, true, true, false);
is_start_of_burst = false; is_start_of_burst = false;
} }
} }
@ -191,7 +193,8 @@ bool radio::tx(void* buffer, uint32_t nof_samples, srslte_timestamp_t tx_time)
srslte_timestamp_add(&end_of_burst_time, 0, (double) nof_samples/cur_tx_srate); srslte_timestamp_add(&end_of_burst_time, 0, (double) nof_samples/cur_tx_srate);
save_trace(0, &tx_time); save_trace(0, &tx_time);
int ret = srslte_rf_send_timed2(&rf_device, buffer, nof_samples+offset, tx_time.full_secs, tx_time.frac_secs, is_start_of_burst, false); iq_samples[0] = buffer;
int ret = srslte_rf_send_timed_multi(&rf_device, (void**) iq_samples, nof_samples+offset, tx_time.full_secs, tx_time.frac_secs, true, is_start_of_burst, false);
offset = 0; offset = 0;
is_start_of_burst = false; is_start_of_burst = false;
if (ret > 0) { if (ret > 0) {

Loading…
Cancel
Save