-
Notifications
You must be signed in to change notification settings - Fork 8
/
srsLTE_cell_measurement.patch
109 lines (103 loc) · 3.78 KB
/
srsLTE_cell_measurement.patch
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
diff --git a/lib/examples/cell_measurement.c b/lib/examples/cell_measurement.c
index 3185b74f..4176f1e5 100644
--- a/lib/examples/cell_measurement.c
+++ b/lib/examples/cell_measurement.c
@@ -60,6 +60,7 @@ typedef struct {
float rf_gain;
}prog_args_t;
+
void args_default(prog_args_t *args) {
args->nof_subframes = -1;
args->force_N_id_2 = -1; // Pick the best
@@ -162,6 +163,12 @@ int main(int argc, char **argv) {
cf_t *ce[SRSLTE_MAX_PORTS];
float cfo = 0;
bool acks[SRSLTE_MAX_CODEWORDS] = {false};
+
+ struct {
+ int subframe;
+ int periodicity;
+ int offset;
+ }sib_loc[8];
srslte_debug_handle_crash(argc, argv);
@@ -328,23 +335,60 @@ int main(int argc, char **argv) {
break;
case DECODE_SIB:
/* We are looking for SI Blocks, search only in appropiate places */
- if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) {
+ /*sib1 subframe = 5, periodicity = 2, offset = 0*/
+
+ sib_loc[1].subframe=0;
+ sib_loc[1].periodicity=16;
+ sib_loc[1].offset=0;
+ sib_loc[2].subframe=0;
+ sib_loc[2].periodicity=16;
+ sib_loc[2].offset=2;
+ sib_loc[3].subframe=0;
+ sib_loc[3].periodicity=32;
+ sib_loc[3].offset=4;
+
+
+ //SIB1//
+ if ((srslte_ue_sync_get_sfidx(&ue_sync) ==5 && (sfn%2)==0)) {
+ n = srslte_ue_dl_decode(&ue_dl, data, 0, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), acks);
+ if (n < 0) {
+ fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
+ return -1;
+ } else if (n == 0) {
+ printf("CFO: %+6.4f kHz, SFO: %+6.4f kHz, PDCCH-Det: %.3f\r",
+ srslte_ue_sync_get_cfo(&ue_sync)/1000, srslte_ue_sync_get_sfo(&ue_sync)/1000,
+ (float) ue_dl.nof_detected/nof_trials);
+ nof_trials++;
+ } else {
+ printf("Decoded SIB1. Payload: ");
+ srslte_vec_fprint_byte(stdout, data[0], n/8);;
+ state = MEASURE;
+ }
+ }
+
+ //index i = sibs entry in SIB1 scheduling info//
+
+ int i = 2;
+
+ if ((srslte_ue_sync_get_sfidx(&ue_sync) == sib_loc[i].subframe &&
+ (sfn%sib_loc[i].periodicity)==sib_loc[i].offset)) {
n = srslte_ue_dl_decode(&ue_dl, data, 0, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), acks);
if (n < 0) {
fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
return -1;
} else if (n == 0) {
printf("CFO: %+6.4f kHz, SFO: %+6.4f kHz, PDCCH-Det: %.3f\r",
- srslte_ue_sync_get_cfo(&ue_sync)/1000, srslte_ue_sync_get_sfo(&ue_sync)/1000,
- (float) ue_dl.nof_detected/nof_trials);
+ srslte_ue_sync_get_cfo(&ue_sync)/1000, srslte_ue_sync_get_sfo(&ue_sync)/1000,
+ (float) ue_dl.nof_detected/nof_trials);
nof_trials++;
} else {
- printf("Decoded SIB1. Payload: ");
+ printf("Decoded SIBs of entry %d. Payload: ", i);
srslte_vec_fprint_byte(stdout, data[0], n/8);;
state = MEASURE;
}
}
- break;
+
+ break;
case MEASURE:
diff --git a/lib/examples/pdsch_ue.c b/lib/examples/pdsch_ue.c
index 74bac426..056e637e 100644
--- a/lib/examples/pdsch_ue.c
+++ b/lib/examples/pdsch_ue.c
@@ -725,7 +725,7 @@ int main(int argc, char **argv) {
if (n < 0) {
// fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
} else if (n > 0) {
-
+ srslte_vec_fprint_byte(stdout, *data, n/8);;
/* Send data if socket active */
if (prog_args.net_port > 0) {
if(sfidx == 1) {
@@ -1066,3 +1066,4 @@ void init_plots() {
}
#endif
+