aboutsummaryrefslogtreecommitdiffstats
path: root/lib/receiver/receiver_impl.h
diff options
context:
space:
mode:
authorPiotr Krysik <ptrkrysik@gmail.com>2019-07-16 16:17:43 +0200
committerPiotr Krysik <ptrkrysik@gmail.com>2019-07-18 10:33:28 +0200
commitc5ed04572f6cb6ced8ad80b9bdb417e855b8f363 (patch)
tree841979d4ed93082be2fbc90381219f4a0bdebd66 /lib/receiver/receiver_impl.h
parent891b2deb5f7104506d4e10a1bad736d204640c78 (diff)
receiver/time_sample_ref: SDR hardware time tracking
Gr-gsm's receiver needs a stream of samples with sampling frequency that is integer multiply of gsm symbol rate. Many hardware receivers don't support such rates, and even if they do there might be error in their time source. Sample rate is adapted and corrected with use of a resampler. Moreover corrections are applied in the runtime so resampler's resample rate is changed dynamically. Those changes need to be tracked in order to be able to track time of the hardware after resampling. Hardware time tracking is needed to enable triggering of events in the hardware (i.e. frequency changes, burst transmissions). Changes were made in time_sample_ref and receiver in order to enable SDR hardware time tracking. Change-Id: Ide8149a5fc6c22700d3a4542115306a4dc682ff2
Diffstat (limited to 'lib/receiver/receiver_impl.h')
-rw-r--r--lib/receiver/receiver_impl.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/receiver/receiver_impl.h b/lib/receiver/receiver_impl.h
index 8714d52..bc11879 100644
--- a/lib/receiver/receiver_impl.h
+++ b/lib/receiver/receiver_impl.h
@@ -54,7 +54,7 @@ namespace gr {
gr_complex d_sch_training_seq[N_SYNC_BITS]; ///<encoded training sequence of a SCH burst
gr_complex d_norm_training_seq[TRAIN_SEQ_NUM][N_TRAIN_BITS]; ///<encoded training sequences of a normal and dummy burst
- float d_last_time;
+ time_spec_t d_last_time;
/** Counts samples consumed by the receiver
*
@@ -209,6 +209,19 @@ namespace gr {
/* State machine handlers */
void fcch_search_handler(gr_complex *input, int noutput_items);
void sch_search_handler(gr_complex *input, int noutput_items);
+
+ uint64_t get_offset_before_resampler(uint64_t offset){
+ std::vector<tag_t> original_ofsets;
+ get_tags_in_window(original_ofsets, 0, offset, offset+1, pmt::intern("original_offset"));
+ uint64_t offset_recovered = d_time_samp_ref.convert_M_to_N(offset);
+ uint64_t offset_before_resampler = 0;
+ if(!original_ofsets.empty()){
+ offset_before_resampler = pmt::to_uint64(original_ofsets[0].value);
+ } else {
+ offset_before_resampler = offset_recovered;
+ }
+ return offset_before_resampler;
+ };
void synchronized_handler(gr_complex *input,
gr_vector_const_void_star &input_items, int noutput_items);