Skip to content

Commit

Permalink
Merge pull request #1 from softwareradiosystems/next_lime
Browse files Browse the repository at this point in the history
adding native lime, soapy, decimation filtering and neon optimizations
  • Loading branch information
ismagom authored May 8, 2017
2 parents 783d26b + a3551e2 commit a723b79
Show file tree
Hide file tree
Showing 25 changed files with 2,196 additions and 33 deletions.
28 changes: 28 additions & 0 deletions cmake/modules/FindLimeSDR.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
if(NOT LIMESDR_FOUND)
pkg_check_modules (LIMESDR_PKG LimeSuite)

find_path(LIMESDR_INCLUDE_DIRS
NAMES LimeSuite.h
PATHS ${LIMESDR_PKG_INCLUDE_DIRS}
/usr/include/lime
/usr/local/include/lime
)

find_library(LIMESDR_LIBRARIES
NAMES LimeSuite
PATHS ${LIMESDR_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)

if(LIMESDR_INCLUDE_DIRS AND LIMESDR_LIBRARIES)
set(LIMESDR_FOUND TRUE CACHE INTERNAL "libLimeSuite found")
message(STATUS "Found libLimeSuite: ${LIMESDR_INCLUDE_DIRS}, ${LIMESDR_LIBRARIES}")
else(LIMESDR_INCLUDE_DIRS AND LIMESDR_LIBRARIES)
set(LIMESDR_FOUND FALSE CACHE INTERNAL "libLimeSuite found")
message(STATUS "libLimeSuite not found.")
endif(LIMESDR_INCLUDE_DIRS AND LIMESDR_LIBRARIES)

mark_as_advanced(LIMESDR_LIBRARIES LIMESDR_INCLUDE_DIRS)

endif(NOT LIMESDR_FOUND)
31 changes: 31 additions & 0 deletions cmake/modules/FindSoapySDR.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

message(STATUS "FINDING SOAPY.")
if(NOT SOAPYSDR_FOUND)
pkg_check_modules (SOAPYSDR_PKG SoapySDR)

find_path(SOAPYSDR_INCLUDE_DIRS
NAMES Device.h
PATHS ${SOAPYSDR_PKG_INCLUDE_DIRS}
/usr/include/SoapySDR
/usr/include/local/SoapySDR
)

find_library(SOAPYSDR_LIBRARIES
NAMES SoapySDR
PATHS ${LIMESDR_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib

)

if(SOAPYSDR_INCLUDE_DIRS AND SOAPYSDR_LIBRARIES)
set(SOAPYSDR_FOUND TRUE CACHE INTERNAL "libSOAPYSDR found")
message(STATUS "Found libSOAPYSDR: ${SOAPYSDR_INCLUDE_DIRS}, ${SOAPYSDR_LIBRARIES}")
else(SOAPYSDR_INCLUDE_DIRS AND SOAPYSDR_LIBRARIES)
set(SOAPYSDR_FOUND FALSE CACHE INTERNAL "libSOAPYSDR found")
message(STATUS "libSOAPYSDR not found.")
endif(SOAPYSDR_INCLUDE_DIRS AND SOAPYSDR_LIBRARIES)

mark_as_advanced(SOAPYSDR_LIBRARIES SOAPYSDR_INCLUDE_DIRS)

endif(NOT SOAPYSDR_FOUND)
21 changes: 18 additions & 3 deletions srslte/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,27 @@ if(NOT DisableBladeRF)
endif(BLADERF_FOUND)
endif(NOT DisableBladeRF)

if(BLADERF_FOUND OR UHD_FOUND)
find_package(SoapySDR)
if(SOAPYSDR_FOUND)
include_directories(${SOAPYSDR_INCLUDE_DIRS})
link_directories(${SOAPYSDR_LIBRARY_DIRS})
endif(SOAPYSDR_FOUND)


find_package(LimeSDR)
if(LIMESDR_FOUND)
include_directories(${LIMESDR_INCLUDE_DIRS})
link_directories(${LIMESDR_LIBRARY_DIRS})
endif(LIMESDR_FOUND)



if(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND)
set(RF_FOUND TRUE CACHE INTERNAL "RF frontend found")
else(BLADERF_FOUND OR UHD_FOUND)
else(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND)
set(RF_FOUND FALSE CACHE INTERNAL "RF frontend found")
add_definitions(-DDISABLE_RF)
endif(BLADERF_FOUND OR UHD_FOUND)
endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND)

include(CheckFunctionExistsMath)
if(${DISABLE_VOLK})
Expand Down
24 changes: 21 additions & 3 deletions srslte/examples/pdsch_ue.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ typedef struct {
int net_port;
char *net_address;
int net_port_signal;
char *net_address_signal;
char *net_address_signal;
int decimate;
}prog_args_t;

void args_default(prog_args_t *args) {
Expand Down Expand Up @@ -124,6 +125,7 @@ void args_default(prog_args_t *args) {
args->net_address = "127.0.0.1";
args->net_port_signal = -1;
args->net_address_signal = "127.0.0.1";
args->decimate = 0;
}

void usage(prog_args_t *args, char *prog) {
Expand Down Expand Up @@ -166,7 +168,7 @@ void usage(prog_args_t *args, char *prog) {
void parse_args(prog_args_t *args, int argc, char **argv) {
int opt;
args_default(args);
while ((opt = getopt(argc, argv, "aAoglipPcOCtdDnvrfuUsS")) != -1) {
while ((opt = getopt(argc, argv, "aAoglipPcOCtdDnvrfuUsSZ")) != -1) {
switch (opt) {
case 'i':
args->input_file_name = argv[optind];
Expand Down Expand Up @@ -234,6 +236,9 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
case 'v':
srslte_verbose++;
break;
case 'Z':
args->decimate = atoi(argv[optind]);
break;
default:
usage(args, argv[0]);
exit(-1);
Expand Down Expand Up @@ -289,6 +294,7 @@ srslte_netsink_t net_sink, net_sink_signal;

int main(int argc, char **argv) {
int ret;
int decimate = 1;
srslte_cell_t cell;
int64_t sf_cnt;
srslte_ue_mib_t ue_mib;
Expand Down Expand Up @@ -412,7 +418,19 @@ int main(int argc, char **argv) {

} else {
#ifndef DISABLE_RF
if (srslte_ue_sync_init_multi(&ue_sync, cell, srslte_rf_recv_wrapper, prog_args.rf_nof_rx_ant, (void*) &rf)) {
if(prog_args.decimate)
{
if(prog_args.decimate > 4 || prog_args.decimate < 0)
{
printf("Invalid decimation factor, setting to 1 \n");
}
else
{
decimate = prog_args.decimate;
//ue_sync.decimate = prog_args.decimate;
}
}
if (srslte_ue_sync_init_multi_decim(&ue_sync, cell, srslte_rf_recv_wrapper, prog_args.rf_nof_rx_ant, (void*) &rf,decimate)) {
fprintf(stderr, "Error initiating ue_sync\n");
exit(-1);
}
Expand Down
6 changes: 6 additions & 0 deletions srslte/include/srslte/fec/viterbi.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ SRSLTE_API int srslte_viterbi_init_sse(srslte_viterbi_t *q,
uint32_t max_frame_length,
bool tail_bitting);

SRSLTE_API int srslte_viterbi_init_neon(srslte_viterbi_t *q,
srslte_viterbi_type_t type,
int poly[3],
uint32_t max_frame_length,
bool tail_bitting);



#endif
15 changes: 13 additions & 2 deletions srslte/include/srslte/sync/pss.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "srslte/config.h"
#include "srslte/common/phy_common.h"
#include "srslte/utils/convolution.h"
#include "srslte/utils/filter.h"

#define CONVOLUTION_FFT

Expand All @@ -74,13 +75,17 @@ typedef struct SRSLTE_API {

#ifdef CONVOLUTION_FFT
srslte_conv_fft_cc_t conv_fft;
#endif
srslte_filt_cc_t filter;

#endif
int decimate;
uint32_t frame_size;
uint32_t N_id_2;
uint32_t fft_size;

cf_t *pss_signal_freq_full[3];

cf_t *pss_signal_time[3];

cf_t pss_signal_freq[3][SRSLTE_PSS_LEN]; // One sequence for each N_id_2
cf_t *tmp_input;
cf_t *conv_output;
Expand All @@ -102,6 +107,12 @@ SRSLTE_API int srslte_pss_synch_init_fft_offset(srslte_pss_synch_t *q,
uint32_t fft_size,
int cfo_i);

SRSLTE_API int srslte_pps_synch_init_fft_offset_decim(srslte_pss_synch_t *q,
uint32_t frame_size,
uint32_t fft_size,
int cfo_i,
int decimate);

SRSLTE_API int srslte_pss_synch_init(srslte_pss_synch_t *q,
uint32_t frame_size);

Expand Down
9 changes: 8 additions & 1 deletion srslte/include/srslte/sync/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ typedef struct SRSLTE_API {
srslte_sss_synch_t sss;
srslte_cp_synch_t cp_synch;
cf_t *cfo_i_corr[2];

int decimate;
float threshold;
float peak_value;
uint32_t N_id_2;
Expand Down Expand Up @@ -112,6 +112,13 @@ SRSLTE_API int srslte_sync_init(srslte_sync_t *q,
uint32_t max_offset,
uint32_t fft_size);

SRSLTE_API int srslte_sync_init_decim(srslte_sync_t *q,
uint32_t frame_size,
uint32_t max_offset,
uint32_t fft_size,
int decimate);


SRSLTE_API void srslte_sync_free(srslte_sync_t *q);

SRSLTE_API void srslte_sync_reset(srslte_sync_t *q);
Expand Down
9 changes: 8 additions & 1 deletion srslte/include/srslte/ue/ue_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ typedef struct SRSLTE_API {
srslte_agc_t agc;
bool do_agc;
uint32_t agc_period;

int decimate;
void *stream;
void *stream_single;
int (*recv_callback)(void*, cf_t*[SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*);
Expand Down Expand Up @@ -135,6 +135,13 @@ SRSLTE_API int srslte_ue_sync_init_multi(srslte_ue_sync_t *q,
uint32_t nof_rx_antennas,
void *stream_handler);

SRSLTE_API int srslte_ue_sync_init_multi_decim(srslte_ue_sync_t *q,
srslte_cell_t cell,
int (recv_callback)(void*, cf_t*[SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*),
uint32_t nof_rx_antennas,
void *stream_handler,
int decimate);

SRSLTE_API int srslte_ue_sync_init_file(srslte_ue_sync_t *q,
uint32_t nof_prb,
char *file_name,
Expand Down
9 changes: 9 additions & 0 deletions srslte/include/srslte/utils/convolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,28 @@ typedef struct SRSLTE_API {
srslte_dft_plan_t input_plan;
srslte_dft_plan_t filter_plan;
srslte_dft_plan_t output_plan;
//cf_t *pss_signal_time_fft[3]; // One sequence for each N_id_2
//cf_t *pss_signal_time[3];

}srslte_conv_fft_cc_t;

SRSLTE_API int srslte_conv_fft_cc_init(srslte_conv_fft_cc_t *q,
uint32_t input_len,
uint32_t filter_len);


SRSLTE_API void srslte_conv_fft_cc_free(srslte_conv_fft_cc_t *q);

SRSLTE_API uint32_t srslte_conv_fft_cc_run(srslte_conv_fft_cc_t *q,
cf_t *input,
cf_t *filter,
cf_t *output);

SRSLTE_API uint32_t srslte_conv_fft_cc_run_opt(srslte_conv_fft_cc_t *q,
cf_t *input,
cf_t *filter_freq,
cf_t *output);

SRSLTE_API uint32_t srslte_conv_cc(cf_t *input,
cf_t *filter,
cf_t *output,
Expand Down
60 changes: 60 additions & 0 deletions srslte/include/srslte/utils/filter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/

/******************************************************************************
* File: debug.h
*
* Description: Debug output utilities.
*
* Reference:
*****************************************************************************/

#ifndef FILTER_H
#define FILTER_H
#include <stdlib.h>
#include <stdio.h>
#include "srslte/config.h"
#include <stdbool.h>
#include "srslte/utils/vector.h"
typedef struct SRSLTE_API{
cf_t *filter_input;
cf_t *downsampled_input;
cf_t *filter_output;
bool is_decimator;
int factor;
int num_taps;
float *taps;

}srslte_filt_cc_t;

void srslte_filt_decim_cc_init(srslte_filt_cc_t *q, int factor, int order);

void srslte_filt_decim_cc_free(srslte_filt_cc_t *q);

void srslte_filt_decim_cc_execute(srslte_filt_cc_t *q, cf_t *input, cf_t *downsampled_input, cf_t *output, int size);

void srslte_downsample_cc(cf_t *input, cf_t *output, int M, int size) ;
#endif // FILTER_H
9 changes: 9 additions & 0 deletions srslte/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ if(RF_FOUND)
if(BLADERF_FOUND)
target_link_libraries(srslte ${BLADERF_LIBRARIES})
endif(BLADERF_FOUND)

if(LIMESDR_FOUND)
target_link_libraries(srslte ${LIMESDR_LIBRARIES})
endif(LIMESDR_FOUND)

if(SOAPYSDR_FOUND)
target_link_libraries(srslte ${SOAPYSDR_LIBRARIES})
endif(SOAPYSDR_FOUND)

endif(RF_FOUND)

if(VOLK_FOUND)
Expand Down
Loading

0 comments on commit a723b79

Please sign in to comment.