From 173555dab71d2bcd1e1984a2608e1dd7f0e77dc5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 30 Sep 2018 14:50:39 +0200 Subject: Fix computing CCCH block number from frame number The existing implementation used a simplistic macro, which was wrong in many ways: 1) it returned a negative value for "fn % 51 < 5" conditions without raising any error message or asserting 2) it returned a wrong block number for many different input frame numbers, as it didn't account properly for the FCCH/SCH gaps between the blocks Let's replace the simplistic macro with a proper lookup table based on TS 05.02, and let's OSMO_ASSERT() if this is ever called with non-CCCH frame numbers. Change-Id: I11fd6cc558bb61c40c2019e46f56c1fe78ef39f5 Closes: OS#3024 --- src/osmo-bts-litecell15/l1_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/osmo-bts-litecell15') diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c index 4093225f..99852e39 100644 --- a/src/osmo-bts-litecell15/l1_if.c +++ b/src/osmo-bts-litecell15/l1_if.c @@ -388,7 +388,7 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, } else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) { /* The sapi depends on DSP configuration, not * on the actual SYSTEM INFORMATION 3. */ - u8BlockNbr = L1SAP_FN2CCCHBLOCK(u32Fn); + u8BlockNbr = l1sap_fn2ccch_block(u32Fn); if (u8BlockNbr >= num_agch(trx, "PH-DATA-REQ")) sapi = GsmL1_Sapi_Pch; else -- cgit v1.2.3