Change in osmo-bsc[master]: use libosmocore's gsm0808_permitted_speech(), gsm0808_chosen_channel()

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu May 24 16:59:47 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/9284


Change subject: use libosmocore's gsm0808_permitted_speech(), gsm0808_chosen_channel()
......................................................................

use libosmocore's gsm0808_permitted_speech(), gsm0808_chosen_channel()

The guts of bssap_speech_from_lchan() and lchan_to_chosen_channel() have been
moved to libosmocore; call that. The functions become mere wrappers to feed the
right lchan members.

Depends: I8a3cc5d4548e9a78d945d54c69ccced251edcec9 (libosmocore)
Change-Id: Ib5c940a9dae11c5e26d4b47fa9d95fef889ad2f6
---
M src/libbsc/bsc_subscr_conn_fsm.c
1 file changed, 5 insertions(+), 72 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/84/9284/1

diff --git a/src/libbsc/bsc_subscr_conn_fsm.c b/src/libbsc/bsc_subscr_conn_fsm.c
index 7617dba..e1706d2 100644
--- a/src/libbsc/bsc_subscr_conn_fsm.c
+++ b/src/libbsc/bsc_subscr_conn_fsm.c
@@ -147,82 +147,15 @@
 /* See TS 48.008 3.2.2.11 Channel Type Octet 5 */
 static int bssap_speech_from_lchan(const struct gsm_lchan *lchan)
 {
-	switch (lchan->type) {
-	case GSM_LCHAN_TCH_H:
-		switch (lchan->tch_mode) {
-		case GSM48_CMODE_SPEECH_V1:
-			return 0x05;
-		case GSM48_CMODE_SPEECH_AMR:
-			return 0x25;
-		default:
-			return -1;
-		}
-		break;
-	case GSM_LCHAN_TCH_F:
-		switch (lchan->tch_mode) {
-		case GSM48_CMODE_SPEECH_V1:
-			return 0x01;
-		case GSM48_CMODE_SPEECH_EFR:
-			return 0x11;
-		case GSM48_CMODE_SPEECH_AMR:
-			return 0x21;
-		default:
-			return -1;
-		}
-		break;
-	default:
-		return -1;
-	}
+	return gsm0808_permitted_speech(lchan->type, lchan->tch_mode);
 }
 
-/* GSM 08.08 3.2.2.33 */
 static uint8_t lchan_to_chosen_channel(struct gsm_lchan *lchan)
 {
-	uint8_t channel_mode = 0, channel = 0;
-
-	switch (lchan->tch_mode) {
-	case GSM48_CMODE_SPEECH_V1:
-	case GSM48_CMODE_SPEECH_EFR:
-	case GSM48_CMODE_SPEECH_AMR:
-		channel_mode = 0x9;
-		break;
-	case GSM48_CMODE_SIGN:
-		channel_mode = 0x8;
-		break;
-	case GSM48_CMODE_DATA_14k5:
-		channel_mode = 0xe;
-		break;
-	case GSM48_CMODE_DATA_12k0:
-		channel_mode = 0xb;
-		break;
-	case GSM48_CMODE_DATA_6k0:
-		channel_mode = 0xc;
-		break;
-	case GSM48_CMODE_DATA_3k6:
-		channel_mode = 0xd;
-		break;
-	}
-
-	switch (lchan->type) {
-	case GSM_LCHAN_NONE:
-		channel = 0x0;
-		break;
-	case GSM_LCHAN_SDCCH:
-		channel = 0x1;
-		break;
-	case GSM_LCHAN_TCH_F:
-		channel = 0x8;
-		break;
-	case GSM_LCHAN_TCH_H:
-		channel = 0x9;
-		break;
-	case GSM_LCHAN_UNKNOWN:
-	default:
-		LOGP(DMSC, LOGL_ERROR, "Unknown lchan type: %p\n", lchan);
-		break;
-	}
-
-	return channel_mode << 4 | channel;
+	uint8_t chosen_channel = gsm0808_chosen_channel(lchan->tch_mode, lchan->type);
+	if (!chosen_channel)
+		LOGP(DMSC, LOGL_ERROR, "Unknown lchan type or TCH mode: %s\n", gsm_lchan_name(lchan));
+	return chosen_channel;
 }
 
 /* Generate and send assignment complete message */

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5c940a9dae11c5e26d4b47fa9d95fef889ad2f6
Gerrit-Change-Number: 9284
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180524/89dc5b78/attachment.htm>


More information about the gerrit-log mailing list