summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-06-01 23:04:43 +0200
committerHarald Welte <laforge@gnumonks.org>2019-06-02 23:29:05 +0200
commit1365a4e7c5f77325d429bb2298ee90edf2c66535 (patch)
tree52fce5c0383bc7aa5b6061de167dc72e8316e56c
parent66f07549b77b72777d6ee030e9fffb8f30229a98 (diff)
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
-rw-r--r--library/LAPDm_RAW_PT.ttcn19
1 files changed, 17 insertions, 2 deletions
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 @@ module LAPDm_RAW_PT {
/* 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 @@ module LAPDm_RAW_PT {
/* 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 @@ module LAPDm_RAW_PT {
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 */