[PATCH] osmo-bts[master]: LC15, SYSMO: Save last SID using common function

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
Wed Sep 14 14:12:11 UTC 2016


Review at  https://gerrit.osmocom.org/845

LC15, SYSMO: Save last SID using common function

The common save_last_sid() function was merged but the corresponding
code to use it was somehow lost during transition. Fix it by propagating
Fn and calling common function instead of duplicated code.

Change-Id: Ie545212cce5ed2b3ea3228597f18a473f5e1deb4
Fixes: OS#1800
---
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-litecell15/l1_if.h
M src/osmo-bts-litecell15/tch.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-sysmo/l1_if.h
M src/osmo-bts-sysmo/tch.c
6 files changed, 13 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/45/845/1

diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 3672b8f..dcb6ea9 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -469,7 +469,7 @@
 		l1if_tch_encode(lchan,
 			l1p->u.phDataReq.msgUnitParam.u8Buffer,
 			&l1p->u.phDataReq.msgUnitParam.u8Size,
-			msg->data, msg->len);
+				msg->data, msg->len, u32Fn);
 	}
 
 	/* no message/data, we generate an empty traffic msg */
diff --git a/src/osmo-bts-litecell15/l1_if.h b/src/osmo-bts-litecell15/l1_if.h
index 2d136af..41d6989 100644
--- a/src/osmo-bts-litecell15/l1_if.h
+++ b/src/osmo-bts-litecell15/l1_if.h
@@ -88,7 +88,7 @@
 
 /* tch.c */
 void l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len,
-	const uint8_t *rtp_pl, unsigned int rtp_pl_len);
+	const uint8_t *rtp_pl, unsigned int rtp_pl_len, uint32_t fn);
 int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg);
 int l1if_tch_fill(struct gsm_lchan *lchan, uint8_t *l1_buffer);
 struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn);
diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c
index 187f688..e6fe015 100644
--- a/src/osmo-bts-litecell15/tch.c
+++ b/src/osmo-bts-litecell15/tch.c
@@ -200,7 +200,7 @@
  */
 static int rtppayload_to_l1_amr(uint8_t *l1_payload, const uint8_t *rtp_payload,
 				uint8_t payload_len,
-				struct gsm_lchan *lchan)
+				struct gsm_lchan *lchan, uint32_t fn)
 {
 	struct amr_multirate_conf *amr_mrc = &lchan->tch.amr_mr;
 	enum osmo_amr_type ft;
@@ -270,14 +270,8 @@
 	}
 #endif
 
-	if (ft == AMR_SID) {
-		/* store the last SID frame in lchan context */
-		unsigned int copy_len;
-		copy_len = OSMO_MIN(payload_len+1,
-				    ARRAY_SIZE(lchan->tch.last_sid.buf));
-		lchan->tch.last_sid.len = copy_len;
-		memcpy(lchan->tch.last_sid.buf, l1_payload, copy_len);
-	}
+	if (ft == AMR_SID)
+		save_last_sid(lchan, l1_payload, payload_len, fn, sti);
 
 	return payload_len+1;
 }
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 0880ee9..8784938 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -462,7 +462,7 @@
 		l1if_tch_encode(lchan,
 			l1p->u.phDataReq.msgUnitParam.u8Buffer,
 			&l1p->u.phDataReq.msgUnitParam.u8Size,
-			msg->data, msg->len);
+				msg->data, msg->len, u32Fn);
 	}
 
 	/* no message/data, we generate an empty traffic msg */
diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h
index 2fc8a29..19dd5dc 100644
--- a/src/osmo-bts-sysmo/l1_if.h
+++ b/src/osmo-bts-sysmo/l1_if.h
@@ -108,7 +108,8 @@
 
 /* tch.c */
 void l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len,
-	const uint8_t *rtp_pl, unsigned int rtp_pl_len);
+		     const uint8_t *rtp_pl, unsigned int rtp_pl_len,
+		     uint32_t fn);
 int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg);
 int l1if_tch_fill(struct gsm_lchan *lchan, uint8_t *l1_buffer);
 struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn);
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index 39feae1..54f2fcd 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -283,7 +283,7 @@
  */
 static int rtppayload_to_l1_amr(uint8_t *l1_payload, const uint8_t *rtp_payload,
 				uint8_t payload_len,
-				struct gsm_lchan *lchan)
+				struct gsm_lchan *lchan, uint32_t fn)
 {
 	struct amr_multirate_conf *amr_mrc = &lchan->tch.amr_mr;
 	enum osmo_amr_type ft;
@@ -367,14 +367,8 @@
 	}
 #endif
 
-	if (ft == AMR_SID) {
-		/* store the last SID frame in lchan context */
-		unsigned int copy_len;
-		copy_len = OSMO_MIN(payload_len+1,
-				    ARRAY_SIZE(lchan->tch.last_sid.buf));
-		lchan->tch.last_sid.len = copy_len;
-		memcpy(lchan->tch.last_sid.buf, l1_payload, copy_len);
-	}
+	if (ft == AMR_SID)
+		save_last_sid(lchan, l1_payload, payload_len, fn, sti);
 
 	return payload_len+1;
 }
@@ -394,7 +388,7 @@
  * pre-fill the primtive.
  */
 void l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len,
-	const uint8_t *rtp_pl, unsigned int rtp_pl_len)
+		     const uint8_t *rtp_pl, unsigned int rtp_pl_len, uint32_t fn)
 {
 	uint8_t *payload_type;
 	uint8_t *l1_payload;
@@ -428,7 +422,7 @@
 	case GSM48_CMODE_SPEECH_AMR:
 		*payload_type = GsmL1_TchPlType_Amr;
 		rc = rtppayload_to_l1_amr(l1_payload, rtp_pl,
-					  rtp_pl_len, lchan);
+					  rtp_pl_len, lchan, fn);
 		break;
 	default:
 		/* we don't support CSD modes */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie545212cce5ed2b3ea3228597f18a473f5e1deb4
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list