soapy: fix array parameter mismatch for some functions

With soapy 0.8.0, GCC 11.1.0 warns of mismatched array bounds
in some functions.
This commit aligns the bound and adds proper wrappers to
fix subsequent warnings.
master
Robert Falkenberg 4 years ago
parent 1a15a65483
commit 24e52d6291

@ -256,11 +256,15 @@ int rf_soapy_stop_tx_stream(void* h)
void rf_soapy_flush_buffer(void* h)
{
int n;
cf_t tmp1[1024];
cf_t tmp2[1024];
void* data[2] = {tmp1, tmp2};
cf_t dummy[1024];
void* data[SRSRAN_MAX_CHANNELS] = {};
for (int i = 0; i < SRSRAN_MAX_CHANNELS; i++) {
data[i] = dummy;
}
do {
n = rf_soapy_recv_with_time_multi(h, data, 1024, 0, NULL, NULL);
n = rf_soapy_recv_with_time_multi(h, data, sizeof(dummy), 0, NULL, NULL);
} while (n > 0);
}
@ -848,7 +852,9 @@ int rf_soapy_recv_with_time_multi(void* h,
int rf_soapy_recv_with_time(void* h, void* data, uint32_t nsamples, bool blocking, time_t* secs, double* frac_secs)
{
return rf_soapy_recv_with_time_multi(h, &data, nsamples, blocking, secs, frac_secs);
void* data_multi[SRSRAN_MAX_PORTS] = {NULL};
data_multi[0] = data;
return rf_soapy_recv_with_time_multi(h, data_multi, nsamples, blocking, secs, frac_secs);
}
int rf_soapy_send_timed(void* h,

@ -14,6 +14,7 @@
#define SRSRAN_RF_SOAPY_IMP_H_
#include "srsran/config.h"
#include "srsran/phy/common/phy_common.h"
#include "srsran/phy/rf/rf.h"
#include <stdbool.h>
#include <stdint.h>
@ -66,8 +67,12 @@ SRSRAN_API double rf_soapy_set_rx_freq(void* h, uint32_t ch, double freq);
SRSRAN_API int
rf_soapy_recv_with_time(void* h, void* data, uint32_t nsamples, bool blocking, time_t* secs, double* frac_secs);
SRSRAN_API int
rf_soapy_recv_with_time_multi(void* h, void** data, uint32_t nsamples, bool blocking, time_t* secs, double* frac_secs);
SRSRAN_API int rf_soapy_recv_with_time_multi(void* h,
void* data[SRSRAN_MAX_PORTS],
uint32_t nsamples,
bool blocking,
time_t* secs,
double* frac_secs);
SRSRAN_API double rf_soapy_set_tx_srate(void* h, double freq);

Loading…
Cancel
Save