Change in osmocom-bb[master]: trxcon: Use RSL channel mode #defines from libosmogsm

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 May 27 15:42:41 UTC 2019


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


Change subject: trxcon: Use RSL channel mode #defines from libosmogsm
......................................................................

trxcon: Use RSL channel mode #defines from libosmogsm

Wherever possible, use #defines from libosmogsm as opposed to magic
numbers.  Using magic numbers in several places has the danger of
different programs/repositories having different views on what those
values mean.

Change-Id: I7ab4958801b3422973b67ff0452b90afa8a3f501
Related: OS#4027
Depends: libosmocore Change-Id I93e557358cf1c1b622f77f906959df7ca6d5cb12
---
M src/host/trxcon/sched_lchan_desc.c
M src/host/trxcon/sched_trx.c
2 files changed, 18 insertions(+), 16 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/07/14207/1

diff --git a/src/host/trxcon/sched_lchan_desc.c b/src/host/trxcon/sched_lchan_desc.c
index ee712d5..8bc336e 100644
--- a/src/host/trxcon/sched_lchan_desc.c
+++ b/src/host/trxcon/sched_lchan_desc.c
@@ -23,6 +23,7 @@
  *
  */
 
+#include <osmocom/gsm/protocol/gsm_08_58.h>
 #include "sched_trx.h"
 
 /* Forward declaration of handlers */
@@ -94,31 +95,31 @@
 	},
 	{
 		TRXC_BCCH,		"BCCH",
-		0x80,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_BCCH,		TRX_CH_LID_DEDIC,
 		4 * GSM_BURST_PL_LEN,	TRX_CH_FLAG_AUTO,
 		rx_data_fn,		NULL,
 	},
 	{
 		TRXC_RACH,		"RACH",
-		0x88,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_RACH,		TRX_CH_LID_DEDIC,
 		0x00,			TRX_CH_FLAG_AUTO,
 		NULL,			tx_rach_fn,
 	},
 	{
 		TRXC_CCCH,		"CCCH",
-		0x90,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_PCH_AGCH,	TRX_CH_LID_DEDIC,
 		4 * GSM_BURST_PL_LEN,	TRX_CH_FLAG_AUTO,
 		rx_data_fn,		NULL,
 	},
 	{
 		TRXC_TCHF,		"TCH/F",
-		0x08,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_Bm_ACCHs,		TRX_CH_LID_DEDIC,
 		8 * GSM_BURST_PL_LEN,	TRX_CH_FLAG_CBTX,
 		rx_tchf_fn,		tx_tchf_fn,
 	},
 	{
 		TRXC_TCHH_0,		"TCH/H(0)",
-		0x10,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_Lm_ACCHs,		TRX_CH_LID_DEDIC,
 		6 * GSM_BURST_PL_LEN,	TRX_CH_FLAG_CBTX,
 		rx_tchh_fn,		tx_tchh_fn,
 	},
@@ -292,25 +293,25 @@
 	},
 	{
 		TRXC_PDTCH,		"PDTCH",
-		0xc0,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_OSMO_PDCH,	TRX_CH_LID_DEDIC,
 		12 * GSM_BURST_PL_LEN,	TRX_CH_FLAG_PDCH,
 		rx_pdtch_fn,		tx_pdtch_fn,
 	},
 	{
 		TRXC_PTCCH,		"PTCCH",
-		0xc0,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_OSMO_PDCH,	TRX_CH_LID_DEDIC,
 		4 * GSM_BURST_PL_LEN,	TRX_CH_FLAG_PDCH,
 		rx_data_fn,		tx_data_fn,
 	},
 	[TRXC_SDCCH4_CBCH] = {
 		TRXC_SDCCH4_CBCH,	"SDCCH/4(CBCH)",
-		0xc8,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_OSMO_CBCH4,		TRX_CH_LID_DEDIC,
 		4 * GSM_BURST_PL_LEN,	TRX_CH_FLAG_AUTO,
 		rx_data_fn,		NULL,
 	},
 	[TRXC_SDCCH8_CBCH] = {
 		TRXC_SDCCH8_CBCH,	"SDCCH/8(CBCH)",
-		0xd0,			TRX_CH_LID_DEDIC,
+		RSL_CHAN_OSMO_CBCH8,	TRX_CH_LID_DEDIC,
 		4 * GSM_BURST_PL_LEN,	0x00,
 		rx_data_fn,		NULL,
 	},
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index 6c3f557..fcaba52 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -29,6 +29,7 @@
 #include <stdbool.h>
 
 #include <osmocom/gsm/a5.h>
+#include <osmocom/gsm/protocol/gsm_08_58.h>
 #include <osmocom/core/bits.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/logging.h>
@@ -530,19 +531,19 @@
 {
 	uint8_t cbits = chan_nr >> 3;
 
-	if (cbits == 0x01)
+	if (cbits == ABIS_RSL_CHAN_NR_CBITS_Bm_ACCHs)
 		return GSM_PCHAN_TCH_F;
-	else if ((cbits & 0x1e) == 0x02)
+	else if ((cbits & 0x1e) == ABIS_RSL_CHAN_NR_CBITS_Lm_ACCHs(0))
 		return GSM_PCHAN_TCH_H;
-	else if ((cbits & 0x1c) == 0x04)
+	else if ((cbits & 0x1c) == ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(0))
 		return GSM_PCHAN_CCCH_SDCCH4;
-	else if ((cbits & 0x18) == 0x08)
+	else if ((cbits & 0x18) == ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(0))
 		return GSM_PCHAN_SDCCH8_SACCH8C;
-	else if ((cbits & 0x1f) == 0x18)
+	else if ((cbits & 0x1f) == ABIS_RSL_CHAN_NR_CBITS_OSMO_PDCH)
 		return GSM_PCHAN_TCH_F_TCH_H_PDCH;
-	else if ((cbits & 0x1f) == 0x19)
+	else if ((cbits & 0x1f) == ABIS_RSL_CHAN_NR_CBITS_OSMO_CBCH4)
 		return GSM_PCHAN_CCCH_SDCCH4_CBCH;
-	else if ((cbits & 0x1f) == 0x1a)
+	else if ((cbits & 0x1f) == ABIS_RSL_CHAN_NR_CBITS_OSMO_CBCH8)
 		return GSM_PCHAN_SDCCH8_SACCH8C_CBCH;
 
 	return GSM_PCHAN_NONE;

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ab4958801b3422973b67ff0452b90afa8a3f501
Gerrit-Change-Number: 14207
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/20190527/a849325f/attachment.htm>


More information about the gerrit-log mailing list