mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 19:50:34 +00:00
Deleting gps_telemetry.cc and gps_telemetry.h. Most of the functions were not used anywhere, the others have been moved to places in which make sense.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@107 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
3ceef64d27
commit
ce4ddd03e8
@ -33,16 +33,16 @@
|
||||
* \todo Clean this code and move the telemetry definitions to GPS_L1_CA system definitions file
|
||||
*/
|
||||
|
||||
#include "gps_l1_ca_telemetry_decoder_cc.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <bitset>
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include "gps_l1_ca_telemetry_decoder_cc.h"
|
||||
#include "control_message_factory.h"
|
||||
|
||||
|
||||
#define _lrotl(X,N) ((X << N) ^ (X >> (32-N))) //!< Used in the parity check algorithm
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
@ -121,6 +121,38 @@ gps_l1_ca_telemetry_decoder_cc::~gps_l1_ca_telemetry_decoder_cc() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
|
||||
{
|
||||
unsigned int d1,d2,d3,d4,d5,d6,d7,t,parity;
|
||||
|
||||
/* XOR as many bits in parallel as possible. The magic constants pick
|
||||
up bits which are to be XOR'ed together to implement the GPS parity
|
||||
check algorithm described in IS-GPS-200E. This avoids lengthy shift-
|
||||
and-xor loops. */
|
||||
|
||||
d1 = gpsword & 0xFBFFBF00;
|
||||
d2 = _lrotl(gpsword,1) & 0x07FFBF01;
|
||||
d3 = _lrotl(gpsword,2) & 0xFC0F8100;
|
||||
d4 = _lrotl(gpsword,3) & 0xF81FFE02;
|
||||
d5 = _lrotl(gpsword,4) & 0xFC00000E;
|
||||
d6 = _lrotl(gpsword,5) & 0x07F00001;
|
||||
d7 = _lrotl(gpsword,6) & 0x00003000;
|
||||
|
||||
t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7;
|
||||
|
||||
// Now XOR the 5 6-bit fields together to produce the 6-bit final result.
|
||||
|
||||
parity = t ^ _lrotl(t,6) ^ _lrotl(t,12) ^ _lrotl(t,18) ^ _lrotl(t,24);
|
||||
parity = parity & 0x3F;
|
||||
if (parity == (gpsword&0x3F))
|
||||
return(true);
|
||||
else
|
||||
return(false);
|
||||
|
||||
}
|
||||
|
||||
int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) {
|
||||
int corr_value=0;
|
||||
@ -247,7 +279,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
|
||||
{
|
||||
d_GPS_frame_4bytes ^= 0x3FFFFFC0; // invert the data bits (using XOR)
|
||||
}
|
||||
if (gps_word_parityCheck(d_GPS_frame_4bytes)) {
|
||||
if (gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(d_GPS_frame_4bytes)) {
|
||||
memcpy(&d_GPS_FSM.d_GPS_frame_4bytes,&d_GPS_frame_4bytes,sizeof(char)*4);
|
||||
d_GPS_FSM.d_preamble_time_ms=d_preamble_time_seconds*1000.0;
|
||||
d_GPS_FSM.Event_gps_word_valid();
|
||||
|
@ -31,15 +31,17 @@
|
||||
#ifndef GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_CC_H
|
||||
#define GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_CC_H
|
||||
|
||||
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "gps_l1_ca_subframe_fsm.h"
|
||||
#include "concurrent_queue.h"
|
||||
#include <fstream>
|
||||
#include <bitset>
|
||||
#include <gnuradio/gr_block.h>
|
||||
//#include <gnuradio/gr_sync_block.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "gps_telemetry.h"
|
||||
#include "gps_l1_ca_subframe_fsm.h"
|
||||
#include "concurrent_queue.h"
|
||||
//#include <gnuradio/gr_sync_block.h>
|
||||
|
||||
|
||||
|
||||
class gps_l1_ca_telemetry_decoder_cc;
|
||||
|
||||
@ -64,6 +66,8 @@ private:
|
||||
gps_l1_ca_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in,unsigned
|
||||
int vector_length, gr_msg_queue_sptr queue, bool dump);
|
||||
|
||||
bool gps_word_parityCheck(unsigned int gpsword);
|
||||
|
||||
// constants
|
||||
unsigned short int d_preambles_bits[8];
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "gps_telemetry.h"
|
||||
#include "gps_navigation_message.h"
|
||||
|
||||
namespace sc = boost::statechart;
|
||||
|
@ -76,7 +76,7 @@ const int GPS_WORD_BITS=30; //!< Number of bits per word in t
|
||||
|
||||
|
||||
|
||||
#define num_of_slices(x) sizeof(x)/sizeof(bits_slice)
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Navigation message bits slice structure: A portion of bits is indicated by
|
||||
|
@ -32,6 +32,10 @@
|
||||
|
||||
#include "gps_navigation_message.h"
|
||||
|
||||
|
||||
#define num_of_slices(x) sizeof(x)/sizeof(bits_slice)
|
||||
|
||||
|
||||
void gps_navigation_message::reset()
|
||||
{
|
||||
d_TOW=0;
|
||||
@ -129,6 +133,13 @@ gps_navigation_message::gps_navigation_message()
|
||||
|
||||
|
||||
|
||||
void gps_navigation_message::print_gps_word_bytes(unsigned int GPS_word)
|
||||
{
|
||||
std::cout << " Word =";
|
||||
std::cout<<std::bitset<32>(GPS_word);
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool gps_navigation_message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices)
|
||||
@ -154,6 +165,7 @@ bool gps_navigation_message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS>
|
||||
unsigned long int gps_navigation_message::read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices)
|
||||
{
|
||||
unsigned long int value;
|
||||
|
||||
value=0;
|
||||
for (int i=0;i<num_of_slices;i++)
|
||||
{
|
||||
|
@ -58,6 +58,7 @@ private:
|
||||
unsigned long int read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices);
|
||||
signed long int read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices);
|
||||
bool read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices);
|
||||
void print_gps_word_bytes(unsigned int GPS_word);
|
||||
|
||||
/*
|
||||
* Accounts for the beginning or end of week crossover
|
||||
|
@ -1,99 +0,0 @@
|
||||
/*!
|
||||
* \file gps_telemetry.cc
|
||||
* \brief GPS L1 C/A telemetry processing
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gps_telemetry.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <cstring>
|
||||
|
||||
bool gps_word_parityCheck(unsigned int gpsword)
|
||||
{
|
||||
unsigned int d1,d2,d3,d4,d5,d6,d7,t,parity;
|
||||
|
||||
/* XOR as many bits in parallel as possible. The magic constants pick
|
||||
up bits which are to be XOR'ed together to implement the GPS parity
|
||||
check algorithm described in ICD-GPS-200. This avoids lengthy shift-
|
||||
and-xor loops. */
|
||||
|
||||
d1 = gpsword & 0xFBFFBF00;
|
||||
d2 = _lrotl(gpsword,1) & 0x07FFBF01;
|
||||
d3 = _lrotl(gpsword,2) & 0xFC0F8100;
|
||||
d4 = _lrotl(gpsword,3) & 0xF81FFE02;
|
||||
d5 = _lrotl(gpsword,4) & 0xFC00000E;
|
||||
d6 = _lrotl(gpsword,5) & 0x07F00001;
|
||||
d7 = _lrotl(gpsword,6) & 0x00003000;
|
||||
|
||||
t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7;
|
||||
|
||||
// Now XOR the 5 6-bit fields together to produce the 6-bit final result.
|
||||
|
||||
parity = t ^ _lrotl(t,6) ^ _lrotl(t,12) ^ _lrotl(t,18) ^ _lrotl(t,24);
|
||||
parity = parity & 0x3F;
|
||||
if (parity == (gpsword&0x3F))
|
||||
return(true);
|
||||
else
|
||||
return(false);
|
||||
|
||||
}
|
||||
|
||||
char bit_mask(int num_bits)
|
||||
{
|
||||
char mask;
|
||||
mask=1;
|
||||
for (int i=0;i<(num_bits-1);i++)
|
||||
{
|
||||
mask<<=1;
|
||||
mask++;
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
char bit_select(int num_bit)
|
||||
{
|
||||
char mask;
|
||||
mask=1;
|
||||
for (int i=0;i<(num_bit-1);i++)
|
||||
{
|
||||
mask<<=1;
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
void print_gps_word_bytes(unsigned int GPS_word)
|
||||
{
|
||||
std::cout << " Word =";
|
||||
std::cout<<std::bitset<32>(GPS_word);
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
/*!
|
||||
* \file gps_telemetry.h
|
||||
* \brief GPS L1 C/A telemetry processing
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef GNSS_SDR_GPS_TELEMETRY_H_
|
||||
#define GNSS_SDR_GPS_TELEMETRY_H_
|
||||
|
||||
#define _lrotl(X,N) ((X << N) ^ (X >> (32-N))) //!< Used in the parity check algorithm
|
||||
|
||||
#include "GPS_L1_CA.h"
|
||||
|
||||
bool gps_word_parityCheck(unsigned int gpsword);
|
||||
char bit_mask(int num_bits);
|
||||
char bit_select(int num_bit);
|
||||
void print_gps_word_bytes(unsigned int GPS_word);
|
||||
|
||||
#endif
|
@ -1,4 +1,3 @@
|
||||
project : build-dir ../../../build ;
|
||||
|
||||
obj gps_navigation_message : gps_navigation_message.cc ;
|
||||
obj gps_telemetry : gps_telemetry.cc ;
|
@ -51,7 +51,6 @@ exe gnss-sdr : main.cc
|
||||
../core/receiver//gnss_block_factory
|
||||
../core/receiver//gnss_flowgraph
|
||||
../core/system_parameters//gps_navigation_message
|
||||
../core/system_parameters//gps_telemetry
|
||||
../..//gflags
|
||||
../..//glog
|
||||
../..//gnuradio-core ;
|
||||
|
Loading…
Reference in New Issue
Block a user