Change in osmo-bts[master]: get_lchan_by_chan_nr(): Fix resolution of CBCH

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Sep 17 19:27:13 UTC 2018


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/11004


Change subject: get_lchan_by_chan_nr(): Fix resolution of CBCH
......................................................................

get_lchan_by_chan_nr(): Fix resolution of CBCH

The CBCH (as per GSM specs) always maps on sub-slot 2 of either
the SDCCH/4 or SDCCH/8 that it replaces.  However, the way how we
express it as RSL-style channel number (0xC8) doesn't allow room
for any sub-slots.  The top 5 bits are used for expressing CBCH, while
the bottom 3 bits are used for the timeslot number (TN).

So when transforming from channel number to lchan, we must handle the
CBCH case specially by using a hard-coded sub-slot number of 2.

Change-Id: I44e2f763d5d25311167f435f2ca7e030b2a3f009
Related: OS#1617
---
M src/common/l1sap.c
1 file changed, 12 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/04/11004/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 1a7a965..ac4f0be 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -58,7 +58,18 @@
 struct gsm_lchan *get_lchan_by_chan_nr(struct gsm_bts_trx *trx,
 				       unsigned int chan_nr)
 {
-	return &trx->ts[L1SAP_CHAN2TS(chan_nr)].lchan[l1sap_chan2ss(chan_nr)];
+	unsigned int tn, ss;
+
+	tn = L1SAP_CHAN2TS(chan_nr);
+	OSMO_ASSERT(tn < ARRAY_SIZE(trx->ts));
+
+	if (L1SAP_IS_CHAN_CBCH(chan_nr))
+		ss = 2; /* CBCH is always on sub-slot 2 */
+	else
+		ss = l1sap_chan2ss(chan_nr);
+	OSMO_ASSERT(ss < ARRAY_SIZE(trx->ts[tn].lchan));
+
+	return &trx->ts[tn].lchan[ss];
 }
 
 static struct gsm_lchan *

-- 
To view, visit https://gerrit.osmocom.org/11004
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I44e2f763d5d25311167f435f2ca7e030b2a3f009
Gerrit-Change-Number: 11004
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180917/2fd7a432/attachment.htm>


More information about the gerrit-log mailing list