Harald Welte has submitted this change and it was merged. ( 
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, 17 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/library/LAPDm_RAW_PT.ttcn b/library/LAPDm_RAW_PT.ttcn
index 222c1aa..2ede566 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,15 @@
                                if (lpd.sacch) {
                                        link_id := 
valueof(ts_RslLinkID_SACCH(lpd.sapi));
                                        buf := 
f_pad_oct(enc_LapdmFrame(lpd.lapdm), 21, '2B'O);
+                                       var SacchL1Header l1h := 
valueof(ts_SacchL1Header(ms_power_lvl,
+                                                                               
false, timing_adv));
+                                       
L1CTL.send(ts_L1CTL_DATA_REQ_SACCH(chan_desc.chan_nr, link_id,
+                                                                          l1h, 
buf));
                                } 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: 3
Gerrit-Owner: Harald Welte <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged

Reply via email to