FreeCalypso > hg > freecalypso-citrine
comparison g23m-gsm/dl/dl_dph.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 09 Jun 2016 00:02:41 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:75a11d740a02 |
|---|---|
| 1 /* | |
| 2 +----------------------------------------------------------------------------- | |
| 3 | Project : GSM-PS | |
| 4 | Modul : DL_DPH | |
| 5 +----------------------------------------------------------------------------- | |
| 6 | Copyright 2002 Texas Instruments Berlin, AG | |
| 7 | All rights reserved. | |
| 8 | | |
| 9 | This file is confidential and a trade secret of Texas | |
| 10 | Instruments Berlin, AG | |
| 11 | The receipt of or possession of this file does not convey | |
| 12 | any rights to reproduce or disclose its contents or to | |
| 13 | manufacture, use, or sell anything it may describe, in | |
| 14 | whole, or in part, without the specific written consent of | |
| 15 | Texas Instruments Berlin, AG. | |
| 16 +----------------------------------------------------------------------------- | |
| 17 | Purpose : This Modul defines the functions for distributing | |
| 18 | all primitives of the lower layers. | |
| 19 +----------------------------------------------------------------------------- | |
| 20 */ | |
| 21 | |
| 22 #ifndef DL_DPH_C | |
| 23 #define DL_DPH_C | |
| 24 | |
| 25 #include "config.h" | |
| 26 #include "fixedconf.h" | |
| 27 #include "condat-features.h" | |
| 28 | |
| 29 #define ENTITY_DL | |
| 30 | |
| 31 /*==== INCLUDES ===================================================*/ | |
| 32 | |
| 33 #include "typedefs.h" | |
| 34 #include <string.h> | |
| 35 #include "pconst.cdg" | |
| 36 #include "vsi.h" | |
| 37 #include "pconst.cdg" | |
| 38 #include "custom.h" | |
| 39 #include "gsm.h" | |
| 40 #include "mon_dl.h" | |
| 41 #include "prim.h" | |
| 42 #include "pei.h" | |
| 43 #include "tok.h" | |
| 44 #include "ccdapi.h" | |
| 45 #include "dl.h" | |
| 46 #include "dl_trc.h" | |
| 47 | |
| 48 /*==== EXPORT =====================================================*/ | |
| 49 | |
| 50 /*==== PRIVAT =====================================================*/ | |
| 51 #if defined(_SIMULATION_) && !defined(DL_2TO1) | |
| 52 LOCAL void dph_ph_data_req (T_PH_DATA_REQ * data_req); | |
| 53 #endif /* _SIMULATION_ && !DL_2TO1 */ | |
| 54 | |
| 55 #if defined(DL_2TO1) || defined(USE_L1M_GS001_1) | |
| 56 LOCAL U8 convert_dcch_ch_type (U8 channel_type); | |
| 57 #endif /* DL_2TO1 || USE_L1M_GS001_1 */ | |
| 58 | |
| 59 LOCAL void dl_process_downlink (UBYTE error_flag, UBYTE channel_type, | |
| 60 UBYTE * frame, ULONG fn); | |
| 61 | |
| 62 /*==== VARIABLES ==================================================*/ | |
| 63 | |
| 64 /*==== FUNCTIONS ==================================================*/ | |
| 65 #if defined(DL_2TO1) | |
| 66 #if defined(_SIMULATION_) | |
| 67 /* | |
| 68 +--------------------------------------------------------------------+ | |
| 69 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 70 | STATE : code ROUTINE : dph_ph_ready_to_send | | |
| 71 +--------------------------------------------------------------------+ | |
| 72 | |
| 73 PURPOSE : Reception of a PH_READY_TO_SEND primitive. | |
| 74 Uplink opportunity for simulation. | |
| 75 | |
| 76 */ | |
| 77 | |
| 78 GLOBAL void l1test_call_mphc_read_dcch (T_L1TEST_CALL_MPHC_READ_DCCH * ready) | |
| 79 { | |
| 80 UBYTE no_signalling_flag = NO_SIGNALLING; | |
| 81 T_RADIO_FRAME *frame = NULL; | |
| 82 | |
| 83 GET_INSTANCE_DATA; | |
| 84 dl_data->dl_active = FALSE; | |
| 85 | |
| 86 switch (ready->chn_mode) | |
| 87 { | |
| 88 case CM_SIGNALLING_ONLY: | |
| 89 /* | |
| 90 * Take over the behaviour of dll_read_dcch(): | |
| 91 * No ch_type is given by the layer 1 for SDCCH and FACCH, | |
| 92 * the first parameter ch_type of the fuction dl1_uplink_ind() get a | |
| 93 * value set to zero. | |
| 94 */ | |
| 95 no_signalling_flag = SIG_ONLY; | |
| 96 break; | |
| 97 default: | |
| 98 break; | |
| 99 } | |
| 100 | |
| 101 frame = dl1_uplink_ind (0, no_signalling_flag); | |
| 102 | |
| 103 if (frame) | |
| 104 { | |
| 105 l1test_return_mphc_read_dcch (frame); | |
| 106 } | |
| 107 | |
| 108 MY_PFREE (ready); | |
| 109 } | |
| 110 | |
| 111 GLOBAL void l1test_call_mphc_read_sacch (T_L1TEST_CALL_MPHC_READ_SACCH * ready) | |
| 112 { | |
| 113 T_RADIO_FRAME *frame = NULL; | |
| 114 | |
| 115 GET_INSTANCE_DATA; | |
| 116 dl_data->dl_active = FALSE; | |
| 117 | |
| 118 frame = dl1_uplink_ind (L2_CHANNEL_SACCH, SIG_ONLY); | |
| 119 if (frame) | |
| 120 { | |
| 121 l1test_return_mphc_read_sacch (frame); | |
| 122 } | |
| 123 | |
| 124 MY_PFREE (ready); | |
| 125 } | |
| 126 | |
| 127 /* | |
| 128 +--------------------------------------------------------------------+ | |
| 129 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 130 | STATE : code ROUTINE : dph_ph_data_req | | |
| 131 +--------------------------------------------------------------------+ | |
| 132 | |
| 133 PURPOSE : Sending of a PH_DATA_REQ primitive. | |
| 134 Uplink for simulation. | |
| 135 | |
| 136 */ | |
| 137 | |
| 138 GLOBAL void l1test_return_mphc_read_dcch (T_RADIO_FRAME * frame) | |
| 139 { | |
| 140 PALLOC(data_req, L1TEST_RETURN_MPHC_READ_DCCH); | |
| 141 | |
| 142 TRACE_FUNCTION ("l1test_return_mphc_read_dcch()"); | |
| 143 | |
| 144 memcpy(data_req->l2_frame.frame_array, frame->frame_array, sizeof(data_req->l2_frame)); | |
| 145 PSEND (hCommPL, data_req); | |
| 146 } | |
| 147 | |
| 148 GLOBAL void l1test_return_mphc_read_sacch (T_RADIO_FRAME * frame) | |
| 149 { | |
| 150 PALLOC(data_req, L1TEST_RETURN_MPHC_READ_SACCH); | |
| 151 | |
| 152 TRACE_FUNCTION ("l1test_return_mphc_read_sacch()"); | |
| 153 | |
| 154 memcpy(data_req->l2_frame.frame_array, frame->frame_array, sizeof(data_req->l2_frame)); | |
| 155 PSEND (hCommPL, data_req); | |
| 156 } | |
| 157 | |
| 158 /* | |
| 159 +--------------------------------------------------------------------+ | |
| 160 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 161 | STATE : code ROUTINE : l1test_call_mphc_dcch_downlink | | |
| 162 +--------------------------------------------------------------------+ | |
| 163 | |
| 164 PURPOSE : Reception of a L1TEST_CALL_MPHC_DCCH_DOWNLINK primitive. | |
| 165 | |
| 166 */ | |
| 167 | |
| 168 GLOBAL void l1test_call_mphc_dcch_downlink (T_L1TEST_CALL_MPHC_DCCH_DOWNLINK * data_ind) | |
| 169 { | |
| 170 /* | |
| 171 * Take over the behaviour of dll_dcch_downlink(): | |
| 172 * No ch_type is given by the layer 1 for SDCCH and FACCH, | |
| 173 * the second parameter ch_type of the function dl_process_downlink() get a | |
| 174 * value set to zero. | |
| 175 */ | |
| 176 dl_data->dl_active = FALSE; | |
| 177 | |
| 178 dl_process_downlink (data_ind->valid_flag, 0, data_ind->l2_frame.frame_array, NOT_PRESENT_32BIT); | |
| 179 | |
| 180 MY_PFREE (data_ind); | |
| 181 } | |
| 182 #endif /* _SIMULATION_ */ | |
| 183 | |
| 184 /* | |
| 185 +--------------------------------------------------------------------+ | |
| 186 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 187 | STATE : code ROUTINE : dph_ph_data_ind | | |
| 188 +--------------------------------------------------------------------+ | |
| 189 | |
| 190 PURPOSE : Reception of a PH_DATA_IND primitive. | |
| 191 This function is only available in stacks >= TCS5 (DL_2TO1). | |
| 192 A function with the same name exist for the old GSM/GPRS stack. | |
| 193 | |
| 194 It is used for SACCH downlink on target as well as on simulation. | |
| 195 In opposite to the old GSM/GPRS stack, a functional interface | |
| 196 (l1test_call_mphc_dcch_downlink) is used by the dual mode stack | |
| 197 implementation for SDCCH and FACCH during simulation. Therefore | |
| 198 this function is only used for SACCH. | |
| 199 | |
| 200 */ | |
| 201 | |
| 202 GLOBAL void dph_ph_data_ind (T_MPHC_PH_DATA_IND * data_ind) | |
| 203 { | |
| 204 /* | |
| 205 * Take over the behaviour of dll_dcch_downlink(): | |
| 206 * No ch_type is given by the layer 1 for SDCCH and FACCH, | |
| 207 * the second parameter ch_type of the function dl_process_downlink() get a | |
| 208 * value set to zero. | |
| 209 */ | |
| 210 | |
| 211 TRACE_FUNCTION ("dph_ph_data_ind() 2TO1"); | |
| 212 | |
| 213 if (data_ind->l2_channel_type EQ L2_CHANNEL_SACCH) | |
| 214 dl_process_downlink (data_ind->error_cause, | |
| 215 L2_CHANNEL_SACCH, | |
| 216 data_ind->l2_frame.frame_array, | |
| 217 NOT_PRESENT_32BIT); | |
| 218 | |
| 219 MY_PFREE (data_ind); | |
| 220 } | |
| 221 | |
| 222 #else /* DL_2TO1 */ | |
| 223 | |
| 224 #if defined(_SIMULATION_) | |
| 225 /* | |
| 226 +--------------------------------------------------------------------+ | |
| 227 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 228 | STATE : code ROUTINE : dph_ph_ready_to_send | | |
| 229 +--------------------------------------------------------------------+ | |
| 230 | |
| 231 PURPOSE : Reception of a PH_READY_TO_SEND primitive. | |
| 232 Uplink opportunity for simulation. | |
| 233 | |
| 234 */ | |
| 235 | |
| 236 GLOBAL void dph_ph_ready_to_send (T_PH_READY_TO_SEND * ready) | |
| 237 { | |
| 238 UBYTE no_signalling_flag = SIG_ONLY; | |
| 239 T_RADIO_FRAME *frame; | |
| 240 UBYTE ch_type; | |
| 241 switch (ready->ch_type) | |
| 242 { | |
| 243 case L2_CHANNEL_FACCH_F: | |
| 244 case L2_CHANNEL_FACCH_H: | |
| 245 no_signalling_flag = NO_SIGNALLING; | |
| 246 /*lint -fallthrough */ | |
| 247 case L2_CHANNEL_SDCCH: | |
| 248 /* | |
| 249 * Take over the behaviour of dll_read_dcch(): | |
| 250 * No ch_type is given by the layer 1 for SDCCH and FACCH, | |
| 251 * the first parameter ch_type of the function dl1_uplink_ind() get a | |
| 252 * value set to zero. | |
| 253 */ | |
| 254 ch_type = 0; | |
| 255 break; | |
| 256 default: | |
| 257 ch_type = ready->ch_type; | |
| 258 break; | |
| 259 } | |
| 260 | |
| 261 frame = dl1_uplink_ind (ch_type, no_signalling_flag); | |
| 262 if (frame) | |
| 263 { | |
| 264 PALLOC_SDU (data, PH_DATA_REQ, 23*BITS_PER_BYTE);/* T_PH_DATA_REQ */ | |
| 265 | |
| 266 /* | |
| 267 * In case the value of ready->ch_type was set to zero above it has to set | |
| 268 * to the value of dcch0_ch_type corresponding the behaviour of the | |
| 269 * function dl1_uplink_ind(). | |
| 270 if (ready->ch_type EQ 0) | |
| 271 { | |
| 272 T_DL_DATA *dl_data = dl_get_data (); | |
| 273 ready->ch_type = dl_data->dcch0_ch_type ? dl_data->dcch0_ch_type : L2_CHANNEL_SDCCH; | |
| 274 } | |
| 275 */ | |
| 276 | |
| 277 memcpy (data->sdu.buf, frame, 23);/*lint !e419 (Warning -- Apparent data overrun) */ | |
| 278 if (ready->ch_type EQ L2_CHANNEL_SACCH) | |
| 279 { | |
| 280 data->sdu.buf[0] = 0;/* layer 1 header occupies 2 bytes */ | |
| 281 data->sdu.buf[1] = 0;/*lint !e415 (Warning -- access of out-of-bounds pointer) */ | |
| 282 data->sdu.o_buf = 2 * BITS_PER_BYTE; | |
| 283 data->sdu.l_buf = 21 * BITS_PER_BYTE; | |
| 284 } | |
| 285 else | |
| 286 { | |
| 287 data->sdu.o_buf = 0; | |
| 288 data->sdu.l_buf = 23 * BITS_PER_BYTE; | |
| 289 } | |
| 290 data->ch_type = ready->ch_type; | |
| 291 dph_ph_data_req (data); | |
| 292 } | |
| 293 | |
| 294 MY_PFREE (ready); | |
| 295 } | |
| 296 | |
| 297 /* | |
| 298 +--------------------------------------------------------------------+ | |
| 299 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 300 | STATE : code ROUTINE : dph_ph_data_req | | |
| 301 +--------------------------------------------------------------------+ | |
| 302 | |
| 303 PURPOSE : Sending of a PH_DATA_REQ primitive. | |
| 304 Uplink for simulation. | |
| 305 | |
| 306 */ | |
| 307 | |
| 308 LOCAL void dph_ph_data_req (T_PH_DATA_REQ * data_req) | |
| 309 { | |
| 310 TRACE_FUNCTION ("dph_ph_data_req()"); | |
| 311 | |
| 312 #if defined(DL_TRACE_WIN32) | |
| 313 if (data_req->ch_type EQ L2_CHANNEL_SACCH) | |
| 314 { | |
| 315 /*lint -e416 (Warning -- creation of out-of-bounds pointer) */ | |
| 316 FTRC (data_req->ch_type, data_req->sdu.buf+2, 1); /* uplink SACCH */ | |
| 317 /*lint +e416 (Warning -- creation of out-of-bounds pointer) */ | |
| 318 } | |
| 319 else | |
| 320 { | |
| 321 FTRC (data_req->ch_type, data_req->sdu.buf, 1); /* uplink other */ | |
| 322 } | |
| 323 #endif /* DL_TRACE_WIN32 */ | |
| 324 | |
| 325 PSENDX (PL, data_req); | |
| 326 } | |
| 327 #endif /* _SIMULATION */ | |
| 328 | |
| 329 /* | |
| 330 +--------------------------------------------------------------------+ | |
| 331 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 332 | STATE : code ROUTINE : dph_ph_data_ind | | |
| 333 +--------------------------------------------------------------------+ | |
| 334 | |
| 335 PURPOSE : Reception of a PH_DATA_IND primitive. | |
| 336 This function is only available in the old GSM/GPRS stack (<= TCS4). | |
| 337 A function with the same name exist for the dual mode stack. | |
| 338 | |
| 339 It can be used for SACCH downlink on target as well as on simulation. | |
| 340 During simulation the old GSM/GPRS stack uses this primitive | |
| 341 function for SDCCH and FACCH also. In this case it takes over the | |
| 342 functional interface dll_dcch_downlink(). | |
| 343 In the current implementation of the old GSM/GPRS stack the ALR | |
| 344 queue is exclusively used for incoming PH_DATA_IND primitives from | |
| 345 L1 for target builds. Only Acknowledged frames (SAPI=3) and frames | |
| 346 with Bter format (short PD header) are forwarded to DL and handled | |
| 347 by this function. | |
| 348 | |
| 349 */ | |
| 350 | |
| 351 GLOBAL void dph_ph_data_ind (T_PH_DATA_IND * ph_data_ind) | |
| 352 { | |
| 353 if (ph_data_ind) | |
| 354 { | |
| 355 #if defined(_SIMULATION_) | |
| 356 /* | |
| 357 * Take over the behaviour of dll_dcch_downlink(): | |
| 358 * No ch_type is given by the layer 1 for SDCCH and FACCH, | |
| 359 * the first parameter ch_type of the function dl_process_downlink() get a | |
| 360 * value set to zero. | |
| 361 */ | |
| 362 switch (ph_data_ind->l2_channel_type) | |
| 363 { | |
| 364 case L2_CHANNEL_SDCCH: | |
| 365 case L2_CHANNEL_FACCH_F: | |
| 366 case L2_CHANNEL_FACCH_H: | |
| 367 ph_data_ind->l2_channel_type = 0; | |
| 368 break; | |
| 369 default: | |
| 370 break; | |
| 371 } | |
| 372 #else /* _SIMULATION */ | |
| 373 if (ph_data_ind->l2_channel_type EQ L2_CHANNEL_SACCH) | |
| 374 #endif /* _SIMULATION */ | |
| 375 dl_process_downlink (ph_data_ind->error_cause, | |
| 376 ph_data_ind->l2_channel_type, | |
| 377 ph_data_ind->l2_frame.A, | |
| 378 NOT_PRESENT_32BIT); | |
| 379 | |
| 380 MY_PFREE (ph_data_ind); | |
| 381 } | |
| 382 } | |
| 383 #endif /* DL_2TO1 */ | |
| 384 | |
| 385 /* | |
| 386 +--------------------------------------------------------------------+ | |
| 387 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 388 | STATE : code ROUTINE : dl_process_downlink | | |
| 389 +--------------------------------------------------------------------+ | |
| 390 | |
| 391 PURPOSE : really processing of layer 2 frame downlink. | |
| 392 | |
| 393 */ | |
| 394 LOCAL void dl_process_downlink (UBYTE error_flag, UBYTE channel_type, UBYTE * frame, ULONG fn) | |
| 395 { | |
| 396 GET_INSTANCE_DATA; | |
| 397 | |
| 398 TRACE_FUNCTION ("dll_process_downlink()"); | |
| 399 | |
| 400 /* set the active dedicated channel type if necessary */ | |
| 401 if (channel_type EQ 0) | |
| 402 { | |
| 403 TRACE_EVENT_WIN_P3 ("dl_process_downlink(%u,) -> ch=%u FN=%d", channel_type, dl_data->dcch0_ch_type, ((int)fn)); | |
| 404 channel_type = dl_data->dcch0_ch_type ? dl_data->dcch0_ch_type : L2_CHANNEL_SDCCH; | |
| 405 } | |
| 406 else | |
| 407 { | |
| 408 TRACE_EVENT_WIN_P1 ("dl_process_downlink(%u,)", channel_type); | |
| 409 } | |
| 410 | |
| 411 if (channel_type NEQ L2_CHANNEL_SACCH) | |
| 412 dl_data->interrupt_context = TRUE; | |
| 413 | |
| 414 if (fn NEQ NOT_PRESENT_32BIT) | |
| 415 dl_data->fn = fn; | |
| 416 | |
| 417 #if defined(DL_TRACE_ENABLED) | |
| 418 { | |
| 419 UCHAR trace_channel = TRACE_CH_UNKNOWN; | |
| 420 UCHAR frame_sapi; | |
| 421 | |
| 422 switch (channel_type) | |
| 423 { | |
| 424 case L2_CHANNEL_SACCH: | |
| 425 frame_sapi = ((*(frame + 2)) & 0x1c) >> 2; | |
| 426 if (frame_sapi EQ PS_SAPI_0) | |
| 427 trace_channel = C_DCCH0; | |
| 428 else if (frame_sapi EQ PS_SAPI_3) | |
| 429 trace_channel = C_DCCH3; | |
| 430 break; | |
| 431 case L2_CHANNEL_SDCCH: | |
| 432 frame_sapi = ((*frame) & 0x1c) >> 2; | |
| 433 if (frame_sapi EQ PS_SAPI_0) | |
| 434 trace_channel = C_DCCH0; | |
| 435 else if (frame_sapi EQ PS_SAPI_3) | |
| 436 trace_channel = C_DCCH3; | |
| 437 break; | |
| 438 case L2_CHANNEL_FACCH_F: | |
| 439 case L2_CHANNEL_FACCH_H: | |
| 440 frame_sapi = ((*frame) & 0x1c) >> 2; | |
| 441 if (frame_sapi EQ PS_SAPI_0) | |
| 442 trace_channel = C_DCCH0; | |
| 443 break; | |
| 444 default: | |
| 445 break; | |
| 446 }/* endswitch chan */ | |
| 447 if (error_flag EQ VALID_BLOCK) | |
| 448 { | |
| 449 DL_OFFLINE_TRACE (TRACE_DOWNLINK, trace_channel, channel_type, &frame[0]); | |
| 450 } | |
| 451 } | |
| 452 #endif /* DL_TRACE_ENABLED */ | |
| 453 | |
| 454 #if defined(DL_TRACE_WIN32) | |
| 455 if (error_flag EQ VALID_BLOCK) | |
| 456 { | |
| 457 if (channel_type EQ L2_CHANNEL_SACCH) | |
| 458 FTRC (channel_type, frame+2, 0); /* downlink SACCH */ | |
| 459 else | |
| 460 FTRC (channel_type, frame, 0); /* downlink other */ | |
| 461 } | |
| 462 #endif /* DL_TRACE_WIN32 */ | |
| 463 | |
| 464 if (channel_type EQ 0) | |
| 465 { | |
| 466 DL_OFFLINE_TRACE (TRACE_DL_EVENT, TRACE_CH_UNKNOWN, channel_type, "DL:no valid channel type"); | |
| 467 } | |
| 468 else | |
| 469 { | |
| 470 dl_downlink (error_flag, channel_type, &frame[0], fn); | |
| 471 } | |
| 472 | |
| 473 dl_data->interrupt_context = FALSE; | |
| 474 } | |
| 475 | |
| 476 /* | |
| 477 +--------------------------------------------------------------------+ | |
| 478 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 479 | STATE : code ROUTINE : dl1_uplink_ind | | |
| 480 +--------------------------------------------------------------------+ | |
| 481 | |
| 482 PURPOSE : Functional Interface for the uplink direction of the | |
| 483 logical channels SACCH/SDCCH/FACCH. | |
| 484 (only used by the target) | |
| 485 | |
| 486 */ | |
| 487 GLOBAL T_RADIO_FRAME * dl1_uplink_ind (UBYTE channel_type, UBYTE no_signalling_flag) | |
| 488 { | |
| 489 T_RADIO_FRAME * pRadioFrame; | |
| 490 UCHAR channel; | |
| 491 UCHAR sapi; | |
| 492 UCHAR signalling = SIG_ONLY; | |
| 493 | |
| 494 GET_INSTANCE_DATA; | |
| 495 | |
| 496 dl_data->interrupt_context = TRUE; | |
| 497 | |
| 498 /* set the active dedicated channel type if necessary */ | |
| 499 if (channel_type EQ 0) | |
| 500 channel_type = dl_data->dcch0_ch_type; | |
| 501 | |
| 502 TRACE_EVENT_WIN_P1 ("dl1_uplink_ind(ch_type=%u,)", channel_type); | |
| 503 | |
| 504 switch (channel_type) | |
| 505 { | |
| 506 case L2_CHANNEL_SACCH: | |
| 507 /* | |
| 508 * The priority arrangement on the SACCH must ensure that if a SAPI = 3 | |
| 509 * frame is awaiting transmission, two SAPI = 0 frames are not sent in | |
| 510 * consecutive SACCH frames. In addition, for the mobile to network | |
| 511 * direction it must also be ensured that any SAPI = 3 frame is followed | |
| 512 * by at least one SAPI = 0 frame. | |
| 513 * | |
| 514 * SAPI = 3 is set as default value. The function dl_uplink() together with | |
| 515 * the variable 'sacch_last_uplink_sapi' determind the actual value. | |
| 516 * e.g. if last uplinked SACCH frame was one with SAPI=3 | |
| 517 * or | |
| 518 * if no SACCH SAPI=3 frame is awaiting transmission | |
| 519 * then a SACCH SAPI=0 frame should be uplinked | |
| 520 */ | |
| 521 channel = C_SACCH0; | |
| 522 sapi = PS_SAPI_3; | |
| 523 TRACE_EVENT_WIN_P2 ("dl1_uplink_ind(%s, %s)", | |
| 524 CH_TYPE_NAME[channel_type], signalling EQ SIG_ONLY?"SIG_ONLY":"NO_SIGNALLING"); | |
| 525 break; | |
| 526 | |
| 527 default: | |
| 528 TRACE_ERROR ("dl1_uplink_ind():no valid channel type, use SDCCH instead"); | |
| 529 channel_type = L2_CHANNEL_SDCCH; | |
| 530 /*lint -fallthrough*/ | |
| 531 case L2_CHANNEL_FACCH_F: | |
| 532 case L2_CHANNEL_FACCH_H: | |
| 533 case L2_CHANNEL_SDCCH: | |
| 534 /* | |
| 535 * build frame for SAPI = 3 will be called (with lower priority) | |
| 536 * if no data is waiting for SAPI = 0. | |
| 537 */ | |
| 538 channel = C_DCCH0; | |
| 539 sapi = PS_SAPI_0; | |
| 540 dl_data->cch[channel].ch_type = channel_type; | |
| 541 signalling = no_signalling_flag; | |
| 542 TRACE_EVENT_WIN_P3 ("dl1_uplink_ind(%s, %s) SAPI=%u", | |
| 543 CH_TYPE_NAME[channel_type], signalling EQ SIG_ONLY?"SIG_ONLY":"NO_SIGNALLING", | |
| 544 sapi); | |
| 545 break; | |
| 546 } | |
| 547 | |
| 548 pRadioFrame= dl_uplink (channel, sapi, signalling, FALSE); | |
| 549 if (pRadioFrame) | |
| 550 { | |
| 551 #ifndef DL_2TO1 | |
| 552 DL_OFFLINE_TRACE (TRACE_UPLINK, channel, channel_type, &pRadioFrame->A[0]); | |
| 553 #else | |
| 554 DL_OFFLINE_TRACE (TRACE_UPLINK, channel, channel_type, &pRadioFrame->frame_array[0]); | |
| 555 #endif | |
| 556 } | |
| 557 | |
| 558 dl_data->interrupt_context = FALSE; | |
| 559 return pRadioFrame; /* return pointer to frame to layer 1 */ | |
| 560 } | |
| 561 | |
| 562 #if defined(DL_2TO1) || defined(USE_L1M_GS001_1) | |
| 563 /* | |
| 564 +--------------------------------------------------------------------+ | |
| 565 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 566 | STATE : code ROUTINE : convert_dcch_ch_type | | |
| 567 +--------------------------------------------------------------------+ | |
| 568 | |
| 569 PURPOSE : Converts dedicated channel types to layer 2 channel types | |
| 570 according to L1M_GS001_1 and L1M_GS001_3. | |
| 571 | |
| 572 */ | |
| 573 LOCAL U8 convert_dcch_ch_type (U8 channel_type) | |
| 574 { | |
| 575 UBYTE ch_type; | |
| 576 switch (channel_type) | |
| 577 { | |
| 578 case MPHC_CH_TCH_F: ch_type = L2_CHANNEL_FACCH_F;break; | |
| 579 case MPHC_CH_TCH_H: ch_type = L2_CHANNEL_FACCH_H;break; | |
| 580 case MPHC_CH_SDCCH_4: | |
| 581 case MPHC_CH_SDCCH_8:ch_type = L2_CHANNEL_SDCCH;break; | |
| 582 } | |
| 583 return ch_type; | |
| 584 } | |
| 585 #endif /* DL_2TO1 || USE_L1M_GS001_1 */ | |
| 586 | |
| 587 /* | |
| 588 +--------------------------------------------------------------------+ | |
| 589 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 590 | STATE : code ROUTINE : dll_read_dcch | | |
| 591 +--------------------------------------------------------------------+ | |
| 592 | |
| 593 PURPOSE : Functional Interface for the uplink direction of | |
| 594 SDCCH/FACCH. Only used by the TI target, look into | |
| 595 TI interface S922 or L1M_GS001_1. | |
| 596 | |
| 597 */ | |
| 598 #if defined(DL_2TO1) || defined(USE_L1M_GS001_1) | |
| 599 GLOBAL T_RADIO_FRAME * dll_read_dcch (U8 chn_mode, U8 channel_type) | |
| 600 { | |
| 601 return dl1_uplink_ind(convert_dcch_ch_type(channel_type), chn_mode); | |
| 602 } | |
| 603 #else /* DL_2TO1 || USE_L1M_GS001_1 */ | |
| 604 GLOBAL T_RADIO_FRAME * dll_read_dcch (U8 chn_mode) | |
| 605 { | |
| 606 /* 0 stands for the currently active SDCCH and FACCH channel type */ | |
| 607 return dl1_uplink_ind(0, chn_mode); | |
| 608 } | |
| 609 #endif /* DL_2TO1 || USE_L1M_GS001_1 */ | |
| 610 | |
| 611 /* | |
| 612 +--------------------------------------------------------------------+ | |
| 613 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 614 | STATE : code ROUTINE : dll_read_sacch | | |
| 615 +--------------------------------------------------------------------+ | |
| 616 | |
| 617 PURPOSE : Functional Interface for the uplink direction of SACCH. | |
| 618 Only used by the TI target, look into | |
| 619 TI interface S922 or L1M_GS001_1. | |
| 620 | |
| 621 */ | |
| 622 GLOBAL T_RADIO_FRAME * dll_read_sacch (UBYTE chn_mode) | |
| 623 { | |
| 624 return dl1_uplink_ind (L2_CHANNEL_SACCH, SIG_ONLY); | |
| 625 } | |
| 626 | |
| 627 /* | |
| 628 +--------------------------------------------------------------------+ | |
| 629 | PROJECT : GSM-PS (6147) MODULE : DL_DPH | | |
| 630 | STATE : code ROUTINE : dll_dcch_downlink | | |
| 631 +--------------------------------------------------------------------+ | |
| 632 | |
| 633 PURPOSE : Functional Interface for the downlink direction of | |
| 634 FACCH/DCCH. Only used by the TI target, look into | |
| 635 TI interface S922 or L1M_GS001_1. | |
| 636 | |
| 637 */ | |
| 638 #if defined(DL_2TO1) || defined(USE_L1M_GS001_1) | |
| 639 GLOBAL void dll_dcch_downlink(U32 * data_ptr, U8 valid_flag, U8 channel_type, U32 fn) | |
| 640 { | |
| 641 if ((data_ptr NEQ NULL) AND (valid_flag EQ DATA_VALID)) | |
| 642 { | |
| 643 dl_process_downlink (VALID_BLOCK, convert_dcch_ch_type(channel_type), | |
| 644 (UBYTE *)data_ptr, fn); | |
| 645 } | |
| 646 } | |
| 647 #else /* DL_2TO1 || USE_L1M_GS001_1 */ | |
| 648 #if defined(SEND_FN_TO_L2_IN_DCCH) && (SEND_FN_TO_L2_IN_DCCH == 1) | |
| 649 GLOBAL void dll_dcch_downlink(U32 * data_ptr, U8 valid_flag, U32 fn) | |
| 650 { | |
| 651 if ((data_ptr NEQ NULL) AND valid_flag) | |
| 652 { | |
| 653 /* | |
| 654 * channel type 0 stands for currently active dedicated | |
| 655 * SDCCH or FACCH channel type | |
| 656 */ | |
| 657 dl_process_downlink (VALID_BLOCK, 0, (UBYTE *)data_ptr, fn); | |
| 658 } | |
| 659 } | |
| 660 #else /* SEND_FN_TO_L2_IN_DCCH == 1 */ | |
| 661 GLOBAL void dll_dcch_downlink(U32 * data_ptr, U8 valid_flag) | |
| 662 { | |
| 663 if ((data_ptr NEQ NULL) AND valid_flag) | |
| 664 { | |
| 665 /* | |
| 666 * channel type 0 stands for currently active dedicated | |
| 667 * SDCCH or FACCH channel type | |
| 668 */ | |
| 669 dl_process_downlink (VALID_BLOCK, 0, (UBYTE *)data_ptr, NOT_PRESENT_32BIT); | |
| 670 } | |
| 671 } | |
| 672 #endif /* SEND_FN_TO_L2_IN_DCCH == 1 */ | |
| 673 #endif /* DL_2TO1 || USE_L1M_GS001_1 */ | |
| 674 #endif /* DL_DPH_C */ |
