comparison gsm-fw/g23m-aci/aci/aci_em.c @ 775:eedbf248bac0

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