Change in ...osmo-ttcn3-hacks[master]: LAPDm_RAW_PT: Fix handling of LAPDm on SACCH (L1 header)

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
Sat Jun 1 21:15:46 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14333


Change subject: LAPDm_RAW_PT: Fix handling of LAPDm on SACCH (L1 header)
......................................................................

LAPDm_RAW_PT: Fix handling of LAPDm on SACCH (L1 header)

The  existing implementation dind't account for the two-byte L1 header
preset on the SACCH in both uplink and downlink.

Change-Id: Iae97ad153e9d1688306b39b5fb43ade323dbe500
---
M library/LAPDm_RAW_PT.ttcn
1 file changed, 20 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/33/14333/1

diff --git a/library/LAPDm_RAW_PT.ttcn b/library/LAPDm_RAW_PT.ttcn
index 222c1aa..6166576 100644
--- a/library/LAPDm_RAW_PT.ttcn
+++ b/library/LAPDm_RAW_PT.ttcn
@@ -173,6 +173,10 @@
 		/* channel description of the currently active DCH */
 		var ChannelDescription chan_desc;
 
+		/* last SACCH downlink L1 header we received */
+		var uint5_t ms_power_lvl := 0;
+		var uint8_t timing_adv := 0;
+
 		var TbfParsPerTs g_tbf_ul;
 		var TbfParsPerTs g_tbf_dl;
 	};
@@ -472,14 +476,21 @@
 
 			/* decode any received DATA frames for the dedicated channel and pass them up */
 			[] L1CTL.receive(tr_L1CTL_DATA_IND(chan_desc.chan_nr)) -> value dl {
+				var octetstring l2;
 				if (dl.dl_info.link_id.c == SACCH) {
 					lpd.sacch := true;
+					var octetstring l1 := substr(dl.payload.data_ind.payload, 0, 2);
+					l2 := substr(dl.payload.data_ind.payload, 2,
+						     lengthof(dl.payload.data_ind.payload)-2);
+					ms_power_lvl := oct2int(l1[0] and4b '1F'O);
+					timing_adv := oct2int(l1[1]);
 					/* FIXME: how to deal with UI frames in B4 format (lo length!) */
 				} else {
 					lpd.sacch := false;
+					l2 := dl.payload.data_ind.payload;
 				}
 				lpd.sapi := dl.dl_info.link_id.sapi;
-				lpd.lapdm.ab := dec_LapdmFrameAB(dl.payload.data_ind.payload);
+				lpd.lapdm.ab := dec_LapdmFrameAB(l2);
 				LAPDM_SP.send(lpd);
 			}
 
@@ -490,11 +501,18 @@
 				if (lpd.sacch) {
 					link_id := valueof(ts_RslLinkID_SACCH(lpd.sapi));
 					buf := f_pad_oct(enc_LapdmFrame(lpd.lapdm), 21, '2B'O);
+					var L1ctlDataReq l1hl2 := {
+						l1header := valueof(ts_SacchL1Header(ms_power_lvl, false,
+										     timing_adv)),
+						l2_payload := buf
+					};
+					L1CTL.send(ts_L1CTL_DATA_REQ_SACCH(chan_desc.chan_nr, link_id,
+									   l1hl2));
 				} else {
 					link_id := valueof(ts_RslLinkID_DCCH(lpd.sapi));
 					buf := f_pad_oct(enc_LapdmFrame(lpd.lapdm), 23, '2B'O);
+					L1CTL.send(ts_L1CTL_DATA_REQ(chan_desc.chan_nr, link_id, buf));
 				}
-				L1CTL.send(ts_L1CTL_DATA_REQ(chan_desc.chan_nr, link_id, buf));
 			}
 
 			/* Release dedicated channel */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14333
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iae97ad153e9d1688306b39b5fb43ade323dbe500
Gerrit-Change-Number: 14333
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190601/839f98c5/attachment.htm>


More information about the gerrit-log mailing list