Merge branch 'next_new_feature' into next

master
Andre Puschmann 8 years ago
commit e16cc4c58b

@ -44,6 +44,7 @@ typedef struct {
SoapySDRStream *rxStream;
SoapySDRStream *txStream;
bool tx_stream_active;
bool rx_stream_active;
} rf_soapy_handler_t;
@ -116,22 +117,23 @@ void rf_soapy_set_rx_cal(void *h, srslte_rf_cal_t *cal)
int rf_soapy_start_rx_stream(void *h)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if (SoapySDRDevice_activateStream(handler->device, handler->rxStream, 0, 0, 0) != 0)
return SRSLTE_ERROR;
if(handler->rx_stream_active == false){
if(SoapySDRDevice_activateStream(handler->device, handler->rxStream, 0, 0, 0) != 0)
return SRSLTE_ERROR;
handler->rx_stream_active = true;
}
return SRSLTE_SUCCESS;
}
int rf_soapy_start_tx_stream(void *h)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if(SoapySDRDevice_activateStream(handler->device, handler->txStream, 0, 0, 0) != 0)
return SRSLTE_ERROR;
handler->tx_stream_active = true;
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if(handler->tx_stream_active == false){
if(SoapySDRDevice_activateStream(handler->device, handler->txStream, 0, 0, 0) != 0)
return SRSLTE_ERROR;
handler->tx_stream_active = true;
}
return SRSLTE_SUCCESS;
}
@ -141,7 +143,8 @@ int rf_soapy_stop_rx_stream(void *h)
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if (SoapySDRDevice_deactivateStream(handler->device, handler->rxStream, 0, 0) != 0)
return SRSLTE_ERROR;
handler->rx_stream_active = false;
return SRSLTE_SUCCESS;
}
@ -152,6 +155,8 @@ int rf_soapy_stop_tx_stream(void *h)
if(SoapySDRDevice_deactivateStream(handler->device, handler->txStream, 0, 0) != 0)
return SRSLTE_ERROR;
handler->tx_stream_active = false;
return SRSLTE_SUCCESS;
}
@ -214,15 +219,25 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
*h = handler;
handler->device = sdr;
handler->tx_stream_active = false;
if (SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
printf("setupStream fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
handler->rx_stream_active = false;
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_RX) > 0){
printf("setting up RX stream\n");
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());
return SRSLTE_ERROR;
}
}
if (SoapySDRDevice_setupStream(handler->device, &(handler->txStream), SOAPY_SDR_TX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
printf("setupStream fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_TX) > 0){
printf("setting up TX stream\n");
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());
return SRSLTE_ERROR;
}
}
return SRSLTE_SUCCESS;
}
@ -362,10 +377,7 @@ int rf_soapy_recv_with_time_multi(void *h,
double *frac_secs)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
//void *buffs[] = {buff}; //array of buffers
int flags; //flags set by receive operation
int num_channels = 1; // temp
int trials = 0;
@ -375,16 +387,14 @@ int rf_soapy_recv_with_time_multi(void *h,
do {
size_t rx_samples = nsamples;
if (rx_samples > nsamples - n)
{
if (rx_samples > nsamples - n){
rx_samples = nsamples - n;
}
void *buffs_ptr[4];
for (int i=0; i<num_channels; i++)
{
for (int i=0; i<num_channels; i++){
cf_t *data_c = (cf_t*) data[i];
buffs_ptr[i] = &data_c[n];
} //(void*)(&data)
}
ret = SoapySDRDevice_readStream(handler->device, handler->rxStream, buffs_ptr , rx_samples, &flags, &timeNs, 1000000);
if(ret < 0) {
// continue when getting overflows
@ -439,34 +449,31 @@ int rf_soapy_send_timed(void *h,
timeNs = timeNs + (frac_secs * 1000000000);
int num_channels = 1;
int n = 0;
if(!handler->tx_stream_active){
rf_soapy_start_tx_stream(h);
}
cf_t *data_c = (cf_t*) data;
do{
do{
size_t tx_samples = nsamples;
if (tx_samples > nsamples - n)
{
if (tx_samples > nsamples - n) {
tx_samples = nsamples - n;
}
void *buff = (void*) &data_c[n];
const void *buffs_ptr[1] = {buff};
ret = SoapySDRDevice_writeStream(handler->device, handler->txStream, buffs_ptr, tx_samples, &flags, timeNs, 10000);
void *buff = (void*) &data_c[n];
const void *buffs_ptr[1] = {buff};
ret = SoapySDRDevice_writeStream(handler->device, handler->txStream, buffs_ptr, tx_samples, &flags, timeNs, 10000);
if(ret < 0)
return SRSLTE_ERROR;
return SRSLTE_ERROR;
n += ret;
trials++;
}while (n < nsamples && trials < 100);
if(ret != nsamples)
return SRSLTE_ERROR;
return ret;
}

@ -218,7 +218,7 @@ uint32_t rlc_am::get_total_buffer_state()
// Room needed for fixed header?
if(n_bytes > 0) {
n_bytes += 2;
log->debug("Total buffer state LCID=%d - tx SDUs: %d bytes\n", lcid, n_bytes);
log->debug("Buffer state - tx SDUs: %d bytes\n", n_bytes);
}
pthread_mutex_unlock(&mutex);
@ -235,7 +235,7 @@ uint32_t rlc_am::get_buffer_state()
check_reordering_timeout();
if(do_status && !status_prohibited()) {
n_bytes = prepare_status();
log->debug("Buffer state LCID=%d - status report: %d bytes\n", lcid, n_bytes);
log->debug("Buffer state - status report: %d bytes\n", n_bytes);
goto unlock_and_return;
}
@ -268,7 +268,7 @@ uint32_t rlc_am::get_buffer_state()
// Room needed for fixed header?
if(n_bytes > 0) {
n_bytes += 2;
log->debug("Buffer state LCID=%d - tx SDUs: %d bytes\n", lcid, n_bytes);
log->debug("Buffer state - tx SDUs: %d bytes\n", n_bytes);
}
unlock_and_return:

Loading…
Cancel
Save