jolly has uploaded this change for review.

View Change

Fix indices of ARFCNs for measurement report

The order of ARFCNs are described in TS 44.018 ยง10.5.2.20.

The function arfcn_from_freq_index() is re-used to get the ARFCNs in
correct order for the report.

Change-Id: I0674467eb5a38a341cf65f95a25aa5f7232df069
---
M src/host/layer23/include/osmocom/bb/common/sysinfo.h
M src/host/layer23/src/mobile/gsm48_rr.c
2 files changed, 32 insertions(+), 19 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/58/34658/1
diff --git a/src/host/layer23/include/osmocom/bb/common/sysinfo.h b/src/host/layer23/include/osmocom/bb/common/sysinfo.h
index 89d38ac..9efb248 100644
--- a/src/host/layer23/include/osmocom/bb/common/sysinfo.h
+++ b/src/host/layer23/include/osmocom/bb/common/sysinfo.h
@@ -219,5 +219,6 @@
int gsm48_decode_mobile_alloc(struct gsm_sysinfo_freq *freq,
const uint8_t *ma, uint8_t len,
uint16_t *hopping, uint8_t *hopp_len, int si4);
+int16_t arfcn_from_freq_index(const struct gsm48_sysinfo *s, uint16_t index);

#endif /* _SYSINFO_H */
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c
index 8dca379..3200412 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -2538,32 +2538,30 @@
&& s->si5
&& (!s->nb_ext_ind_si5 || s->si5bis)) {
struct gsm48_rr_meas *rrmeas = &ms->rrlayer.meas;
- int n = 0, i, refer_pcs;
+ int i, refer_pcs;
+ int16_t arfcn;

LOGP(DRR, LOGL_NOTICE, "Complete set of SI5* for BA(%d)\n",
s->nb_ba_ind_si5);
rrmeas->nc_num = 0;
refer_pcs = gsm_refer_pcs(cs->arfcn, s);

- /* collect channels from freq list (1..1023,0) */
- for (i = 1; i <= 1024; i++) {
- if ((s->freq[i & 1023].mask & FREQ_TYPE_REP)) {
- if (n == 32) {
- LOGP(DRR, LOGL_NOTICE, "SI5* report "
- "exceeds 32 BCCHs\n");
- break;
- }
- if (refer_pcs && i >= 512 && i <= 810)
- rrmeas->nc_arfcn[n] = i | ARFCN_PCS;
- else
- rrmeas->nc_arfcn[n] = i & 1023;
- rrmeas->nc_rxlev_dbm[n] = -128;
- LOGP(DRR, LOGL_NOTICE, "SI5* report arfcn %s\n",
- gsm_print_arfcn(rrmeas->nc_arfcn[n]));
- n++;
- }
+ /* Collect channels from freq list in correct order. */
+ for (i = 1; i < 32; i++) {
+ arfcn = arfcn_from_freq_index(s, i);
+ if (arfcn < 0)
+ break;
+ if (refer_pcs && arfcn >= 512 && arfcn <= 810)
+ rrmeas->nc_arfcn[i] = arfcn | ARFCN_PCS;
+ else
+ rrmeas->nc_arfcn[i] = arfcn;
+ rrmeas->nc_rxlev_dbm[i] = -128;
+ LOGP(DRR, LOGL_NOTICE, "SI5/SI5bis report arfcn %s (index %d)\n",
+ gsm_print_arfcn(rrmeas->nc_arfcn[i]), i);
}
- rrmeas->nc_num = n;
+ rrmeas->nc_num = i;
+ if (i == 32 && arfcn_from_freq_index(s, i) >= 0)
+ LOGP(DRR, LOGL_NOTICE, "SI5/SI5bis/SI5ter define more than 32 channels.\n");
}

/* send sysinfo event to other layers */

To view, visit change 34658. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I0674467eb5a38a341cf65f95a25aa5f7232df069
Gerrit-Change-Number: 34658
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas@eversberg.eu>
Gerrit-MessageType: newchange