mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
Add more extensive use of cstdint typenames
This commit is contained in:
parent
4a2ba1cff0
commit
65a0804084
@ -39,7 +39,7 @@
|
|||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Channel::Channel(ConfigurationInterface* configuration, unsigned int channel,
|
Channel::Channel(ConfigurationInterface* configuration, uint32_t channel,
|
||||||
std::shared_ptr<GNSSBlockInterface> pass_through, std::shared_ptr<AcquisitionInterface> acq,
|
std::shared_ptr<GNSSBlockInterface> pass_through, std::shared_ptr<AcquisitionInterface> acq,
|
||||||
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
|
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
|
||||||
std::string role, std::string implementation, gr::msg_queue::sptr queue)
|
std::string role, std::string implementation, gr::msg_queue::sptr queue)
|
||||||
@ -76,9 +76,9 @@ Channel::Channel(ConfigurationInterface* configuration, unsigned int channel,
|
|||||||
|
|
||||||
// IMPORTANT: Do not change the order between set_doppler_step and set_threshold
|
// IMPORTANT: Do not change the order between set_doppler_step and set_threshold
|
||||||
|
|
||||||
unsigned int doppler_step = configuration->property("Acquisition_" + implementation_ + boost::lexical_cast<std::string>(channel_) + ".doppler_step", 0);
|
uint32_t doppler_step = configuration->property("Acquisition_" + implementation_ + boost::lexical_cast<std::string>(channel_) + ".doppler_step", 0);
|
||||||
if (doppler_step == 0) doppler_step = configuration->property("Acquisition_" + implementation_ + ".doppler_step", 500);
|
if (doppler_step == 0) doppler_step = configuration->property("Acquisition_" + implementation_ + ".doppler_step", 500);
|
||||||
if (FLAGS_doppler_step != 0) doppler_step = static_cast<unsigned int>(FLAGS_doppler_step);
|
if (FLAGS_doppler_step != 0) doppler_step = static_cast<uint32_t>(FLAGS_doppler_step);
|
||||||
DLOG(INFO) << "Channel " << channel_ << " Doppler_step = " << doppler_step;
|
DLOG(INFO) << "Channel " << channel_ << " Doppler_step = " << doppler_step;
|
||||||
|
|
||||||
acq_->set_doppler_step(doppler_step);
|
acq_->set_doppler_step(doppler_step);
|
||||||
|
@ -60,7 +60,7 @@ class Channel : public ChannelInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
Channel(ConfigurationInterface* configuration, unsigned int channel,
|
Channel(ConfigurationInterface* configuration, uint32_t channel,
|
||||||
std::shared_ptr<GNSSBlockInterface> pass_through, std::shared_ptr<AcquisitionInterface> acq,
|
std::shared_ptr<GNSSBlockInterface> pass_through, std::shared_ptr<AcquisitionInterface> acq,
|
||||||
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
|
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
|
||||||
std::string role, std::string implementation, gr::msg_queue::sptr queue);
|
std::string role, std::string implementation, gr::msg_queue::sptr queue);
|
||||||
@ -99,7 +99,7 @@ private:
|
|||||||
std::string role_;
|
std::string role_;
|
||||||
std::string implementation_;
|
std::string implementation_;
|
||||||
bool flag_enable_fpga;
|
bool flag_enable_fpga;
|
||||||
unsigned int channel_;
|
uint32_t channel_;
|
||||||
Gnss_Synchro gnss_synchro_;
|
Gnss_Synchro gnss_synchro_;
|
||||||
Gnss_Signal gnss_signal_;
|
Gnss_Signal gnss_signal_;
|
||||||
bool connected_;
|
bool connected_;
|
||||||
|
@ -39,16 +39,16 @@ ChannelFsm::ChannelFsm()
|
|||||||
{
|
{
|
||||||
acq_ = nullptr;
|
acq_ = nullptr;
|
||||||
trk_ = nullptr;
|
trk_ = nullptr;
|
||||||
channel_ = 0;
|
channel_ = 0U;
|
||||||
d_state = 0;
|
d_state = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) : acq_(acquisition)
|
ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) : acq_(acquisition)
|
||||||
{
|
{
|
||||||
trk_ = nullptr;
|
trk_ = nullptr;
|
||||||
channel_ = 0;
|
channel_ = 0U;
|
||||||
d_state = 0;
|
d_state = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ bool ChannelFsm::Event_failed_tracking_standby()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_state = 0;
|
d_state = 0U;
|
||||||
notify_stop_tracking();
|
notify_stop_tracking();
|
||||||
DLOG(INFO) << "CH = " << channel_ << ". Ev failed tracking standby";
|
DLOG(INFO) << "CH = " << channel_ << ". Ev failed tracking standby";
|
||||||
return true;
|
return true;
|
||||||
@ -158,7 +158,7 @@ void ChannelFsm::set_queue(gr::msg_queue::sptr queue)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChannelFsm::set_channel(unsigned int channel)
|
void ChannelFsm::set_channel(uint32_t channel)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lk(mx);
|
std::lock_guard<std::mutex> lk(mx);
|
||||||
channel_ = channel;
|
channel_ = channel;
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "tracking_interface.h"
|
#include "tracking_interface.h"
|
||||||
#include "telemetry_decoder_interface.h"
|
#include "telemetry_decoder_interface.h"
|
||||||
#include <gnuradio/msg_queue.h>
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ public:
|
|||||||
void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
|
void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
|
||||||
void set_tracking(std::shared_ptr<TrackingInterface> tracking);
|
void set_tracking(std::shared_ptr<TrackingInterface> tracking);
|
||||||
void set_queue(gr::msg_queue::sptr queue);
|
void set_queue(gr::msg_queue::sptr queue);
|
||||||
void set_channel(unsigned int channel);
|
void set_channel(uint32_t channel);
|
||||||
|
|
||||||
//FSM EVENTS
|
//FSM EVENTS
|
||||||
bool Event_start_acquisition();
|
bool Event_start_acquisition();
|
||||||
@ -70,8 +71,8 @@ private:
|
|||||||
std::shared_ptr<AcquisitionInterface> acq_;
|
std::shared_ptr<AcquisitionInterface> acq_;
|
||||||
std::shared_ptr<TrackingInterface> trk_;
|
std::shared_ptr<TrackingInterface> trk_;
|
||||||
gr::msg_queue::sptr queue_;
|
gr::msg_queue::sptr queue_;
|
||||||
unsigned int channel_;
|
uint32_t channel_;
|
||||||
unsigned int d_state;
|
uint32_t d_state;
|
||||||
std::mutex mx;
|
std::mutex mx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn)
|
void galileo_e1_code_gen_int(int* _dest, char _Signal[3], int32_t _prn)
|
||||||
{
|
{
|
||||||
std::string _galileo_signal = _Signal;
|
std::string _galileo_signal = _Signal;
|
||||||
signed int prn = _prn - 1;
|
int32_t prn = _prn - 1;
|
||||||
int index = 0;
|
int32_t index = 0;
|
||||||
|
|
||||||
/* A simple error check */
|
/* A simple error check */
|
||||||
if ((_prn < 1) || (_prn > 50))
|
if ((_prn < 1) || (_prn > 50))
|
||||||
@ -67,17 +67,17 @@ void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1_sinboc_11_gen_int(int* _dest, int* _prn, unsigned int _length_out)
|
void galileo_e1_sinboc_11_gen_int(int* _dest, int* _prn, uint32_t _length_out)
|
||||||
{
|
{
|
||||||
const unsigned int _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
const uint32_t _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||||
unsigned int _period = static_cast<unsigned int>(_length_out / _length_in);
|
uint32_t _period = static_cast<uint32_t>(_length_out / _length_in);
|
||||||
for (unsigned int i = 0; i < _length_in; i++)
|
for (uint32_t i = 0; i < _length_in; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < (_period / 2); j++)
|
for (uint32_t j = 0; j < (_period / 2); j++)
|
||||||
{
|
{
|
||||||
_dest[i * _period + j] = _prn[i];
|
_dest[i * _period + j] = _prn[i];
|
||||||
}
|
}
|
||||||
for (unsigned int j = (_period / 2); j < _period; j++)
|
for (uint32_t j = (_period / 2); j < _period; j++)
|
||||||
{
|
{
|
||||||
_dest[i * _period + j] = -_prn[i];
|
_dest[i * _period + j] = -_prn[i];
|
||||||
}
|
}
|
||||||
@ -85,53 +85,55 @@ void galileo_e1_sinboc_11_gen_int(int* _dest, int* _prn, unsigned int _length_ou
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1_sinboc_61_gen_int(int* _dest, int* _prn, unsigned int _length_out)
|
void galileo_e1_sinboc_61_gen_int(int* _dest, int* _prn, uint32_t _length_out)
|
||||||
{
|
{
|
||||||
const unsigned int _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
const uint32_t _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||||
unsigned int _period = static_cast<unsigned int>(_length_out / _length_in);
|
uint32_t _period = static_cast<uint32_t>(_length_out / _length_in);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < _length_in; i++)
|
for (uint32_t i = 0; i < _length_in; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < _period; j += 2)
|
for (uint32_t j = 0; j < _period; j += 2)
|
||||||
{
|
{
|
||||||
_dest[i * _period + j] = _prn[i];
|
_dest[i * _period + j] = _prn[i];
|
||||||
}
|
}
|
||||||
for (unsigned int j = 1; j < _period; j += 2)
|
for (uint32_t j = 1; j < _period; j += 2)
|
||||||
{
|
{
|
||||||
_dest[i * _period + j] = -_prn[i];
|
_dest[i * _period + j] = -_prn[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], unsigned int _prn)
|
|
||||||
|
void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], uint32_t _prn)
|
||||||
{
|
{
|
||||||
std::string _galileo_signal = _Signal;
|
std::string _galileo_signal = _Signal;
|
||||||
unsigned int _codeLength = static_cast<unsigned int>(Galileo_E1_B_CODE_LENGTH_CHIPS);
|
uint32_t _codeLength = static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS);
|
||||||
int primary_code_E1_chips[4092]; // _codeLength not accepted by Clang
|
int32_t primary_code_E1_chips[4092]; // _codeLength not accepted by Clang
|
||||||
galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip
|
galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip
|
||||||
for (unsigned int i = 0; i < _codeLength; i++)
|
for (uint32_t i = 0; i < _codeLength; i++)
|
||||||
{
|
{
|
||||||
_dest[2 * i] = static_cast<float>(primary_code_E1_chips[i]);
|
_dest[2 * i] = static_cast<float>(primary_code_E1_chips[i]);
|
||||||
_dest[2 * i + 1] = -_dest[2 * i];
|
_dest[2 * i + 1] = -_dest[2 * i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1_gen_float(float* _dest, int* _prn, char _Signal[3])
|
void galileo_e1_gen_float(float* _dest, int* _prn, char _Signal[3])
|
||||||
{
|
{
|
||||||
std::string _galileo_signal = _Signal;
|
std::string _galileo_signal = _Signal;
|
||||||
const unsigned int _codeLength = 12 * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
const uint32_t _codeLength = 12 * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||||
const float alpha = sqrt(10.0 / 11.0);
|
const float alpha = sqrt(10.0 / 11.0);
|
||||||
const float beta = sqrt(1.0 / 11.0);
|
const float beta = sqrt(1.0 / 11.0);
|
||||||
|
|
||||||
int sinboc_11[12 * 4092]; // _codeLength not accepted by Clang
|
int32_t sinboc_11[12 * 4092]; // _codeLength not accepted by Clang
|
||||||
int sinboc_61[12 * 4092];
|
int32_t sinboc_61[12 * 4092];
|
||||||
|
|
||||||
galileo_e1_sinboc_11_gen_int(sinboc_11, _prn, _codeLength); //generate sinboc(1,1) 12 samples per chip
|
galileo_e1_sinboc_11_gen_int(sinboc_11, _prn, _codeLength); //generate sinboc(1,1) 12 samples per chip
|
||||||
galileo_e1_sinboc_61_gen_int(sinboc_61, _prn, _codeLength); //generate sinboc(6,1) 12 samples per chip
|
galileo_e1_sinboc_61_gen_int(sinboc_61, _prn, _codeLength); //generate sinboc(6,1) 12 samples per chip
|
||||||
|
|
||||||
if (_galileo_signal.rfind("1B") != std::string::npos && _galileo_signal.length() >= 2)
|
if (_galileo_signal.rfind("1B") != std::string::npos && _galileo_signal.length() >= 2)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < _codeLength; i++)
|
for (uint32_t i = 0; i < _codeLength; i++)
|
||||||
{
|
{
|
||||||
_dest[i] = alpha * static_cast<float>(sinboc_11[i]) +
|
_dest[i] = alpha * static_cast<float>(sinboc_11[i]) +
|
||||||
beta * static_cast<float>(sinboc_61[i]);
|
beta * static_cast<float>(sinboc_61[i]);
|
||||||
@ -139,7 +141,7 @@ void galileo_e1_gen_float(float* _dest, int* _prn, char _Signal[3])
|
|||||||
}
|
}
|
||||||
else if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2)
|
else if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < _codeLength; i++)
|
for (uint32_t i = 0; i < _codeLength; i++)
|
||||||
{
|
{
|
||||||
_dest[i] = alpha * static_cast<float>(sinboc_11[i]) -
|
_dest[i] = alpha * static_cast<float>(sinboc_11[i]) -
|
||||||
beta * static_cast<float>(sinboc_61[i]);
|
beta * static_cast<float>(sinboc_61[i]);
|
||||||
@ -149,19 +151,19 @@ void galileo_e1_gen_float(float* _dest, int* _prn, char _Signal[3])
|
|||||||
|
|
||||||
|
|
||||||
void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
||||||
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift,
|
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift,
|
||||||
bool _secondary_flag)
|
bool _secondary_flag)
|
||||||
{
|
{
|
||||||
// This function is based on the GNU software GPS for MATLAB in Kay Borre's book
|
// This function is based on the GNU software GPS for MATLAB in Kay Borre's book
|
||||||
std::string _galileo_signal = _Signal;
|
std::string _galileo_signal = _Signal;
|
||||||
unsigned int _samplesPerCode;
|
uint32_t _samplesPerCode;
|
||||||
const int _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz
|
const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz
|
||||||
unsigned int _codeLength = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
uint32_t _codeLength = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||||
int primary_code_E1_chips[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)];
|
int32_t primary_code_E1_chips[static_cast<int32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS)];
|
||||||
_samplesPerCode = static_cast<unsigned int>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
_samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||||
const int _samplesPerChip = (_cboc == true) ? 12 : 2;
|
const int32_t _samplesPerChip = (_cboc == true) ? 12 : 2;
|
||||||
|
|
||||||
const unsigned int delay = ((static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS) - _chip_shift) % static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)) * _samplesPerCode / Galileo_E1_B_CODE_LENGTH_CHIPS;
|
const uint32_t delay = ((static_cast<int32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS) - _chip_shift) % static_cast<int32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS)) * _samplesPerCode / Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||||
|
|
||||||
galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip
|
galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip
|
||||||
|
|
||||||
@ -176,10 +178,10 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int _signal_E1_int[_codeLength];
|
int32_t _signal_E1_int[_codeLength];
|
||||||
galileo_e1_sinboc_11_gen_int(_signal_E1_int, primary_code_E1_chips, _codeLength); //generate sinboc(1,1) 2 samples per chip
|
galileo_e1_sinboc_11_gen_int(_signal_E1_int, primary_code_E1_chips, _codeLength); //generate sinboc(1,1) 2 samples per chip
|
||||||
|
|
||||||
for (unsigned int ii = 0; ii < _codeLength; ++ii)
|
for (uint32_t ii = 0; ii < _codeLength; ++ii)
|
||||||
{
|
{
|
||||||
_signal_E1[ii] = static_cast<float>(_signal_E1_int[ii]);
|
_signal_E1[ii] = static_cast<float>(_signal_E1_int[ii]);
|
||||||
}
|
}
|
||||||
@ -197,9 +199,9 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
|||||||
|
|
||||||
if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2 && _secondary_flag)
|
if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2 && _secondary_flag)
|
||||||
{
|
{
|
||||||
float* _signal_E1C_secondary = new float[static_cast<int>(Galileo_E1_C_SECONDARY_CODE_LENGTH) * _samplesPerCode];
|
float* _signal_E1C_secondary = new float[static_cast<int32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH) * _samplesPerCode];
|
||||||
|
|
||||||
for (unsigned int i = 0; i < static_cast<unsigned int>(Galileo_E1_C_SECONDARY_CODE_LENGTH); i++)
|
for (uint32_t i = 0; i < static_cast<uint32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH); i++)
|
||||||
{
|
{
|
||||||
for (unsigned k = 0; k < _samplesPerCode; k++)
|
for (unsigned k = 0; k < _samplesPerCode; k++)
|
||||||
{
|
{
|
||||||
@ -207,13 +209,13 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_samplesPerCode *= static_cast<int>(Galileo_E1_C_SECONDARY_CODE_LENGTH);
|
_samplesPerCode *= static_cast<int32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH);
|
||||||
|
|
||||||
delete[] _signal_E1;
|
delete[] _signal_E1;
|
||||||
_signal_E1 = _signal_E1C_secondary;
|
_signal_E1 = _signal_E1C_secondary;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < _samplesPerCode; i++)
|
for (uint32_t i = 0; i < _samplesPerCode; i++)
|
||||||
{
|
{
|
||||||
_dest[(i + delay) % _samplesPerCode] = _signal_E1[i];
|
_dest[(i + delay) % _samplesPerCode] = _signal_E1[i];
|
||||||
}
|
}
|
||||||
@ -223,24 +225,24 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
|||||||
|
|
||||||
|
|
||||||
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
||||||
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift,
|
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift,
|
||||||
bool _secondary_flag)
|
bool _secondary_flag)
|
||||||
{
|
{
|
||||||
std::string _galileo_signal = _Signal;
|
std::string _galileo_signal = _Signal;
|
||||||
const int _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz
|
const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz
|
||||||
unsigned int _samplesPerCode = static_cast<unsigned int>(static_cast<double>(_fs) /
|
uint32_t _samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) /
|
||||||
(static_cast<double>(_codeFreqBasis) / static_cast<double>(Galileo_E1_B_CODE_LENGTH_CHIPS)));
|
(static_cast<double>(_codeFreqBasis) / static_cast<double>(Galileo_E1_B_CODE_LENGTH_CHIPS)));
|
||||||
|
|
||||||
if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2 && _secondary_flag)
|
if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2 && _secondary_flag)
|
||||||
{
|
{
|
||||||
_samplesPerCode *= static_cast<int>(Galileo_E1_C_SECONDARY_CODE_LENGTH);
|
_samplesPerCode *= static_cast<int32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
float real_code[_samplesPerCode];
|
float real_code[_samplesPerCode];
|
||||||
|
|
||||||
galileo_e1_code_gen_float_sampled(real_code, _Signal, _cboc, _prn, _fs, _chip_shift, _secondary_flag);
|
galileo_e1_code_gen_float_sampled(real_code, _Signal, _cboc, _prn, _fs, _chip_shift, _secondary_flag);
|
||||||
|
|
||||||
for (unsigned int ii = 0; ii < _samplesPerCode; ++ii)
|
for (uint32_t ii = 0; ii < _samplesPerCode; ++ii)
|
||||||
{
|
{
|
||||||
_dest[ii] = std::complex<float>(real_code[ii], 0.0f);
|
_dest[ii] = std::complex<float>(real_code[ii], 0.0f);
|
||||||
}
|
}
|
||||||
@ -248,14 +250,14 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
|
|||||||
|
|
||||||
|
|
||||||
void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
||||||
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift)
|
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
galileo_e1_code_gen_float_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false);
|
galileo_e1_code_gen_float_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
||||||
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift)
|
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
galileo_e1_code_gen_complex_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false);
|
galileo_e1_code_gen_complex_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false);
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,13 @@
|
|||||||
#define GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H_
|
#define GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H_
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This function generates Galileo E1 code (can select E1B or E1C sinboc).
|
* \brief This function generates Galileo E1 code (can select E1B or E1C sinboc).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], unsigned int _prn);
|
void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], uint32_t _prn);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This function generates Galileo E1 code (can select E1B or E1C, cboc or sinboc
|
* \brief This function generates Galileo E1 code (can select E1B or E1C, cboc or sinboc
|
||||||
@ -46,7 +47,7 @@ void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], unsigned
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
||||||
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift,
|
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift,
|
||||||
bool _secondary_flag);
|
bool _secondary_flag);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -55,7 +56,7 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
||||||
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift);
|
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This function generates Galileo E1 code (can select E1B or E1C, cboc or sinboc
|
* \brief This function generates Galileo E1 code (can select E1B or E1C, cboc or sinboc
|
||||||
@ -63,13 +64,13 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
||||||
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift,
|
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift,
|
||||||
bool _secondary_flag);
|
bool _secondary_flag);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief galileo_e1_code_gen_complex_sampled without _secondary_flag for backward compatibility.
|
* \brief galileo_e1_code_gen_complex_sampled without _secondary_flag for backward compatibility.
|
||||||
*/
|
*/
|
||||||
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
||||||
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift);
|
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H_ */
|
#endif /* GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H_ */
|
||||||
|
@ -37,11 +37,11 @@
|
|||||||
#include <gnuradio/gr_complex.h>
|
#include <gnuradio/gr_complex.h>
|
||||||
|
|
||||||
|
|
||||||
void galileo_e5_a_code_gen_complex_primary(std::complex<float>* _dest, signed int _prn, char _Signal[3])
|
void galileo_e5_a_code_gen_complex_primary(std::complex<float>* _dest, int32_t _prn, char _Signal[3])
|
||||||
{
|
{
|
||||||
unsigned int prn = _prn - 1;
|
uint32_t prn = _prn - 1;
|
||||||
unsigned int index = 0;
|
uint32_t index = 0;
|
||||||
int a[4];
|
int32_t a[4];
|
||||||
if ((_prn < 1) || (_prn > 50))
|
if ((_prn < 1) || (_prn > 50))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -80,7 +80,7 @@ void galileo_e5_a_code_gen_complex_primary(std::complex<float>* _dest, signed in
|
|||||||
}
|
}
|
||||||
else if (_Signal[0] == '5' && _Signal[1] == 'X')
|
else if (_Signal[0] == '5' && _Signal[1] == 'X')
|
||||||
{
|
{
|
||||||
int b[4];
|
int32_t b[4];
|
||||||
for (size_t i = 0; i < Galileo_E5a_I_PRIMARY_CODE[prn].length() - 1; i++)
|
for (size_t i = 0; i < Galileo_E5a_I_PRIMARY_CODE[prn].length() - 1; i++)
|
||||||
{
|
{
|
||||||
hex_to_binary_converter(a, Galileo_E5a_I_PRIMARY_CODE[prn].at(i));
|
hex_to_binary_converter(a, Galileo_E5a_I_PRIMARY_CODE[prn].at(i));
|
||||||
@ -99,19 +99,20 @@ void galileo_e5_a_code_gen_complex_primary(std::complex<float>* _dest, signed in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
||||||
unsigned int _prn, signed int _fs, unsigned int _chip_shift)
|
uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
unsigned int _samplesPerCode;
|
uint32_t _samplesPerCode;
|
||||||
unsigned int delay;
|
uint32_t delay;
|
||||||
const unsigned int _codeLength = Galileo_E5a_CODE_LENGTH_CHIPS;
|
const uint32_t _codeLength = Galileo_E5a_CODE_LENGTH_CHIPS;
|
||||||
const int _codeFreqBasis = Galileo_E5a_CODE_CHIP_RATE_HZ;
|
const int32_t _codeFreqBasis = Galileo_E5a_CODE_CHIP_RATE_HZ;
|
||||||
|
|
||||||
std::complex<float>* _code = new std::complex<float>[_codeLength]();
|
std::complex<float>* _code = new std::complex<float>[_codeLength]();
|
||||||
|
|
||||||
galileo_e5_a_code_gen_complex_primary(_code, _prn, _Signal);
|
galileo_e5_a_code_gen_complex_primary(_code, _prn, _Signal);
|
||||||
|
|
||||||
_samplesPerCode = static_cast<unsigned int>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
_samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||||
|
|
||||||
delay = ((_codeLength - _chip_shift) % _codeLength) * _samplesPerCode / _codeLength;
|
delay = ((_codeLength - _chip_shift) % _codeLength) * _samplesPerCode / _codeLength;
|
||||||
|
|
||||||
@ -121,12 +122,12 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Sig
|
|||||||
if (posix_memalign((void**)&_resampled_signal, 16, _samplesPerCode * sizeof(gr_complex)) == 0)
|
if (posix_memalign((void**)&_resampled_signal, 16, _samplesPerCode * sizeof(gr_complex)) == 0)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
resampler(_code, _resampled_signal, _codeFreqBasis, _fs, _codeLength, _samplesPerCode); //resamples code to fs
|
resampler(_code, _resampled_signal, _codeFreqBasis, _fs, _codeLength, _samplesPerCode); // resamples code to fs
|
||||||
delete[] _code;
|
delete[] _code;
|
||||||
_code = _resampled_signal;
|
_code = _resampled_signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < _samplesPerCode; i++)
|
for (uint32_t i = 0; i < _samplesPerCode; i++)
|
||||||
{
|
{
|
||||||
_dest[(i + delay) % _samplesPerCode] = _code[i];
|
_dest[(i + delay) % _samplesPerCode] = _code[i];
|
||||||
}
|
}
|
||||||
|
@ -35,23 +35,23 @@
|
|||||||
#define GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H_
|
#define GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H_
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Generates Galileo E5a code at 1 sample/chip
|
* \brief Generates Galileo E5a code at 1 sample/chip
|
||||||
* bool _pilot generates E5aQ code if true and E5aI (data signal) if false.
|
* bool _pilot generates E5aQ code if true and E5aI (data signal) if false.
|
||||||
*/
|
*/
|
||||||
void galileo_e5_a_code_gen_complex_primary(std::complex<float>* _dest, signed int _prn, char _Signal[3]);
|
void galileo_e5_a_code_gen_complex_primary(std::complex<float>* _dest, int32_t _prn, char _Signal[3]);
|
||||||
|
|
||||||
|
void galileo_e5_a_code_gen_tiered(std::complex<float>* _dest, std::complex<float>* _primary, uint32_t _prn, char _Signal[3]);
|
||||||
void galileo_e5_a_code_gen_tiered(std::complex<float>* _dest, std::complex<float>* _primary, unsigned int _prn, char _Signal[3]);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Generates Galileo E5a complex code, shifted to the desired chip and sampled at a frequency fs
|
* \brief Generates Galileo E5a complex code, shifted to the desired chip and sampled at a frequency fs
|
||||||
* bool _pilot generates E5aQ code if true and E5aI (data signal) if false.
|
* bool _pilot generates E5aQ code if true and E5aI (data signal) if false.
|
||||||
*/
|
*/
|
||||||
void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest,
|
void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest,
|
||||||
char _Signal[3], unsigned int _prn, signed int _fs, unsigned int _chip_shift);
|
char _Signal[3], uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
|
||||||
|
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H_ */
|
#endif /* GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H_ */
|
||||||
|
@ -32,17 +32,17 @@
|
|||||||
|
|
||||||
#include "glonass_l1_signal_processing.h"
|
#include "glonass_l1_signal_processing.h"
|
||||||
|
|
||||||
auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
|
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
|
||||||
|
|
||||||
void glonass_l1_ca_code_gen_complex(std::complex<float>* _dest, /* signed int _prn,*/ unsigned int _chip_shift)
|
void glonass_l1_ca_code_gen_complex(std::complex<float>* _dest, /* int32_t _prn,*/ uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
const unsigned int _code_length = 511;
|
const uint32_t _code_length = 511;
|
||||||
bool G1[_code_length];
|
bool G1[_code_length];
|
||||||
bool G1_register[9];
|
bool G1_register[9];
|
||||||
bool feedback1;
|
bool feedback1;
|
||||||
bool aux;
|
bool aux;
|
||||||
unsigned int delay;
|
uint32_t delay;
|
||||||
unsigned int lcv, lcv2;
|
uint32_t lcv, lcv2;
|
||||||
|
|
||||||
for (lcv = 0; lcv < 9; lcv++)
|
for (lcv = 0; lcv < 9; lcv++)
|
||||||
{
|
{
|
||||||
@ -104,26 +104,26 @@ void glonass_l1_ca_code_gen_complex(std::complex<float>* _dest, /* signed int _p
|
|||||||
/*
|
/*
|
||||||
* Generates complex GLONASS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
|
* Generates complex GLONASS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
|
||||||
*/
|
*/
|
||||||
void glonass_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift)
|
void glonass_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||||
std::complex<float> _code[511];
|
std::complex<float> _code[511];
|
||||||
signed int _samplesPerCode, _codeValueIndex;
|
int32_t _samplesPerCode, _codeValueIndex;
|
||||||
float _ts;
|
float _ts;
|
||||||
float _tc;
|
float _tc;
|
||||||
float aux;
|
float aux;
|
||||||
const signed int _codeFreqBasis = 511000; //Hz
|
const int32_t _codeFreqBasis = 511000; //Hz
|
||||||
const signed int _codeLength = 511;
|
const int32_t _codeLength = 511;
|
||||||
|
|
||||||
//--- Find number of samples per spreading code ----------------------------
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
_samplesPerCode = static_cast<signed int>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||||
|
|
||||||
//--- Find time constants --------------------------------------------------
|
//--- Find time constants --------------------------------------------------
|
||||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||||
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
||||||
glonass_l1_ca_code_gen_complex(_code, _chip_shift); //generate C/A code 1 sample per chip
|
glonass_l1_ca_code_gen_complex(_code, _chip_shift); //generate C/A code 1 sample per chip
|
||||||
|
|
||||||
for (signed int i = 0; i < _samplesPerCode; i++)
|
for (int32_t i = 0; i < _samplesPerCode; i++)
|
||||||
{
|
{
|
||||||
//=== Digitizing =======================================================
|
//=== Digitizing =======================================================
|
||||||
|
|
||||||
|
@ -34,14 +34,15 @@
|
|||||||
#define GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H_
|
#define GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H_
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
//!Generates complex GLONASS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
|
//!Generates complex GLONASS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
|
||||||
void glonass_l1_ca_code_gen_complex(std::complex<float>* _dest, /*signed int _prn,*/ unsigned int _chip_shift);
|
void glonass_l1_ca_code_gen_complex(std::complex<float>* _dest, /*int32_t _prn,*/ uint32_t _chip_shift);
|
||||||
|
|
||||||
//! Generates N complex GLONASS L1 C/A codes for the desired SV ID and code shift
|
//! Generates N complex GLONASS L1 C/A codes for the desired SV ID and code shift
|
||||||
void glonass_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift, unsigned int _ncodes);
|
void glonass_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
|
||||||
|
|
||||||
//! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift
|
//! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift
|
||||||
void glonass_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift);
|
void glonass_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift);
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H_ */
|
#endif /* GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H_ */
|
||||||
|
@ -32,17 +32,17 @@
|
|||||||
|
|
||||||
#include "glonass_l2_signal_processing.h"
|
#include "glonass_l2_signal_processing.h"
|
||||||
|
|
||||||
auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
|
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
|
||||||
|
|
||||||
void glonass_l2_ca_code_gen_complex(std::complex<float>* _dest, /* signed int _prn,*/ unsigned int _chip_shift)
|
void glonass_l2_ca_code_gen_complex(std::complex<float>* _dest, /* int32_t _prn,*/ uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
const unsigned int _code_length = 511;
|
const uint32_t _code_length = 511;
|
||||||
bool G1[_code_length];
|
bool G1[_code_length];
|
||||||
bool G1_register[9];
|
bool G1_register[9];
|
||||||
bool feedback1;
|
bool feedback1;
|
||||||
bool aux;
|
bool aux;
|
||||||
unsigned int delay;
|
uint32_t delay;
|
||||||
unsigned int lcv, lcv2;
|
uint32_t lcv, lcv2;
|
||||||
|
|
||||||
for (lcv = 0; lcv < 9; lcv++)
|
for (lcv = 0; lcv < 9; lcv++)
|
||||||
{
|
{
|
||||||
@ -104,26 +104,26 @@ void glonass_l2_ca_code_gen_complex(std::complex<float>* _dest, /* signed int _p
|
|||||||
/*
|
/*
|
||||||
* Generates complex GLONASS L2 C/A code for the desired SV ID and sampled to specific sampling frequency
|
* Generates complex GLONASS L2 C/A code for the desired SV ID and sampled to specific sampling frequency
|
||||||
*/
|
*/
|
||||||
void glonass_l2_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift)
|
void glonass_l2_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||||
std::complex<float> _code[511];
|
std::complex<float> _code[511];
|
||||||
signed int _samplesPerCode, _codeValueIndex;
|
int32_t _samplesPerCode, _codeValueIndex;
|
||||||
float _ts;
|
float _ts;
|
||||||
float _tc;
|
float _tc;
|
||||||
float aux;
|
float aux;
|
||||||
const signed int _codeFreqBasis = 511000; //Hz
|
const int32_t _codeFreqBasis = 511000; //Hz
|
||||||
const signed int _codeLength = 511;
|
const int32_t _codeLength = 511;
|
||||||
|
|
||||||
//--- Find number of samples per spreading code ----------------------------
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
_samplesPerCode = static_cast<signed int>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||||
|
|
||||||
//--- Find time constants --------------------------------------------------
|
//--- Find time constants --------------------------------------------------
|
||||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||||
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
||||||
glonass_l2_ca_code_gen_complex(_code, _chip_shift); //generate C/A code 1 sample per chip
|
glonass_l2_ca_code_gen_complex(_code, _chip_shift); //generate C/A code 1 sample per chip
|
||||||
|
|
||||||
for (signed int i = 0; i < _samplesPerCode; i++)
|
for (int32_t i = 0; i < _samplesPerCode; i++)
|
||||||
{
|
{
|
||||||
//=== Digitizing =======================================================
|
//=== Digitizing =======================================================
|
||||||
|
|
||||||
|
@ -34,14 +34,15 @@
|
|||||||
#define GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H_
|
#define GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H_
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
//!Generates complex GLONASS L2 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
|
//!Generates complex GLONASS L2 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
|
||||||
void glonass_l2_ca_code_gen_complex(std::complex<float>* _dest, /*signed int _prn,*/ unsigned int _chip_shift);
|
void glonass_l2_ca_code_gen_complex(std::complex<float>* _dest, /*int32_t _prn,*/ uint32_t _chip_shift);
|
||||||
|
|
||||||
//! Generates N complex GLONASS L2 C/A codes for the desired SV ID and code shift
|
//! Generates N complex GLONASS L2 C/A codes for the desired SV ID and code shift
|
||||||
void glonass_l2_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift, unsigned int _ncodes);
|
void glonass_l2_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
|
||||||
|
|
||||||
//! Generates complex GLONASS L2 C/A code for the desired SV ID and code shift
|
//! Generates complex GLONASS L2 C/A code for the desired SV ID and code shift
|
||||||
void glonass_l2_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift);
|
void glonass_l2_ca_code_gen_complex_sampled(std::complex<float>* _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift);
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H_ */
|
#endif /* GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H_ */
|
||||||
|
@ -45,12 +45,12 @@ gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(double _fs, int32_t _
|
|||||||
interval_ms = _interval_ms;
|
interval_ms = _interval_ms;
|
||||||
fs = _fs;
|
fs = _fs;
|
||||||
samples_per_output = std::round(fs * static_cast<double>(interval_ms) / 1e3);
|
samples_per_output = std::round(fs * static_cast<double>(interval_ms) / 1e3);
|
||||||
//todo: Load here the hardware counter register with this amount of samples. It should produde an
|
//todo: Load here the hardware counter register with this amount of samples. It should produce an
|
||||||
//interrupt every samples_per_output count.
|
//interrupt every samples_per_output count.
|
||||||
//The hardware timmer must keep always interrupting the PS. It must not wait for the interrupt to
|
//The hardware timer must keep always interrupting the PS. It must not wait for the interrupt to
|
||||||
//be served.
|
//be served.
|
||||||
|
|
||||||
sample_counter = 0;
|
sample_counter = 0ULL;
|
||||||
current_T_rx_ms = 0;
|
current_T_rx_ms = 0;
|
||||||
current_s = 0;
|
current_s = 0;
|
||||||
current_m = 0;
|
current_m = 0;
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
#include <gnuradio/fxpt_nco.h>
|
#include <gnuradio/fxpt_nco.h>
|
||||||
|
|
||||||
|
|
||||||
auto auxCeil2 = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
|
auto auxCeil2 = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
|
||||||
|
|
||||||
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps)
|
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, uint32_t _samps)
|
||||||
{
|
{
|
||||||
gr::fxpt_nco d_nco;
|
gr::fxpt_nco d_nco;
|
||||||
d_nco.set_freq((GPS_TWO_PI * _f) / _fs);
|
d_nco.set_freq((GPS_TWO_PI * _f) / _fs);
|
||||||
@ -46,14 +46,15 @@ void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps)
|
void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs, uint32_t _samps)
|
||||||
{
|
{
|
||||||
gr::fxpt_nco d_nco;
|
gr::fxpt_nco d_nco;
|
||||||
d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs);
|
d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs);
|
||||||
d_nco.sincos(_dest, _samps, 1);
|
d_nco.sincos(_dest, _samps, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hex_to_binary_converter(int* _dest, char _from)
|
|
||||||
|
void hex_to_binary_converter(int32_t* _dest, char _from)
|
||||||
{
|
{
|
||||||
switch (_from)
|
switch (_from)
|
||||||
{
|
{
|
||||||
@ -156,15 +157,16 @@ void hex_to_binary_converter(int* _dest, char _from)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void resampler(float* _from, float* _dest, float _fs_in,
|
void resampler(float* _from, float* _dest, float _fs_in,
|
||||||
float _fs_out, unsigned int _length_in, unsigned int _length_out)
|
float _fs_out, uint32_t _length_in, uint32_t _length_out)
|
||||||
{
|
{
|
||||||
unsigned int _codeValueIndex;
|
uint32_t _codeValueIndex;
|
||||||
float aux;
|
float aux;
|
||||||
//--- Find time constants --------------------------------------------------
|
//--- Find time constants --------------------------------------------------
|
||||||
const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
|
const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
|
||||||
const float _t_out = 1 / _fs_out; // Out sampling period in sec
|
const float _t_out = 1 / _fs_out; // Out sampling period in sec
|
||||||
for (unsigned int i = 0; i < _length_out - 1; i++)
|
for (uint32_t i = 0; i < _length_out - 1; i++)
|
||||||
{
|
{
|
||||||
//=== Digitizing =======================================================
|
//=== Digitizing =======================================================
|
||||||
//--- compute index array to read sampled values -------------------------
|
//--- compute index array to read sampled values -------------------------
|
||||||
@ -179,15 +181,16 @@ void resampler(float* _from, float* _dest, float _fs_in,
|
|||||||
_dest[_length_out - 1] = _from[_length_in - 1];
|
_dest[_length_out - 1] = _from[_length_in - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void resampler(std::complex<float>* _from, std::complex<float>* _dest, float _fs_in,
|
void resampler(std::complex<float>* _from, std::complex<float>* _dest, float _fs_in,
|
||||||
float _fs_out, unsigned int _length_in, unsigned int _length_out)
|
float _fs_out, uint32_t _length_in, uint32_t _length_out)
|
||||||
{
|
{
|
||||||
unsigned int _codeValueIndex;
|
uint32_t _codeValueIndex;
|
||||||
float aux;
|
float aux;
|
||||||
//--- Find time constants --------------------------------------------------
|
//--- Find time constants --------------------------------------------------
|
||||||
const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
|
const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
|
||||||
const float _t_out = 1 / _fs_out; // Out sampling period in sec
|
const float _t_out = 1 / _fs_out; // Out sampling period in sec
|
||||||
for (unsigned int i = 0; i < _length_out - 1; i++)
|
for (uint32_t i = 0; i < _length_out - 1; i++)
|
||||||
{
|
{
|
||||||
//=== Digitizing =======================================================
|
//=== Digitizing =======================================================
|
||||||
//--- compute index array to read sampled values -------------------------
|
//--- compute index array to read sampled values -------------------------
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#define GNSS_SDR_GNSS_SIGNAL_PROCESSING_H_
|
#define GNSS_SDR_GNSS_SIGNAL_PROCESSING_H_
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -43,14 +44,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs,
|
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs,
|
||||||
unsigned int _samps);
|
uint32_t _samps);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This function generates a conjugate complex exponential in _dest.
|
* \brief This function generates a conjugate complex exponential in _dest.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs,
|
void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs,
|
||||||
unsigned int _samps);
|
uint32_t _samps);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -58,21 +59,21 @@ void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs,
|
|||||||
* to binary (the output are 4 ints with +1 or -1 values).
|
* to binary (the output are 4 ints with +1 or -1 values).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void hex_to_binary_converter(int* _dest, char _from);
|
void hex_to_binary_converter(int32_t* _dest, char _from);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This function resamples a sequence of float values.
|
* \brief This function resamples a sequence of float values.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void resampler(float* _from, float* _dest,
|
void resampler(float* _from, float* _dest,
|
||||||
float _fs_in, float _fs_out, unsigned int _length_in,
|
float _fs_in, float _fs_out, uint32_t _length_in,
|
||||||
unsigned int _length_out);
|
uint32_t _length_out);
|
||||||
/*!
|
/*!
|
||||||
* \brief This function resamples a sequence of complex values.
|
* \brief This function resamples a sequence of complex values.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void resampler(std::complex<float>* _from, std::complex<float>* _dest,
|
void resampler(std::complex<float>* _from, std::complex<float>* _dest,
|
||||||
float _fs_in, float _fs_out, unsigned int _length_in,
|
float _fs_in, float _fs_out, uint32_t _length_in,
|
||||||
unsigned int _length_out);
|
uint32_t _length_out);
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GNSS_SIGNAL_PROCESSING_H_ */
|
#endif /* GNSS_SDR_GNSS_SIGNAL_PROCESSING_H_ */
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "gps_l2c_signal.h"
|
#include "gps_l2c_signal.h"
|
||||||
#include "GPS_L2C.h"
|
#include "GPS_L2C.h"
|
||||||
#include <cstdint>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
@ -42,11 +41,11 @@ int32_t gps_l2c_m_shift(int32_t x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l2c_m_code(int32_t* _dest, unsigned int _prn)
|
void gps_l2c_m_code(int32_t* _dest, uint32_t _prn)
|
||||||
{
|
{
|
||||||
int32_t x;
|
int32_t x;
|
||||||
x = GPS_L2C_M_INIT_REG[_prn - 1];
|
x = GPS_L2C_M_INIT_REG[_prn - 1];
|
||||||
for (int n = 0; n < GPS_L2_M_CODE_LENGTH_CHIPS; n++)
|
for (int32_t n = 0; n < GPS_L2_M_CODE_LENGTH_CHIPS; n++)
|
||||||
{
|
{
|
||||||
_dest[n] = static_cast<int8_t>(x & 1);
|
_dest[n] = static_cast<int8_t>(x & 1);
|
||||||
x = gps_l2c_m_shift(x);
|
x = gps_l2c_m_shift(x);
|
||||||
@ -54,7 +53,7 @@ void gps_l2c_m_code(int32_t* _dest, unsigned int _prn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
|||||||
gps_l2c_m_code(_code, _prn);
|
gps_l2c_m_code(_code, _prn);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (signed int i = 0; i < GPS_L2_M_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L2_M_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
||||||
}
|
}
|
||||||
@ -71,7 +70,8 @@ void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
|||||||
delete[] _code;
|
delete[] _code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l2c_m_code_gen_float(float* _dest, unsigned int _prn)
|
|
||||||
|
void gps_l2c_m_code_gen_float(float* _dest, uint32_t _prn)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ void gps_l2c_m_code_gen_float(float* _dest, unsigned int _prn)
|
|||||||
gps_l2c_m_code(_code, _prn);
|
gps_l2c_m_code(_code, _prn);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (signed int i = 0; i < GPS_L2_M_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L2_M_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
|
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ void gps_l2c_m_code_gen_float(float* _dest, unsigned int _prn)
|
|||||||
/*
|
/*
|
||||||
* Generates complex GPS L2C M code for the desired SV ID and sampled to specific sampling frequency
|
* Generates complex GPS L2C M code for the desired SV ID and sampled to specific sampling frequency
|
||||||
*/
|
*/
|
||||||
void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs)
|
void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
||||||
if (_prn > 0 and _prn < 51)
|
if (_prn > 0 and _prn < 51)
|
||||||
@ -100,20 +100,20 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
|
|||||||
gps_l2c_m_code(_code, _prn);
|
gps_l2c_m_code(_code, _prn);
|
||||||
}
|
}
|
||||||
|
|
||||||
signed int _samplesPerCode, _codeValueIndex;
|
int32_t _samplesPerCode, _codeValueIndex;
|
||||||
float _ts;
|
float _ts;
|
||||||
float _tc;
|
float _tc;
|
||||||
const signed int _codeLength = GPS_L2_M_CODE_LENGTH_CHIPS;
|
const int32_t _codeLength = GPS_L2_M_CODE_LENGTH_CHIPS;
|
||||||
|
|
||||||
//--- Find number of samples per spreading code ----------------------------
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
_samplesPerCode = static_cast<int>(static_cast<double>(_fs) / (static_cast<double>(GPS_L2_M_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(GPS_L2_M_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
||||||
|
|
||||||
//--- Find time constants --------------------------------------------------
|
//--- Find time constants --------------------------------------------------
|
||||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||||
_tc = 1.0 / static_cast<float>(GPS_L2_M_CODE_RATE_HZ); // C/A chip period in sec
|
_tc = 1.0 / static_cast<float>(GPS_L2_M_CODE_RATE_HZ); // C/A chip period in sec
|
||||||
|
|
||||||
//float aux;
|
//float aux;
|
||||||
for (signed int i = 0; i < _samplesPerCode; i++)
|
for (int32_t i = 0; i < _samplesPerCode; i++)
|
||||||
{
|
{
|
||||||
//=== Digitizing =======================================================
|
//=== Digitizing =======================================================
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
|
|||||||
//TODO: Check this formula! Seems to start with an extra sample
|
//TODO: Check this formula! Seems to start with an extra sample
|
||||||
_codeValueIndex = ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
|
_codeValueIndex = ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
|
||||||
//aux = (_ts * (i + 1)) / _tc;
|
//aux = (_ts * (i + 1)) / _tc;
|
||||||
//_codeValueIndex = static_cast<int>(static_cast<long>(aux)) - 1;
|
//_codeValueIndex = static_cast<int32_t>(static_cast<long>(aux)) - 1;
|
||||||
|
|
||||||
//--- Make the digitized version of the L2C code -----------------------
|
//--- Make the digitized version of the L2C code -----------------------
|
||||||
if (i == _samplesPerCode - 1)
|
if (i == _samplesPerCode - 1)
|
||||||
|
@ -34,13 +34,14 @@
|
|||||||
#define GNSS_SDR_GPS_L2C_SIGNAL_H_
|
#define GNSS_SDR_GPS_L2C_SIGNAL_H_
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
||||||
//!Generates complex GPS L2C M code for the desired SV ID
|
//! Generates complex GPS L2C M code for the desired SV ID
|
||||||
void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, unsigned int _prn);
|
void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, uint32_t _prn);
|
||||||
void gps_l2c_m_code_gen_float(float* _dest, unsigned int _prn);
|
void gps_l2c_m_code_gen_float(float* _dest, uint32_t _prn);
|
||||||
|
|
||||||
//! Generates complex GPS L2C M code for the desired SV ID, and sampled to specific sampling frequency
|
//! Generates complex GPS L2C M code for the desired SV ID, and sampled to specific sampling frequency
|
||||||
void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs);
|
void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs);
|
||||||
|
|
||||||
#endif /* GNSS_GPS_L2C_SIGNAL_H_ */
|
#endif /* GNSS_GPS_L2C_SIGNAL_H_ */
|
||||||
|
@ -89,7 +89,7 @@ std::deque<bool> make_l5i_xa()
|
|||||||
std::deque<bool> xa = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
std::deque<bool> xa = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
std::deque<bool> y(GPS_L5i_CODE_LENGTH_CHIPS, 0);
|
std::deque<bool> y(GPS_L5i_CODE_LENGTH_CHIPS, 0);
|
||||||
|
|
||||||
for (int i = 0; i < GPS_L5i_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L5i_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
y[i] = xa[12];
|
y[i] = xa[12];
|
||||||
xa = l5i_xa_shift(xa);
|
xa = l5i_xa_shift(xa);
|
||||||
@ -103,7 +103,7 @@ std::deque<bool> make_l5i_xb()
|
|||||||
std::deque<bool> xb = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
std::deque<bool> xb = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
std::deque<bool> y(GPS_L5i_CODE_LENGTH_CHIPS, 0);
|
std::deque<bool> y(GPS_L5i_CODE_LENGTH_CHIPS, 0);
|
||||||
|
|
||||||
for (int i = 0; i < GPS_L5i_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L5i_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
y[i] = xb[12];
|
y[i] = xb[12];
|
||||||
xb = l5i_xb_shift(xb);
|
xb = l5i_xb_shift(xb);
|
||||||
@ -117,7 +117,7 @@ std::deque<bool> make_l5q_xa()
|
|||||||
std::deque<bool> xa = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
std::deque<bool> xa = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
std::deque<bool> y(GPS_L5q_CODE_LENGTH_CHIPS, 0);
|
std::deque<bool> y(GPS_L5q_CODE_LENGTH_CHIPS, 0);
|
||||||
|
|
||||||
for (int i = 0; i < GPS_L5q_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L5q_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
y[i] = xa[12];
|
y[i] = xa[12];
|
||||||
xa = l5q_xa_shift(xa);
|
xa = l5q_xa_shift(xa);
|
||||||
@ -131,7 +131,7 @@ std::deque<bool> make_l5q_xb()
|
|||||||
std::deque<bool> xb = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
std::deque<bool> xb = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
std::deque<bool> y(GPS_L5q_CODE_LENGTH_CHIPS, 0);
|
std::deque<bool> y(GPS_L5q_CODE_LENGTH_CHIPS, 0);
|
||||||
|
|
||||||
for (int i = 0; i < GPS_L5q_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L5q_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
y[i] = xb[12];
|
y[i] = xb[12];
|
||||||
xb = l5q_xb_shift(xb);
|
xb = l5q_xb_shift(xb);
|
||||||
@ -140,47 +140,47 @@ std::deque<bool> make_l5q_xb()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void make_l5i(int32_t* _dest, int prn)
|
void make_l5i(int32_t* _dest, int32_t prn)
|
||||||
{
|
{
|
||||||
int xb_offset = GPS_L5i_INIT_REG[prn];
|
int32_t xb_offset = GPS_L5i_INIT_REG[prn];
|
||||||
|
|
||||||
std::deque<bool> xb = make_l5i_xb();
|
std::deque<bool> xb = make_l5i_xb();
|
||||||
std::deque<bool> xa = make_l5i_xa();
|
std::deque<bool> xa = make_l5i_xa();
|
||||||
std::deque<bool> xb_shift(GPS_L5i_CODE_LENGTH_CHIPS, 0);
|
std::deque<bool> xb_shift(GPS_L5i_CODE_LENGTH_CHIPS, 0);
|
||||||
|
|
||||||
for (int n = 0; n < GPS_L5i_CODE_LENGTH_CHIPS; n++)
|
for (int32_t n = 0; n < GPS_L5i_CODE_LENGTH_CHIPS; n++)
|
||||||
{
|
{
|
||||||
xb_shift[n] = xb[(xb_offset + n) % GPS_L5i_CODE_LENGTH_CHIPS];
|
xb_shift[n] = xb[(xb_offset + n) % GPS_L5i_CODE_LENGTH_CHIPS];
|
||||||
}
|
}
|
||||||
std::deque<bool> out_code(GPS_L5i_CODE_LENGTH_CHIPS, 0);
|
std::deque<bool> out_code(GPS_L5i_CODE_LENGTH_CHIPS, 0);
|
||||||
for (int n = 0; n < GPS_L5i_CODE_LENGTH_CHIPS; n++)
|
for (int32_t n = 0; n < GPS_L5i_CODE_LENGTH_CHIPS; n++)
|
||||||
{
|
{
|
||||||
_dest[n] = xa[n] xor xb_shift[n];
|
_dest[n] = xa[n] xor xb_shift[n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void make_l5q(int32_t* _dest, int prn)
|
void make_l5q(int32_t* _dest, int32_t prn)
|
||||||
{
|
{
|
||||||
int xb_offset = GPS_L5q_INIT_REG[prn];
|
int32_t xb_offset = GPS_L5q_INIT_REG[prn];
|
||||||
|
|
||||||
std::deque<bool> xb = make_l5q_xb();
|
std::deque<bool> xb = make_l5q_xb();
|
||||||
std::deque<bool> xa = make_l5q_xa();
|
std::deque<bool> xa = make_l5q_xa();
|
||||||
std::deque<bool> xb_shift(GPS_L5q_CODE_LENGTH_CHIPS, 0);
|
std::deque<bool> xb_shift(GPS_L5q_CODE_LENGTH_CHIPS, 0);
|
||||||
|
|
||||||
for (int n = 0; n < GPS_L5q_CODE_LENGTH_CHIPS; n++)
|
for (int32_t n = 0; n < GPS_L5q_CODE_LENGTH_CHIPS; n++)
|
||||||
{
|
{
|
||||||
xb_shift[n] = xb[(xb_offset + n) % GPS_L5q_CODE_LENGTH_CHIPS];
|
xb_shift[n] = xb[(xb_offset + n) % GPS_L5q_CODE_LENGTH_CHIPS];
|
||||||
}
|
}
|
||||||
std::deque<bool> out_code(GPS_L5q_CODE_LENGTH_CHIPS, 0);
|
std::deque<bool> out_code(GPS_L5q_CODE_LENGTH_CHIPS, 0);
|
||||||
for (int n = 0; n < GPS_L5q_CODE_LENGTH_CHIPS; n++)
|
for (int32_t n = 0; n < GPS_L5q_CODE_LENGTH_CHIPS; n++)
|
||||||
{
|
{
|
||||||
_dest[n] = xa[n] xor xb_shift[n];
|
_dest[n] = xa[n] xor xb_shift[n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l5i_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
void gps_l5i_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ void gps_l5i_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
|||||||
make_l5i(_code, _prn - 1);
|
make_l5i(_code, _prn - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (signed int i = 0; i < GPS_L5i_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L5i_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
||||||
}
|
}
|
||||||
@ -197,7 +197,8 @@ void gps_l5i_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
|||||||
delete[] _code;
|
delete[] _code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l5i_code_gen_float(float* _dest, unsigned int _prn)
|
|
||||||
|
void gps_l5i_code_gen_float(float* _dest, uint32_t _prn)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
|
||||||
|
|
||||||
@ -206,7 +207,7 @@ void gps_l5i_code_gen_float(float* _dest, unsigned int _prn)
|
|||||||
make_l5i(_code, _prn - 1);
|
make_l5i(_code, _prn - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (signed int i = 0; i < GPS_L5i_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L5i_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
|
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
|
||||||
}
|
}
|
||||||
@ -214,10 +215,11 @@ void gps_l5i_code_gen_float(float* _dest, unsigned int _prn)
|
|||||||
delete[] _code;
|
delete[] _code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency
|
* Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency
|
||||||
*/
|
*/
|
||||||
void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs)
|
void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L5i_CODE_LENGTH_CHIPS];
|
||||||
if (_prn > 0 and _prn < 51)
|
if (_prn > 0 and _prn < 51)
|
||||||
@ -225,20 +227,20 @@ void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _
|
|||||||
make_l5i(_code, _prn - 1);
|
make_l5i(_code, _prn - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
signed int _samplesPerCode, _codeValueIndex;
|
int32_t _samplesPerCode, _codeValueIndex;
|
||||||
float _ts;
|
float _ts;
|
||||||
float _tc;
|
float _tc;
|
||||||
const signed int _codeLength = GPS_L5i_CODE_LENGTH_CHIPS;
|
const int32_t _codeLength = GPS_L5i_CODE_LENGTH_CHIPS;
|
||||||
|
|
||||||
//--- Find number of samples per spreading code ----------------------------
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
_samplesPerCode = static_cast<int>(static_cast<double>(_fs) / (static_cast<double>(GPS_L5i_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(GPS_L5i_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
||||||
|
|
||||||
//--- Find time constants --------------------------------------------------
|
//--- Find time constants --------------------------------------------------
|
||||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||||
_tc = 1.0 / static_cast<float>(GPS_L5i_CODE_RATE_HZ); // C/A chip period in sec
|
_tc = 1.0 / static_cast<float>(GPS_L5i_CODE_RATE_HZ); // C/A chip period in sec
|
||||||
|
|
||||||
//float aux;
|
//float aux;
|
||||||
for (signed int i = 0; i < _samplesPerCode; i++)
|
for (int32_t i = 0; i < _samplesPerCode; i++)
|
||||||
{
|
{
|
||||||
//=== Digitizing =======================================================
|
//=== Digitizing =======================================================
|
||||||
|
|
||||||
@ -246,7 +248,7 @@ void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _
|
|||||||
//TODO: Check this formula! Seems to start with an extra sample
|
//TODO: Check this formula! Seems to start with an extra sample
|
||||||
_codeValueIndex = ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
|
_codeValueIndex = ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
|
||||||
//aux = (_ts * (i + 1)) / _tc;
|
//aux = (_ts * (i + 1)) / _tc;
|
||||||
//_codeValueIndex = static_cast<int>(static_cast<long>(aux)) - 1;
|
//_codeValueIndex = static_cast<int32_t> (static_cast<long>(aux)) - 1;
|
||||||
|
|
||||||
//--- Make the digitized version of the L2C code -----------------------
|
//--- Make the digitized version of the L2C code -----------------------
|
||||||
if (i == _samplesPerCode - 1)
|
if (i == _samplesPerCode - 1)
|
||||||
@ -263,7 +265,7 @@ void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l5q_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
void gps_l5q_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
|
||||||
|
|
||||||
@ -272,7 +274,7 @@ void gps_l5q_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
|||||||
make_l5q(_code, _prn - 1);
|
make_l5q(_code, _prn - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (signed int i = 0; i < GPS_L5q_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L5q_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
||||||
}
|
}
|
||||||
@ -280,7 +282,8 @@ void gps_l5q_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
|||||||
delete[] _code;
|
delete[] _code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l5q_code_gen_float(float* _dest, unsigned int _prn)
|
|
||||||
|
void gps_l5q_code_gen_float(float* _dest, uint32_t _prn)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
|
||||||
|
|
||||||
@ -289,17 +292,19 @@ void gps_l5q_code_gen_float(float* _dest, unsigned int _prn)
|
|||||||
make_l5q(_code, _prn - 1);
|
make_l5q(_code, _prn - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (signed int i = 0; i < GPS_L5q_CODE_LENGTH_CHIPS; i++)
|
for (int32_t i = 0; i < GPS_L5q_CODE_LENGTH_CHIPS; i++)
|
||||||
{
|
{
|
||||||
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
|
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] _code;
|
delete[] _code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency
|
* Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency
|
||||||
*/
|
*/
|
||||||
void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs)
|
void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
|
||||||
{
|
{
|
||||||
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
|
int32_t* _code = new int32_t[GPS_L5q_CODE_LENGTH_CHIPS];
|
||||||
if (_prn > 0 and _prn < 51)
|
if (_prn > 0 and _prn < 51)
|
||||||
@ -307,20 +312,20 @@ void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _
|
|||||||
make_l5q(_code, _prn - 1);
|
make_l5q(_code, _prn - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
signed int _samplesPerCode, _codeValueIndex;
|
int32_t _samplesPerCode, _codeValueIndex;
|
||||||
float _ts;
|
float _ts;
|
||||||
float _tc;
|
float _tc;
|
||||||
const signed int _codeLength = GPS_L5q_CODE_LENGTH_CHIPS;
|
const int32_t _codeLength = GPS_L5q_CODE_LENGTH_CHIPS;
|
||||||
|
|
||||||
//--- Find number of samples per spreading code ----------------------------
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
_samplesPerCode = static_cast<int>(static_cast<double>(_fs) / (static_cast<double>(GPS_L5q_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(GPS_L5q_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
||||||
|
|
||||||
//--- Find time constants --------------------------------------------------
|
//--- Find time constants --------------------------------------------------
|
||||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||||
_tc = 1.0 / static_cast<float>(GPS_L5q_CODE_RATE_HZ); // C/A chip period in sec
|
_tc = 1.0 / static_cast<float>(GPS_L5q_CODE_RATE_HZ); // C/A chip period in sec
|
||||||
|
|
||||||
//float aux;
|
//float aux;
|
||||||
for (signed int i = 0; i < _samplesPerCode; i++)
|
for (int32_t i = 0; i < _samplesPerCode; i++)
|
||||||
{
|
{
|
||||||
//=== Digitizing =======================================================
|
//=== Digitizing =======================================================
|
||||||
|
|
||||||
@ -328,7 +333,7 @@ void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _
|
|||||||
//TODO: Check this formula! Seems to start with an extra sample
|
//TODO: Check this formula! Seems to start with an extra sample
|
||||||
_codeValueIndex = ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
|
_codeValueIndex = ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
|
||||||
//aux = (_ts * (i + 1)) / _tc;
|
//aux = (_ts * (i + 1)) / _tc;
|
||||||
//_codeValueIndex = static_cast<int>(static_cast<long>(aux)) - 1;
|
//_codeValueIndex = static_cast<int32_t> (static_cast<long>(aux)) - 1;
|
||||||
|
|
||||||
//--- Make the digitized version of the L2C code -----------------------
|
//--- Make the digitized version of the L2C code -----------------------
|
||||||
if (i == _samplesPerCode - 1)
|
if (i == _samplesPerCode - 1)
|
||||||
|
@ -34,21 +34,21 @@
|
|||||||
#define GNSS_SDR_GPS_L5_SIGNAL_H_
|
#define GNSS_SDR_GPS_L5_SIGNAL_H_
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
//!Generates complex GPS L5i M code for the desired SV ID
|
//!Generates complex GPS L5i M code for the desired SV ID
|
||||||
void gps_l5i_code_gen_complex(std::complex<float>* _dest, unsigned int _prn);
|
void gps_l5i_code_gen_complex(std::complex<float>* _dest, uint32_t _prn);
|
||||||
void gps_l5i_code_gen_float(float* _dest, unsigned int _prn);
|
void gps_l5i_code_gen_float(float* _dest, uint32_t _prn);
|
||||||
|
|
||||||
//!Generates complex GPS L5q M code for the desired SV ID
|
//!Generates complex GPS L5q M code for the desired SV ID
|
||||||
void gps_l5q_code_gen_complex(std::complex<float>* _dest, unsigned int _prn);
|
void gps_l5q_code_gen_complex(std::complex<float>* _dest, uint32_t _prn);
|
||||||
void gps_l5q_code_gen_float(float* _dest, unsigned int _prn);
|
void gps_l5q_code_gen_float(float* _dest, uint32_t _prn);
|
||||||
|
|
||||||
//! Generates complex GPS L5i M code for the desired SV ID, and sampled to specific sampling frequency
|
//! Generates complex GPS L5i M code for the desired SV ID, and sampled to specific sampling frequency
|
||||||
void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs);
|
void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs);
|
||||||
|
|
||||||
//! Generates complex GPS L5q M code for the desired SV ID, and sampled to specific sampling frequency
|
//! Generates complex GPS L5q M code for the desired SV ID, and sampled to specific sampling frequency
|
||||||
void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs);
|
void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs);
|
||||||
|
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GPS_L5_SIGNAL_H_ */
|
#endif /* GNSS_SDR_GPS_L5_SIGNAL_H_ */
|
||||||
|
@ -32,22 +32,22 @@
|
|||||||
|
|
||||||
#include "gps_sdr_signal_processing.h"
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
|
||||||
auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
|
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
|
||||||
|
|
||||||
void gps_l1_ca_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shift)
|
void gps_l1_ca_code_gen_int(int32_t* _dest, int32_t _prn, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
const unsigned int _code_length = 1023;
|
const uint32_t _code_length = 1023;
|
||||||
bool G1[_code_length];
|
bool G1[_code_length];
|
||||||
bool G2[_code_length];
|
bool G2[_code_length];
|
||||||
bool G1_register[10], G2_register[10];
|
bool G1_register[10], G2_register[10];
|
||||||
bool feedback1, feedback2;
|
bool feedback1, feedback2;
|
||||||
bool aux;
|
bool aux;
|
||||||
unsigned int lcv, lcv2;
|
uint32_t lcv, lcv2;
|
||||||
unsigned int delay;
|
uint32_t delay;
|
||||||
signed int prn_idx;
|
int32_t prn_idx;
|
||||||
|
|
||||||
/* G2 Delays as defined in GPS-ISD-200D */
|
/* G2 Delays as defined in GPS-ISD-200D */
|
||||||
const signed int delays[51] = {5 /*PRN1*/, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254, 255, 256, 257, 258, 469, 470, 471, 472,
|
const int32_t delays[51] = {5 /*PRN1*/, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254, 255, 256, 257, 258, 469, 470, 471, 472,
|
||||||
473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862 /*PRN32*/,
|
473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862 /*PRN32*/,
|
||||||
145 /*PRN120*/, 175, 52, 21, 237, 235, 886, 657, 634, 762,
|
145 /*PRN120*/, 175, 52, 21, 237, 235, 886, 657, 634, 762,
|
||||||
355, 1012, 176, 603, 130, 359, 595, 68, 386 /*PRN138*/};
|
355, 1012, 176, 603, 130, 359, 595, 68, 386 /*PRN138*/};
|
||||||
@ -114,28 +114,28 @@ void gps_l1_ca_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shif
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_code_gen_float(float* _dest, signed int _prn, unsigned int _chip_shift)
|
void gps_l1_ca_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
unsigned int _code_length = 1023;
|
uint32_t _code_length = 1023;
|
||||||
int ca_code_int[_code_length];
|
int32_t ca_code_int[_code_length];
|
||||||
|
|
||||||
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);
|
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);
|
||||||
|
|
||||||
for (unsigned int ii = 0; ii < _code_length; ++ii)
|
for (uint32_t ii = 0; ii < _code_length; ++ii)
|
||||||
{
|
{
|
||||||
_dest[ii] = static_cast<float>(ca_code_int[ii]);
|
_dest[ii] = static_cast<float>(ca_code_int[ii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift)
|
void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
unsigned int _code_length = 1023;
|
uint32_t _code_length = 1023;
|
||||||
int ca_code_int[_code_length];
|
int32_t ca_code_int[_code_length];
|
||||||
|
|
||||||
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);
|
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);
|
||||||
|
|
||||||
for (unsigned int ii = 0; ii < _code_length; ++ii)
|
for (uint32_t ii = 0; ii < _code_length; ++ii)
|
||||||
{
|
{
|
||||||
_dest[ii] = std::complex<float>(static_cast<float>(ca_code_int[ii]), 0.0f);
|
_dest[ii] = std::complex<float>(static_cast<float>(ca_code_int[ii]), 0.0f);
|
||||||
}
|
}
|
||||||
@ -146,26 +146,26 @@ void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, signed int _prn, uns
|
|||||||
* Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
|
* Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
|
||||||
* NOTICE: the number of samples is rounded towards zero (integer truncation)
|
* NOTICE: the number of samples is rounded towards zero (integer truncation)
|
||||||
*/
|
*/
|
||||||
void gps_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift)
|
void gps_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
|
||||||
{
|
{
|
||||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||||
std::complex<float> _code[1023];
|
std::complex<float> _code[1023];
|
||||||
signed int _samplesPerCode, _codeValueIndex;
|
int32_t _samplesPerCode, _codeValueIndex;
|
||||||
float _ts;
|
float _ts;
|
||||||
float _tc;
|
float _tc;
|
||||||
float aux;
|
float aux;
|
||||||
const signed int _codeFreqBasis = 1023000; //Hz
|
const int32_t _codeFreqBasis = 1023000; //Hz
|
||||||
const signed int _codeLength = 1023;
|
const int32_t _codeLength = 1023;
|
||||||
|
|
||||||
//--- Find number of samples per spreading code ----------------------------
|
//--- Find number of samples per spreading code ----------------------------
|
||||||
_samplesPerCode = static_cast<signed int>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||||
|
|
||||||
//--- Find time constants --------------------------------------------------
|
//--- Find time constants --------------------------------------------------
|
||||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||||
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
||||||
gps_l1_ca_code_gen_complex(_code, _prn, _chip_shift); //generate C/A code 1 sample per chip
|
gps_l1_ca_code_gen_complex(_code, _prn, _chip_shift); //generate C/A code 1 sample per chip
|
||||||
|
|
||||||
for (signed int i = 0; i < _samplesPerCode; i++)
|
for (int32_t i = 0; i < _samplesPerCode; i++)
|
||||||
{
|
{
|
||||||
//=== Digitizing =======================================================
|
//=== Digitizing =======================================================
|
||||||
|
|
||||||
|
@ -34,20 +34,21 @@
|
|||||||
#define GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_
|
#define GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_
|
||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
//!Generates int GPS L1 C/A code for the desired SV ID and code shift
|
//! Generates int GPS L1 C/A code for the desired SV ID and code shift
|
||||||
void gps_l1_ca_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shift);
|
void gps_l1_ca_code_gen_int(int32_t* _dest, int32_t _prn, uint32_t _chip_shift);
|
||||||
|
|
||||||
//!Generates float GPS L1 C/A code for the desired SV ID and code shift
|
//! Generates float GPS L1 C/A code for the desired SV ID and code shift
|
||||||
void gps_l1_ca_code_gen_float(float* _dest, signed int _prn, unsigned int _chip_shift);
|
void gps_l1_ca_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift);
|
||||||
|
|
||||||
//!Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
|
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
|
||||||
void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift);
|
void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift);
|
||||||
|
|
||||||
//! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift
|
//! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift
|
||||||
void gps_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift, unsigned int _ncodes);
|
void gps_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
|
||||||
|
|
||||||
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift
|
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift
|
||||||
void gps_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift);
|
void gps_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ */
|
#endif /* GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user