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
|
@ -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