diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index ab24d5fc1..717b8ac00 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -6,48 +6,41 @@ # Optional drivers -set(OPT_DRIVER_SOURCES "") -set(OPT_DRIVER_HEADERS "") if(ENABLE_RAW_UDP AND PCAP_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} custom_udp_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} custom_udp_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES custom_udp_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS custom_udp_signal_source.h) endif() - if(ENABLE_PLUTOSDR) ############################################## # ADALM-PLUTO (Analog Devices Inc.) ############################################## - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} plutosdr_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES plutosdr_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS plutosdr_signal_source.h) endif() - if(ENABLE_FMCOMMS2) ############################################### # FMCOMMS2 based SDR Hardware ############################################### - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} fmcomms2_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES fmcomms2_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS fmcomms2_signal_source.h) endif() - if(ENABLE_AD9361) ############################################### # AD9361 DIRECT TO FPGA Hardware ############################################### - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ad9361_fpga_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad9361_fpga_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES ad9361_fpga_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS ad9361_fpga_signal_source.h) endif() - if(ENABLE_FLEXIBAND AND TELEORBIT_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} flexiband_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} flexiband_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES flexiband_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS flexiband_signal_source.h) endif() - if(ENABLE_ARRAY) ############################################## # DBFCTTC GNSS EXPERIMENTAL ARRAY PROTOTYPE @@ -56,32 +49,30 @@ if(ENABLE_ARRAY) message(" gr-dbfcttc not found, install it from https://github.com/gnss-sdr/gr-dbfcttc") message(FATAL_ERROR "gr-dbfcttc required for building gnss-sdr with this option enabled") endif() - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} raw_array_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} raw_array_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES raw_array_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS raw_array_signal_source.h) endif() - if(ENABLE_OSMOSDR) ################################################################################ # OsmoSDR - https://osmocom.org/projects/gr-osmosdr/ ################################################################################ if(GROSMOSDR_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} osmosdr_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} osmosdr_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES osmosdr_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS osmosdr_signal_source.h) endif() endif() if(ENABLE_LIMESDR) if(GRLIMESDR_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} limesdr_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} limesdr_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES limesdr_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS limesdr_signal_source.h) endif() endif() - if(ENABLE_UHD) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} uhd_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES uhd_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS uhd_signal_source.h) endif() if(ENABLE_ZMQ) @@ -89,7 +80,6 @@ if(ENABLE_ZMQ) list(APPEND OPT_DRIVER_HEADERS zmq_signal_source.h) endif() - set(SIGNAL_SOURCE_ADAPTER_SOURCES signal_source_base.cc file_source_base.cc @@ -218,7 +208,6 @@ if(ENABLE_LIMESDR AND GRLIMESDR_FOUND) ) endif() - if(ENABLE_AD9361 AND LIBIIO_FOUND) target_link_libraries(signal_source_adapters PRIVATE @@ -302,8 +291,6 @@ target_compile_definitions(signal_source_adapters PRIVATE -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}" ) - - set_property(TARGET signal_source_adapters APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc index ea92274f3..dafa79e37 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc @@ -32,6 +32,10 @@ #include #include +#if HAS_BOOST_ENDIAN +#include +#endif + labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, const std::vector &channel_selector, Concurrent_Queue *queue, bool digital_io_enabled) { @@ -737,7 +741,8 @@ void labsat23_source::decode_ls3w_register(uint64_t input, std::vector bs(input); - // Reverse, since register are written to file as 64-bit little endian words + // Earlier samples are written in the MSBs of the register. Bit-reverse the register + // for easier indexing. Note this bit-reverses individual samples as well for quant > 1 bit for (std::size_t i = 0; i < 32; ++i) { bool t = bs[i]; @@ -1074,14 +1079,20 @@ int labsat23_source::general_work(int noutput_items, std::size_t output_pointer = 0; for (int i = 0; i < registers_to_read; i++) { + uint64_t read_register = 0ULL; + // Labsat3W writes its 64-bit shift register to files in little endian. Read and convert to host endianness. +#if HAS_BOOST_ENDIAN + binary_input_file.read(reinterpret_cast(&read_register), sizeof(read_register)); + boost::endian::little_to_native_inplace(read_register); +#else std::array memory_block{}; binary_input_file.read(memory_block.data(), 8); - uint64_t read_register = 0ULL; for (int k = 7; k >= 0; --k) { read_register <<= 8; - read_register |= uint64_t(memory_block[k]); + read_register |= uint64_t(memory_block[k]); // This is buggy if the MSB of the char is set. } +#endif if (binary_input_file.gcount() == 8) {