1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

Merge branch 'labsat3w_unpack_fix' of https://github.com/jeffmelville/gnss-sdr into jeffmelville-labsat3w_unpack_fix

This commit is contained in:
Carles Fernandez 2022-12-05 13:14:51 +01:00
commit 38341c351b
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -21,6 +21,7 @@
#include "INIReader.h" #include "INIReader.h"
#include "command_event.h" #include "command_event.h"
#include "gnss_sdr_make_unique.h" #include "gnss_sdr_make_unique.h"
#include <boost/endian/conversion.hpp>
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <algorithm> #include <algorithm>
#include <array> #include <array>
@ -737,7 +738,8 @@ void labsat23_source::decode_ls3w_register(uint64_t input, std::vector<gr_comple
{ {
std::bitset<64> bs(input); std::bitset<64> 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) for (std::size_t i = 0; i < 32; ++i)
{ {
bool t = bs[i]; bool t = bs[i];
@ -1074,14 +1076,10 @@ int labsat23_source::general_work(int noutput_items,
std::size_t output_pointer = 0; std::size_t output_pointer = 0;
for (int i = 0; i < registers_to_read; i++) for (int i = 0; i < registers_to_read; i++)
{ {
std::array<char, 8> memory_block{};
binary_input_file.read(memory_block.data(), 8);
uint64_t read_register = 0ULL; uint64_t read_register = 0ULL;
for (int k = 7; k >= 0; --k) // Labsat3W writes its 64-bit shift register to files in little endian. Read and convert to host endianness.
{ binary_input_file.read(reinterpret_cast<char *>(&read_register), sizeof(read_register));
read_register <<= 8; boost::endian::little_to_native_inplace(read_register);
read_register |= uint64_t(memory_block[k]);
}
if (binary_input_file.gcount() == 8) if (binary_input_file.gcount() == 8)
{ {