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