[PATCH] osmo-bts[master]: Move common TCH code into src/common/tch.c

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/.

Max gerrit-no-reply at lists.osmocom.org
Tue Jun 7 12:40:31 UTC 2016


Hello Jenkins Builder, Holger Freyther,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/206

to look at the new patch set (#2).

Move common TCH code into src/common/tch.c

Move gen_empty_tch_msg() into src/common/ to make adding DTXd support
easier.

Change-Id: Ia0d4d0f9848fc2ab54f975a3b6d1815fbcdf78a7
Related: OS#1563
---
M src/common/Makefile.am
A src/common/tch.c
M src/osmo-bts-litecell15/tch.c
M src/osmo-bts-sysmo/tch.c
4 files changed, 68 insertions(+), 81 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/06/206/2

diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 8df6513..5c84ade 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -4,7 +4,7 @@
 
 noinst_LIBRARIES = libbts.a libl1sched.a
 libbts_a_SOURCES = gsm_data_shared.c sysinfo.c logging.c abis.c oml.c bts.c \
-		   rsl.c vty.c paging.c measurement.c amr.c lchan.c \
+		   rsl.c vty.c paging.c measurement.c amr.c tch.c lchan.c \
 		   load_indication.c pcu_sock.c handover.c msg_utils.c \
 		   load_indication.c pcu_sock.c handover.c msg_utils.c \
 		   tx_power.c bts_ctrl_commands.c bts_ctrl_lookup.c \
diff --git a/src/common/tch.c b/src/common/tch.c
new file mode 100644
index 0000000..d31b04e
--- /dev/null
+++ b/src/common/tch.c
@@ -0,0 +1,67 @@
+/* OsmoBTS common TCH code */
+
+/* (C) 2011-2012 by Harald Welte <laforge at gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <osmo-bts/gsm_data.h>
+
+extern struct msgb *l1p_msgb_alloc(void);
+extern uint8_t *get_payload_addr(struct msgb *msg);
+extern void set_payload_type(struct msgb *msg, struct gsm_lchan *lchan);
+extern void set_payload_size(struct msgb *msg, uint8_t size);
+
+struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan)
+{
+	struct msgb *msg;
+	uint8_t *l1_payload;
+
+	msg = l1p_msgb_alloc();
+	if (!msg)
+		return NULL;
+
+	l1_payload = get_payload_addr(msg);
+
+	switch (lchan->tch_mode) {
+	case GSM48_CMODE_SPEECH_AMR:
+		set_payload_type(msg, lchan);
+		if (lchan->tch.last_sid.len) {
+			memcpy(l1_payload, lchan->tch.last_sid.buf,
+				lchan->tch.last_sid.len);
+			set_payload_size(msg, lchan->tch.last_sid.len + 1);
+		} else {
+			/* FIXME: decide if we should send SPEECH_BAD or
+			 * SID_BAD */
+#if 0
+			*payload_type = GsmL1_TchPlType_Amr_SidBad;
+			memset(l1_payload, 0xFF, 5);
+			msu_param->u8Size = 5 + 3;
+#else
+			/* send an all-zero SID */
+			set_payload_size(msg, 8);
+#endif
+		}
+		break;
+	default:
+		msgb_free(msg);
+		msg = NULL;
+		break;
+	}
+
+	return msg;
+}
diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c
index 2c42ef5..d09264a 100644
--- a/src/osmo-bts-litecell15/tch.c
+++ b/src/osmo-bts-litecell15/tch.c
@@ -530,43 +530,3 @@
 		get_value_string(lc15bts_tch_pl_names, payload_type));
 	return -EINVAL;
 }
-
-struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan)
-{
-	struct msgb *msg;
-	uint8_t *l1_payload;
-
-	msg = l1p_msgb_alloc();
-	if (!msg)
-		return NULL;
-
-	l1_payload = get_payload_addr(msg);
-
-	switch (lchan->tch_mode) {
-	case GSM48_CMODE_SPEECH_AMR:
-		set_payload_type(msg, lchan);
-		if (lchan->tch.last_sid.len) {
-			memcpy(l1_payload, lchan->tch.last_sid.buf,
-				lchan->tch.last_sid.len);
-			set_payload_size(msg, lchan->tch.last_sid.len + 1);
-		} else {
-			/* FIXME: decide if we should send SPEECH_BAD or
-			 * SID_BAD */
-#if 0
-			*payload_type = GsmL1_TchPlType_Amr_SidBad;
-			memset(l1_payload, 0xFF, 5);
-			msu_param->u8Size = 5 + 3;
-#else
-			/* send an all-zero SID */
-			set_payload_size(msg, 8);
-#endif
-		}
-		break;
-	default:
-		msgb_free(msg);
-		msg = NULL;
-		break;
-	}
-
-	return msg;
-}
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index 3b9fe36..13f9ec6 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -625,43 +625,3 @@
 		get_value_string(femtobts_tch_pl_names, payload_type));
 	return -EINVAL;
 }
-
-struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan)
-{
-	struct msgb *msg;
-	uint8_t *l1_payload;
-
-	msg = l1p_msgb_alloc();
-	if (!msg)
-		return NULL;
-
-	l1_payload = get_payload_addr(msg);
-
-	switch (lchan->tch_mode) {
-	case GSM48_CMODE_SPEECH_AMR:
-		set_payload_type(msg, lchan);
-		if (lchan->tch.last_sid.len) {
-			memcpy(l1_payload, lchan->tch.last_sid.buf,
-				lchan->tch.last_sid.len);
-			set_payload_size(msg, lchan->tch.last_sid.len + 1);
-		} else {
-			/* FIXME: decide if we should send SPEECH_BAD or
-			 * SID_BAD */
-#if 0
-			*payload_type = GsmL1_TchPlType_Amr_SidBad;
-			memset(l1_payload, 0xFF, 5);
-			msu_param->u8Size = 5 + 3;
-#else
-			/* send an all-zero SID */
-			set_payload_size(msg, 8);
-#endif
-		}
-		break;
-	default:
-		msgb_free(msg);
-		msg = NULL;
-		break;
-	}
-
-	return msg;
-}

-- 
To view, visit https://gerrit.osmocom.org/206
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia0d4d0f9848fc2ab54f975a3b6d1815fbcdf78a7
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list