mirror of https://github.com/PentHertz/srsLTE.git
Fix ZMQ TX channel mapping for NULL pointers
Fix ZMQ transmit frequency mapping Use map mask in ZMQ to determine mapped channels Fix ZMQ mapping
This commit is contained in:
parent
562fd1b4d4
commit
085e247ece
|
@ -195,10 +195,10 @@ int rf_zmq_open_multi(char* args, void** h, uint32_t nof_channels)
|
||||||
return SRSRAN_ERROR;
|
return SRSRAN_ERROR;
|
||||||
}
|
}
|
||||||
bzero(handler, sizeof(rf_zmq_handler_t));
|
bzero(handler, sizeof(rf_zmq_handler_t));
|
||||||
*h = handler;
|
*h = handler;
|
||||||
handler->base_srate = ZMQ_BASERATE_DEFAULT_HZ; // Sample rate for 100 PRB cell
|
handler->base_srate = ZMQ_BASERATE_DEFAULT_HZ; // Sample rate for 100 PRB cell
|
||||||
pthread_mutex_lock(&handler->rx_gain_mutex);
|
pthread_mutex_lock(&handler->rx_gain_mutex);
|
||||||
handler->rx_gain = 0.0;
|
handler->rx_gain = 0.0;
|
||||||
pthread_mutex_unlock(&handler->rx_gain_mutex);
|
pthread_mutex_unlock(&handler->rx_gain_mutex);
|
||||||
handler->info.max_rx_gain = ZMQ_MAX_GAIN_DB;
|
handler->info.max_rx_gain = ZMQ_MAX_GAIN_DB;
|
||||||
handler->info.min_rx_gain = ZMQ_MIN_GAIN_DB;
|
handler->info.min_rx_gain = ZMQ_MIN_GAIN_DB;
|
||||||
|
@ -471,7 +471,7 @@ int rf_zmq_set_rx_gain(void* h, double gain)
|
||||||
if (h) {
|
if (h) {
|
||||||
rf_zmq_handler_t* handler = (rf_zmq_handler_t*)h;
|
rf_zmq_handler_t* handler = (rf_zmq_handler_t*)h;
|
||||||
pthread_mutex_lock(&handler->rx_gain_mutex);
|
pthread_mutex_lock(&handler->rx_gain_mutex);
|
||||||
handler->rx_gain = gain;
|
handler->rx_gain = gain;
|
||||||
pthread_mutex_unlock(&handler->rx_gain_mutex);
|
pthread_mutex_unlock(&handler->rx_gain_mutex);
|
||||||
}
|
}
|
||||||
return SRSRAN_SUCCESS;
|
return SRSRAN_SUCCESS;
|
||||||
|
@ -498,7 +498,7 @@ double rf_zmq_get_rx_gain(void* h)
|
||||||
if (h) {
|
if (h) {
|
||||||
rf_zmq_handler_t* handler = (rf_zmq_handler_t*)h;
|
rf_zmq_handler_t* handler = (rf_zmq_handler_t*)h;
|
||||||
pthread_mutex_lock(&handler->rx_gain_mutex);
|
pthread_mutex_lock(&handler->rx_gain_mutex);
|
||||||
ret = handler->rx_gain;
|
ret = handler->rx_gain;
|
||||||
pthread_mutex_unlock(&handler->rx_gain_mutex);
|
pthread_mutex_unlock(&handler->rx_gain_mutex);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -617,23 +617,28 @@ int rf_zmq_recv_with_time_multi(void* h, void** data, uint32_t nsamples, bool bl
|
||||||
|
|
||||||
// Map ports to data buffers according to the selected frequencies
|
// Map ports to data buffers according to the selected frequencies
|
||||||
pthread_mutex_lock(&handler->rx_config_mutex);
|
pthread_mutex_lock(&handler->rx_config_mutex);
|
||||||
|
bool mapped[SRSRAN_MAX_CHANNELS] = {}; // Mapped mask, set to true when the physical channel is used
|
||||||
cf_t* buffers[SRSRAN_MAX_CHANNELS] = {}; // Buffer pointers, NULL if unmatched
|
cf_t* buffers[SRSRAN_MAX_CHANNELS] = {}; // Buffer pointers, NULL if unmatched
|
||||||
for (uint32_t i = 0; i < handler->nof_channels; i++) {
|
|
||||||
bool mapped = false;
|
|
||||||
|
|
||||||
// Find first matching frequency
|
// For each logical channel...
|
||||||
for (uint32_t j = 0; j < handler->nof_channels && !mapped; j++) {
|
for (uint32_t logical = 0; logical < handler->nof_channels; logical++) {
|
||||||
// Traverse all channels, break if mapped
|
bool unmatched = true;
|
||||||
if (buffers[j] == NULL && rf_zmq_rx_match_freq(&handler->receiver[j], handler->rx_freq_mhz[i])) {
|
|
||||||
// Available buffer and matched frequency with receiver
|
// For each physical channel...
|
||||||
buffers[j] = (cf_t*)data[i];
|
for (uint32_t physical = 0; physical < handler->nof_channels; physical++) {
|
||||||
mapped = true;
|
// Consider a match if the physical channel is NOT mapped and the frequency match
|
||||||
|
if (!mapped[physical] && rf_zmq_rx_match_freq(&handler->receiver[physical], handler->rx_freq_mhz[logical])) {
|
||||||
|
// Not mapped and matched frequency with receiver
|
||||||
|
buffers[physical] = (cf_t*)data[logical];
|
||||||
|
mapped[physical] = true;
|
||||||
|
unmatched = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no matching frequency found; set data to zeros
|
// If no matching frequency found; set data to zeros
|
||||||
if (!mapped && data[i]) {
|
if (unmatched) {
|
||||||
memset(data[i], 0, sizeof(cf_t) * nsamples);
|
srsran_vec_zero(data[logical], nsamples);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&handler->rx_config_mutex);
|
pthread_mutex_unlock(&handler->rx_config_mutex);
|
||||||
|
@ -831,17 +836,19 @@ int rf_zmq_send_timed_multi(void* h,
|
||||||
|
|
||||||
// Map ports to data buffers according to the selected frequencies
|
// Map ports to data buffers according to the selected frequencies
|
||||||
pthread_mutex_lock(&handler->tx_config_mutex);
|
pthread_mutex_lock(&handler->tx_config_mutex);
|
||||||
cf_t* buffers[SRSRAN_MAX_CHANNELS] = {}; // Buffer pointers, NULL if unmatched
|
bool mapped[SRSRAN_MAX_CHANNELS] = {}; // Mapped mask, set to true when the physical channel is used
|
||||||
for (uint32_t i = 0; i < handler->nof_channels; i++) {
|
cf_t* buffers[SRSRAN_MAX_CHANNELS] = {}; // Buffer pointers, NULL if unmatched or zero transmission
|
||||||
bool mapped = false;
|
|
||||||
|
|
||||||
// Find first matching frequency
|
// For each logical channel...
|
||||||
for (uint32_t j = 0; j < handler->nof_channels && !mapped; j++) {
|
for (uint32_t logical = 0; logical < handler->nof_channels; logical++) {
|
||||||
// Traverse all channels, break if mapped
|
// For each physical channel...
|
||||||
if (buffers[j] == NULL && rf_zmq_tx_match_freq(&handler->transmitter[j], handler->tx_freq_mhz[i])) {
|
for (uint32_t physical = 0; physical < handler->nof_channels; physical++) {
|
||||||
// Available buffer and matched frequency with receiver
|
// Consider a match if the physical channel is NOT mapped and the frequency match
|
||||||
buffers[j] = (cf_t*)data[i];
|
if (!mapped[physical] && rf_zmq_tx_match_freq(&handler->transmitter[physical], handler->tx_freq_mhz[logical])) {
|
||||||
mapped = true;
|
// Not mapped and matched frequency with receiver
|
||||||
|
buffers[physical] = (cf_t*)data[logical];
|
||||||
|
mapped[physical] = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue