aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmo-bts
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-09-30 14:50:39 +0200
committerHarald Welte <laforge@gnumonks.org>2018-09-30 15:50:01 +0200
commit173555dab71d2bcd1e1984a2608e1dd7f0e77dc5 (patch)
tree7bddedb01c0b788ffda8132b42ce51a9898b8787 /include/osmo-bts
parent2c1a46a2ddd306f0f6758d5d5af67534adf74c28 (diff)
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
Diffstat (limited to 'include/osmo-bts')
-rw-r--r--include/osmo-bts/l1sap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h
index 3225a60f..e2c92fa2 100644
--- a/include/osmo-bts/l1sap.h
+++ b/include/osmo-bts/l1sap.h
@@ -29,7 +29,7 @@
#define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70 && (ra & 0x0f) != 0x0f)
/* CCCH block from frame number */
-#define L1SAP_FN2CCCHBLOCK(fn) ((fn % 51) / 5 - 1)
+unsigned int l1sap_fn2ccch_block(uint32_t fn);
/* PTCH layout from frame number */
#define L1SAP_FN2MACBLOCK(fn) ((fn % 52) / 4)