diff options
author | Piotr Krysik <ptrkrysik@gmail.com> | 2018-04-16 22:21:29 +0200 |
---|---|---|
committer | Piotr Krysik <ptrkrysik@gmail.com> | 2018-04-16 22:21:29 +0200 |
commit | 8a8d41a58320d5f30713a6e6362c86d5db6de1de (patch) | |
tree | d95b1badab52b83126d57d410dd8e92e7a255c8e /include | |
parent | 8b9b88d788cc5064c0f6d7aa60a14954aee59eab (diff) | |
parent | fe4db93e6d03e92a958664bfffcd0e2923f20e34 (diff) |
Merge branch 'ptrkrysik/trx' into development
Diffstat (limited to 'include')
-rw-r--r-- | include/grgsm/CMakeLists.txt | 2 | ||||
-rw-r--r-- | include/grgsm/flow_control/CMakeLists.txt | 1 | ||||
-rw-r--r-- | include/grgsm/flow_control/burst_type_filter.h | 63 | ||||
-rw-r--r-- | include/grgsm/flow_control/uplink_downlink_splitter.h | 4 | ||||
-rw-r--r-- | include/grgsm/gsm_constants.h | 178 | ||||
-rw-r--r-- | include/grgsm/misc_utils/CMakeLists.txt | 5 | ||||
-rw-r--r-- | include/grgsm/misc_utils/controlled_fractional_resampler_cc.h | 2 | ||||
-rw-r--r-- | include/grgsm/misc_utils/fn_time.h | 55 | ||||
-rw-r--r-- | include/grgsm/misc_utils/msg_to_tag.h | 2 | ||||
-rw-r--r-- | include/grgsm/misc_utils/time_spec.h | 141 | ||||
-rw-r--r-- | include/grgsm/misc_utils/trx_burst_if.h | 59 | ||||
-rw-r--r-- | include/grgsm/qa_utils/burst_sink.h | 2 | ||||
-rw-r--r-- | include/grgsm/transmitter/CMakeLists.txt | 28 | ||||
-rw-r--r-- | include/grgsm/transmitter/gen_test_ab.h | 60 | ||||
-rw-r--r-- | include/grgsm/transmitter/preprocess_tx_burst.h | 60 | ||||
-rw-r--r-- | include/grgsm/transmitter/txtime_setter.h | 62 |
16 files changed, 719 insertions, 5 deletions
diff --git a/include/grgsm/CMakeLists.txt b/include/grgsm/CMakeLists.txt index d9b032d..2f76929 100644 --- a/include/grgsm/CMakeLists.txt +++ b/include/grgsm/CMakeLists.txt @@ -25,6 +25,7 @@ install(FILES api.h gsmtap.h constants.h + gsm_constants.h DESTINATION include/grgsm ) @@ -35,3 +36,4 @@ add_subdirectory(receiver) add_subdirectory(misc_utils) add_subdirectory(qa_utils) add_subdirectory(flow_control) +add_subdirectory(transmitter) diff --git a/include/grgsm/flow_control/CMakeLists.txt b/include/grgsm/flow_control/CMakeLists.txt index 322c8c8..d86f1c7 100644 --- a/include/grgsm/flow_control/CMakeLists.txt +++ b/include/grgsm/flow_control/CMakeLists.txt @@ -27,6 +27,7 @@ install(FILES burst_timeslot_filter.h burst_sdcch_subslot_filter.h burst_fnr_filter.h + burst_type_filter.h dummy_burst_filter.h uplink_downlink_splitter.h DESTINATION include/grgsm/flow_control ) diff --git a/include/grgsm/flow_control/burst_type_filter.h b/include/grgsm/flow_control/burst_type_filter.h new file mode 100644 index 0000000..6430039 --- /dev/null +++ b/include/grgsm/flow_control/burst_type_filter.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* @file + * @author (C) 2017 by Piotr Krysik <ptrkrysik@gmail.com> + * @section LICENSE + * + * Gr-gsm 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, or (at your option) + * any later version. + * + * Gr-gsm 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 gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef INCLUDED_GSM_BURST_TYPE_FILTER_H +#define INCLUDED_GSM_BURST_TYPE_FILTER_H + +#include <grgsm/api.h> +#include <gnuradio/block.h> +#include <grgsm/flow_control/common.h> + +namespace gr { + namespace gsm { + + /*! + * \brief <+description of block+> + * \ingroup gsm + * + */ + class GRGSM_API burst_type_filter : virtual public gr::block + { + public: + typedef boost::shared_ptr<burst_type_filter> sptr; + + /*! + * \brief Return a shared_ptr to a new instance of grgsm::burst_type_filter. + * + * To avoid accidental use of raw pointers, grgsm::burst_type_filter's + * constructor is in a private implementation + * class. grgsm::burst_type_filter::make is the public interface for + * creating new instances. + */ + + static sptr make(const std::vector<uint8_t> & selected_burst_types); + + /* External API */ + /* Filtering policy */ + virtual filter_policy get_policy(void) = 0; + virtual filter_policy set_policy(filter_policy policy) = 0; + virtual void set_selected_burst_types(const std::vector<uint8_t> & selected_burst_types) = 0; + }; + } // namespace gsm +} // namespace gr + +#endif /* INCLUDED_GSM_BURST_TYPE_FILTER_H */ diff --git a/include/grgsm/flow_control/uplink_downlink_splitter.h b/include/grgsm/flow_control/uplink_downlink_splitter.h index 0dbc0bc..874c0b6 100644 --- a/include/grgsm/flow_control/uplink_downlink_splitter.h +++ b/include/grgsm/flow_control/uplink_downlink_splitter.h @@ -28,7 +28,7 @@ #include <gnuradio/block.h> namespace gr { - namespace grgsm { + namespace gsm { /*! * \brief <+description of block+> @@ -51,7 +51,7 @@ namespace gr { static sptr make(); }; - } // namespace grgsm + } // namespace gsm } // namespace gr #endif /* INCLUDED_GRGSM_UPLINK_DOWNLINK_SPLITTER_H */ diff --git a/include/grgsm/gsm_constants.h b/include/grgsm/gsm_constants.h new file mode 100644 index 0000000..2fbfd36 --- /dev/null +++ b/include/grgsm/gsm_constants.h @@ -0,0 +1,178 @@ +/* -*- c++ -*- */ +/* + * @file + * @author (C) 2014 by Piotr Krysik <ptrkrysik@gmail.com> + * @section LICENSE + * + * Gr-gsm 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, or (at your option) + * any later version. + * + * Gr-gsm 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 gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GSM_CONSTANTS_H +#define INCLUDED_GSM_CONSTANTS_H + +#define GSM_SYMBOL_RATE (1625000.0/6.0) //symbols per second +#define GSM_SYMBOL_PERIOD (1.0/GSM_SYMBOL_RATE) //seconds per symbol + +//Burst timing +#define TAIL_BITS 3 +#define GUARD_BITS 8 +#define GUARD_FRACTIONAL 0.25 //fractional part of guard period +#define GUARD_PERIOD GUARD_BITS + GUARD_FRACTIONAL +#define DATA_BITS 57 //size of 1 data block in normal burst +#define STEALING_BIT 1 +#define N_TRAIN_BITS 26 +#define N_SYNC_BITS 64 +#define USEFUL_BITS 142 //(2*(DATA_BITS+STEALING_BIT) + N_TRAIN_BITS ) +#define FCCH_BITS USEFUL_BITS +#define BURST_SIZE (USEFUL_BITS+2*TAIL_BITS) +#define ACCESS_BURST_SIZE 88 +#define PROCESSED_CHUNK BURST_SIZE+2*GUARD_PERIOD + +#define SCH_DATA_LEN 39 +#define TS_BITS (TAIL_BITS+USEFUL_BITS+TAIL_BITS+GUARD_BITS) //a full TS (156 bits) +#define TS_PER_FRAME 8 +#define FRAME_BITS (TS_PER_FRAME * TS_BITS + 2) // 156.25 * 8 +#define FCCH_POS TAIL_BITS +#define SYNC_POS 39 +#define TRAIN_POS ( TAIL_BITS + (DATA_BITS+STEALING_BIT) + 5) //first 5 bits of a training sequence + //aren't used for channel impulse response estimation +#define TRAIN_BEGINNING 5 +#define SAFETY_MARGIN 6 // + +#define FCCH_HITS_NEEDED (USEFUL_BITS - 4) +#define FCCH_MAX_MISSES 1 +#define FCCH_MAX_FREQ_OFFSET 100 + +#define CHAN_IMP_RESP_LENGTH 5 + +#define MAX_SCH_ERRORS 10 //maximum number of subsequent sch errors after which gsm receiver goes to find_next_fcch state + +typedef enum {empty, fcch_burst, sch_burst, normal_burst, rach_burst, dummy, dummy_or_normal, normal_or_noise} burst_type; +typedef enum {unknown, multiframe_26, multiframe_51} multiframe_type; + +static const unsigned char SYNC_BITS[] = { + 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, + 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, + 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1 +}; + +const unsigned FCCH_FRAMES[] = {0, 10, 20, 30, 40}; +const unsigned SCH_FRAMES[] = {1, 11, 21, 31, 41}; + +const unsigned BCCH_FRAMES[] = {2, 3, 4, 5}; //!!the receiver shouldn't care about logical + //!!channels so this will be removed from this header +const unsigned TEST_CCH_FRAMES[] = {2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49}; +const unsigned TRAFFIC_CHANNEL_F[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; +const unsigned TEST51[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50}; + + +#define TSC0 0 +#define TSC1 1 +#define TSC2 2 +#define TSC3 3 +#define TSC4 4 +#define TSC5 5 +#define TSC6 6 +#define TSC7 7 +#define TS_DUMMY 8 + +#define TRAIN_SEQ_NUM 9 + +#define TIMESLOT0 0 +#define TIMESLOT1 1 +#define TIMESLOT2 2 +#define TIMESLOT3 3 +#define TIMESLOT4 4 +#define TIMESLOT5 5 +#define TIMESLOT6 6 +#define TIMESLOT7 7 + + +static const unsigned char train_seq[TRAIN_SEQ_NUM][N_TRAIN_BITS] = { + {0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1}, + {0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1}, + {0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0}, + {0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0}, + {0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1}, + {0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0}, + {1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1}, + {1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0}, + {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1} // DUMMY +}; + + +//Dummy burst 0xFB 76 0A 4E 09 10 1F 1C 5C 5C 57 4A 33 39 E9 F1 2F A8 +static const unsigned char dummy_burst[] = { + 0, 0, 0, + 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, + 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, + 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 0, 0, + + 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, + 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, + 0, 0, 0, 1, 0, 1, + + 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, + 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, + 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, + 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, + 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, + 1, 1, 1, 0, 1, 0, 1, 0, + 0, 0, 0 +}; + + +/* + * The frequency correction burst is used for frequency synchronization + * of the mobile. This is broadcast in TS0 together with the SCH and + * BCCH. + * + * Modulating the bits below causes a spike at 62.5kHz above (below for + * COMPACT) the center frequency. One can use this spike with a narrow + * band filter to accurately determine the center of the channel. + */ +static const unsigned char fc_fb[] = { + 0, 0, 0, //I don't use this tables, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //I copied this here from burst_types.h because + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //the description is very informative - p.krysik + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0 +}; + +static const unsigned char fc_compact_fb[] = { + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 +}; + + +#endif /* INCLUDED_GSM_CONSTANTS_H */ diff --git a/include/grgsm/misc_utils/CMakeLists.txt b/include/grgsm/misc_utils/CMakeLists.txt index 2f7f4c3..0ec706c 100644 --- a/include/grgsm/misc_utils/CMakeLists.txt +++ b/include/grgsm/misc_utils/CMakeLists.txt @@ -35,5 +35,8 @@ install(FILES message_printer.h tmsi_dumper.h msg_to_tag.h - controlled_fractional_resampler_cc.h DESTINATION include/grgsm/misc_utils + trx_burst_if.h + controlled_fractional_resampler_cc.h + time_spec.h + fn_time.h DESTINATION include/grgsm/misc_utils ) diff --git a/include/grgsm/misc_utils/controlled_fractional_resampler_cc.h b/include/grgsm/misc_utils/controlled_fractional_resampler_cc.h index b085f94..9dae6b8 100644 --- a/include/grgsm/misc_utils/controlled_fractional_resampler_cc.h +++ b/include/grgsm/misc_utils/controlled_fractional_resampler_cc.h @@ -57,7 +57,7 @@ namespace gr { virtual void set_resamp_ratio(float resamp_ratio) = 0; }; - } // namespace grgsm + } // namespace gsm } // namespace gr #endif /* INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_H */ diff --git a/include/grgsm/misc_utils/fn_time.h b/include/grgsm/misc_utils/fn_time.h new file mode 100644 index 0000000..b26c21b --- /dev/null +++ b/include/grgsm/misc_utils/fn_time.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* @file + * @author Piotr Krysik <ptrkrysik@gmail.com> + * @author Vadim Yanitskiy <axilirator@gmail.com> + * @section LICENSE + * + * Gr-gsm 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, or (at your option) + * any later version. + * + * Gr-gsm 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 gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + * + */ + + +#ifndef INCLUDED_GRGSM_FN_TIME_H +#define INCLUDED_GRGSM_FN_TIME_H + +#include <grgsm/api.h> +#include <stdint.h> +#include <utility> + +namespace gr { + namespace gsm { + + /** + * Computes difference between reference frame number + * and a second frame number. + * @param fn_ref reference frame number modulo GSM_HYPER_FRAME + * @param fn second frame number modulo GSM_HYPER_FRAME + * @param time_ref precise timestamp of the first sample in the fn_ref + * @param time_hint coarse time for fn that is used as a hint to avoid + * ambiguities caused by modulo operation applied to + * frame numbers + * @return difference between fn_ref and fn + */ + typedef std::pair<unsigned long long, double> time_format; + + GRGSM_API time_format fn_time_delta_cpp(uint32_t fn_ref, time_format time_ref, uint32_t fn_x, + time_format time_hint, uint32_t ts_num, uint32_t ts_ref); + + } // namespace gsm +} // namespace gr + +#endif /* INCLUDED_GRGSM_FN_TIME_H */ + diff --git a/include/grgsm/misc_utils/msg_to_tag.h b/include/grgsm/misc_utils/msg_to_tag.h index 87e2e78..c7b4e10 100644 --- a/include/grgsm/misc_utils/msg_to_tag.h +++ b/include/grgsm/misc_utils/msg_to_tag.h @@ -50,7 +50,7 @@ namespace gr { static sptr make(); }; - } // namespace grgsm + } // namespace gsm } // namespace gr #endif /* INCLUDED_GRGSM_MSG_TO_TAG_H */ diff --git a/include/grgsm/misc_utils/time_spec.h b/include/grgsm/misc_utils/time_spec.h new file mode 100644 index 0000000..6ae5963 --- /dev/null +++ b/include/grgsm/misc_utils/time_spec.h @@ -0,0 +1,141 @@ +// +// Copyright 2010-2012 Ettus Research LLC +// +// This program 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. +// +// This program 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 this program. If not, see <http://www.gnu.org/licenses/>. +// + +#ifndef INCLUDED_TYPES_TIME_SPEC_HPP +#define INCLUDED_TYPES_TIME_SPEC_HPP + +#include <grgsm/api.h> +#include <boost/operators.hpp> +#include <ctime> + +namespace gr { + namespace gsm { + + /*! + * A time_spec_t holds a seconds and a fractional seconds time value. + * Depending upon usage, the time_spec_t can represent absolute times, + * relative times, or time differences (between absolute times). + * + * The time_spec_t provides clock-domain independent time storage, + * but can convert fractional seconds to/from clock-domain specific units. + * + * The fractional seconds are stored as double precision floating point. + * This gives the fractional seconds enough precision to unambiguously + * specify a clock-tick/sample-count up to rates of several petahertz. + */ + class GRGSM_API time_spec_t : boost::additive<time_spec_t>, boost::totally_ordered<time_spec_t>{ + public: + + /*! + * Copy constructor + */ + time_spec_t(const time_spec_t & spec); + + /*! + * Create a time_spec_t from a real-valued seconds count. + * \param secs the real-valued seconds count (default = 0) + */ + time_spec_t(double secs = 0); + + /*! + * Create a time_spec_t from whole and fractional seconds. + * \param full_secs the whole/integer seconds count + * \param frac_secs the fractional seconds count (default = 0) + */ + time_spec_t(time_t full_secs, double frac_secs = 0); + + /*! + * Create a time_spec_t from whole seconds and fractional ticks. + * Translation from clock-domain specific units. + * \param full_secs the whole/integer seconds count + * \param tick_count the fractional seconds tick count + * \param tick_rate the number of ticks per second + */ + time_spec_t(time_t full_secs, long tick_count, double tick_rate); + + /*! + * Create a time_spec_t from a 64-bit tick count. + * Translation from clock-domain specific units. + * \param ticks an integer count of ticks + * \param tick_rate the number of ticks per second + */ + static time_spec_t from_ticks(long long ticks, double tick_rate); + + /*! + * Convert the fractional seconds to clock ticks. + * Translation into clock-domain specific units. + * \param tick_rate the number of ticks per second + * \return the fractional seconds tick count + */ + long get_tick_count(double tick_rate) const; + + /*! + * Convert the time spec into a 64-bit tick count. + * Translation into clock-domain specific units. + * \param tick_rate the number of ticks per second + * \return an integer number of ticks + */ + long long to_ticks(const double tick_rate) const; + + /*! + * Get the time as a real-valued seconds count. + * Note: If this time_spec_t represents an absolute time, + * the precision of the fractional seconds may be lost. + * \return the real-valued seconds + */ + double get_real_secs(void) const; + + /*! + * Get the whole/integer part of the time in seconds. + * \return the whole/integer seconds + */ + time_t get_full_secs(void) const; + + /*! + * Get the fractional part of the time in seconds. + * \return the fractional seconds + */ + double get_frac_secs(void) const; + + //! Implement addable interface + time_spec_t &operator+=(const time_spec_t &); + + //! Implement subtractable interface + time_spec_t &operator-=(const time_spec_t &); + + //private time storage details + private: time_t _full_secs; double _frac_secs; + }; + + //! Implement equality_comparable interface + bool operator==(const time_spec_t &, const time_spec_t &); + + //! Implement less_than_comparable interface + bool operator<(const time_spec_t &, const time_spec_t &); + + inline time_t time_spec_t::get_full_secs(void) const{ + return this->_full_secs; + } + + inline double time_spec_t::get_frac_secs(void) const{ + return this->_frac_secs; + } + + } //namespace transceiver +} //namespace gr + +#endif /* INCLUDED_TYPES_TIME_SPEC_HPP */ diff --git a/include/grgsm/misc_utils/trx_burst_if.h b/include/grgsm/misc_utils/trx_burst_if.h new file mode 100644 index 0000000..0e7a35a --- /dev/null +++ b/include/grgsm/misc_utils/trx_burst_if.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* @file + * @author Vadim Yanitskiy <axilirator@gmail.com> + * @section LICENSE + * + * Gr-gsm 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, or (at your option) + * any later version. + * + * Gr-gsm 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 gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef INCLUDED_GRGSM_TRX_BURST_IF_H +#define INCLUDED_GRGSM_TRX_BURST_IF_H + +#include <grgsm/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace gsm { + + /*! + * \brief <+description of block+> + * \ingroup grgsm + * + */ + class GRGSM_API trx_burst_if : virtual public gr::block + { + public: + typedef boost::shared_ptr<trx_burst_if> sptr; + + /*! + * \brief Return a shared_ptr to a new instance of grgsm::trx_burst_if. + * + * To avoid accidental use of raw pointers, grgsm::trx_burst_if's + * constructor is in a private implementation + * class. grgsm::trx_burst_if::make is the public interface for + * creating new instances. + */ + static sptr make( + const std::string &remote_addr, + const std::string &base_port); + }; + + } // namespace gsm +} // namespace gr + +#endif /* INCLUDED_GRGSM_TRX_BURST_IF_H */ + diff --git a/include/grgsm/qa_utils/burst_sink.h b/include/grgsm/qa_utils/burst_sink.h index e12d027..774075f 100644 --- a/include/grgsm/qa_utils/burst_sink.h +++ b/include/grgsm/qa_utils/burst_sink.h @@ -25,6 +25,7 @@ #include <grgsm/api.h> #include <gnuradio/block.h> +#include <pmt/pmt.h> namespace gr { namespace gsm { @@ -52,6 +53,7 @@ namespace gr { virtual std::vector<int> get_framenumbers() = 0; virtual std::vector<int> get_timeslots() = 0; virtual std::vector<std::string> get_burst_data() = 0; + virtual pmt::pmt_t get_bursts() = 0; }; } // namespace gsm } // namespace gr diff --git a/include/grgsm/transmitter/CMakeLists.txt b/include/grgsm/transmitter/CMakeLists.txt new file mode 100644 index 0000000..fab6f7c --- /dev/null +++ b/include/grgsm/transmitter/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright 2011,2012 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install public header files +######################################################################## +install(FILES + txtime_setter.h + preprocess_tx_burst.h + gen_test_ab.h + DESTINATION include/grgsm/transmitter +) diff --git a/include/grgsm/transmitter/gen_test_ab.h b/include/grgsm/transmitter/gen_test_ab.h new file mode 100644 index 0000000..d2756f1 --- /dev/null +++ b/include/grgsm/transmitter/gen_test_ab.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* @file + * @author Piotr Krysik <ptrkrysik@gmail.com> + * @section LICENSE + * + * Gr-gsm 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, or (at your option) + * any later version. + * + * Gr-gsm 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 gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + * + */ + + +#ifndef INCLUDED_GSM_GEN_TEST_AB_H +#define INCLUDED_GSM_GEN_TEST_AB_H + +#include <grgsm/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace gsm { + + /*! + * \brief A block that does preprocessing tasks before sending bursts to modulator. + * \ingroup gsm + * + * Currently it removes GSMTAP header from a burst and puts it in first part of PDU + * pair and removes tailing zeros from Access Bursts coming from TRX interface. + */ + class GRGSM_API gen_test_ab : virtual public gr::block + { + public: + typedef boost::shared_ptr<gen_test_ab> sptr; + + /*! + * \brief Return a shared_ptr to a new instance of gsm::gen_test_ab. + * + * To avoid accidental use of raw pointers, gsm::gen_test_ab's + * constructor is in a private implementation + * class. gsm::gen_test_ab::make is the public interface for + * creating new instances. + */ + static sptr make(); + }; + + } // namespace gsm +} // namespace gr + +#endif /* INCLUDED_GSM_GEN_TEST_AB_H */ + diff --git a/include/grgsm/transmitter/preprocess_tx_burst.h b/include/grgsm/transmitter/preprocess_tx_burst.h new file mode 100644 index 0000000..2a07dd5 --- /dev/null +++ b/include/grgsm/transmitter/preprocess_tx_burst.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* @file + * @author Piotr Krysik <ptrkrysik@gmail.com> + * @section LICENSE + * + * Gr-gsm 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, or (at your option) + * any later version. + * + * Gr-gsm 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 gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + * + */ + + +#ifndef INCLUDED_GSM_PREPROCESS_TX_BURST_H +#define INCLUDED_GSM_PREPROCESS_TX_BURST_H + +#include <grgsm/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace gsm { + + /*! + * \brief A block that does preprocessing tasks before sending bursts to modulator. + * \ingroup gsm + * + * Currently it removes GSMTAP header from a burst and puts it in first part of PDU + * pair and removes tailing zeros from Access Bursts coming from TRX interface. + */ + class GRGSM_API preprocess_tx_burst : virtual public gr::block + { + public: + typedef boost::shared_ptr<preprocess_tx_burst> sptr; + + /*! + * \brief Return a shared_ptr to a new instance of gsm::preprocess_tx_burst. + * + * To avoid accidental use of raw pointers, gsm::preprocess_tx_burst's + * constructor is in a private implementation + * class. gsm::preprocess_tx_burst::make is the public interface for + * creating new instances. + */ + static sptr make(); + }; + + } // namespace gsm +} // namespace gr + +#endif /* INCLUDED_GSM_PREPROCESS_TX_BURST_H */ + diff --git a/include/grgsm/transmitter/txtime_setter.h b/include/grgsm/transmitter/txtime_setter.h new file mode 100644 index 0000000..0bf0b03 --- /dev/null +++ b/include/grgsm/transmitter/txtime_setter.h @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* @file + * @author Piotr Krysik <ptrkrysik@gmail.com> + * @section LICENSE + * + * Gr-gsm 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, or (at your option) + * any later version. + * + * Gr-gsm 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 gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + * + */ + + +#ifndef INCLUDED_GSM_TXTIME_SETTER_H +#define INCLUDED_GSM_TXTIME_SETTER_H + +#include <grgsm/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace gsm { + + /*! + * \brief <+description of block+> + * \ingroup gsm + * + */ + class GRGSM_API txtime_setter : virtual public gr::block + { + public: + typedef boost::shared_ptr<txtime_setter> sptr; + + /*! + * \brief Return a shared_ptr to a new instance of gsm::txtime_setter. + * + * To avoid accidental use of raw pointers, gsm::txtime_setter's + * constructor is in a private implementation + * class. gsm::txtime_setter::make is the public interface for + * creating new instances. + */ + static sptr make(uint32_t init_fn, uint64_t init_time_secs, double init_time_fracs, uint64_t time_hint_secs, double time_hint_fracs, double timing_advance, double delay_correction); + virtual void set_fn_time_reference(uint32_t fn, uint32_t ts, uint64_t time_secs, double time_fracs) = 0; + virtual void set_time_hint(uint64_t time_hint_secs, double time_hint_fracs) = 0; + virtual void set_delay_correction(double delay_correction) = 0; + virtual void set_timing_advance(double timing_advance) = 0; + }; + + } // namespace gsm +} // namespace gr + +#endif /* INCLUDED_GSM_TXTIME_SETTER_H */ + |