Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 1 | module PCUIF_RAW_Components { |
| 2 | |
| 3 | /* |
| 4 | * Components for (RAW) PCU test cases. |
| 5 | * |
| 6 | * (C) 2019 Vadim Yanitskiy <axilirator@gmail.com> |
| 7 | * |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * Released under the terms of GNU General Public License, Version 2 or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 14 | */ |
| 15 | |
| 16 | import from IPL4asp_Types all; |
| 17 | import from UD_Types all; |
| 18 | |
| 19 | import from PCUIF_Types all; |
| 20 | import from PCUIF_CodecPort all; |
| 21 | |
| 22 | /* Component communication diagram: |
| 23 | * |
| 24 | * +-----+ +----------+ +---------+ |
| 25 | * | MTC +---------------+ PCUIF_CT +------+ OsmoPCU | |
| 26 | * +--+--+ +----+-----+ +---------+ |
| 27 | * | | |
| 28 | * | | |
| 29 | * | | |
| 30 | * | +-----------+ | +---------------+ |
| 31 | * +----+ BTS_CT #1 +------+ | ClckGen_CT #1 | |
| 32 | * | +-----+-----+ | +-------+-------+ |
| 33 | * | | | | |
| 34 | * | +---------------------------+ |
| 35 | * | | |
| 36 | * | +-----------+ | +---------------+ |
| 37 | * +----+ BTS_CT #2 +------+ | ClckGen_CT #2 | |
| 38 | * | +-----+-----+ | +-------+-------+ |
| 39 | * | | | | |
| 40 | * | +---------------------------+ |
| 41 | * | | |
| 42 | * | +-----------+ | +---------------+ |
| 43 | * +----+ BTS_CT #N +------+ | ClckGen_CT #N | |
| 44 | * +-----+-----+ +-------+-------+ |
| 45 | * | | |
| 46 | * +---------------------------+ |
| 47 | */ |
| 48 | |
| 49 | /* Events are used by the components to indicate that something |
| 50 | * has happened, e.g. we have got a connection from the PCU. */ |
| 51 | type enumerated RAW_PCU_EventType { |
| 52 | /* Events related to RAW_PCUIF_CT */ |
| 53 | PCU_EV_DISCONNECT, /*!< OsmoPCU has disconnected */ |
| 54 | PCU_EV_CONNECT, /*!< OsmoPCU is now connected */ |
| 55 | |
| 56 | /* Events related to RAW_PCU_BTS_CT */ |
| 57 | BTS_EV_SI13_NEGO, /*!< SI13 negotiation complete */ |
| 58 | |
| 59 | /* TDMA clock related events (TDMA frame-number in parameters) */ |
| 60 | TDMA_EV_PDTCH_BLOCK_BEG, /*!< 1/4 bursts of a PDTCH block on both Uplink and Downlink */ |
| 61 | TDMA_EV_PDTCH_BLOCK_END, /*!< 4/4 bursts of a PDTCH block on both Uplink and Downlink */ |
| 62 | TDMA_EV_PTCCH_DL_BLOCK, /*!< 4/4 bursts of a PTCCH block on Downlink */ |
| 63 | TDMA_EV_PTCCH_UL_BURST, /*!< One Access Burst on PTCCH/U */ |
| 64 | |
| 65 | TDMA_EV_PDTCH_BLOCK_SENT /*!< A PDTCH block has been sent to the PCU */ |
| 66 | }; |
| 67 | |
| 68 | /* Union of all possible parameters of the events */ |
| 69 | type union RAW_PCU_EventParam { |
| 70 | integer tdma_fn |
| 71 | }; |
| 72 | |
| 73 | type record RAW_PCU_Event { |
| 74 | RAW_PCU_EventType event, |
| 75 | /* TODO: can we use 'anytype' here? */ |
| 76 | RAW_PCU_EventParam data optional |
| 77 | }; |
| 78 | |
| 79 | template (value) RAW_PCU_Event ts_RAW_PCU_EV(RAW_PCU_EventType event) := { |
| 80 | event := event, |
| 81 | data := omit |
| 82 | } |
| 83 | template RAW_PCU_Event tr_RAW_PCU_EV(template RAW_PCU_EventType event := ?, |
| 84 | template RAW_PCU_EventParam data := *) := { |
| 85 | event := event, |
| 86 | data := data |
| 87 | } |
| 88 | |
| 89 | template (value) RAW_PCU_Event ts_RAW_PCU_CLCK_EV(RAW_PCU_EventType event, integer fn) := { |
| 90 | event := event, |
| 91 | data := { tdma_fn := fn } |
| 92 | } |
| 93 | template RAW_PCU_Event tr_RAW_PCU_CLCK_EV := { |
| 94 | event := (TDMA_EV_PDTCH_BLOCK_BEG, TDMA_EV_PDTCH_BLOCK_END, |
| 95 | TDMA_EV_PTCCH_DL_BLOCK, TDMA_EV_PTCCH_UL_BURST, |
| 96 | TDMA_EV_PDTCH_BLOCK_SENT), |
| 97 | data := { tdma_fn := ? } |
| 98 | } |
| 99 | |
Vadim Yanitskiy | 02f77d8 | 2019-10-04 17:12:35 +0700 | [diff] [blame^] | 100 | /* Commands are mostly used by the MTC to configure the components |
| 101 | * at run-time, e.g. to enable or disable some optional features. */ |
| 102 | type enumerated RAW_PCU_CommandType { |
| 103 | TDMA_CMD_ENABLE_PTCCH_UL_FWD /*!< Enable forwarding of TDMA_EV_PTCCH_UL_BURST to the MTC */ |
| 104 | }; |
| 105 | |
| 106 | type record RAW_PCU_Command { |
| 107 | RAW_PCU_CommandType cmd, |
| 108 | anytype data optional |
| 109 | }; |
| 110 | |
| 111 | template (value) RAW_PCU_Command ts_RAW_PCU_CMD(RAW_PCU_CommandType cmd) := { |
| 112 | cmd := cmd, |
| 113 | data := omit |
| 114 | } |
| 115 | template RAW_PCU_Command tr_RAW_PCU_CMD(template RAW_PCU_CommandType cmd := ?, |
| 116 | template anytype data := *) := { |
| 117 | cmd := cmd, |
| 118 | data := data |
| 119 | } |
| 120 | |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 121 | /* Generic port for messages and events */ |
| 122 | type port RAW_PCU_MSG_PT message { |
Vadim Yanitskiy | 02f77d8 | 2019-10-04 17:12:35 +0700 | [diff] [blame^] | 123 | inout RAW_PCU_Command; |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 124 | inout RAW_PCU_Event; |
| 125 | inout PCUIF_Message; |
| 126 | } with { extension "internal" }; |
| 127 | |
| 128 | /* TDMA frame clock generator */ |
| 129 | type component RAW_PCU_ClckGen_CT { |
| 130 | /* One TDMA frame is 4.615 ms long */ |
| 131 | timer T_TDMAClock := 4.615 / 1000.0; |
| 132 | port RAW_PCU_MSG_PT CLCK; |
| 133 | var integer fn := 0; |
| 134 | } |
| 135 | |
| 136 | function f_ClckGen_CT_handler() |
| 137 | runs on RAW_PCU_ClckGen_CT { |
| 138 | var integer fn104, fn52, fn13; |
| 139 | |
| 140 | while (true) { |
| 141 | fn104 := fn mod 104; |
| 142 | fn52 := fn mod 52; |
| 143 | fn13 := fn mod 13; |
| 144 | |
| 145 | if (fn13 == 0 or fn13 == 4 or fn13 == 8) { |
| 146 | /* 1/4 bursts of a PDTCH block on both Uplink and Downlink */ |
| 147 | CLCK.send(ts_RAW_PCU_CLCK_EV(TDMA_EV_PDTCH_BLOCK_BEG, fn)); |
| 148 | } else if (fn13 == 3 or fn13 == 7 or fn13 == 11) { |
| 149 | /* 4/4 bursts of a PDTCH block on both Uplink and Downlink */ |
| 150 | CLCK.send(ts_RAW_PCU_CLCK_EV(TDMA_EV_PDTCH_BLOCK_END, fn)); |
| 151 | } else if (fn104 == 90) { |
| 152 | /* 4/4 bursts of a PTCCH (Timing Advance Control) block on Downlink */ |
| 153 | CLCK.send(ts_RAW_PCU_CLCK_EV(TDMA_EV_PTCCH_DL_BLOCK, fn)); |
| 154 | } else if (fn52 == 12 or fn52 == 38) { |
| 155 | /* One Access Burst on PTCCH/U */ |
| 156 | CLCK.send(ts_RAW_PCU_CLCK_EV(TDMA_EV_PTCCH_UL_BURST, fn)); |
| 157 | } |
| 158 | |
| 159 | /* TDMA hyperframe period is (2048 * 51 * 26) frames */ |
| 160 | fn := (fn + 1) mod (2048 * 51 * 26); |
| 161 | |
| 162 | /* (Re)start TDMA clock timer and wait */ |
| 163 | T_TDMAClock.start; |
| 164 | T_TDMAClock.timeout; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | type record of PCUIF_Message PCUIF_MsgQueue; |
| 169 | |
| 170 | /* Enqueue a given message to the end of a given queue */ |
| 171 | private function f_PCUIF_MsgQueue_enqueue(inout PCUIF_MsgQueue queue, |
| 172 | in PCUIF_Message msg) |
| 173 | { |
| 174 | queue := queue & { msg }; |
| 175 | } |
| 176 | |
| 177 | /* Dequeue the first message of a given queue */ |
| 178 | private function f_PCUIF_MsgQueue_dequeue(inout PCUIF_MsgQueue queue, |
| 179 | out PCUIF_Message msg) |
| 180 | { |
| 181 | var integer len := lengthof(queue); |
| 182 | |
| 183 | if (len == 0) { |
| 184 | setverdict(fail, "Failed to dequeue a message: the queue is empty!"); |
| 185 | mtc.stop; |
| 186 | } |
| 187 | |
| 188 | /* Store the first message */ |
| 189 | msg := queue[0]; |
| 190 | |
| 191 | /* Remove the first message from queue */ |
| 192 | if (len > 1) { |
| 193 | queue := substr(queue, 1, len - 1); |
| 194 | } else { |
| 195 | queue := { }; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | /* Multiple base stations can be connected to the PCU. This component |
| 200 | * represents one BTS with an associated TDMA clock generator. */ |
| 201 | type component RAW_PCU_BTS_CT { |
| 202 | /* TDMA clock generator */ |
| 203 | var RAW_PCU_ClckGen_CT vc_CLCK_GEN; |
| 204 | port RAW_PCU_MSG_PT CLCK; |
| 205 | |
| 206 | /* Queues of PCUIF messages to be sent |
| 207 | * TODO: we may have multiple PDCH time-slots */ |
| 208 | var PCUIF_MsgQueue pdtch_data_queue := { }; |
| 209 | var PCUIF_MsgQueue pdtch_rts_queue := { }; |
| 210 | var PCUIF_MsgQueue ptcch_rts_queue := { }; |
| 211 | |
| 212 | /* Connection towards the PCU interface */ |
| 213 | port RAW_PCU_MSG_PT PCUIF; |
| 214 | /* Connection towards the test case */ |
| 215 | port RAW_PCU_MSG_PT TC; |
Vadim Yanitskiy | 02f77d8 | 2019-10-04 17:12:35 +0700 | [diff] [blame^] | 216 | |
| 217 | /* Whether to forward PTCCH/U burst events to the TC */ |
| 218 | var boolean cfg_ptcch_burst_fwd := false; |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | private altstep as_BTS_CT_MsgQueue(integer bts_nr) |
| 222 | runs on RAW_PCU_BTS_CT { |
| 223 | var PCUIF_Message pcu_msg; |
| 224 | |
| 225 | /* Enqueue DATA.ind and RTS.req messages */ |
| 226 | [] TC.receive(tr_PCUIF_MSG(PCU_IF_MSG_DATA_IND, bts_nr)) -> value pcu_msg { |
| 227 | f_PCUIF_MsgQueue_enqueue(pdtch_data_queue, pcu_msg); |
| 228 | repeat; |
| 229 | } |
| 230 | [] TC.receive(tr_PCUIF_RTS_REQ(bts_nr, sapi := PCU_IF_SAPI_PDTCH)) -> value pcu_msg { |
| 231 | f_PCUIF_MsgQueue_enqueue(pdtch_rts_queue, pcu_msg); |
| 232 | repeat; |
| 233 | } |
| 234 | [] TC.receive(tr_PCUIF_RTS_REQ(bts_nr, sapi := PCU_IF_SAPI_PTCCH)) -> value pcu_msg { |
| 235 | f_PCUIF_MsgQueue_enqueue(ptcch_rts_queue, pcu_msg); |
| 236 | repeat; |
| 237 | } |
| 238 | /* Forward other messages directly to the PCU */ |
| 239 | [] TC.receive(tr_PCUIF_MSG(?, bts_nr)) -> value pcu_msg { |
| 240 | PCUIF.send(pcu_msg); |
| 241 | repeat; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | private altstep as_BTS_CT_TDMASched(integer bts_nr) |
| 246 | runs on RAW_PCU_BTS_CT { |
| 247 | var PCUIF_Message pcu_msg; |
| 248 | var RAW_PCU_Event event; |
| 249 | |
| 250 | [] CLCK.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_BEG)) -> value event { |
| 251 | /* If the RTS queue for PDTCH is not empty, send a message */ |
| 252 | if (lengthof(pdtch_rts_queue) > 0) { |
| 253 | f_PCUIF_MsgQueue_dequeue(pdtch_rts_queue, pcu_msg); |
| 254 | |
| 255 | /* Patch TDMA frame / block number and send */ |
| 256 | pcu_msg.u.rts_req.fn := event.data.tdma_fn; |
| 257 | pcu_msg.u.rts_req.block_nr := 0; /* FIXME! */ |
| 258 | PCUIF.send(pcu_msg); |
| 259 | } |
| 260 | |
| 261 | /* We don't really need to send every frame to OsmoPCU, because |
| 262 | * it omits frame numbers not starting at a MAC block. */ |
| 263 | PCUIF.send(ts_PCUIF_TIME_IND(bts_nr, event.data.tdma_fn)); |
| 264 | repeat; |
| 265 | } |
| 266 | [lengthof(pdtch_data_queue) > 0] CLCK.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_END)) -> value event { |
| 267 | /* Dequeue a DATA.ind message */ |
| 268 | f_PCUIF_MsgQueue_dequeue(pdtch_data_queue, pcu_msg); |
| 269 | |
| 270 | /* Patch TDMA frame / block number */ |
| 271 | pcu_msg.u.data_ind.fn := event.data.tdma_fn; |
| 272 | pcu_msg.u.data_ind.block_nr := 0; /* FIXME! */ |
| 273 | |
| 274 | PCUIF.send(pcu_msg); /* Send to the PCU and notify the TC */ |
| 275 | TC.send(ts_RAW_PCU_CLCK_EV(TDMA_EV_PDTCH_BLOCK_SENT, event.data.tdma_fn)); |
| 276 | repeat; |
| 277 | } |
| 278 | [lengthof(ptcch_rts_queue) > 0] CLCK.receive(tr_RAW_PCU_EV(TDMA_EV_PTCCH_DL_BLOCK)) -> value event { |
| 279 | /* Dequeue an RTS.req message for PTCCH */ |
| 280 | f_PCUIF_MsgQueue_dequeue(ptcch_rts_queue, pcu_msg); |
| 281 | |
| 282 | /* Patch TDMA frame / block number and send */ |
| 283 | pcu_msg.u.rts_req.fn := event.data.tdma_fn; |
| 284 | pcu_msg.u.rts_req.block_nr := 0; /* FIXME! */ |
| 285 | PCUIF.send(pcu_msg); |
| 286 | repeat; |
| 287 | } |
Vadim Yanitskiy | 02f77d8 | 2019-10-04 17:12:35 +0700 | [diff] [blame^] | 288 | /* Optional forwarding of PTCCH/U burst indications to the test case */ |
| 289 | [cfg_ptcch_burst_fwd] CLCK.receive(tr_RAW_PCU_EV(TDMA_EV_PTCCH_UL_BURST)) -> value event { |
| 290 | TC.send(event); |
| 291 | repeat; |
| 292 | } |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 293 | /* Ignore other clock events (and guard against an empty queue) */ |
| 294 | [] CLCK.receive(tr_RAW_PCU_CLCK_EV) { repeat; } |
| 295 | } |
| 296 | |
| 297 | function f_BTS_CT_handler(integer bts_nr, PCUIF_info_ind info_ind) |
| 298 | runs on RAW_PCU_BTS_CT { |
| 299 | var PCUIF_Message pcu_msg; |
Vadim Yanitskiy | 02f77d8 | 2019-10-04 17:12:35 +0700 | [diff] [blame^] | 300 | var RAW_PCU_Command cmd; |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 301 | var RAW_PCU_Event event; |
| 302 | |
| 303 | /* Init TDMA clock generator (so we can stop and start it) */ |
| 304 | vc_CLCK_GEN := RAW_PCU_ClckGen_CT.create("ClckGen-" & int2str(bts_nr)) alive; |
| 305 | connect(vc_CLCK_GEN:CLCK, self:CLCK); |
| 306 | |
| 307 | /* Wait until the PCU is connected */ |
| 308 | PCUIF.receive(tr_RAW_PCU_EV(PCU_EV_CONNECT)); |
| 309 | |
| 310 | /* TODO: implement ACT.req handling */ |
| 311 | alt { |
| 312 | /* Wait for TXT.ind (PCU_VERSION) and respond with INFO.ind (SI13) */ |
| 313 | [] PCUIF.receive(tr_PCUIF_TXT_IND(bts_nr, PCU_VERSION, ?)) -> value pcu_msg { |
| 314 | log("Rx TXT.ind from the PCU, version is ", pcu_msg.u.txt_ind.text); |
| 315 | |
| 316 | /* Send System Information 13 to the PCU */ |
| 317 | PCUIF.send(PCUIF_Message:{ |
| 318 | msg_type := PCU_IF_MSG_INFO_IND, |
| 319 | bts_nr := bts_nr, |
| 320 | spare := '0000'O, |
| 321 | u := { info_ind := info_ind } |
| 322 | }); |
| 323 | |
| 324 | /* Notify the test case that we're done with SI13 */ |
| 325 | TC.send(ts_RAW_PCU_EV(BTS_EV_SI13_NEGO)); |
| 326 | |
| 327 | /* Start feeding clock to the PCU */ |
| 328 | vc_CLCK_GEN.start(f_ClckGen_CT_handler()); |
| 329 | repeat; |
| 330 | } |
| 331 | /* PCU -> test case forwarding (filter by the BTS number) */ |
| 332 | [] PCUIF.receive(tr_PCUIF_MSG(?, bts_nr)) -> value pcu_msg { |
| 333 | TC.send(pcu_msg); |
| 334 | repeat; |
| 335 | } |
| 336 | |
| 337 | /* TC -> [Queue] -> PCU forwarding */ |
| 338 | [] as_BTS_CT_MsgQueue(bts_nr); |
| 339 | /* TDMA scheduler (clock and queue handling) */ |
| 340 | [] as_BTS_CT_TDMASched(bts_nr); |
| 341 | |
Vadim Yanitskiy | 02f77d8 | 2019-10-04 17:12:35 +0700 | [diff] [blame^] | 342 | /* Command handling */ |
| 343 | [] TC.receive(tr_RAW_PCU_CMD(TDMA_CMD_ENABLE_PTCCH_UL_FWD)) { |
| 344 | log("Enabling forwarding of PTCCH/U TDMA events to the TC"); |
| 345 | cfg_ptcch_burst_fwd := true; |
| 346 | repeat; |
| 347 | } |
| 348 | [] TC.receive(tr_RAW_PCU_CMD) -> value cmd { |
| 349 | log("Ignore unhandled command: ", cmd); |
| 350 | repeat; |
| 351 | } |
| 352 | |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 353 | /* TODO: handle events (e.g. disconnection) from the PCU interface */ |
| 354 | [] PCUIF.receive(tr_RAW_PCU_EV) -> value event { |
| 355 | log("Ignore unhandled event: ", event); |
| 356 | repeat; |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | /* PCU interface (UNIX domain socket) handler */ |
| 362 | type component RAW_PCUIF_CT { |
| 363 | var ConnectionId g_pcu_conn_id := -1; |
| 364 | var boolean g_pcu_connected := false; |
| 365 | port PCUIF_CODEC_PT PCU; |
| 366 | |
| 367 | /* Connection towards BTS component(s) */ |
| 368 | port RAW_PCU_MSG_PT BTS; |
| 369 | /* Connection to the MTC (test case) */ |
| 370 | port RAW_PCU_MSG_PT MTC; |
| 371 | }; |
| 372 | |
| 373 | /* All received messages and events from OsmoPCU can be additionally sent |
| 374 | * directly to the MTC component. Pass direct := true to enable this mode. */ |
| 375 | function f_PCUIF_CT_handler(charstring pcu_sock_path, boolean direct := false) |
| 376 | runs on RAW_PCUIF_CT { |
| 377 | var PCUIF_send_data pcu_sd_msg; |
| 378 | var PCUIF_Message pcu_msg; |
| 379 | timer T_Conn := 10.0; |
| 380 | |
| 381 | log("Init PCU interface on '" & pcu_sock_path & "', waiting for connection..."); |
| 382 | g_pcu_conn_id := f_pcuif_listen(PCU, pcu_sock_path); |
| 383 | |
| 384 | /* Wait for connection */ |
| 385 | T_Conn.start; |
| 386 | alt { |
| 387 | [not g_pcu_connected] PCU.receive(UD_connected:?) { |
| 388 | log("OsmoPCU is now connected"); |
| 389 | /* Duplicate this event to the MTC if requested */ |
| 390 | if (direct) { MTC.send(ts_RAW_PCU_EV(PCU_EV_CONNECT)); } |
| 391 | BTS.send(ts_RAW_PCU_EV(PCU_EV_CONNECT)); |
| 392 | g_pcu_connected := true; |
| 393 | setverdict(pass); |
| 394 | T_Conn.stop; |
| 395 | repeat; |
| 396 | } |
| 397 | /* PCU -> BTS / MTC message forwarding */ |
| 398 | [g_pcu_connected] PCU.receive(PCUIF_send_data:?) -> value pcu_sd_msg { |
| 399 | /* Send to the BTSes if at least one is connected */ |
| 400 | if (BTS.checkstate("Connected")) { BTS.send(pcu_sd_msg.data); } |
| 401 | /* Duplicate this message to the MTC if requested */ |
| 402 | if (direct) { MTC.send(pcu_sd_msg.data); } |
| 403 | repeat; |
| 404 | } |
| 405 | /* MTC -> PCU message forwarding */ |
| 406 | [g_pcu_connected] MTC.receive(PCUIF_Message:?) -> value pcu_msg { |
| 407 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, pcu_msg)); |
| 408 | repeat; |
| 409 | } |
| 410 | /* BTS -> PCU message forwarding */ |
| 411 | [g_pcu_connected] BTS.receive(PCUIF_Message:?) -> value pcu_msg { |
| 412 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, pcu_msg)); |
| 413 | repeat; |
| 414 | } |
| 415 | [not g_pcu_connected] MTC.receive(PCUIF_Message:?) -> value pcu_msg { |
| 416 | log("PCU is not connected, dropping ", pcu_msg); |
| 417 | repeat; |
| 418 | } |
| 419 | [not g_pcu_connected] BTS.receive(PCUIF_Message:?) -> value pcu_msg { |
| 420 | log("PCU is not connected, dropping ", pcu_msg); |
| 421 | repeat; |
| 422 | } |
| 423 | /* TODO: handle disconnect and reconnect of the PCU */ |
| 424 | [] PCU.receive { |
| 425 | log("Unhandled message on PCU interface"); |
| 426 | repeat; |
| 427 | } |
| 428 | [not g_pcu_connected] T_Conn.timeout { |
| 429 | setverdict(fail, "Timeout waiting for PCU connection"); |
| 430 | mtc.stop; |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | } |