|
|
@ -97,7 +97,11 @@ char* rf_soapy_devname(void* h)
|
|
|
|
|
|
|
|
|
|
|
|
bool rf_soapy_rx_wait_lo_locked(void *h)
|
|
|
|
bool rf_soapy_rx_wait_lo_locked(void *h)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("TODO: implement rf_soapy_rx_wait_lo_locked()\n");
|
|
|
|
rf_soapy_handler_t *handler = (rf_soapy_handler_t*)h;
|
|
|
|
|
|
|
|
char *ret = SoapySDRDevice_readChannelSensor(handler->device, SOAPY_SDR_RX, 0, "lo_locked");
|
|
|
|
|
|
|
|
if (ret != NULL) {
|
|
|
|
|
|
|
|
return (strcmp(ret, "true") == 0 ? true : false);
|
|
|
|
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -212,7 +216,7 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
|
|
|
|
|
|
|
|
|
|
|
|
SoapySDRDevice *sdr = SoapySDRDevice_make(&(soapy_args[0]));
|
|
|
|
SoapySDRDevice *sdr = SoapySDRDevice_make(&(soapy_args[0]));
|
|
|
|
if (sdr == NULL) {
|
|
|
|
if (sdr == NULL) {
|
|
|
|
printf("failed to create SOAPY object\n");
|
|
|
|
printf("Failed to create Soapy object\n");
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -225,7 +229,7 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
|
|
|
|
handler->rx_stream_active = false;
|
|
|
|
handler->rx_stream_active = false;
|
|
|
|
handler->devname = devname;
|
|
|
|
handler->devname = devname;
|
|
|
|
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_RX) > 0){
|
|
|
|
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_RX) > 0){
|
|
|
|
printf("setting up RX stream\n");
|
|
|
|
printf("Setting up RX stream\n");
|
|
|
|
if(SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
|
|
|
|
if(SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
|
|
|
|
printf("Rx setupStream fail: %s\n", SoapySDRDevice_lastError());
|
|
|
|
printf("Rx setupStream fail: %s\n", SoapySDRDevice_lastError());
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
@ -233,19 +237,27 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_TX) > 0){
|
|
|
|
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_TX) > 0){
|
|
|
|
printf("setting up TX stream\n");
|
|
|
|
printf("Setting up TX stream\n");
|
|
|
|
if (SoapySDRDevice_setupStream(handler->device, &(handler->txStream), SOAPY_SDR_TX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
|
|
|
|
if (SoapySDRDevice_setupStream(handler->device, &(handler->txStream), SOAPY_SDR_TX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
|
|
|
|
printf("Tx setupStream fail: %s\n", SoapySDRDevice_lastError());
|
|
|
|
printf("Tx setupStream fail: %s\n", SoapySDRDevice_lastError());
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// list device sensors
|
|
|
|
size_t sensor_length;
|
|
|
|
size_t sensor_length;
|
|
|
|
char** sensors;
|
|
|
|
char** sensors;
|
|
|
|
sensors = SoapySDRDevice_listSensors(handler->device, &sensor_length);
|
|
|
|
sensors = SoapySDRDevice_listSensors(handler->device, &sensor_length);
|
|
|
|
for(int i = 0; i < sensor_length;i++)
|
|
|
|
printf("Available device sensors: \n");
|
|
|
|
{
|
|
|
|
for(int i = 0; i < sensor_length; i++) {
|
|
|
|
printf("available sensors are : \n");
|
|
|
|
printf(" - %s\n", sensors[i]);
|
|
|
|
puts(sensors[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// list channel sensors
|
|
|
|
|
|
|
|
sensors = SoapySDRDevice_listChannelSensors(handler->device, SOAPY_SDR_RX, 0, &sensor_length);
|
|
|
|
|
|
|
|
printf("Available sensors for RX channel 0: \n");
|
|
|
|
|
|
|
|
for(int i = 0; i < sensor_length; i++) {
|
|
|
|
|
|
|
|
printf(" - %s\n", sensors[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
@ -408,6 +420,7 @@ int rf_soapy_recv_with_time_multi(void *h,
|
|
|
|
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
|
|
|
|
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
|
|
|
|
int flags; //flags set by receive operation
|
|
|
|
int flags; //flags set by receive operation
|
|
|
|
int num_channels = 1; // temp
|
|
|
|
int num_channels = 1; // temp
|
|
|
|
|
|
|
|
const long timeoutUs = 1000000; // arbitrarily chosen
|
|
|
|
|
|
|
|
|
|
|
|
int trials = 0;
|
|
|
|
int trials = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int ret = 0;
|
|
|
@ -424,7 +437,7 @@ int rf_soapy_recv_with_time_multi(void *h,
|
|
|
|
cf_t *data_c = (cf_t*) data[i];
|
|
|
|
cf_t *data_c = (cf_t*) data[i];
|
|
|
|
buffs_ptr[i] = &data_c[n];
|
|
|
|
buffs_ptr[i] = &data_c[n];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret = SoapySDRDevice_readStream(handler->device, handler->rxStream, buffs_ptr, rx_samples, &flags, &timeNs, 1000000);
|
|
|
|
ret = SoapySDRDevice_readStream(handler->device, handler->rxStream, buffs_ptr, rx_samples, &flags, &timeNs, timeoutUs);
|
|
|
|
if(ret < 0) {
|
|
|
|
if(ret < 0) {
|
|
|
|
// continue when getting overflows
|
|
|
|
// continue when getting overflows
|
|
|
|
if (ret == SOAPY_SDR_OVERFLOW) {
|
|
|
|
if (ret == SOAPY_SDR_OVERFLOW) {
|
|
|
@ -446,8 +459,6 @@ int rf_soapy_recv_with_time_multi(void *h,
|
|
|
|
n += ret;
|
|
|
|
n += ret;
|
|
|
|
trials++;
|
|
|
|
trials++;
|
|
|
|
} while (n < nsamples && trials < 100);
|
|
|
|
} while (n < nsamples && trials < 100);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return n;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
}
|
|
|
|