-
Notifications
You must be signed in to change notification settings - Fork 7
/
ffafb13e7f84146de450e72deb0c7c205fe9c74d.diff
66 lines (63 loc) · 5.04 KB
/
ffafb13e7f84146de450e72deb0c7c205fe9c74d.diff
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
diff --git a/gsm-receiver/src/lib/gsm_receiver_cf.cc b/gsm-receiver/src/lib/gsm_receiver_cf.cc
index a5108cf..b9e3ba3 100644
--- a/gsm-receiver/src/lib/gsm_receiver_cf.cc
+++ b/gsm-receiver/src/lib/gsm_receiver_cf.cc
@@ -478,6 +478,7 @@ void gsm_receiver_cf::forecast(int noutput_items, gr_vector_int &nitems_items_re
{
const gr_complex *input = (const gr_complex *) input_items[0];
const gr_complex *input_ul = (const gr_complex *) input_items[1];
+ const int ninput_items = d_is_uplink?min(nitems_items[0],nitems_items[1]):nitems_items[0];
//float *out = (float *) output_items[0];
int produced_out = 0; //how many output elements were produced - this isn't used yet
//probably the gsm receiver will be changed into sink so this variable won't be necessary
@@ -514,7 +515,7 @@ void gsm_receiver_cf::forecast(int noutput_items, gr_vector_int &nitems_items_re
break;
}
case first_fcch_search:
- if (find_fcch_burst(input, min(nitems_items[0],nitems_items[1]))) { //find frequency correction burst in the input buffer
+ if (find_fcch_burst(input, ninput_items)) { //find frequency correction burst in the input buffer
set_frequency(d_freq_offset); //if fcch search is successful set frequency offset
//produced_out = 0;
d_state = next_fcch_search;
@@ -526,7 +527,7 @@ void gsm_receiver_cf::forecast(int noutput_items, gr_vector_int &nitems_items_re
case next_fcch_search: { //this state is used because it takes some time (a bunch of buffered samples)
float prev_freq_offset = d_freq_offset; //before previous set_frequqency cause change
- if (find_fcch_burst(input, min(nitems_items[0],nitems_items[1]))) {
+ if (find_fcch_burst(input, ninput_items)) {
if (abs(prev_freq_offset - d_freq_offset) > FCCH_MAX_FREQ_OFFSET) {
set_frequency(d_freq_offset); //call set_frequncy only frequency offset change is greater than some value
}
@@ -545,7 +546,7 @@ void gsm_receiver_cf::forecast(int noutput_items, gr_vector_int &nitems_items_re
int burst_start = 0;
unsigned char output_binary[BURST_SIZE];
- if (reach_sch_burst(min(nitems_items[0],nitems_items[1]))) { //wait for a SCH burst
+ if (reach_sch_burst(ninput_items)) { //wait for a SCH burst
burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response from it
detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //detect bits using MLSE detection
if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) { //decode SCH burst
@@ -695,15 +696,17 @@ void gsm_receiver_cf::forecast(int noutput_items, gr_vector_int &nitems_items_re
detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
process_normal_burst(d_burst_nr, output_binary, first_burst, false); //TODO: this shouldn't be here - remove it when gsm receiver's interface will be ready
- double power_ul = power_complex(input_ul+burst_start, BURST_SIZE * d_OSR);
- if (power_ul > 0 /*15000*/) {
- burst_start = get_norm_chan_imp_resp(input_ul, &channel_imp_resp[0], d_bcc); //get channel impulse response for given training sequence number - d_bcc
- if (d_gs_ctx.ts_ctx[d_burst_nr.get_timeslot_nr()].type != TST_OFF) {
- DCOUT(d_burst_nr.get_frame_nr()<<":"<<d_burst_nr.get_timeslot_nr()
- << " UL normal burst start: " << burst_start << " power: " << power_ul << ((power_ul>15000)?" *":""));
- }
- detect_burst(input_ul, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
- process_normal_burst(d_burst_nr, output_binary, first_burst, true); //TODO: this shouldn't be here - remove it when gsm receiver's interface will be ready
+ if (d_is_uplink) {
+ double power_ul = power_complex(input_ul+burst_start, BURST_SIZE * d_OSR);
+ if (power_ul > 0 /*15000*/) {
+ burst_start = get_norm_chan_imp_resp(input_ul, &channel_imp_resp[0], d_bcc); //get channel impulse response for given training sequence number - d_bcc
+ if (d_gs_ctx.ts_ctx[d_burst_nr.get_timeslot_nr()].type != TST_OFF) {
+ DCOUT(d_burst_nr.get_frame_nr()<<":"<<d_burst_nr.get_timeslot_nr()
+ << " UL normal burst start: " << burst_start << " power: " << power_ul << ((power_ul>15000)?" *":""));
+ }
+ detect_burst(input_ul, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
+ process_normal_burst(d_burst_nr, output_binary, first_burst, true); //TODO: this shouldn't be here - remove it when gsm receiver's interface will be ready
+ }
}
break;
}