comparison src/aci2/aci/aci_em.c @ 3:93999a60b835

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