Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 1 | /* dual-faced port that wraps an Unixdomain port and encodes/decodes L1CTL |
| 2 | * (C) 2017-2019 Harald Welte <laforge@gnumonks.org> |
| 3 | * contributions by sysmocom - s.f.m.c. GmbH |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Released under the terms of GNU General Public License, Version 2 or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 12 | module L1CTL_PortType { |
| 13 | import from L1CTL_Types all; |
| 14 | import from UD_PortType all; |
| 15 | import from UD_Types all; |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 16 | import from Osmocom_Types all; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 17 | import from Osmocom_Types all; |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 18 | import from GSM_Types all; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 19 | import from GSM_RR_Types all; |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 20 | import from L1CTL_PortType_CtrlFunct all; |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 21 | |
| 22 | type record L1CTL_connect { |
| 23 | charstring path |
| 24 | } |
| 25 | |
| 26 | type record L1CTL_connect_result { |
| 27 | UD_Result_code result_code optional, |
| 28 | charstring err optional |
| 29 | } |
| 30 | |
Harald Welte | f68765d | 2017-08-20 22:54:57 +0200 | [diff] [blame] | 31 | modulepar { |
| 32 | charstring m_l1ctl_sock_path := "/tmp/osmocom_l2"; |
| 33 | } |
| 34 | |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 35 | function f_L1CTL_getMsgLen(in octetstring stream, inout ro_integer args) return integer { |
| 36 | var integer stream_len := lengthof(stream); |
| 37 | var integer len; |
| 38 | if (stream_len < 2) { |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 39 | return -1; |
| 40 | } |
| 41 | len := 2 + oct2int(substr(stream, 0, 2)); |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 42 | return len; |
| 43 | } |
| 44 | |
Pau Espin Pedrol | 752ffd5 | 2018-06-07 13:55:45 +0200 | [diff] [blame] | 45 | function f_L1CTL_FBSB(L1CTL_PT pt, Arfcn arfcn, L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED, integer rxlev_exp := 57) { |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 46 | timer T := 15.0; |
Harald Welte | 8fe9eba | 2018-03-09 17:03:49 +0100 | [diff] [blame] | 47 | for (var integer i := 0; i < 10; i := i+1) { |
Stefan Sperling | 0258590 | 2018-08-30 17:03:50 +0200 | [diff] [blame] | 48 | var L1ctlDlMessage dl; |
Pau Espin Pedrol | 752ffd5 | 2018-06-07 13:55:45 +0200 | [diff] [blame] | 49 | pt.send(ts_L1CTL_FBSB_REQ(arfcn, valueof(t_L1CTL_FBSB_F_ALL), 0, ccch_mode, rxlev_exp)); |
Harald Welte | 8fe9eba | 2018-03-09 17:03:49 +0100 | [diff] [blame] | 50 | T.start |
| 51 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 52 | [] pt.receive(tr_L1CTL_FBSB_CONF(0)) { return; }; |
Stefan Sperling | 0258590 | 2018-08-30 17:03:50 +0200 | [diff] [blame] | 53 | [i >= 9] pt.receive(tr_L1CTL_FBSB_CONF(?)) -> value dl { |
| 54 | setverdict(fail, "FBSB Failed with non-zero return code ", dl.payload.fbsb_conf.result); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 55 | mtc.stop; |
Harald Welte | 7d7d26c | 2018-02-22 18:52:28 +0100 | [diff] [blame] | 56 | }; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 57 | [] pt.receive(tr_L1CTL_FBSB_CONF(?)) { |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 58 | f_sleep(1.0); |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 59 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 60 | [] pt.receive { repeat; }; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 61 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 62 | setverdict(fail, "Timeout waiting for L1CTL_FBSB_CONF"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 63 | mtc.stop; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 64 | }; |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | function f_L1CTL_CCCH_MODE(L1CTL_PT pt, L1ctlCcchMode ccch_mode) { |
| 70 | timer T := 2.0; |
| 71 | pt.send(ts_L1CTL_CCCH_MODE_REQ(ccch_mode)); |
| 72 | T.start; |
| 73 | alt { |
| 74 | [] pt.receive(tr_L1CTL_CCCH_MODE_CONF) { } |
| 75 | [] pt.receive { repeat; } |
| 76 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 77 | setverdict(fail, "Timeout waiting for L1CTL_CCCH_MODE_CONF"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 78 | mtc.stop; |
Harald Welte | 8fe9eba | 2018-03-09 17:03:49 +0100 | [diff] [blame] | 79 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 80 | } |
| 81 | } |
| 82 | |
Vadim Yanitskiy | e432ba9 | 2019-05-31 18:44:13 +0700 | [diff] [blame] | 83 | function f_L1CTL_RACH(L1CTL_PT pt, uint8_t ra, uint8_t combined := 1, uint16_t offset := 0, |
| 84 | template (value) RslChannelNr chan_nr := ts_RslChanNr_RACH(0), |
| 85 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0)) |
| 86 | return GsmFrameNumber { |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 87 | var L1ctlDlMessage rc; |
| 88 | var GsmFrameNumber fn; |
| 89 | timer T := 2.0; |
| 90 | T.start |
Vadim Yanitskiy | e432ba9 | 2019-05-31 18:44:13 +0700 | [diff] [blame] | 91 | pt.send(ts_L1CTL_RACH_REQ(ra, combined, offset, chan_nr, link_id)) |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 92 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 93 | [] pt.receive(tr_L1CTL_RACH_CONF) -> value rc { fn := rc.dl_info.frame_nr }; |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 94 | [] pt.receive { repeat; }; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 95 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 96 | setverdict(fail, "Timeout waiting for L1CTL_RACH_CONF"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 97 | mtc.stop; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 98 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 99 | } |
| 100 | return fn; |
| 101 | } |
| 102 | |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 103 | function f_L1CTL_EXT_RACH( |
| 104 | L1CTL_PT pt, uint16_t ra11, L1ctlRachSynchSeq seq, |
| 105 | uint8_t combined := 1, uint16_t offset := 0 |
| 106 | ) return GsmFrameNumber { |
| 107 | var L1ctlDlMessage rc; |
| 108 | var GsmFrameNumber fn; |
| 109 | timer T := 2.0; |
| 110 | |
| 111 | T.start; |
| 112 | pt.send(ts_L1CTL_EXT_RACH_REQ(ra11, seq, combined, offset)); |
| 113 | alt { |
| 114 | [] pt.receive(tr_L1CTL_RACH_CONF) -> value rc { fn := rc.dl_info.frame_nr }; |
| 115 | [] pt.receive { repeat; }; |
| 116 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 117 | setverdict(fail, "Timeout waiting for (extended) L1CTL_RACH_CONF"); |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 118 | mtc.stop; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | return fn; |
| 123 | } |
| 124 | |
Harald Welte | 3705273 | 2018-03-09 19:38:46 +0100 | [diff] [blame] | 125 | function f_L1CTL_PARAM(L1CTL_PT pt, uint8_t ta, uint8_t tx_power) { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 126 | pt.send(ts_L1CTL_PAR_REQ(ta, tx_power)); |
Harald Welte | 3705273 | 2018-03-09 19:38:46 +0100 | [diff] [blame] | 127 | } |
| 128 | |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 129 | function f_L1CTL_WAIT_IMM_ASS(L1CTL_PT pt, uint8_t ra, GsmFrameNumber rach_fn) return ImmediateAssignment { |
Vadim Yanitskiy | 23b7440 | 2019-09-09 16:43:29 +0200 | [diff] [blame] | 130 | var template GsmRrMessage rr_imm_ass; |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 131 | var L1ctlDlMessage dl; |
| 132 | var GsmRrMessage rr; |
| 133 | timer T := 10.0; |
Vadim Yanitskiy | 23b7440 | 2019-09-09 16:43:29 +0200 | [diff] [blame] | 134 | |
| 135 | /* Prepare generic template (for both CS and PS) */ |
| 136 | rr_imm_ass := tr_IMM_ASS(ra, rach_fn); |
| 137 | rr_imm_ass.payload.imm_ass.ded_or_tbf := ?; |
| 138 | rr_imm_ass.payload.imm_ass.pkt_chan_desc := *; |
| 139 | rr_imm_ass.payload.imm_ass.chan_desc := *; |
| 140 | |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 141 | T.start; |
| 142 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 143 | [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl { |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 144 | rr := dec_GsmRrMessage(dl.payload.data_ind.payload); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 145 | log("PCH/AGCH DL RR: ", rr); |
Vadim Yanitskiy | 23b7440 | 2019-09-09 16:43:29 +0200 | [diff] [blame] | 146 | if (match(rr, rr_imm_ass)) { |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 147 | log("Received IMM.ASS for our RACH!"); |
| 148 | } else { |
| 149 | repeat; |
| 150 | } |
| 151 | }; |
| 152 | [] pt.receive { repeat }; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 153 | [] T.timeout { |
| 154 | setverdict(fail, "Timeout waiting for IMM ASS"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 155 | mtc.stop; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 156 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 157 | } |
| 158 | T.stop; |
| 159 | return rr.payload.imm_ass; |
| 160 | } |
| 161 | |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 162 | function f_L1CTL_WAIT_IMM_ASS_TBF_DL(L1CTL_PT pt, GprsTlli tlli) return ImmediateAssignment { |
Vadim Yanitskiy | 6edd4f5 | 2019-09-09 01:51:09 +0200 | [diff] [blame] | 163 | var template PacketDlAssign dl_ass := tr_PacketDlAssign(tlli); |
| 164 | var template IaRestOctets rest := tr_IaRestOctets_DLAss(dl_ass); |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 165 | var L1ctlDlMessage dl; |
| 166 | var GsmRrMessage rr; |
| 167 | timer T := 10.0; |
| 168 | T.start; |
| 169 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 170 | [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl { |
Vadim Yanitskiy | 6edd4f5 | 2019-09-09 01:51:09 +0200 | [diff] [blame] | 171 | /* TODO: use decmatch tr_IaRestOctets_DLAss(...) instead */ |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 172 | rr := dec_GsmRrMessage(dl.payload.data_ind.payload); |
| 173 | log("PCH/AGCN DL RR: ", rr); |
Vadim Yanitskiy | 6edd4f5 | 2019-09-09 01:51:09 +0200 | [diff] [blame] | 174 | if (match(rr, tr_IMM_TBF_ASS(dl := true, rest := rest))) { |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 175 | log("Received IMM.ASS for our TLLI!"); |
| 176 | } else { |
| 177 | repeat; |
| 178 | } |
| 179 | }; |
| 180 | [] pt.receive { repeat }; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 181 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 182 | setverdict(fail, "Timeout waiting for TBF IMM ASS"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 183 | mtc.stop; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 184 | } |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 185 | } |
| 186 | T.stop; |
| 187 | return rr.payload.imm_ass; |
| 188 | } |
| 189 | |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 190 | function f_L1CTL_TBF_CFG(L1CTL_PT pt, boolean is_uplink, TfiUsfArr tfi_usf) { |
| 191 | timer T := 2.0; |
| 192 | T.start; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 193 | pt.send(ts_L1CTL_TBF_CFG_REQ(is_uplink, tfi_usf)); |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 194 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 195 | [] pt.receive(tr_L1CTL_TBF_CFG_CONF(is_uplink)) {} |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 196 | [] pt.receive { repeat }; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 197 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 198 | setverdict(fail, "Timeout waiting for L1CTL_TBF_CFG_CONF"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 199 | mtc.stop; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 200 | }; |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 201 | } |
| 202 | T.stop; |
| 203 | } |
Harald Welte | b05fd2d | 2019-05-19 22:25:38 +0200 | [diff] [blame] | 204 | function f_L1CTL_DM_EST_REQ(L1CTL_PT pt, Arfcn arfcn, RslChannelNr chan_nr, GsmTsc tsc) { |
| 205 | pt.send(ts_L1CTL_DM_EST_REQ(arfcn, chan_nr, tsc)); |
| 206 | } |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 207 | |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 208 | /* Send DM_EST_REQ from parameters derived from IMM ASS */ |
| 209 | function f_L1CTL_DM_EST_REQ_IA(L1CTL_PT pt, ImmediateAssignment imm_ass) { |
Harald Welte | b05fd2d | 2019-05-19 22:25:38 +0200 | [diff] [blame] | 210 | f_L1CTL_DM_EST_REQ(pt, { false, imm_ass.chan_desc.arfcn }, imm_ass.chan_desc.chan_nr, |
| 211 | imm_ass.chan_desc.tsc); |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 212 | } |
| 213 | |
Harald Welte | 3dc2046 | 2018-03-10 23:03:38 +0100 | [diff] [blame] | 214 | /* Send DM_REL_REQ from parameters derived from IMM ASS */ |
| 215 | function f_L1CTL_DM_REL_REQ(L1CTL_PT pt, RslChannelNr chan_nr) { |
| 216 | pt.send(ts_L1CTL_DM_REL_REQ(chan_nr)); |
| 217 | } |
| 218 | |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 219 | function f_L1CTL_RESET(L1CTL_PT pt, L1ctlResetType res_type := L1CTL_RES_T_FULL) { |
| 220 | timer T := 2.0; |
| 221 | pt.send(t_L1ctlResetReq(res_type)); |
| 222 | T.start; |
| 223 | alt { |
| 224 | [] pt.receive(tr_L1CTL_MsgType(L1CTL_RESET_CONF)) { } |
| 225 | [] pt.receive { repeat; } |
| 226 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 227 | setverdict(fail, "Timeout waiting for L1CTL_RESET_CONF"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 228 | mtc.stop; |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 229 | } |
| 230 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 231 | } |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 232 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 233 | function f_L1CTL_CRYPTO_REQ(L1CTL_PT pt, RslChannelNr chan_nr, uint8_t algo, octetstring key) { |
| 234 | pt.send(ts_L1CTL_CRYPTO_REQ(chan_nr, algo, key)); |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 235 | } |
| 236 | |
Harald Welte | f68765d | 2017-08-20 22:54:57 +0200 | [diff] [blame] | 237 | function f_connect_reset(L1CTL_PT pt, charstring l1ctl_sock_path := m_l1ctl_sock_path) { |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 238 | var f_UD_getMsgLen vl_f := refers(f_L1CTL_getMsgLen); |
| 239 | f_L1CTL_setGetMsgLen(pt, -1, vl_f, {}); |
Harald Welte | d1209a6 | 2017-07-29 12:55:06 +0200 | [diff] [blame] | 240 | pt.send(L1CTL_connect:{path:=l1ctl_sock_path}); |
| 241 | pt.receive(L1CTL_connect_result:{result_code := SUCCESS, err:=omit}); |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 242 | f_L1CTL_setGetMsgLen(pt, 0, vl_f, {}); |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 243 | f_L1CTL_RESET(pt); |
Harald Welte | d1209a6 | 2017-07-29 12:55:06 +0200 | [diff] [blame] | 244 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 245 | |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 246 | private function L1CTL_to_UD_connect(in L1CTL_connect pin, out UD_connect pout) { |
| 247 | pout.path := pin.path; |
| 248 | pout.id := 0; |
| 249 | } with { extension "prototype(fast)" } |
| 250 | |
| 251 | private function UD_to_L1CTL_connect_result(in UD_connect_result pin, out L1CTL_connect_result pout) { |
| 252 | pout.result_code := pin.result.result_code; |
| 253 | pout.err := pin.result.err; |
| 254 | } with { extension "prototype(fast)" } |
| 255 | |
| 256 | private function L1CTL_to_UD_ul(in L1ctlUlMessage pin, out UD_send_data pout) { |
| 257 | var L1ctlUlMessageLV msg_lv := { msg := pin }; |
| 258 | pout.data := enc_L1ctlUlMessageLV(msg_lv); |
| 259 | pout.id := 0; |
| 260 | } with { extension "prototype(fast)" } |
| 261 | |
| 262 | private function UD_to_L1CTL_dl(in UD_send_data pin, out L1ctlDlMessage pout) { |
| 263 | var L1ctlDlMessageLV msg_lv := dec_L1ctlDlMessageLV(pin.data); |
| 264 | pout:= msg_lv.msg; |
| 265 | } with { extension "prototype(fast)" } |
| 266 | |
| 267 | type port L1CTL_PT message { |
| 268 | out L1ctlUlMessage |
| 269 | out L1CTL_connect |
| 270 | in L1ctlDlMessage |
| 271 | in L1CTL_connect_result |
| 272 | in UD_listen_result |
| 273 | in UD_connected |
| 274 | } with { extension "user UD_PT |
| 275 | out(L1ctlUlMessage -> UD_send_data: function(L1CTL_to_UD_ul); |
| 276 | L1CTL_connect -> UD_connect: function(L1CTL_to_UD_connect)) |
| 277 | in(UD_send_data -> L1ctlDlMessage: function(UD_to_L1CTL_dl); |
| 278 | UD_connect_result -> L1CTL_connect_result: function(UD_to_L1CTL_connect_result); |
| 279 | UD_listen_result -> UD_listen_result: simple; |
| 280 | UD_connected -> UD_connected: simple |
| 281 | )" } |
| 282 | } |