comparison g23m-aci/aci/aci_em.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 :
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 defines the engineering mode (EM) device driver for the
18 | G23 protocol stack. This driver is used to control all engineering
19 | mode related functions.
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef ACI_EM_C
24 #define ACI_EM_C
25 #endif
26
27 #include "config.h"
28 #include "fixedconf.h"
29 #include "condat-features.h"
30 #include "aci_conf.h"
31
32 #include "aci_all.h"
33 /*===== INCLUDES ===================================================*/
34
35 #include "aci_cmh.h"
36
37 #ifdef UART
38 #include "dti.h"
39 #include "dti_conn_mng.h"
40 #endif
41
42 #ifdef _SIMULATION_
43 #ifdef UART
44 #include "psa_uart.h"
45 #endif
46 #endif
47
48 #include "ati_cmd.h"
49 #include "aci_mem.h"
50
51 #ifdef FF_ATI
52 #include "aci_io.h"
53 #endif
54
55 #include "aci.h"
56
57 #include "aci_em.h"
58
59 #ifdef GPRS
60 #include "gaci.h"
61 #include "gaci_cmh.h"
62 #include "psa.h"
63 #include "cmh.h"
64 #include "cmh_sm.h"
65 #endif
66
67
68 /*==== CONSTANTS ==================================================*/
69 /*==== PRIVAT =====================================================*/
70 /*==== EXPORT =====================================================*/
71
72 EXTERN UBYTE em_l1_sem_buffer [];
73 EXTERN UBYTE em_l1_sem_index;
74 EXTERN UBYTE em_dl_sem_buffer [];
75 EXTERN UBYTE em_dl_sem_index;
76 EXTERN UBYTE em_rr_sem_buffer [];
77 EXTERN UBYTE em_rr_sem_index;
78
79 EXTERN void em_l1_sem_read (void);
80 EXTERN void em_l1_sem_reset(void);
81 EXTERN void em_dl_sem_read (void);
82 EXTERN void em_dl_sem_reset(void);
83 EXTERN void em_rr_sem_read (void);
84 EXTERN UBYTE em_rr_sem_reset(void);
85
86 EXTERN UBYTE em_mm_event_buffer[EM_MM_BUFFER_SIZE];
87 EXTERN UBYTE em_mm_buffer_write;
88 EXTERN UBYTE em_cc_event_buffer[EM_CC_BUFFER_SIZE];
89 EXTERN UBYTE em_cc_buffer_write;
90 EXTERN UBYTE em_ss_event_buffer[EM_SS_BUFFER_SIZE];
91 EXTERN UBYTE em_ss_buffer_write;
92 EXTERN UBYTE em_sms_event_buffer[EM_SMS_BUFFER_SIZE];
93 EXTERN UBYTE em_sms_buffer_write;
94 EXTERN UBYTE em_sim_event_buffer[EM_SIM_BUFFER_SIZE];
95 EXTERN UBYTE em_sim_buffer_write;
96
97 EXTERN void em_aci_sem (UBYTE entity, UBYTE *buffer, UBYTE buf_index_tmp);
98
99 #ifndef WIN32
100 EXTERN const CHAR* l1_version(void);
101 EXTERN const CHAR* dl_version(void);
102 EXTERN const CHAR* rr_version(void);
103 EXTERN const CHAR* mm_version(void);
104 EXTERN const CHAR* cc_version(void);
105 EXTERN const CHAR* ss_version(void);
106 EXTERN const CHAR* sim_version(void);
107 EXTERN const CHAR* sms_version(void);
108 /*EXTERN const CHAR* aci_version(void);*/
109 #endif
110
111 /*==== VARIABLES ==================================================*/
112
113 /*
114 * callback for the single infrastructure and mobile data functions.
115 */
116 static drv_SignalCB_Type_EM em_para_signal_callback = NULL;
117 static drv_SignalCB_Type_EM em_para_signal_sc_callback = NULL;
118 static drv_SignalCB_Type_EM em_para_signal_sc_gprs_callback = NULL;
119 static drv_SignalCB_Type_EM em_para_signal_nc_callback = NULL;
120 static drv_SignalCB_Type_EM em_para_signal_loc_callback = NULL;
121 static drv_SignalCB_Type_EM em_para_signal_plmn_callback = NULL;
122 static drv_SignalCB_Type_EM em_para_signal_cip_callback = NULL;
123 static drv_SignalCB_Type_EM em_para_signal_pow_callback = NULL;
124 static drv_SignalCB_Type_EM em_para_signal_id_callback = NULL;
125 static drv_SignalCB_Type_EM em_para_signal_ver_callback = NULL;
126 static drv_SignalCB_Type_EM em_para_signal_gmm_callback = NULL;
127 static drv_SignalCB_Type_EM em_para_signal_grlc_callback = NULL;
128 static drv_SignalCB_Type_EM em_para_signal_amr_callback = NULL;
129 static drv_SignalCB_Type_EM em_para_signal_pdp_callback = NULL;
130
131 /*
132 * callback for the event trace function.
133 */
134 static drv_SignalCB_Type_EM_EVENT em_event_signal_callback = NULL;
135
136 /*
137 * These flags indicates if the first event for the corresponding entity occurred. It is only used to
138 * prevent unnecessary semaphor copying.
139 */
140 static UBYTE em_l1_trace;
141 static UBYTE em_dl_trace;
142 static UBYTE em_rr_trace;
143 static UBYTE em_mm_trace;
144 static UBYTE em_cc_trace;
145 static UBYTE em_ss_trace;
146 static UBYTE em_sms_trace;
147 static UBYTE em_sim_trace;
148
149 /*
150 * The buffer keeps all information about index and length of the single event trace data until it is
151 * passed to the originator of the em_Read_Event_Parameter() call.
152 */
153 static T_EM_EVENT_BUF aci_em_buf;
154
155 static UBYTE drv_enabled;
156
157 static UBYTE em_aci_buf_index;
158
159 GLOBAL USHORT em_relcs = 0;
160
161 /*==== FUNCTIONS ==================================================*/
162 LOCAL UBYTE em_class_infra_data (UBYTE em_subclass, UBYTE em_type);
163 LOCAL UBYTE em_class_mobile_data (UBYTE em_subclass, UBYTE em_type);
164 LOCAL UBYTE em_class_event_tracing (UBYTE em_subclass, ULONG bitmask_h, ULONG bitmask_l);
165
166 LOCAL UBYTE em_subclass_sc (UBYTE em_type);
167 LOCAL UBYTE em_subclass_sc_gprs (UBYTE em_type);
168 LOCAL UBYTE em_subclass_nc (UBYTE em_type);
169 LOCAL UBYTE em_subclass_loc_pag (UBYTE em_type);
170 LOCAL UBYTE em_subclass_plmn (UBYTE em_type);
171 LOCAL UBYTE em_subclass_ciph_hop_dtx (UBYTE em_type);
172 LOCAL UBYTE em_subclass_power (UBYTE em_type);
173 LOCAL UBYTE em_subclass_id (UBYTE em_type);
174 LOCAL UBYTE em_subclass_version (UBYTE em_type);
175 LOCAL UBYTE em_subclass_gmm (UBYTE em_type);
176 LOCAL UBYTE em_subclass_grlc (UBYTE em_type);
177 LOCAL UBYTE em_subclass_amr (UBYTE em_type);
178 #ifdef GPRS
179 LOCAL UBYTE em_subclass_pdp (UBYTE em_type);
180 LOCAL void em_pco_pdp_trace_req (void );
181 #endif
182
183 LOCAL UBYTE em_event_l1 (USHORT bitmask_h, ULONG bitmask_l);
184 LOCAL UBYTE em_event_dl (USHORT bitmask_h);
185 LOCAL UBYTE em_event_rr (USHORT bitmask_h, ULONG bitmask_l);
186 LOCAL UBYTE em_event_mm (ULONG bitmask_h);
187 LOCAL UBYTE em_event_cc (ULONG bitmask_h, ULONG bitmask_l);
188 LOCAL UBYTE em_event_ss (USHORT bitmask_h);
189 LOCAL UBYTE em_event_sms (ULONG bitmask_h, ULONG bitmask_l);
190 LOCAL UBYTE em_event_sim (ULONG bitmask);
191
192 LOCAL void em_sw_ver_info_cnf (T_EM_SW_VER *version);
193
194
195 /*==== FUNCTIONS ==================================================*/
196
197 /*
198 +------------------------------------------------------------------------------
199 | Function : em_Init
200 +------------------------------------------------------------------------------
201 | Description : The function initializes the driverīs internal data. The
202 | function returns DRV_OK in case of a successful completition.
203 | The function returns DRV_INITIALIZED if the driver has already
204 | been initialized and is ready to be used or is already in use.
205 | In case of an initialization failure, which means that the
206 | driver cannot be used, the function returns DRV_INITFAILURE.
207 | This function handles unsupported primitives.
208 |
209 | Parameters : Callback function
210 |
211 | Return : UBYTE
212 +------------------------------------------------------------------------------
213 */
214
215 GLOBAL UBYTE em_Init (drv_SignalCB_Type_EM in_SignalCBPtr, drv_SignalCB_Type_EM_EVENT in_SignalEventCBPtr)
216 {
217 TRACE_FUNCTION("em_Init ()");
218
219 em_para_signal_callback = in_SignalCBPtr; /* store call-back function - Data */
220 em_event_signal_callback = in_SignalEventCBPtr; /* store call-back function - Event */
221
222 em_relcs = 0;
223
224 if (drv_enabled EQ FALSE) { /* EM not initialized yet */
225 drv_enabled = TRUE;
226 return DRV_OK;
227 }
228 else {
229 return DRV_INITIALIZED;
230 }
231 }
232
233 /*
234 +------------------------------------------------------------------------------
235 | Function : em_Exit
236 +------------------------------------------------------------------------------
237 | Description : The function is used to indicate that the driver and its
238 | functionality isnīt needed anymore.
239 |
240 | Parameters : void
241 |
242 | Return : void
243 +------------------------------------------------------------------------------
244 */
245
246 GLOBAL void em_Exit (void)
247 {
248 TRACE_FUNCTION("em_Exit ()");
249
250 em_para_signal_callback = NULL;
251 }
252
253 /*
254 +------------------------------------------------------------------------------
255 | Function : em_Read_Data_Parameter
256 +------------------------------------------------------------------------------
257 | Description : The function is used to indicate that the driver and its
258 | functionality isnīt needed anymore.
259 |
260 | Parameters : UBYTE em_class
261 | UBYTE em_subclass
262 | UBYTE em_type
263 | void (*cbfunc)(T_DRV_SIGNAL_EM * Signal)
264 |
265 | Return : UBYTE
266 +------------------------------------------------------------------------------
267 */
268
269 GLOBAL UBYTE em_Read_Data_Parameter (UBYTE em_class, UBYTE em_subclass, UBYTE em_type,
270 void (*cbfunc)(T_DRV_SIGNAL_EM * Signal))
271 {
272 TRACE_FUNCTION("em_Read_Data_Parameter ()");
273
274 /*
275 Used to store the callback-address for the different sub-functions. If the same infrastructure data is
276 requested a second time before the first one is served only the latest one is handled.
277 */
278 switch (em_subclass)
279 {
280 case EM_SUBCLASS_SC:
281 em_para_signal_sc_callback = cbfunc;
282 break;
283 case EM_SUBCLASS_SC_GPRS:
284 em_para_signal_sc_gprs_callback = cbfunc;
285 break;
286 case EM_SUBCLASS_NC:
287 em_para_signal_nc_callback = cbfunc;
288 break;
289 case EM_SUBCLASS_LOC_PAG:
290 em_para_signal_loc_callback = cbfunc;
291 break;
292 case EM_SUBCLASS_PLMN:
293 em_para_signal_plmn_callback = cbfunc;
294 break;
295 case EM_SUBCLASS_CIPH_HOP_DTX:
296 em_para_signal_cip_callback = cbfunc;
297 break;
298 case EM_SUBCLASS_POWER:
299 em_para_signal_pow_callback = cbfunc;
300 break;
301 case EM_SUBCLASS_ID:
302 em_para_signal_id_callback = cbfunc;
303 break;
304 case EM_SUBCLASS_SW_VERSION:
305 em_para_signal_ver_callback = cbfunc;
306 break;
307 case EM_SUBCLASS_GMM:
308 em_para_signal_gmm_callback = cbfunc;
309 break;
310 case EM_SUBCLASS_GRLC:
311 em_para_signal_grlc_callback = cbfunc;
312 break;
313 case EM_SUBCLASS_AMR:
314 em_para_signal_amr_callback = cbfunc;
315 break;
316 case EM_SUBCLASS_PDP:
317 em_para_signal_pdp_callback = cbfunc;
318 break;
319 default:
320 em_para_signal_callback = NULL;
321 break;
322 }
323
324 switch (em_class)
325 {
326 case EM_CLASS_INFRA_DATA:
327 return(em_class_infra_data(em_subclass, em_type));
328 case EM_CLASS_MOBILE_DATA:
329 return(em_class_mobile_data(em_subclass, em_type));
330 default:
331 return EM_INVALID_CLASS;
332 }
333 }
334
335 /*
336 +------------------------------------------------------------------------------
337 | Function : em_Read_Event_Parameter
338 +------------------------------------------------------------------------------
339 | Description : The function is used to indicate that the driver and its
340 | functionality isnīt needed anymore.
341 |
342 | Parameters : UBYTE entity
343 | (*cbfunc)(T_DRV_SIGNAL_EM_EVENT * Signal)
344 |
345 | Return : UBYTE
346 +------------------------------------------------------------------------------
347 */
348
349 GLOBAL UBYTE em_Read_Event_Parameter (UBYTE entity, void (*cbfunc)(T_DRV_SIGNAL_EM_EVENT * Signal))
350 {
351 T_DRV_SIGNAL_EM_EVENT signal_params;
352
353 UBYTE emet1=0,emet2=0,emet3=0,emet4=0,emet5=0,emet6=0,emet7=0,emet8=0;
354 UBYTE *event_buf;
355 USHORT length_event_buf;
356 UBYTE alr_tmp, dl_tmp, rr_tmp, mm_tmp, cc_tmp, ss_tmp, sms_tmp, sim_tmp;
357
358 TRACE_FUNCTION("em_Read_Event_Parameter ()");
359
360 /*
361 * Used to store the callback-address for the different sub-functions. If the same event trace is
362 * requested a second time before the first one is served only the latest one is handled.
363 */
364 em_event_signal_callback = cbfunc;
365
366 em_aci_buf_index = 0;
367
368 /*
369 * length_event_buf indicates the length of all event traces and is used for dynamic
370 * memory allocation. The single values are from the correspondent entities and therefor
371 * defined as global. To ensure that no buffer overflow happens, the actual index is stored
372 * in a temp variable - a new event could occure after the memory is allocated.
373 */
374 length_event_buf = (alr_tmp=em_l1_sem_index) + (dl_tmp=em_dl_sem_index) + (rr_tmp=em_rr_sem_index) +
375 (mm_tmp=em_mm_buffer_write) + (cc_tmp=em_cc_buffer_write) + (ss_tmp=em_ss_buffer_write) +
376 (sms_tmp=em_sms_buffer_write) + (sim_tmp=em_sim_buffer_write);
377
378 #ifdef WIN32
379 length_event_buf = 100;
380 #endif /* WIN32 */
381
382 memset(&aci_em_buf, 0, sizeof(T_EM_EVENT_BUF));
383
384 ACI_MALLOC(event_buf, length_event_buf);
385
386 /*
387 * This checks if the entity is set in the bitmask and at least one event
388 * occurred in the corresponding entity. The event flag (em_xx_trace) protects
389 * unnecessary buffer operations.
390 */
391 emet1 = ( (((entity & 0x0001) > 0) ? TRUE : FALSE) AND em_l1_trace ) ; /* L1 */
392 emet2 = ( (((entity & 0x0002) > 0) ? TRUE : FALSE) AND em_dl_trace ) ; /* DL */
393 emet3 = ( (((entity & 0x0004) > 0) ? TRUE : FALSE) AND em_rr_trace ) ; /* RR */
394 emet4 = ( (((entity & 0x0008) > 0) ? TRUE : FALSE) AND em_mm_trace ) ; /* MM */
395 emet5 = ( (((entity & 0x0010) > 0) ? TRUE : FALSE) AND em_cc_trace ) ; /* CC */
396 emet6 = ( (((entity & 0x0020) > 0) ? TRUE : FALSE) AND em_ss_trace ) ; /* SS */
397 emet7 = ( (((entity & 0x0040) > 0) ? TRUE : FALSE) AND em_sms_trace ); /* SMS */
398 emet8 = ( (((entity & 0x0080) > 0) ? TRUE : FALSE) AND em_sim_trace ); /* SIM */
399
400 if(emet1)
401 {
402 em_aci_sem(EM_L1, event_buf, alr_tmp);
403 em_l1_trace = FALSE;
404 }
405 if(emet2)
406 {
407 em_aci_sem(EM_DL, event_buf, dl_tmp);
408 em_dl_trace = FALSE;
409 }
410 if(emet3)
411 {
412 em_aci_sem(EM_RR, event_buf, rr_tmp);
413 em_rr_trace = FALSE;
414 }
415 if(emet4)
416 {
417 em_aci_sem(EM_MM, event_buf, mm_tmp);
418 em_mm_trace = FALSE;
419 }
420 if(emet5)
421 {
422 em_aci_sem(EM_CC, event_buf, cc_tmp);
423 em_cc_trace = FALSE;
424 }
425 if(emet6)
426 {
427 em_aci_sem(EM_SS, event_buf, ss_tmp);
428 em_ss_trace = FALSE;
429 }
430 if(emet7)
431 {
432 em_aci_sem(EM_SMS, event_buf, sms_tmp);
433 em_sms_trace = FALSE;
434 }
435 if(emet8)
436 {
437 em_aci_sem(EM_SIM, event_buf, sim_tmp);
438 em_sim_trace = FALSE;
439 }
440
441 memcpy(&signal_params.Data, &aci_em_buf, sizeof(T_EM_EVENT_BUF));
442 signal_params.DataLength = length_event_buf;
443 signal_params.Pointer = event_buf;
444
445 if (em_event_signal_callback NEQ NULL) {
446 (*em_event_signal_callback)(&signal_params);
447 }
448
449 ACI_MFREE(event_buf);
450
451 return TRUE;
452 }
453
454 /*
455 +------------------------------------------------------------------------------
456 | Function : em_Set_EventTrace
457 +------------------------------------------------------------------------------
458 | Description : Set the event flags and the callback function for the subclass
459 |
460 | Parameters : subclass - defines the subclass the data is coming from
461 | bitmask_h - bitmask
462 | bitmask_l - bitmask
463 |
464 | Return : UBYTE
465 +------------------------------------------------------------------------------
466 */
467 GLOBAL UBYTE em_Set_EventTrace (UBYTE em_subclass, ULONG bitmask_h, ULONG bitmask_l)
468 {
469 TRACE_FUNCTION("em_Set_EventTrace ()");
470
471 return(em_class_event_tracing(em_subclass, bitmask_h, bitmask_l));
472 }
473
474
475 /*
476 +------------------------------------------------------------------------------
477 | Function : em_Received_Data
478 +------------------------------------------------------------------------------
479 | Description : Compose the callback function
480 |
481 | Parameters : data - requested data
482 subclass - defines the subclass the data is coming from
483 |
484 | Return : void
485 +------------------------------------------------------------------------------
486 */
487 GLOBAL void em_Received_Data (void *data, UBYTE subclass)
488 {
489 /*lint -e813*//* info about auto variable size of drv_SignalID_Type_EM*/
490 drv_SignalID_Type_EM signal_params;
491
492 TRACE_FUNCTION("em_Received_Data ()");
493
494 signal_params.SignalType = subclass;
495
496 switch (subclass) {
497 case EM_SUBCLASS_SC: {
498 memcpy(&signal_params.UserData.sc, data, sizeof (T_EM_SC_INFO_CNF));
499 signal_params.DataLength = (sizeof (signal_params.UserData.sc) + 6);
500 em_para_signal_callback = em_para_signal_sc_callback;
501 break; }
502 case EM_SUBCLASS_SC_GPRS: {
503 memcpy(&signal_params.UserData.sc_gprs, data, sizeof (T_EM_SC_GPRS_INFO_CNF));
504 signal_params.DataLength = (sizeof (signal_params.UserData.sc_gprs) + 6);
505 em_para_signal_callback = em_para_signal_sc_gprs_callback;
506 break; }
507 case EM_SUBCLASS_NC: {
508 memcpy(&signal_params.UserData.nc, data, sizeof (T_EM_NC_INFO_CNF));
509 signal_params.DataLength = (sizeof (signal_params.UserData.nc) + 6);
510 em_para_signal_callback = em_para_signal_nc_callback;
511 break; }
512 case EM_SUBCLASS_LOC_PAG: {
513 memcpy(&signal_params.UserData.log_pag, data, sizeof (T_EM_LOC_PAG_INFO_CNF));
514 signal_params.DataLength = (sizeof (signal_params.UserData.log_pag) + 6);
515 em_para_signal_callback = em_para_signal_loc_callback;
516 break; }
517 case EM_SUBCLASS_PLMN: {
518 memcpy(&signal_params.UserData.plmn, data, sizeof (T_EM_PLMN_INFO_CNF));
519 signal_params.UserData.plmn.rel_cause = em_relcs;
520 signal_params.DataLength = (sizeof (signal_params.UserData.plmn) + 6);
521 em_para_signal_callback = em_para_signal_plmn_callback;
522 break; }
523 case EM_SUBCLASS_CIPH_HOP_DTX: {
524 memcpy(&signal_params.UserData.cip, data, sizeof (T_EM_CIP_HOP_DTX_INFO_CNF));
525 signal_params.DataLength = (sizeof (signal_params.UserData.cip) + 6);
526 em_para_signal_callback = em_para_signal_cip_callback;
527 break; }
528 case EM_SUBCLASS_POWER: {
529 memcpy(&signal_params.UserData.power, data, sizeof (T_EM_POWER_INFO_CNF));
530 signal_params.DataLength = (sizeof (signal_params.UserData.power) + 6);
531 em_para_signal_callback = em_para_signal_pow_callback;
532 break; }
533 case EM_SUBCLASS_ID: {
534 memcpy(&signal_params.UserData.id, data, sizeof (T_EM_IDENTITY_INFO_CNF));
535 signal_params.DataLength = (sizeof (signal_params.UserData.id) + 6);
536 em_para_signal_callback = em_para_signal_id_callback;
537 break; }
538 case EM_SUBCLASS_SW_VERSION: {
539 em_sw_ver_info_cnf(&signal_params.UserData.version);
540 signal_params.DataLength = (sizeof (signal_params.UserData.version) + 6);
541 em_para_signal_callback = em_para_signal_ver_callback;
542 break; }
543 case EM_SUBCLASS_GMM: {
544 memcpy(&signal_params.UserData.gmm, data, sizeof (T_EM_GMM_INFO_CNF));
545 signal_params.DataLength = (sizeof (signal_params.UserData.gmm) + 6);
546 em_para_signal_callback = em_para_signal_gmm_callback;
547 break; }
548 case EM_SUBCLASS_GRLC: {
549 memcpy(&signal_params.UserData.grlc, data, sizeof (T_EM_GRLC_INFO_CNF));
550 signal_params.DataLength = (sizeof (signal_params.UserData.grlc) + 6);
551 em_para_signal_callback = em_para_signal_grlc_callback;
552 break; }
553 case EM_SUBCLASS_AMR: {
554 memcpy(&signal_params.UserData.amr, data, sizeof (T_EM_AMR_INFO_CNF));
555 signal_params.DataLength = (sizeof (signal_params.UserData.amr) + 6);
556 em_para_signal_callback = em_para_signal_amr_callback;
557 break; }
558 case EM_SUBCLASS_PDP: {
559 em_para_signal_callback = em_para_signal_pdp_callback;
560 break; }
561 default: {
562 signal_params.UserData.defaulT = 0xff;
563 signal_params.DataLength = (sizeof (signal_params.UserData.defaulT) + 6);
564 em_para_signal_callback = NULL;
565 break; }
566 }
567 if (em_para_signal_callback NEQ NULL) {
568 (*em_para_signal_callback)(&signal_params);
569 }
570
571 if(data NEQ NULL)
572 PFREE(data);
573 }
574
575 LOCAL void em_sw_ver_info_cnf (T_EM_SW_VER *version)
576 {
577 TRACE_FUNCTION ("em_sw_ver_info_cnf()");
578
579 memset (version, 0, sizeof (T_EM_SW_VER));
580
581 #ifndef WIN32
582 /* The respective functions are auto-generated by the target build only */
583
584 /* Copy the static const strings into the structure */
585 strncpy (version->alr, l1_version(), MAX_VER-1);
586 strncpy (version->dl, dl_version(), MAX_VER-1);
587 strncpy (version->rr, rr_version(), MAX_VER-1);
588 strncpy (version->mm, mm_version(), MAX_VER-1);
589 strncpy (version->cc, cc_version(), MAX_VER-1);
590 strncpy (version->ss, ss_version(), MAX_VER-1);
591 strncpy (version->sms, sms_version(), MAX_VER-1);
592 strncpy (version->sim, sim_version(), MAX_VER-1);
593 #endif
594 }
595
596 /*
597 +------------------------------------------------------------------------------
598 | Function : em_class_infra_data
599 +------------------------------------------------------------------------------
600 | Description : This function calls the appropriate subfunction for the
601 | requested data (infrastructure data).
602 |
603 | Parameters : em_subclass - defines the subclass the data is requested from
604 | em_type - defines the actual data
605 |
606 | Return : UBYTE
607 +------------------------------------------------------------------------------
608 */
609
610 LOCAL UBYTE em_class_infra_data (UBYTE em_subclass, UBYTE em_type)
611 {
612 TRACE_FUNCTION("em_class_infra_data ()");
613
614 switch (em_subclass)
615 {
616 case EM_SUBCLASS_SC:
617 return (em_subclass_sc(em_type));
618 case EM_SUBCLASS_SC_GPRS:
619 #ifdef GPRS
620 return (em_subclass_sc_gprs(em_type));
621 #else
622 return EM_INVALID_SUBCLASS;
623 #endif /* GPRS */
624 case EM_SUBCLASS_NC:
625 return (em_subclass_nc(em_type));
626 case EM_SUBCLASS_LOC_PAG:
627 return (em_subclass_loc_pag(em_type));
628 case EM_SUBCLASS_PLMN:
629 return (em_subclass_plmn(em_type));
630 case EM_SUBCLASS_CIPH_HOP_DTX:
631 return (em_subclass_ciph_hop_dtx(em_type));
632 case EM_SUBCLASS_GMM:
633 #ifdef GPRS
634 return (em_subclass_gmm(em_type));
635 #else /* GPRS */
636 return EM_INVALID_SUBCLASS;
637 #endif /* GPRS */
638 case EM_SUBCLASS_GRLC:
639 #ifdef GPRS
640 return (em_subclass_grlc(em_type));
641 #else /* GPRS */
642 return EM_INVALID_SUBCLASS;
643 #endif /* GPRS */
644 case EM_SUBCLASS_AMR:
645 return (em_subclass_amr(em_type));
646 case EM_SUBCLASS_PDP:
647 #ifdef GPRS
648 return (em_subclass_pdp(em_type));
649 #else
650 return EM_INVALID_SUBCLASS;
651 #endif
652 default:
653 return EM_INVALID_SUBCLASS;
654 }
655 }
656
657 /*
658 +------------------------------------------------------------------------------
659 | Function : em_class_mobile_data
660 +------------------------------------------------------------------------------
661 | Description : This function calls the appropriate subfunction for the
662 | requested data (mobile data).
663 |
664 | Parameters : em_subclass - defines the subclass the data is requested from
665 | em_type - defines the actual data
666 |
667 | Return : UBYTE
668 +------------------------------------------------------------------------------
669 */
670
671 LOCAL UBYTE em_class_mobile_data (UBYTE em_subclass, UBYTE em_type)
672 {
673 TRACE_FUNCTION("em_class_mobile_data ()");
674
675 switch (em_subclass)
676 {
677 case EM_SUBCLASS_POWER:
678 return (em_subclass_power(em_type));
679 case EM_SUBCLASS_ID:
680 return (em_subclass_id(em_type));
681 case EM_SUBCLASS_SW_VERSION:
682 return (em_subclass_version(em_type)); /* not implemented yet */
683 default:
684 return EM_INVALID_SUBCLASS;
685 }
686 }
687
688
689 /*
690 +------------------------------------------------------------------------------
691 | Function : em_class_event_tracing
692 +------------------------------------------------------------------------------
693 | Description : This function calls the appropriate subfunction for the
694 | requested data (event trace).
695 |
696 | Parameters : em_subclass - defines the event subclass
697 | bitmask - defines the single events
698 |
699 | Return : UBYTE
700 +------------------------------------------------------------------------------
701 */
702
703 LOCAL UBYTE em_class_event_tracing (UBYTE em_subclass, ULONG bitmask_h, ULONG bitmask_l)
704 {
705 TRACE_FUNCTION("em_class_event_tracing ()");
706
707 switch (em_subclass)
708 {
709 case EM_SUBCLASS_LAYER_1:
710 return em_event_l1((USHORT)bitmask_h, bitmask_l);
711 case EM_SUBCLASS_DL:
712 return em_event_dl((USHORT)bitmask_l);
713 case EM_SUBCLASS_RR:
714 return em_event_rr((USHORT)bitmask_h, bitmask_l);
715 case EM_SUBCLASS_MM:
716 return em_event_mm(bitmask_l);
717 case EM_SUBCLASS_CC:
718 return em_event_cc(bitmask_h, bitmask_l);
719 case EM_SUBCLASS_SS:
720 return em_event_ss((USHORT)bitmask_l);
721 case EM_SUBCLASS_SMS:
722 return em_event_sms(bitmask_h, bitmask_l);
723 case EM_SUBCLASS_SIM:
724 return em_event_sim(bitmask_l);
725 default:
726 return EM_INVALID_SUBCLASS;
727 }
728 }
729
730 /*
731 +------------------------------------------------------------------------------
732 | Function : em_subclass_sc
733 +------------------------------------------------------------------------------
734 | Description : This function send the appropriate primitive to the involved
735 | entity.
736 |
737 | Parameters : em_type - defines the actual data
738 |
739 | Return : UBYTE
740 +------------------------------------------------------------------------------
741 */
742
743 LOCAL UBYTE em_subclass_sc (UBYTE em_type)
744 {
745 TRACE_FUNCTION ("em_subclass_sc()");
746
747 /*
748 *-------------------------------------------------------------------
749 * create and send primitive
750 *-------------------------------------------------------------------
751 */
752 {
753 PALLOC(em_sc_info_req, EM_SC_INFO_REQ); /* T_EM_SC_INFO_REQ */
754
755 /* fill in primitive parameter: */
756 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
757 em_sc_info_req->data = em_type;
758
759 /* the primitive is send to RR via MM */
760 PSENDX (RR, em_sc_info_req);
761 }
762 return TRUE;
763 }
764
765 /*
766 +------------------------------------------------------------------------------
767 | Function : em_subclass_sc_gprs
768 +------------------------------------------------------------------------------
769 | Description : This function send the appropriate primitive to the involved
770 | entity.
771 |
772 | Parameters : em_type - defines the actual data
773 |
774 | Return : UBYTE
775 +------------------------------------------------------------------------------
776 */
777
778 #ifdef GPRS
779 LOCAL UBYTE em_subclass_sc_gprs (UBYTE em_type)
780 {
781 TRACE_FUNCTION ("em_subclass_sc_gprs()");
782
783 /*
784 *-------------------------------------------------------------------
785 * create and send primitive
786 *-------------------------------------------------------------------
787 */
788 {
789 PALLOC(em_sc_gprs_info_req, EM_SC_GPRS_INFO_REQ); /* T_EM_SC_GPRS_INFO_REQ */
790
791 /* fill in primitive parameter: */
792 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
793 em_sc_gprs_info_req->data = em_type;
794
795 /* the primitive is send to GRR via GMM */
796 PSEND (hCommGMM, em_sc_gprs_info_req);
797 }
798 return TRUE;
799 }
800 #endif /* GPRS */
801
802 /*
803 +------------------------------------------------------------------------------
804 | Function : em_subclass_nc
805 +------------------------------------------------------------------------------
806 | Description : This function send the appropriate primitive to the involved
807 | entity.
808 |
809 | Parameters : em_type - defines the actual data
810 |
811 | Return : UBYTE
812 +------------------------------------------------------------------------------
813 */
814
815 LOCAL UBYTE em_subclass_nc (UBYTE em_type)
816 {
817 TRACE_FUNCTION ("em_subclass_nc()");
818
819 /*
820 *-------------------------------------------------------------------
821 * create and send primitive
822 *-------------------------------------------------------------------
823 */
824 {
825 PALLOC(em_nc_info_req, EM_NC_INFO_REQ); /* T_EM_NC_INFO_REQ */
826
827 /* fill in primitive parameter: */
828 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
829 em_nc_info_req->data = em_type;
830
831 /* the primitive is send to RR via MM */
832 PSENDX (RR, em_nc_info_req);
833 }
834 return TRUE;
835 }
836
837 /*
838 +------------------------------------------------------------------------------
839 | Function : em_subclass_loc_pag
840 +------------------------------------------------------------------------------
841 | Description : This function send the appropriate primitive to the involved
842 | entity.
843 |
844 | Parameters : em_type - defines the actual data
845 |
846 | Return : UBYTE
847 +------------------------------------------------------------------------------
848 */
849
850 LOCAL UBYTE em_subclass_loc_pag (UBYTE em_type)
851 {
852 TRACE_FUNCTION ("em_subclass_loc_pag()");
853
854 /*
855 *-------------------------------------------------------------------
856 * create and send primitive
857 *-------------------------------------------------------------------
858 */
859 {
860 PALLOC(em_loc_pag_info_req, EM_LOC_PAG_INFO_REQ); /* T_EM_LOC_PAG_INFO_REQ */
861
862 /* fill in primitive parameter: */
863 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
864 em_loc_pag_info_req->data = em_type;
865
866 /* the primitive is send to RR via MM */
867 PSENDX (RR, em_loc_pag_info_req);
868 }
869 return TRUE;
870 }
871
872 /*
873 +------------------------------------------------------------------------------
874 | Function : em_subclass_plmn
875 +------------------------------------------------------------------------------
876 | Description : This function send the appropriate primitive to the involved
877 | entity.
878 |
879 | Parameters : em_type - defines the actual data
880 |
881 | Return : UBYTE
882 +------------------------------------------------------------------------------
883 */
884
885 LOCAL UBYTE em_subclass_plmn (UBYTE em_type)
886 {
887 TRACE_FUNCTION ("em_subclass_plmn()");
888
889 /*
890 *-------------------------------------------------------------------
891 * create and send primitive
892 *-------------------------------------------------------------------
893 */
894 {
895 PALLOC(em_plmn_info_req, EM_PLMN_INFO_REQ); /* T_EM_PLMN_INFO_REQ */
896
897 /* fill in primitive parameter: */
898 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
899 em_plmn_info_req->data = em_type;
900
901 /* the primitive is send to RR via MM */
902 PSENDX (RR, em_plmn_info_req);
903 }
904 return TRUE;
905 }
906
907 /*
908 +------------------------------------------------------------------------------
909 | Function : em_subclass_ciph_hop_dtx
910 +------------------------------------------------------------------------------
911 | Description : This function send the appropriate primitive to the involved
912 | entity.
913 |
914 | Parameters : em_type - defines the actual data
915 |
916 | Return : UBYTE
917 +------------------------------------------------------------------------------
918 */
919
920 LOCAL UBYTE em_subclass_ciph_hop_dtx (UBYTE em_type)
921 {
922 TRACE_FUNCTION ("em_subclass_ciph_hop_dtx()");
923
924 /*
925 *-------------------------------------------------------------------
926 * create and send primitive
927 *-------------------------------------------------------------------
928 */
929 {
930 PALLOC(em_cip_hop_dtx_info_req, EM_CIP_HOP_DTX_INFO_REQ); /* T_EM_CIP_HOP_DTX_INFO_REQ */
931
932 /* fill in primitive parameter: */
933 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
934 em_cip_hop_dtx_info_req->data = em_type;
935
936 /* the primitive is send to RR via MM */
937 PSENDX (RR, em_cip_hop_dtx_info_req);
938 }
939 return TRUE;
940 }
941
942 /*
943 +------------------------------------------------------------------------------
944 | Function : em_subclass_power
945 +------------------------------------------------------------------------------
946 | Description : This function send the appropriate primitive to the involved
947 | entity.
948 |
949 | Parameters : em_type - defines the actual data
950 |
951 | Return : UBYTE
952 +------------------------------------------------------------------------------
953 */
954
955 LOCAL UBYTE em_subclass_power (UBYTE em_type)
956 {
957 TRACE_FUNCTION ("em_subclass_power()");
958
959 /*
960 *-------------------------------------------------------------------
961 * create and send primitive
962 *-------------------------------------------------------------------
963 */
964 {
965 PALLOC(em_power_info_req, EM_POWER_INFO_REQ); /* T_EM_POWER_INFO_REQ */
966
967 /* fill in primitive parameter: */
968 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
969 em_power_info_req->data = em_type;
970
971 /* the primitive is send to RR via MM */
972 PSENDX (RR, em_power_info_req);
973 }
974 return TRUE;
975 }
976
977 /*
978 +------------------------------------------------------------------------------
979 | Function : em_subclass_id
980 +------------------------------------------------------------------------------
981 | Description : This function send the appropriate primitive to the involved
982 | entity.
983 |
984 | Parameters : em_type - defines the actual data
985 |
986 | Return : UBYTE
987 +------------------------------------------------------------------------------
988 */
989
990 LOCAL UBYTE em_subclass_id (UBYTE em_type)
991 {
992 TRACE_FUNCTION ("em_subclass_id()");
993
994 /*
995 *-------------------------------------------------------------------
996 * create and send primitive
997 *-------------------------------------------------------------------
998 */
999 {
1000 PALLOC(em_identity_info_req, EM_IDENTITY_INFO_REQ); /* T_EM_IDENTITY_INFO_REQ */
1001
1002 /* fill in primitive parameter: */
1003 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
1004 em_identity_info_req->data = em_type;
1005
1006 /* the primitive is send to RR via MM */
1007 PSENDX (RR, em_identity_info_req);
1008 }
1009 return TRUE;
1010 }
1011
1012 /*
1013 +------------------------------------------------------------------------------
1014 | Function : em_subclass_version
1015 +------------------------------------------------------------------------------
1016 | Description : This function send the appropriate primitive to the involved
1017 | entity.
1018 |
1019 | Parameters : em_type - defines the actual data
1020 |
1021 | Return : UBYTE
1022 +------------------------------------------------------------------------------
1023 */
1024
1025 LOCAL UBYTE em_subclass_version (UBYTE em_type)
1026 {
1027 TRACE_FUNCTION ("em_subclass_version()");
1028
1029 /*
1030 *-------------------------------------------------------------------
1031 * create and send primitive
1032 *-------------------------------------------------------------------
1033 */
1034 {
1035 PALLOC(em_sw_version_info_req, EM_SW_VERSION_INFO_REQ); /* T_EM_SW_VERSION_INFO_REQ */
1036
1037 /* fill in primitive parameter: */
1038 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
1039 em_sw_version_info_req->data = em_type;
1040
1041 /* the primitive is send to RR via MM */
1042 PSENDX (RR, em_sw_version_info_req);
1043 }
1044 return TRUE;
1045 }
1046
1047 /*
1048 +------------------------------------------------------------------------------
1049 | Function : em_subclass_pco_bitmap
1050 +------------------------------------------------------------------------------
1051 | Description : This function send the appropriate primitive to the involved
1052 | entity.
1053 |
1054 | Parameters : em_pco_bitmap - defines the actual requested data
1055 |
1056 | Return : UBYTE
1057 +------------------------------------------------------------------------------
1058 */
1059
1060 UBYTE em_subclass_pco_bitmap (U32 em_pco_bitmap)
1061 {
1062 TRACE_FUNCTION ("em_subclass_pco_bitmap()");
1063
1064 /*
1065 *-------------------------------------------------------------------
1066 * create and send primitive
1067 *-------------------------------------------------------------------
1068 */
1069
1070 #ifdef GPRS
1071 /*check for requested GMM, GRLC, GRR info*/
1072 if(em_pco_bitmap & (EM_PCO_GPRS_INFO | EM_PCO_GMM_INFO | EM_PCO_GRLC_INFO))
1073 {
1074 PALLOC(em_pco_trace_req, EM_PCO_TRACE_REQ); /* T_EM_PCO_TRACE_REQ */
1075
1076 em_pco_trace_req->pco_bitmap = em_pco_bitmap;
1077
1078 /* the primitive is send to GMM*/
1079 PSENDX(GMM, em_pco_trace_req);
1080 }
1081 #endif /*GPRS*/
1082
1083 /*check for requested RR info*/
1084 if(em_pco_bitmap & (EM_PCO_SC_INFO | EM_PCO_NC_INFO | EM_PCO_LOC_PAG_INFO | EM_PCO_IDENTITY_INFO |
1085 EM_PCO_CIPH_HOP_DTX_INFO | EM_PCO_POWER_INFO | EM_PCO_PLMN_INFO | EM_PCO_SW_VERSION_INFO |
1086 EM_PCO_AMR_INFO))
1087 {
1088 PALLOC(em_pco_trace_req, EM_PCO_TRACE_REQ); /* T_EM_PCO_TRACE_REQ */
1089
1090 em_pco_trace_req->pco_bitmap = em_pco_bitmap;
1091
1092 /* the primitive is send to RR*/
1093 PSENDX(RR, em_pco_trace_req);
1094 }
1095
1096 #ifdef GPRS
1097 if(em_pco_bitmap & EM_PCO_PDP_INFO)
1098 {
1099 em_pco_pdp_trace_req();
1100 }
1101 #endif
1102 return TRUE;
1103 }/*em_subclass_pco_bitmap*/
1104
1105 /*
1106 +------------------------------------------------------------------------------
1107 | Function : em_pco_pdp_trace_req
1108 +------------------------------------------------------------------------------
1109 | Description : This function prints PDP configuration on PCO
1110 |
1111 | Parameters : void
1112 |
1113 | Return : void
1114 +------------------------------------------------------------------------------
1115 */
1116 #ifdef GPRS
1117 LOCAL void em_pco_pdp_trace_req(void)
1118 {
1119 UBYTE cid;
1120 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL;
1121
1122
1123 TRACE_FUNCTION ("em_pco_pdp_trace_req()");
1124
1125 TRACE_EVENT_EM_P1("EM_PDP_INFO_REQ: num_ctxts : %d",PDP_CONTEXT_CID_MAX);
1126
1127 for(cid=1;cid<=PDP_CONTEXT_CID_MAX;cid++)
1128 {
1129
1130 p_pdp_context_node = pdp_context_find_node_from_cid( cid );
1131
1132 if( p_pdp_context_node->internal_data.state EQ PDP_CONTEXT_STATE_INVALID )
1133 {
1134 TRACE_EVENT_EM_P1("EM_PDP_INFO_REQ: state : %d",p_pdp_context_node->internal_data.state);
1135 }
1136 else
1137 {
1138 if ( p_pdp_context_node->attributes.pdp_addr.ctrl_ip_address EQ NAS_is_ipv4 )
1139 {
1140 TRACE_EVENT_EM_P4("EM_PDP_INFO_REQ: state:%d,pdp_type:%s,apn:%s,pdp address:%s",
1141 p_pdp_context_node->internal_data.state,
1142 p_pdp_context_node->attributes.pdp_type,
1143 p_pdp_context_node->attributes.pdp_apn,
1144 (( p_pdp_context_node->internal_data.state EQ PDP_CONTEXT_STATE_ACTIVATED ) OR
1145 ( p_pdp_context_node->internal_data.state EQ PDP_CONTEXT_STATE_DATA_LINK ))
1146 ? p_pdp_context_node->internal_data.pdp_address_allocated.ip_address.ipv4_addr.a4 :
1147 p_pdp_context_node->attributes.pdp_addr.ip_address.ipv4_addr.a4);
1148 }
1149 else if ( p_pdp_context_node->attributes.pdp_addr.ctrl_ip_address EQ NAS_is_ipv6 )
1150 {
1151 TRACE_EVENT_EM_P4("EM_PDP_INFO_REQ: state:%d,pdp_type:%s,apn:%s,pdp address:%s",
1152 p_pdp_context_node->internal_data.state,
1153 p_pdp_context_node->attributes.pdp_type,
1154 p_pdp_context_node->attributes.pdp_apn,
1155 (( p_pdp_context_node->internal_data.state EQ PDP_CONTEXT_STATE_ACTIVATED ) OR
1156 ( p_pdp_context_node->internal_data.state EQ PDP_CONTEXT_STATE_DATA_LINK ))
1157 ? p_pdp_context_node->internal_data.pdp_address_allocated.ip_address.ipv6_addr.a6 :
1158 p_pdp_context_node->attributes.pdp_addr.ip_address.ipv6_addr.a6);
1159 }
1160 }
1161 }
1162
1163 }
1164 #endif /* GPRS */
1165
1166 /*
1167 +------------------------------------------------------------------------------
1168 | Function : em_subclass_gmm
1169 +------------------------------------------------------------------------------
1170 | Description : This function send the appropriate primitive to the involved
1171 | entity.
1172 |
1173 | Parameters : em_type - defines the actual data
1174 |
1175 | Return : UBYTE
1176 +------------------------------------------------------------------------------
1177 */
1178
1179 #ifdef GPRS
1180 LOCAL UBYTE em_subclass_gmm(UBYTE em_type)
1181 {
1182 TRACE_FUNCTION ("em_subclass_gmm()");
1183
1184 /*
1185 *-------------------------------------------------------------------
1186 * create and send primitive
1187 *-------------------------------------------------------------------
1188 */
1189 {
1190 PALLOC(em_gmm_info_req, EM_GMM_INFO_REQ); /* T_EM_SC_GPRS_INFO_REQ */
1191
1192 /* fill in primitive parameter: */
1193 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
1194 em_gmm_info_req->data = em_type;
1195
1196 /* the primitive is send to GMM */
1197 PSEND (hCommGMM, em_gmm_info_req);
1198 }
1199 return TRUE;
1200 }
1201 #endif /* GPRS */
1202
1203 /*
1204 +------------------------------------------------------------------------------
1205 | Function : em_subclass_gmm
1206 +------------------------------------------------------------------------------
1207 | Description : This function send the appropriate primitive to the involved
1208 | entity.
1209 |
1210 | Parameters : em_type - defines the actual data
1211 |
1212 | Return : UBYTE
1213 +------------------------------------------------------------------------------
1214 */
1215
1216 #ifdef GPRS
1217 LOCAL UBYTE em_subclass_grlc(UBYTE em_type)
1218 {
1219 TRACE_FUNCTION ("em_subclass_grlc()");
1220
1221 /*
1222 *-------------------------------------------------------------------
1223 * create and send primitive
1224 *-------------------------------------------------------------------
1225 */
1226 {
1227 PALLOC(em_subclass_grlc, EM_GRLC_INFO_REQ); /* T_EM_SC_GPRS_INFO_REQ */
1228
1229 /* fill in primitive parameter: */
1230 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
1231 em_subclass_grlc->data = em_type;
1232
1233 /* the primitive is send to GRLC via GMM */
1234 PSEND (hCommGMM, em_subclass_grlc);
1235 }
1236 return TRUE;
1237 }
1238 #endif /* GPRS */
1239
1240 /*
1241 +------------------------------------------------------------------------------
1242 | Function : em_subclass_amr
1243 +------------------------------------------------------------------------------
1244 | Description : This function send the appropriate primitive to the involved
1245 | entity.
1246 |
1247 | Parameters : em_type - defines the actual data
1248 |
1249 | Return : UBYTE
1250 +------------------------------------------------------------------------------
1251 */
1252
1253 LOCAL UBYTE em_subclass_amr (UBYTE em_type)
1254 {
1255 TRACE_FUNCTION ("em_subclass_amr()");
1256
1257 /*
1258 *-------------------------------------------------------------------
1259 * create and send primitive
1260 *-------------------------------------------------------------------
1261 */
1262 {
1263 PALLOC(em_amr_info_req, EM_AMR_INFO_REQ); /* T_EM_AMR_INFO_REQ */
1264
1265 /* fill in primitive parameter: */
1266 /* the bitmask em_type is only used to prevent unnecesary use of primitives*/
1267 em_amr_info_req->data = em_type;
1268
1269 /* the primitive directly to RR */
1270 PSENDX (RR, em_amr_info_req);
1271 }
1272 return TRUE;
1273 }
1274
1275 /*
1276 +------------------------------------------------------------------------------
1277 | Function : em_subclass_pdp
1278 +------------------------------------------------------------------------------
1279 | Description : This function displays PDP output directly since the
1280 | data is available in ACI itself.
1281 |
1282 | Parameters : em_type - defines the actual data
1283 |
1284 | Return : UBYTE
1285 +------------------------------------------------------------------------------
1286 */
1287
1288 #ifdef GPRS
1289 LOCAL UBYTE em_subclass_pdp (UBYTE em_type)
1290 {
1291
1292 TRACE_FUNCTION ("em_subclass_pdp()");
1293
1294 em_Received_Data ((void *)NULL, EM_SUBCLASS_PDP);
1295
1296 return TRUE;
1297
1298 }
1299 #endif
1300
1301 /*
1302 +------------------------------------------------------------------------------
1303 | Function : em_event_l1
1304 +------------------------------------------------------------------------------
1305 | Description : This function send the appropriate primitive to the involved
1306 | entity.
1307 |
1308 | Parameters : bitmask - defines the single events
1309 |
1310 | Return : UBYTE
1311 +------------------------------------------------------------------------------
1312 */
1313
1314 LOCAL UBYTE em_event_l1 (USHORT bitmask_h, ULONG bitmask_l)
1315 {
1316 TRACE_FUNCTION ("em_event_l1()");
1317
1318 /* check if only specified events are set in the bitmask */
1319 if (!(bitmask_h & ~EM_BITMASK_L1_H))
1320 {
1321 /*
1322 *-------------------------------------------------------------------
1323 * create and send primitive
1324 *-------------------------------------------------------------------
1325 */
1326 PALLOC(em_l1_event_req, EM_L1_EVENT_REQ); /* T_EM_L1_EVENT_REQ */
1327
1328 /* fill in primitive parameter: */
1329 em_l1_event_req->bitmask_l1_h = bitmask_h;
1330 em_l1_event_req->bitmask_l1_l = bitmask_l;
1331
1332 /* additional information for the mscviewer */
1333 TRACE_PRIM_TO("PL");
1334
1335 /* the primitive is send to PL */
1336 PSENDX (PL, em_l1_event_req);
1337 return TRUE;
1338 }
1339 else /* wrong bitmask */
1340 return EM_DATA_NOT_AVAIL;
1341 }
1342
1343 /*
1344 +------------------------------------------------------------------------------
1345 | Function : em_event_dl
1346 +------------------------------------------------------------------------------
1347 | Description : This function send the appropriate primitive to the involved
1348 | entity.
1349 |
1350 | Parameters : bitmask - defines the single events
1351 |
1352 | Return : UBYTE
1353 +------------------------------------------------------------------------------
1354 */
1355
1356 LOCAL UBYTE em_event_dl (USHORT bitmask)
1357 {
1358 TRACE_FUNCTION ("em_event_dl()");
1359
1360 /* check if only specified events are set in the bitmask */
1361 if (!(bitmask & ~EM_BITMASK_DL)) {
1362 /*
1363 *-------------------------------------------------------------------
1364 * create and send primitive
1365 *-------------------------------------------------------------------
1366 */
1367 {
1368 PALLOC(em_dl_event_req, EM_DL_EVENT_REQ); /* T_EM_DL_EVENT_REQ */
1369
1370 /* fill in primitive parameter: */
1371 em_dl_event_req->bitmask_dl = bitmask;
1372
1373 /* additional information for the mscviewer */
1374 TRACE_PRIM_TO("DL");
1375
1376 /* the primitive is send to DL via MM */
1377 PSENDX (MM, em_dl_event_req);
1378 }
1379 return TRUE;
1380 }
1381 else /* wrong bitmask */
1382 return EM_DATA_NOT_AVAIL;
1383 }
1384
1385 /*
1386 +------------------------------------------------------------------------------
1387 | Function : em_event_rr
1388 +------------------------------------------------------------------------------
1389 | Description : This function send the appropriate primitive to the involved
1390 | entity.
1391 |
1392 | Parameters : bitmask - defines the single events
1393 |
1394 | Return : UBYTE
1395 +------------------------------------------------------------------------------
1396 */
1397
1398 LOCAL UBYTE em_event_rr (USHORT bitmask_h, ULONG bitmask_l)
1399 {
1400 TRACE_FUNCTION ("em_event_rr()");
1401
1402 /* check if only specified events are set in the bitmask */
1403 if (!(bitmask_h & ~EM_BITMASK_RR_H)) {
1404 /*
1405 *-------------------------------------------------------------------
1406 * create and send primitive
1407 *-------------------------------------------------------------------
1408 */
1409 {
1410 PALLOC(em_rr_event_req, EM_RR_EVENT_REQ); /* EM_RR_EVENT_REQ */
1411
1412 /* fill in primitive parameter: */
1413 em_rr_event_req->bitmask_rr_h = bitmask_h;
1414 em_rr_event_req->bitmask_rr_l = bitmask_l;
1415
1416 /* no additional information for the mscviewer is needed here because
1417 * RR is the default entity inside the mscview.tbl
1418 TRACE_PRIM_TO("RR");
1419 */
1420
1421 /* the primitive is send to RR */
1422 PSENDX (RR, em_rr_event_req);
1423 }
1424 return TRUE;
1425 }
1426 else /* wrong bitmask */
1427 return EM_DATA_NOT_AVAIL;
1428 }
1429
1430 /*
1431 +------------------------------------------------------------------------------
1432 | Function : em_event_mm
1433 +------------------------------------------------------------------------------
1434 | Description : This function send the appropriate primitive to the involved
1435 | entity.
1436 |
1437 | Parameters : bitmask - defines the single events
1438 |
1439 | Return : UBYTE
1440 +------------------------------------------------------------------------------
1441 */
1442
1443 LOCAL UBYTE em_event_mm (ULONG bitmask)
1444 {
1445 TRACE_FUNCTION ("em_event_mm()");
1446
1447 /* check if only specified events are set in the bitmask */
1448 if (!(bitmask & ~EM_BITMASK_MM)) {
1449 /*
1450 *-------------------------------------------------------------------
1451 * create and send primitive
1452 *-------------------------------------------------------------------
1453 */
1454 {
1455 PALLOC(em_mm_event_req, EM_MM_EVENT_REQ); /* T_EM_MM_EVENT_REQ */
1456
1457 /* fill in primitive parameter: */
1458 em_mm_event_req->bitmask_mm = bitmask;
1459
1460 /* additional information for the mscviewer */
1461 TRACE_PRIM_TO("MM");
1462
1463 /* the primitive is send to MM */
1464 PSENDX (MM, em_mm_event_req);
1465 }
1466 return TRUE;
1467 }
1468 else /* wrong bitmask */
1469 return EM_DATA_NOT_AVAIL;
1470 }
1471
1472 /*
1473 +------------------------------------------------------------------------------
1474 | Function : em_event_cc
1475 +------------------------------------------------------------------------------
1476 | Description : This function send the appropriate primitive to the involved
1477 | entity.
1478 |
1479 | Parameters : bitmask - defines the single events
1480 |
1481 | Return : UBYTE
1482 +------------------------------------------------------------------------------
1483 */
1484
1485 LOCAL UBYTE em_event_cc (ULONG bitmask_h, ULONG bitmask_l)
1486 {
1487 TRACE_FUNCTION ("em_event_cc()");
1488
1489 /* check if only specified events are set in the bitmask */
1490 if (!(bitmask_h & ~EM_BITMASK_CC_H)) {
1491 /*
1492 *-------------------------------------------------------------------
1493 * create and send primitive
1494 *-------------------------------------------------------------------
1495 */
1496 {
1497 PALLOC(em_cc_event_req, EM_CC_EVENT_REQ); /* T_EM_CC_EVENT_REQ */
1498
1499 /* fill in primitive parameter: */
1500 em_cc_event_req->bitmask_cc_h = bitmask_h;
1501 em_cc_event_req->bitmask_cc_l = bitmask_l;
1502
1503 /* additional information for the mscviewer */
1504 TRACE_PRIM_TO("CC");
1505
1506 /* the primitive is send to CC */
1507 PSENDX (CC, em_cc_event_req);
1508 }
1509 return TRUE;
1510 }
1511 else /* wrong bitmask */
1512 return EM_DATA_NOT_AVAIL;
1513 }
1514
1515 /*
1516 +------------------------------------------------------------------------------
1517 | Function : em_event_ss
1518 +------------------------------------------------------------------------------
1519 | Description : This function send the appropriate primitive to the involved
1520 | entity.
1521 |
1522 | Parameters : bitmask - defines the single events
1523 |
1524 | Return : UBYTE
1525 +------------------------------------------------------------------------------
1526 */
1527
1528
1529 LOCAL UBYTE em_event_ss (USHORT bitmask)
1530 {
1531 TRACE_FUNCTION ("em_event_ss()");
1532
1533 /* check if only specified events are set in the bitmask */
1534 if (!(bitmask & ~EM_BITMASK_SS)) {
1535 /*
1536 *-------------------------------------------------------------------
1537 * create and send primitive
1538 *-------------------------------------------------------------------
1539 */
1540 {
1541 PALLOC(em_ss_event_req, EM_SS_EVENT_REQ); /* T_EM_SS_EVENT_REQ */
1542
1543 /* fill in primitive parameter: */
1544 em_ss_event_req->bitmask_ss = bitmask;
1545
1546 /* additional information for the mscviewer */
1547 TRACE_PRIM_TO("SS");
1548
1549 /* the primitive is send to SS */
1550 PSENDX (SS, em_ss_event_req);
1551 }
1552 return TRUE;
1553 }
1554 else /* wrong bitmask */
1555 return EM_DATA_NOT_AVAIL;
1556 }
1557
1558 /*
1559 +------------------------------------------------------------------------------
1560 | Function : em_event_sms
1561 +------------------------------------------------------------------------------
1562 | Description : This function send the appropriate primitive to the involved
1563 | entity.
1564 |
1565 | Parameters : bitmask - defines the single events
1566 |
1567 | Return : UBYTE
1568 +------------------------------------------------------------------------------
1569 */
1570
1571 LOCAL UBYTE em_event_sms (ULONG bitmask_h, ULONG bitmask_l)
1572 {
1573 TRACE_FUNCTION ("em_event_sms()");
1574
1575 /* check if only specified events are set in the bitmask */
1576 if (!(bitmask_h & ~EM_BITMASK_SMS_H)) {
1577 /*
1578 *-------------------------------------------------------------------
1579 * create and send primitive
1580 *-------------------------------------------------------------------
1581 */
1582 {
1583 PALLOC(em_sms_event_req, EM_SMS_EVENT_REQ); /* T_EM_SMS_EVENT_REQ */
1584
1585 /* fill in primitive parameter: */
1586 em_sms_event_req->bitmask_sms_h = bitmask_h;
1587 em_sms_event_req->bitmask_sms_l = bitmask_l;
1588
1589 /* additional information for the mscviewer */
1590 TRACE_PRIM_TO("SMS");
1591
1592 /* the primitive is send to SMS */
1593 PSENDX (SMS, em_sms_event_req);
1594 }
1595 return TRUE;
1596 }
1597 else /* wrong bitmask */
1598 return EM_DATA_NOT_AVAIL;
1599 }
1600
1601 /*
1602 +------------------------------------------------------------------------------
1603 | Function : em_event_sim
1604 +------------------------------------------------------------------------------
1605 | Description : This function send the appropriate primitive to the involved
1606 | entity.
1607 |
1608 | Parameters : bitmask - defines the single events
1609 |
1610 | Return : UBYTE
1611 +------------------------------------------------------------------------------
1612 */
1613
1614 LOCAL UBYTE em_event_sim (ULONG bitmask)
1615 {
1616 TRACE_FUNCTION ("em_event_sim()");
1617
1618 /* check if only specified events are set in the bitmask */
1619 if (!(bitmask & ~EM_BITMASK_SIM)) {
1620 /*
1621 *-------------------------------------------------------------------
1622 * create and send primitive
1623 *-------------------------------------------------------------------
1624 */
1625 {
1626 PALLOC(em_sim_event_req, EM_SIM_EVENT_REQ); /* T_EM_SIM_EVENT_REQ */
1627
1628 /* fill in primitive parameter: */
1629 em_sim_event_req->bitmask_sim = bitmask;
1630
1631 /* additional information for the mscviewer */
1632 TRACE_PRIM_TO("SIM");
1633
1634 /* the primitive is send to SIM */
1635 PSENDX (SIM, em_sim_event_req);
1636 }
1637 return TRUE;
1638 }
1639 else /* wrong bitmask */
1640 return EM_DATA_NOT_AVAIL;
1641 }
1642
1643 /*
1644 +------------------------------------------------------------------------------
1645 | Function : em_aci_sem
1646 +------------------------------------------------------------------------------
1647 | Description : Clear all entries inside the semaphor for event tracing
1648 |
1649 | Parameters : UBYTE entity
1650 |
1651 | Return : void
1652 +------------------------------------------------------------------------------
1653 */
1654 void em_aci_sem (UBYTE entity, UBYTE *buffer, UBYTE buf_index_tmp)
1655 {
1656 TRACE_FUNCTION ("em_aci_sem()");
1657
1658 /*
1659 * aci_em_buf.xxx.index keeps the position of the data inside the buffer
1660 * aci_em_buf.xxx.length indicates the length of the data to be copied
1661 * both values are used for later processing of the data
1662 */
1663 switch (entity)
1664 {
1665 case (EM_L1):
1666 em_l1_sem_read();
1667 memcpy(buffer + em_aci_buf_index, em_l1_sem_buffer, buf_index_tmp);
1668 aci_em_buf.alr.index = em_aci_buf_index;
1669 aci_em_buf.alr.length = buf_index_tmp;
1670 em_aci_buf_index += buf_index_tmp;
1671 em_l1_sem_reset ();
1672 break;
1673 case (EM_DL):
1674 em_dl_sem_read();
1675 memcpy(buffer + em_aci_buf_index, em_dl_sem_buffer, buf_index_tmp);
1676 aci_em_buf.dl.index = em_aci_buf_index;
1677 aci_em_buf.dl.length = buf_index_tmp;
1678 em_aci_buf_index += buf_index_tmp;
1679 em_dl_sem_reset ();
1680 break;
1681 case (EM_RR):
1682 em_rr_sem_read();
1683 memcpy(buffer + em_aci_buf_index, em_rr_sem_buffer, buf_index_tmp);
1684 aci_em_buf.rr.index = em_aci_buf_index;
1685 aci_em_buf.rr.length = buf_index_tmp;
1686 em_aci_buf_index += buf_index_tmp;
1687 em_rr_sem_reset ();
1688 break;
1689 case (EM_MM):
1690 memcpy(buffer + em_aci_buf_index, em_mm_event_buffer, buf_index_tmp);
1691 aci_em_buf.mm.index = em_aci_buf_index;
1692 aci_em_buf.mm.length = buf_index_tmp;
1693 em_aci_buf_index += buf_index_tmp;
1694 em_mm_buffer_write = 0;
1695 break;
1696 case (EM_CC):
1697 memcpy(buffer + em_aci_buf_index, em_cc_event_buffer, buf_index_tmp);
1698 aci_em_buf.cc.index = em_aci_buf_index;
1699 aci_em_buf.cc.length = buf_index_tmp;
1700 em_aci_buf_index += buf_index_tmp;
1701 em_cc_buffer_write = 0;
1702 break;
1703 case (EM_SS):
1704 memcpy(buffer + em_aci_buf_index, em_ss_event_buffer, buf_index_tmp);
1705 aci_em_buf.ss.index = em_aci_buf_index;
1706 aci_em_buf.ss.length = buf_index_tmp;
1707 em_aci_buf_index += buf_index_tmp;
1708 em_ss_buffer_write = 0;
1709 break;
1710 case (EM_SMS):
1711 memcpy(buffer + em_aci_buf_index, em_sms_event_buffer, buf_index_tmp);
1712 aci_em_buf.sms.index = em_aci_buf_index;
1713 aci_em_buf.sms.length = buf_index_tmp;
1714 em_aci_buf_index += buf_index_tmp;
1715 em_sms_buffer_write = 0;
1716 break;
1717 case (EM_SIM):
1718 memcpy(buffer + em_aci_buf_index, em_sim_event_buffer, buf_index_tmp);
1719 aci_em_buf.sim.index = em_aci_buf_index;
1720 aci_em_buf.sim.length = buf_index_tmp;
1721 em_aci_buf_index += buf_index_tmp;
1722 em_sim_buffer_write = 0;
1723 break;
1724 default:
1725 break;
1726 } /* switch */
1727 } /* endfunc em_aci_sem */
1728
1729 /*
1730 +------------------------------------------------------------------------------
1731 | Function : em_event_trace_ind
1732 +------------------------------------------------------------------------------
1733 | Description : When event tracing is enabled, the entity sends a notification
1734 | that the first event occurred. The event flag (em_xx_trace)
1735 | protects unnecessary buffer operations.
1736 |
1737 | Parameters : Entity
1738 |
1739 | Return : void
1740 +------------------------------------------------------------------------------
1741 */
1742 GLOBAL void em_event_trace_ind (T_EM_DATA_IND * em_data_ind)
1743 {
1744 TRACE_FUNCTION ("em_event_trace_ind()");
1745
1746 switch (em_data_ind->entity)
1747 {
1748 case EM_L1:
1749 em_l1_trace = TRUE;
1750 break;
1751 case EM_DL:
1752 em_dl_trace = TRUE;
1753 break;
1754 case EM_RR:
1755 em_rr_trace = TRUE;
1756 break;
1757 case EM_MM:
1758 em_mm_trace = TRUE;
1759 break;
1760 case EM_CC:
1761 em_cc_trace = TRUE;
1762 break;
1763 case EM_SS:
1764 em_ss_trace = TRUE;
1765 break;
1766 case EM_SMS:
1767 em_sms_trace = TRUE;
1768 break;
1769 case EM_SIM:
1770 em_sim_trace = TRUE;
1771 break;
1772 default:
1773 break;
1774 } /* switch */
1775 PFREE(em_data_ind);
1776 }
1777
1778
1779 /*+++++++++++++++++++++++++++++++++++++++++ E O F +++++++++++++++++++++++++++++++++++++++++*/