FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/g23m-gsm/dl/dl_pei.c @ 673:2f7df7a314f8
gsm-fw/g23m-gsm subtree: initial import from LoCosto source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 28 Sep 2014 23:20:04 +0000 |
parents | |
children | 6bc81ea50ab5 |
comparison
equal
deleted
inserted
replaced
672:0dc6f9e8e980 | 673:2f7df7a314f8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : | |
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 module implements the process body interface | |
18 | for the entity DL of the mobile station. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef DL_PEI_C | |
23 #define DL_PEI_C | |
24 | |
25 #define ENTITY_DL | |
26 | |
27 | |
28 | |
29 /*==== INCLUDES ===================================================*/ | |
30 #include "typedefs.h" | |
31 #include <string.h> | |
32 #include <stdlib.h> | |
33 #include <stddef.h> | |
34 #include "vsi.h" | |
35 #include "pconst.cdg" | |
36 #include "custom.h" | |
37 #include "gsm.h" | |
38 #include "mon_dl.h" | |
39 #include "prim.h" | |
40 #include "pei.h" | |
41 #include "tok.h" | |
42 #include "ccdapi.h" | |
43 #include "dl.h" | |
44 #include "dl_em.h" | |
45 #include "dl_trc.h" | |
46 | |
47 /*==== EXPORT =====================================================*/ | |
48 #ifdef TI_PS_HCOMM_CHANGE | |
49 #else | |
50 GLOBAL T_HANDLE hCommDL = VSI_ERROR; /* Self Communication */ | |
51 GLOBAL T_HANDLE hCommRR = VSI_ERROR; /* RR Communication */ | |
52 GLOBAL T_HANDLE hCommPL = VSI_ERROR; /* PL Communication */ | |
53 #ifdef FF_EM_MODE | |
54 GLOBAL T_HANDLE hCommMMI = VSI_ERROR; /* EM Communication */ | |
55 #endif /* FF_EM_MODE */ | |
56 #endif | |
57 GLOBAL USHORT dl_handle; | |
58 | |
59 /*==== PRIVATE ====================================================*/ | |
60 | |
61 LOCAL void pei_not_supported (void *data); | |
62 LOCAL int dl_process_signal (ULONG opc, void *signal_data); | |
63 | |
64 LOCAL SHORT pei_signal (T_SIGNAL_OPC opc, void *signal_data); | |
65 | |
66 /*==== VARIABLES ==================================================*/ | |
67 #ifdef _SIMULATION_ | |
68 static UBYTE first_access = TRUE; | |
69 #endif /* _SIMULATION_ */ | |
70 | |
71 static T_MONITOR dl_mon; | |
72 | |
73 /*==== FUNCTIONS ==================================================*/ | |
74 /* Please consider that the opc´s are not necessarily sorted in sequential order. | |
75 * DL doesn´t use the normal technique to get the primitive from the table. | |
76 * Instead it uses the direct search and compare: | |
77 * for (i=0; i<n; i++, table++) | |
78 * if (table->opc EQ opc) | |
79 * break; | |
80 */ | |
81 LOCAL const T_FUNC dl_table[] = { | |
82 MAK_FUNC_S( drr_dl_establish_req , DL_ESTABLISH_REQ ), /* 0x80000003 */ | |
83 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x80010003 */ | |
84 MAK_FUNC_0( drr_dl_release_req , DL_RELEASE_REQ ), /* 0x80020003 */ | |
85 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x80030003 */ | |
86 MAK_FUNC_S( drr_dl_data_req , DL_DATA_REQ ), /* 0x80040003 */ | |
87 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x80050003 */ | |
88 MAK_FUNC_S( drr_dl_unitdata_req , DL_UNITDATA_REQ ), /* 0x80060003 */ | |
89 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x80070003 */ | |
90 MAK_FUNC_0( drr_dl_suspend_req , DL_SUSPEND_REQ ), /* 0x80080003 */ | |
91 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x80090003 */ | |
92 MAK_FUNC_S( drr_dl_resume_req , DL_RESUME_REQ ), /* 0x800a0003 */ | |
93 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x800b0003 */ | |
94 MAK_FUNC_S( drr_dl_reconnect_req , DL_RECONNECT_REQ ), /* 0x800c0003 */ | |
95 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x800d0003 */ | |
96 #if defined (DL_TRACE_ENABLED) && !defined(DL_IMMEDIATE_TRACE) | |
97 MAK_FUNC_0( dl_trace_read_all , DL_TRACE_REQ ), /* 0x800e0003 */ | |
98 #else | |
99 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x800e0003 */ | |
100 #endif /* DL_TRACE_ENABLED && !DL_IMMEDIATE_TRACE */ | |
101 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x800f0003 */ | |
102 MAK_FUNC_S( drr_dl_short_unitdata_req , DL_SHORT_UNITDATA_REQ) /* 0x80100003 */ | |
103 }; | |
104 | |
105 LOCAL const T_FUNC mphc_table[] = { | |
106 MAK_FUNC_0( dph_ph_data_ind, PH_DATA_IND ) /* 0x0000006d */ | |
107 }; | |
108 | |
109 | |
110 #if defined (DL_2TO1) | |
111 #if defined(_SIMULATION_) | |
112 LOCAL const T_FUNC l1_test_table[] = { | |
113 MAK_FUNC_0( l1test_call_mphc_read_dcch, L1TEST_CALL_MPHC_READ_DCCH ), /* 8000409b */ | |
114 MAK_FUNC_N( pei_not_supported , 0 ) /* removed */ | |
115 MAK_FUNC_N( pei_not_supported , 0 ) /* removed */ | |
116 }; | |
117 #endif /* _SIMULATION_ */ | |
118 #else /* DL_2TO1 */ | |
119 | |
120 LOCAL const T_FUNC mdl_table[] = { | |
121 MAK_FUNC_0( drr_mdl_release_req , MDL_RELEASE_REQ ) /* 0x80004004 */ | |
122 }; | |
123 | |
124 #if defined (_SIMULATION_) || (defined (DL_TRACE_ENABLED) && !defined(DL_IMMEDIATE_TRACE)) | |
125 LOCAL const T_FUNC ph_table[] = { | |
126 #if defined(_SIMULATION_) | |
127 MAK_FUNC_0( dph_ph_ready_to_send , PH_READY_TO_SEND ), /* 0x4100 */ | |
128 #else | |
129 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x4100 */ | |
130 #endif /* _SIMULATION_ */ | |
131 MAK_FUNC_N( pei_not_supported , 0 ), /* 0x4101 */ | |
132 #if defined (DL_TRACE_ENABLED) && !defined(DL_IMMEDIATE_TRACE) | |
133 MAK_FUNC_0( dl_trace_read , PH_TRACE_IND ) /* 0x4102 */ | |
134 #else | |
135 MAK_FUNC_N( pei_not_supported , 0 ) /* 0x4102 */ | |
136 #endif /* DL_TRACE_ENABLED && !DL_IMMEDIATE_TRACE*/ | |
137 }; | |
138 #endif /* _SIMULATION_||(DL_TRACE_ENABLED&& !DL_IMMEDIATE_TRACE) */ | |
139 #endif /* DL_2TO1 */ | |
140 | |
141 #ifdef FF_EM_MODE | |
142 LOCAL const T_FUNC em_ul_table[] = { | |
143 MAK_FUNC_0( dl_em_dl_event_req , EM_DL_EVENT_REQ ), /* 0x3e0A*/ | |
144 }; | |
145 #endif /* FF_EM_MODE */ | |
146 | |
147 | |
148 /* | |
149 +--------------------------------------------------------------------+ | |
150 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
151 | STATE : code ROUTINE : pei_primitive | | |
152 +--------------------------------------------------------------------+ | |
153 | |
154 PURPOSE : Process protocol specific primitive. | |
155 | |
156 */ | |
157 LOCAL SHORT pei_primitive (void * ptr) | |
158 { | |
159 GET_INSTANCE_DATA; | |
160 T_PRIM *prim = (T_PRIM*)ptr; | |
161 /* | |
162 * | | | |
163 * DL MDL | |
164 * | | | |
165 * +------v------------v------+ | |
166 * | | | |
167 * | DL | | |
168 * | | | |
169 * +-------------^------------+ | |
170 * | | |
171 * MPHC/PH | |
172 * | | |
173 * | |
174 */ | |
175 | |
176 TRACE_FUNCTION ("pei_primitive()"); | |
177 | |
178 if (prim NEQ NULL) | |
179 { | |
180 ULONG opc = prim->custom.opc; | |
181 USHORT n; | |
182 const T_FUNC *table; | |
183 | |
184 VSI_PPM_REC ((T_PRIM_HEADER*)prim, __FILE__, __LINE__); | |
185 | |
186 PTRACE_IN (opc); | |
187 | |
188 switch (SAP_NR(opc)) | |
189 { | |
190 case SAP_NR(DL_UL): table = dl_table; n = TAB_SIZE (dl_table); break; | |
191 /*case SAP_NR(MPHC_UL):*/ /* same as MPHC_DL */ | |
192 case SAP_NR(MPHC_DL): | |
193 table = mphc_table; | |
194 n = TAB_SIZE (mphc_table); | |
195 /* | |
196 * The opcodes for MPHC_DL start at 0x6d | |
197 */ | |
198 opc -= 0x6d; | |
199 break; | |
200 #if defined (DL_2TO1) | |
201 #if defined(_SIMULATION_) | |
202 case SAP_NR(L1TEST_UL): | |
203 case SAP_NR(L1TEST_DL): table = l1_test_table; n = TAB_SIZE (l1_test_table); break; | |
204 #endif /* _SIMULATION_ */ | |
205 #else /* DL_2TO1 */ | |
206 case SAP_NR(MDL_DL): table = mdl_table; n = TAB_SIZE (mdl_table); break; | |
207 #if defined (_SIMULATION_) || (defined (DL_TRACE_ENABLED) && !defined(DL_IMMEDIATE_TRACE)) | |
208 case SAP_NR(PH_UL): | |
209 case SAP_NR(PH_DL): table = ph_table; n = TAB_SIZE (ph_table); break; | |
210 #endif /* _SIMULATION_||(DL_TRACE_ENABLED&&!DL_IMMEDIATE_TRACE) */ | |
211 #endif /* DL_2TO1 */ | |
212 | |
213 #ifdef FF_EM_MODE | |
214 case EM_Ul: | |
215 table = em_ul_table; | |
216 n = TAB_SIZE (em_ul_table); | |
217 /* | |
218 * The opcodes for EM_Ul start at 0x0a | |
219 */ | |
220 opc -= 0x0a; | |
221 break; | |
222 #endif /* FF_EM_MODE*/ | |
223 default : table = NULL; n = 0; break; | |
224 } | |
225 if (table) | |
226 { | |
227 | |
228 #if defined (_SIMULATION_) | |
229 if (opc NEQ PH_READY_TO_SEND) | |
230 /* | |
231 * this simulates function call of layer 1 in the | |
232 * windows environment | |
233 */ | |
234 #endif /* _SIMULATION_ */ | |
235 dl_data->dl_active = TRUE; | |
236 | |
237 | |
238 if (PRIM_NR(opc)<n) | |
239 { | |
240 table += PRIM_NR(opc); | |
241 #ifdef PALLOC_TRANSITION | |
242 /*lint -e661 (Warning -- Possible access of out-of-bounds) */ | |
243 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0; | |
244 /*lint +e661 (Warning -- Possible access of out-of-bounds) */ | |
245 #ifndef NO_COPY_ROUTING | |
246 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER); | |
247 #endif /* NO_COPY_ROUTING */ | |
248 #endif /* PALLOC_TRANSITION */ | |
249 | |
250 #if defined (DL_TRACE_ENABLED) && !defined(DL_2TO1) | |
251 if ((opc EQ DL_TRACE_REQ) OR (opc EQ PH_TRACE_IND)) | |
252 /*lint -e661 (Warning -- Possible access of out-of-bounds) */ | |
253 JUMP (table->func)(); | |
254 /*lint +e661 (Warning -- Possible access of out-of-bounds) */ | |
255 else | |
256 #endif /* DL_TRACE_ENABLED && !DL_2TO1 */ | |
257 /*lint -e661 (Warning -- Possible access of out-of-bounds) */ | |
258 JUMP (table->func) (P2D(prim)); | |
259 /*lint +e661 (Warning -- Possible access of out-of-bounds) */ | |
260 } | |
261 else | |
262 { | |
263 pei_not_supported (P2D(prim)); | |
264 } | |
265 dl_data->dl_active = FALSE; | |
266 | |
267 return PEI_OK; | |
268 } | |
269 | |
270 #if defined (_SIMULATION_) | |
271 /* TDC is not able to send signals, therefore the redirection over primitives */ | |
272 if (opc EQ DL_SIGNAL_EM_READ) | |
273 { /* test ACI read of EM buffer only */ | |
274 return dl_process_signal(DL_SIGNAL_EM_READ, NULL); | |
275 } | |
276 #endif /* _SIMULATION_ */ | |
277 | |
278 /* | |
279 * Primitive is no GSM Primitive | |
280 * then forward to the environment | |
281 */ | |
282 | |
283 #ifdef GSM_ONLY | |
284 MY_PFREE (P2D(prim)) | |
285 | |
286 return PEI_ERROR; | |
287 #else | |
288 if (opc & SYS_MASK) | |
289 vsi_c_primitive (VSI_CALLER prim); | |
290 else | |
291 { | |
292 void* p = (void*)P2D(prim); | |
293 MY_PFREE (p); | |
294 return PEI_ERROR; | |
295 } | |
296 #endif | |
297 } | |
298 return PEI_OK; | |
299 } | |
300 | |
301 /* | |
302 +--------------------------------------------------------------------+ | |
303 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
304 | STATE : code ROUTINE : pei_not_supported | | |
305 +--------------------------------------------------------------------+ | |
306 | |
307 PURPOSE : An unsupported primitive is received. | |
308 | |
309 */ | |
310 | |
311 LOCAL void pei_not_supported (void * data) | |
312 { | |
313 TRACE_FUNCTION ("pei_not_supported()"); | |
314 | |
315 MY_PFREE (data); | |
316 } | |
317 | |
318 | |
319 /* | |
320 +--------------------------------------------------------------------+ | |
321 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
322 | STATE : code ROUTINE : pei_init | | |
323 +--------------------------------------------------------------------+ | |
324 | |
325 PURPOSE : Initialize Protocol Stack Entity | |
326 | |
327 */ | |
328 | |
329 LOCAL SHORT pei_init (T_HANDLE handle) | |
330 { | |
331 dl_handle = handle; | |
332 | |
333 TRACE_FUNCTION ("pei_init() " __DATE__ " " __TIME__); | |
334 | |
335 #ifdef TI_PS_HCOMM_CHANGE | |
336 if (!cl_hcom_all_handles_open()) | |
337 { | |
338 return PEI_ERROR; | |
339 } | |
340 #else /* for hCommHandles backward compatibility */ | |
341 if (hCommDL < VSI_OK) | |
342 { | |
343 if ((hCommDL = vsi_c_open (VSI_CALLER DL_NAME)) < VSI_OK) | |
344 return PEI_ERROR; | |
345 } | |
346 | |
347 if (hCommRR < VSI_OK) | |
348 { | |
349 if ((hCommRR = vsi_c_open (VSI_CALLER RR_NAME)) < VSI_OK) | |
350 return PEI_ERROR; | |
351 } | |
352 | |
353 | |
354 if (hCommPL < VSI_OK) | |
355 { | |
356 if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < VSI_OK) | |
357 return PEI_ERROR; | |
358 } | |
359 | |
360 #ifdef FF_EM_MODE | |
361 if (hCommMMI < VSI_OK) | |
362 { | |
363 if ((hCommMMI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK) | |
364 return PEI_ERROR; | |
365 } | |
366 #endif /* FF_EM_MODE */ | |
367 #endif | |
368 | |
369 TRC_INIT (); | |
370 | |
371 #if !defined(_SIMULATION_) | |
372 TRACE_EVENT (dl_version()); | |
373 SYST_TRACE (dl_version()); | |
374 #endif /* !_SIMULATION_ */ | |
375 | |
376 /* | |
377 * Initialize data base | |
378 */ | |
379 | |
380 #if defined(DL_TRACE_ENABLED) && !defined(DL_IMMEDIATE_TRACE) | |
381 dl_trace_init (); | |
382 #endif /* DL_TRACE_ENABLED && !DL_IMMEDIATE_TRACE*/ | |
383 | |
384 com_init_data (); | |
385 dcch0_init_dl_data (); | |
386 sacch0_init_dl_data (); | |
387 | |
388 #ifdef FF_EM_MODE | |
389 /* | |
390 initialise event flags | |
391 */ | |
392 em_init_dl_event_trace(); | |
393 /* | |
394 initialise dl semaphor for EM event tracing | |
395 */ | |
396 em_dl_sem_init(); | |
397 #endif /* FF_EM_MODE */ | |
398 | |
399 return PEI_OK; | |
400 } | |
401 | |
402 #ifdef _SIMULATION_ | |
403 /* | |
404 +--------------------------------------------------------------------+ | |
405 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
406 | STATE : code ROUTINE : pei_exit | | |
407 +--------------------------------------------------------------------+ | |
408 | |
409 PURPOSE : Close Resources and terminate | |
410 | |
411 */ | |
412 LOCAL SHORT pei_exit (void) | |
413 { | |
414 TRACE_FUNCTION ("pei_exit()"); | |
415 | |
416 #if defined(DL_TRACE_ENABLED) && !defined(DL_IMMEDIATE_TRACE) | |
417 dl_trace_exit (); | |
418 #endif /* DL_TRACE_ENABLED && !DL_IMMEDIATE_TRACE*/ | |
419 | |
420 #ifdef FF_EM_MODE | |
421 em_dl_sem_exit(); | |
422 #endif /* FF_EM_MODE */ | |
423 | |
424 /* | |
425 * clean up communication | |
426 */ | |
427 #ifdef TI_PS_HCOMM_CHANGE | |
428 #else /* for hCommHandles backward compatibility */ | |
429 vsi_c_close (VSI_CALLER hCommDL); | |
430 hCommDL = VSI_ERROR; | |
431 | |
432 vsi_c_close (VSI_CALLER hCommRR); | |
433 hCommRR = VSI_ERROR; | |
434 | |
435 vsi_c_close (VSI_CALLER hCommPL); | |
436 hCommPL = VSI_ERROR; | |
437 | |
438 #ifdef FF_EM_MODE | |
439 vsi_c_close (VSI_CALLER hCommMMI); | |
440 hCommMMI = VSI_ERROR; | |
441 #endif /* FF_EM_MODE */ | |
442 #endif | |
443 | |
444 TRC_EXIT (); | |
445 | |
446 return PEI_OK; | |
447 } | |
448 #endif /* _SIMULATION_ */ | |
449 | |
450 /* | |
451 +--------------------------------------------------------------------+ | |
452 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
453 | STATE : code ROUTINE : pei_config | | |
454 +--------------------------------------------------------------------+ | |
455 | |
456 PURPOSE : Dynamic Configuration | |
457 | |
458 */ | |
459 | |
460 /* Implements Measure#36 */ | |
461 #ifdef NCONFIG | |
462 #else /* NCONFIG */ | |
463 LOCAL SHORT pei_config (T_PEI_CONFIG inString) | |
464 { | |
465 return PEI_OK; | |
466 } | |
467 #endif /* NCONFIG */ | |
468 | |
469 /* | |
470 +--------------------------------------------------------------------+ | |
471 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
472 | STATE : code ROUTINE : dl_pei_config | | |
473 +--------------------------------------------------------------------+ | |
474 | |
475 PURPOSE : Dynamic Configuration | |
476 | |
477 */ | |
478 /* Implements Measure#36 */ | |
479 #ifdef NCONFIG | |
480 #else /* NCONFIG */ | |
481 GLOBAL T_PEI_RETURN dl_pei_config ( char * inString, char * dummy ) | |
482 { | |
483 return pei_config ( inString ); | |
484 } | |
485 #endif /* NCONFIG */ | |
486 | |
487 /* | |
488 +--------------------------------------------------------------------+ | |
489 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
490 | STATE : code ROUTINE : pei_monitor | | |
491 +--------------------------------------------------------------------+ | |
492 | |
493 PURPOSE : Monitoring of physical Parameters | |
494 | |
495 */ | |
496 | |
497 LOCAL SHORT pei_monitor (void ** monitor) | |
498 { | |
499 TRACE_FUNCTION ("pei_monitor()"); | |
500 | |
501 /* Implements Measure#32: Row 50 */ | |
502 | |
503 * monitor = &dl_mon; | |
504 | |
505 return PEI_OK; | |
506 } | |
507 | |
508 /* | |
509 +--------------------------------------------------------------------+ | |
510 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
511 | STATE : code ROUTINE : pei_create | | |
512 +--------------------------------------------------------------------+ | |
513 | |
514 PURPOSE : Create the Protocol Stack Entity | |
515 | |
516 */ | |
517 | |
518 /* | |
519 * New Frame | |
520 */ | |
521 GLOBAL T_PEI_RETURN dl_pei_create (T_PEI_INFO **info) | |
522 { | |
523 static const T_PEI_INFO pei_info = | |
524 { | |
525 "DL", | |
526 { | |
527 pei_init, | |
528 #ifdef _SIMULATION_ | |
529 pei_exit, | |
530 #else | |
531 NULL, | |
532 #endif | |
533 pei_primitive, | |
534 NULL, /* no timeout function */ | |
535 pei_signal, /* signal function */ | |
536 NULL, /* no run function */ | |
537 /* Implements Measure#36 */ | |
538 #ifdef NCONFIG | |
539 NULL, /* no pei_config function */ | |
540 #else /* NCONFIG */ | |
541 pei_config, | |
542 #endif /* NCONFIG */ | |
543 pei_monitor, | |
544 }, | |
545 #if defined (GPRS) | |
546 1536, /* Stack Size incresed for omaps00140330 */ | |
547 #else | |
548 #if defined (FAX_AND_DATA) | |
549 1536, /* Stack Size incresed for omaps00140330 */ | |
550 #else | |
551 1394, /* Stack Size incresed for omaps00140330 */ | |
552 #endif | |
553 #endif | |
554 10+DL_SIGNAL_DATA_ELEMENTS, /* Queue Entries */ | |
555 215, /* Priority */ | |
556 0, /* number of timer */ | |
557 /* flags */ | |
558 #ifdef _TARGET_ | |
559 #ifdef GPRS | |
560 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND | |
561 #else | |
562 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND | |
563 #endif | |
564 #else | |
565 PASSIVE_BODY|COPY_BY_REF | |
566 #endif | |
567 | |
568 }; | |
569 | |
570 TRACE_FUNCTION ("pei_create"); | |
571 /* | |
572 * Close Resources if open | |
573 */ | |
574 | |
575 #ifdef _SIMULATION_ | |
576 if (first_access) | |
577 first_access = FALSE; | |
578 else | |
579 pei_exit (); | |
580 #endif | |
581 | |
582 /* | |
583 * export startup configuration data | |
584 */ | |
585 *info = (T_PEI_INFO *)&pei_info; | |
586 /* | |
587 * Initialize entity data | |
588 */ | |
589 | |
590 /* | |
591 * Initialize Condat Coder Decoder and | |
592 * processes | |
593 */ | |
594 | |
595 | |
596 return PEI_OK; | |
597 } | |
598 | |
599 /* | |
600 +--------------------------------------------------------------------+ | |
601 | PROJECT : GSM-PS (6147) MODULE : DL_PEI | | |
602 | STATE : code ROUTINE : pei_signal | | |
603 +--------------------------------------------------------------------+ | |
604 | |
605 PURPOSE : Functional interface to signal a primitive. | |
606 | |
607 */ | |
608 LOCAL SHORT pei_signal (T_SIGNAL_OPC opc, void *signal_data) | |
609 { | |
610 #ifdef TRACE_FKT | |
611 { | |
612 char buf[24]; | |
613 sprintf(buf, "pei_signal (0x%lx)", (ULONG)opc); | |
614 TRACE_FUNCTION (buf); | |
615 PTRACE_IN(opc); | |
616 } | |
617 #elif defined(_SIMULATION_) | |
618 TRACE_EVENT_WIN_P1 ("pei_signal (0x%lx)", (ULONG)opc); | |
619 #endif | |
620 | |
621 dl_process_signal ((ULONG)opc, signal_data); | |
622 | |
623 return PEI_OK; | |
624 } | |
625 | |
626 LOCAL int dl_process_signal (ULONG opc, void *signal_data) | |
627 { | |
628 /*TRACE_FUNCTION ("pei_process_signal()");*/ | |
629 GET_INSTANCE_DATA; | |
630 switch (opc) | |
631 { | |
632 #if defined(DL_TRACE_ENABLED) && !defined (DL_IMMEDIATE_TRACE) && !defined(DL_2TO1) | |
633 case DL_TRACE_REQ: /* RR -> DL */ | |
634 SYST_TRACE("call dl_trace_read_all()"); | |
635 dl_trace_read_all (); | |
636 break; | |
637 case PH_TRACE_IND: /* ALR/TIL -> DL */ | |
638 dl_trace_read (); | |
639 break; | |
640 #endif /* DL_TRACE_ENABLED && !DL_IMMEDIATE_TRACE &6 !DL_2TO1 */ | |
641 #if defined(INVOKE_SIGNAL) | |
642 case DL_SIGNAL_ESTABLISH_IND: | |
643 sig_handle_drr_dl_establish_ind ((T_DL_SIGNAL_DATA *) signal_data); | |
644 break; | |
645 case DL_SIGNAL_ESTABLISH_CNF: | |
646 sig_handle_drr_dl_establish_cnf ((T_DL_SIGNAL_DATA *) signal_data); | |
647 break; | |
648 case DL_SIGNAL_DATA_IND: | |
649 sig_handle_com_data_ind ((T_DL_SIGNAL_DATA *) signal_data); | |
650 break; | |
651 case DL_SIGNAL_DATA_CNF: | |
652 sig_handle_drr_dl_data_cnf ((T_DL_SIGNAL_DATA *) signal_data); | |
653 break; | |
654 #if 0 /* happens in primitive context only */ | |
655 case DL_SIGNAL_UNITDATA_IND: | |
656 sig_handle_drr_dl_unitdata_ind (dl_data, (T_DL_SIGNAL_DATA *) signal_data); | |
657 break; | |
658 #endif /* 0 */ | |
659 case DL_SIGNAL_SHORT_UNITDATA_IND: | |
660 sig_handle_drr_dl_short_unitdata_ind ((T_DL_SIGNAL_DATA *) signal_data); | |
661 break; | |
662 case DL_SIGNAL_RELEASE_IND: | |
663 sig_handle_drr_dl_release_ind ((T_DL_SIGNAL_DATA *) signal_data); | |
664 break; | |
665 case DL_SIGNAL_RELEASE_CNF: | |
666 sig_handle_drr_dl_release_cnf ((T_DL_SIGNAL_DATA *) signal_data); | |
667 break; | |
668 case DL_SIGNAL_ERROR_IND: | |
669 sig_handle_drr_error_ind ((T_DL_SIGNAL_DATA *) signal_data); | |
670 break; | |
671 case DL_SIGNAL_FREE_POINTER: | |
672 sig_handle_com_free_pointer ((T_DL_SIGNAL_DATA *) signal_data); | |
673 break; | |
674 case DL_SIGNAL_CONCATENATE: | |
675 sig_handle_com_concatenate((T_DL_SIGNAL_DATA *) signal_data); | |
676 break; | |
677 #if defined(DL_TRACE_ENABLED) | |
678 case DL_SIGNAL_L2TRACE: | |
679 sig_handle_com_l2trace ((T_DL_SIGNAL_DATA *) signal_data); | |
680 break; | |
681 #endif /*DL_TRACE_ENABLED*/ | |
682 case DL_SIGNAL_L3TRACE: | |
683 sig_handle_com_l3trace((T_DL_SIGNAL_DATA *) signal_data); | |
684 break; | |
685 #if defined(FF_EM_MODE) | |
686 case DL_SIGNAL_EM_IND: | |
687 sig_handle_dl_em_first_event_check (); | |
688 break; | |
689 case DL_SIGNAL_EM_WRITE: | |
690 sig_handle_dl_em_write (dl_data, (T_DL_SIGNAL_DATA *) signal_data); | |
691 break; | |
692 #if defined(_SIMULATION_) | |
693 case DL_SIGNAL_EM_READ: | |
694 { | |
695 T_MONITOR *dummy; | |
696 | |
697 em_dl_sem_read (); | |
698 em_dl_sem_reset (); | |
699 pei_monitor (&dummy); | |
700 TRACE_EVENT_WIN (dummy->version); | |
701 } | |
702 break; | |
703 #endif /* _SIMULATION_ */ | |
704 #endif /* FF_EM_MODE */ | |
705 #endif /* INVOKE_SIGNAL */ | |
706 default: | |
707 break; | |
708 } | |
709 | |
710 #if defined(INVOKE_SIGNAL) | |
711 if (signal_data) | |
712 { | |
713 TRACE_EVENT_WIN_P1 ("pei_process_signal(): set data with idx=%u to FREE", | |
714 ((T_DL_SIGNAL_DATA *)signal_data)->idx); | |
715 | |
716 ((T_DL_SIGNAL_DATA *)signal_data)->busy = FALSE; | |
717 } | |
718 #endif /* INVOKE_SIGNAL */ | |
719 | |
720 return PEI_OK; | |
721 }/* dl_process_signal */ | |
722 | |
723 GLOBAL UBYTE * dl_get_sacch_buffer (void) | |
724 { | |
725 GET_INSTANCE_DATA; | |
726 return dl_data->sacch_act_buffer.buf; | |
727 } | |
728 | |
729 #endif /* DL_PEI_C */ |