diff --git a/CMakeLists.txt b/CMakeLists.txt index d1389040e..ad7f6b782 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,6 @@ IF(MSVC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE ) - LIST(APPEND IRIS_CORE_COMMON_FLAGS_AND_DEFINES -DHAVE_CONFIG_H) ADD_DEFINITIONS(/MP) #build with multiple processors ENDIF(MSVC) @@ -87,52 +86,6 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -######################################################################## -# Setup Boost -######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Configuring Boost C++ Libraries...") -SET(BOOST_REQUIRED_COMPONENTS - program_options - system - thread - unit_test_framework -) - -IF(UNIX AND EXISTS "/usr/lib64") - LIST(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix -ENDIF(UNIX AND EXISTS "/usr/lib64") - -IF(MSVC) - SET(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking") - IF(BOOST_ALL_DYN_LINK) - ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc - ELSE(BOOST_ALL_DYN_LINK) - UNSET(BOOST_REQUIRED_COMPONENTS) #empty components list for static link - ENDIF(BOOST_ALL_DYN_LINK) -ENDIF(MSVC) - -SET(Boost_ADDITIONAL_VERSIONS - "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" "1.40.0" "1.40" - "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" - "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" "1.45.0" "1.45" - "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" - "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53") -FIND_PACKAGE(Boost 1.37 REQUIRED ${BOOST_REQUIRED_COMPONENTS}) -MESSAGE(STATUS "Boost version: ${Boost_VERSION}") - -IF(Boost_VERSION LESS 104600) - ADD_DEFINITIONS( -DBOOST_FILESYSTEM_VERSION=2 ) #use filesystem version 2 in boost < 1.46 - MESSAGE(STATUS "Using Boost Filesystem V2") -ENDIF(Boost_VERSION LESS 104600) - -INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) - -MESSAGE(STATUS "Boost include directories: ${Boost_INCLUDE_DIRS}") -MESSAGE(STATUS "Boost library directories: ${Boost_LIBRARY_DIRS}") -MESSAGE(STATUS "Boost libraries: ${Boost_LIBRARIES}") - ######################################################################## # Create uninstall targets diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6d535f4ed..a93eda319 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -19,7 +19,9 @@ # and at http://www.gnu.org/licenses/. # +################################################################# # TO BE MOVED TO UNIT TESTS +################################################################# add_executable(hl_example hl_example.c) target_link_libraries(hl_example lte) @@ -39,20 +41,47 @@ target_link_libraries(viterbi_test lte) add_executable(mib_test mib_test.c) target_link_libraries(mib_test lte) + +################################################################# +# Check if UHD C-API and Graphics library are available +################################################################# + LIST(FIND OPTIONAL_LIBS cuhd CUHD_FIND) LIST(FIND OPTIONAL_LIBS graphics GRAPHICS_FIND) +################################################################# +# These two can be compiled without UHD or graphics support +################################################################# + +add_executable(mib_track mib_track.c) +target_link_libraries(mib_track lte) + +add_executable(enodeb_bch enodeb_bch.c) +target_link_libraries(enodeb_bch lte) + +IF(${CUHD_FIND} EQUAL -1) + SET_TARGET_PROPERTIES(mib_track PROPERTIES COMPILE_DEFINITIONS "DISABLE_UHD") + SET_TARGET_PROPERTIES(enodeb_bch PROPERTIES COMPILE_DEFINITIONS "DISABLE_UHD") +ELSE(${CUHD_FIND} EQUAL -1) + target_link_libraries(mib_track cuhd) + target_link_libraries(enodeb_bch cuhd) +ENDIF(${CUHD_FIND} EQUAL -1) + +IF(${GRAPHICS_FIND} EQUAL -1) + SET_TARGET_PROPERTIES(mib_track PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS") + SET_TARGET_PROPERTIES(enodeb_bch PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS") +ELSE(${GRAPHICS_FIND} EQUAL -1) + target_link_libraries(mib_track graphics) + target_link_libraries(enodeb_bch graphics) +ENDIF(${GRAPHICS_FIND} EQUAL -1) + + + +################################################################# +# These examples need the UHD driver +################################################################# IF(${CUHD_FIND} GREATER -1) - IF(${GRAPHICS_FIND} GREATER -1) - add_executable(mib_track mib_track.c) - target_link_libraries(mib_track lte cuhd graphics) - ELSE(${GRAPHICS_FIND} GREATER -1) - MESSAGE(STATUS " mib_track is ignored: GRAPHICS library not compiled.") - ENDIF(${GRAPHICS_FIND} GREATER -1) - - add_executable(enodeb_bch enodeb_bch.c) - target_link_libraries(enodeb_bch lte cuhd ) add_executable(rssi_scan_usrp rssi_scan_usrp.c) target_link_libraries(rssi_scan_usrp lte cuhd ) diff --git a/examples/enodeb_bch.c b/examples/enodeb_bch.c index e92fe1e77..133bfe568 100644 --- a/examples/enodeb_bch.c +++ b/examples/enodeb_bch.c @@ -33,11 +33,9 @@ #include "lte.h" -#define ENABLE_UHD - -#ifdef ENABLE_UHD -#include "cuhd.h" -void *uhd; +#ifndef DISABLE_UHD + #include "cuhd.h" + void *uhd; #endif char *output_file_name = NULL; @@ -59,10 +57,14 @@ int slot_n_re, slot_n_samples; void usage(char *prog) { printf("Usage: %s [agmfoncvp]\n", prog); +#ifndef DISABLE_UHD printf("\t-a UHD args [Default %s]\n", uhd_args); printf("\t-g UHD TX gain [Default %.2f dB]\n", uhd_gain); printf("\t-m UHD signal amplitude [Default %.2f]\n", uhd_amp); printf("\t-f UHD TX frequency [Default %.1f MHz]\n", uhd_freq/1000000); +#else + printf("\t UHD is disabled. CUHD library not available\n"); +#endif printf("\t-o output_file [Default USRP]\n"); printf("\t-n number of frames [Default %d]\n", nof_frames); printf("\t-c cell id [Default %d]\n", cell_id); @@ -106,7 +108,7 @@ void parse_args(int argc, char **argv) { exit(-1); } } -#ifndef ENABLE_UHD +#ifdef DISABLE_UHD if (!output_file_name) { usage(argv[0]); exit(-1); @@ -133,16 +135,18 @@ void base_init() { exit(-1); } } else { -#ifdef ENABLE_UHD +#ifndef DISABLE_UHD printf("Opening UHD device...\n"); if (cuhd_open(uhd_args,&uhd)) { fprintf(stderr, "Error opening uhd\n"); exit(-1); } #else - exit(-1); // not supposed to be here + printf("Error UHD not available. Select an output file\n"); + exit(-1); #endif } + /* create ifft object */ if (lte_ifft_init(&ifft, CPNORM, nof_prb)) { fprintf(stderr, "Error creating iFFT object\n"); @@ -169,7 +173,7 @@ void base_free() { if (output_file_name) { filesink_free(&fsink); } else { -#ifdef ENABLE_UHD +#ifndef DISABLE_UHD cuhd_close(&uhd); #endif } @@ -186,7 +190,7 @@ int main(int argc, char **argv) { cf_t *slot1_symbols[MAX_PORTS_CTRL]; -#ifndef ENABLE_UHD +#ifdef DISABLE_UHD if (argc < 3) { usage(argv[0]); exit(-1); @@ -224,7 +228,7 @@ int main(int argc, char **argv) { slot1_symbols[i] = slot_buffer; } -#ifdef ENABLE_UHD +#ifndef DISABLE_UHD if (!output_file_name) { printf("Set TX rate: %.2f MHz\n", cuhd_set_tx_srate(uhd, UHD_SAMP_FREQ)/1000000); printf("Set TX gain: %.1f dB\n", cuhd_set_tx_gain(uhd, uhd_gain)); @@ -260,8 +264,9 @@ int main(int argc, char **argv) { /* send to file or usrp */ if (output_file_name) { filesink_write(&fsink, output_buffer, slot_n_samples); + usleep(5000); } else { -#ifdef ENABLE_UHD +#ifndef DISABLE_UHD vec_sc_prod_cfc(output_buffer, uhd_amp, output_buffer, slot_n_samples); cuhd_send(uhd, output_buffer, slot_n_samples, 1); #endif diff --git a/examples/mib_track.c b/examples/mib_track.c index 6273f7032..29d31d422 100644 --- a/examples/mib_track.c +++ b/examples/mib_track.c @@ -35,12 +35,19 @@ #include #include +#include "lte.h" + #ifndef DISABLE_UHD -#include "cuhd.h" + #include "cuhd.h" + void *uhd; #endif -#include "lte.h" -#include "plot.h" +#ifndef DISABLE_GRAPHICS + #include "plot.h" + plot_real_t poutfft; + plot_complex_t pce; + plot_scatter_t pscatrecv, pscatequal; +#endif #define MHZ 1000000 #define SAMP_FREQ 1920000 @@ -66,22 +73,25 @@ chest_t chest; sync_t sfind, strack; cfo_t cfocorr; -plot_real_t poutfft; -plot_complex_t pce; -plot_scatter_t pscatrecv, pscatequal; - -void *uhd; enum sync_state {FIND, TRACK}; void usage(char *prog) { printf("Usage: %s [iagfndv]\n", prog); printf("\t-i input_file [Default use USRP]\n"); +#ifndef DISABLE_UHD printf("\t-a UHD args [Default %s]\n", uhd_args); printf("\t-g UHD RX gain [Default %.2f dB]\n", uhd_gain); printf("\t-f UHD RX frequency [Default %.1f MHz]\n", uhd_freq/1000000); +#else + printf("\t UHD is disabled. CUHD library not available\n"); +#endif printf("\t-n nof_frames [Default %d]\n", nof_frames); +#ifndef DISABLE_GRAPHICS printf("\t-d disable plots [Default enabled]\n"); +#else + printf("\t plots are disabled. Graphics library not available\n"); +#endif printf("\t-v [set verbose to debug, default none]\n"); } @@ -117,6 +127,8 @@ void parse_args(int argc, char **argv) { } } +#ifndef DISABLE_GRAPHICS + void init_plots() { plot_init(); plot_real_init(&poutfft); @@ -141,15 +153,20 @@ void init_plots() { plot_scatter_setTitle(&pscatequal, "Equalized Symbols"); plot_scatter_setXAxisScale(&pscatequal, -1, 1); plot_scatter_setYAxisScale(&pscatequal, -1, 1); - } +#endif + int base_init(int frame_length) { int i; +#ifndef DISABLE_GRAPHICS if (!disable_plots) { init_plots(); } +#else + printf("-- PLOTS are disabled. Graphics library not available --\n\n"); +#endif if (input_file_name) { if (filesource_init(&fsrc, input_file_name, COMPLEX_FLOAT_BIN)) { @@ -164,7 +181,7 @@ int base_init(int frame_length) { return -1; } #else - printf("Error UHD not configured. Select an input file\n"); + printf("Error UHD not available. Select an input file\n"); return -1; #endif } @@ -257,7 +274,6 @@ int mib_decoder_init(int cell_id) { int mib_decoder_run(cf_t *input, pbch_mib_t *mib) { int i, n; lte_fft_run(&fft, input, fft_buffer); - float tmp[72*7]; /* Get channel estimates for each port */ for (i=0;i #include #include -#include "irisapi/Exceptions.h" - +#include class WaterfallData :public QwtRasterData @@ -34,8 +33,7 @@ public: void appendData(double* data, int n) { - if(n != nData_) - throw iris::InvalidDataException("WaterfallData: invalid data length"); + assert(n == nData_); VecPtr v = data_.front(); v->assign(data, data+n); diff --git a/graphics/lib/complexplot/ComplexWidget.cpp b/graphics/lib/complexplot/ComplexWidget.cpp index da56a3aaa..39646fc37 100644 --- a/graphics/lib/complexplot/ComplexWidget.cpp +++ b/graphics/lib/complexplot/ComplexWidget.cpp @@ -4,10 +4,8 @@ #include #include -#include using namespace std; -namespace bl = boost::lambda; ComplexWidget::ComplexWidget(QWidget *parent) :QWidget(parent) diff --git a/graphics/lib/realplot/RealWidget.cpp b/graphics/lib/realplot/RealWidget.cpp index ce53fa7fa..85b10844d 100644 --- a/graphics/lib/realplot/RealWidget.cpp +++ b/graphics/lib/realplot/RealWidget.cpp @@ -4,10 +4,8 @@ #include #include -#include using namespace std; -namespace bl = boost::lambda; RealWidget::RealWidget(QWidget *parent) :QWidget(parent) diff --git a/graphics/lib/scatterplot/ScatterWidget.cpp b/graphics/lib/scatterplot/ScatterWidget.cpp index 268bf49a4..f3f3542a6 100644 --- a/graphics/lib/scatterplot/ScatterWidget.cpp +++ b/graphics/lib/scatterplot/ScatterWidget.cpp @@ -4,7 +4,6 @@ #include #include -#include using namespace std; diff --git a/graphics/lib/waterfallplot/WaterfallWidget.cpp b/graphics/lib/waterfallplot/WaterfallWidget.cpp index a3d789bcd..89846f04b 100644 --- a/graphics/lib/waterfallplot/WaterfallWidget.cpp +++ b/graphics/lib/waterfallplot/WaterfallWidget.cpp @@ -6,10 +6,8 @@ #include #include #include -#include using namespace std; -namespace bl = boost::lambda; WaterfallWidget::WaterfallWidget(int numDataPoints, int numRows, QWidget *parent)