|
|
|
@ -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
|
|
|
|
|
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
|
|
|
|
|
for (uint32_t i = 0; i < handler->nof_channels; i++) {
|
|
|
|
|
bool mapped = false;
|
|
|
|
|
|
|
|
|
|
// Find first matching frequency
|
|
|
|
|
for (uint32_t j = 0; j < handler->nof_channels && !mapped; j++) {
|
|
|
|
|
// Traverse all channels, break if mapped
|
|
|
|
|
if (buffers[j] == NULL && rf_zmq_rx_match_freq(&handler->receiver[j], handler->rx_freq_mhz[i])) {
|
|
|
|
|
// Available buffer and matched frequency with receiver
|
|
|
|
|
buffers[j] = (cf_t*)data[i];
|
|
|
|
|
mapped = true;
|
|
|
|
|
// For each logical channel...
|
|
|
|
|
for (uint32_t logical = 0; logical < handler->nof_channels; logical++) {
|
|
|
|
|
bool unmatched = true;
|
|
|
|
|
|
|
|
|
|
// For each physical channel...
|
|
|
|
|
for (uint32_t physical = 0; physical < handler->nof_channels; physical++) {
|
|
|
|
|
// 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 (!mapped && data[i]) {
|
|
|
|
|
memset(data[i], 0, sizeof(cf_t) * nsamples);
|
|
|
|
|
if (unmatched) {
|
|
|
|
|
srsran_vec_zero(data[logical], nsamples);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
pthread_mutex_lock(&handler->tx_config_mutex);
|
|
|
|
|
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 (uint32_t j = 0; j < handler->nof_channels && !mapped; j++) {
|
|
|
|
|
// Traverse all channels, break if mapped
|
|
|
|
|
if (buffers[j] == NULL && rf_zmq_tx_match_freq(&handler->transmitter[j], handler->tx_freq_mhz[i])) {
|
|
|
|
|
// Available buffer and matched frequency with receiver
|
|
|
|
|
buffers[j] = (cf_t*)data[i];
|
|
|
|
|
mapped = true;
|
|
|
|
|
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 or zero transmission
|
|
|
|
|
|
|
|
|
|
// For each logical channel...
|
|
|
|
|
for (uint32_t logical = 0; logical < handler->nof_channels; logical++) {
|
|
|
|
|
// For each physical channel...
|
|
|
|
|
for (uint32_t physical = 0; physical < handler->nof_channels; physical++) {
|
|
|
|
|
// Consider a match if the physical channel is NOT mapped and the frequency match
|
|
|
|
|
if (!mapped[physical] && rf_zmq_tx_match_freq(&handler->transmitter[physical], handler->tx_freq_mhz[logical])) {
|
|
|
|
|
// Not mapped and matched frequency with receiver
|
|
|
|
|
buffers[physical] = (cf_t*)data[logical];
|
|
|
|
|
mapped[physical] = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|