FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/upm/upm_pei.c @ 197:2cf312e56ee7
src/g23m-gprs/upm: import from LoCosto source
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 14 Oct 2016 01:21:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
196:a04cde1fb771 | 197:2cf312e56ee7 |
---|---|
1 /*---------------------------------------------------------------------------- | |
2 | Project : 3G PS | |
3 | Module : UPM | |
4 +----------------------------------------------------------------------------- | |
5 | Copyright 2003 Texas Instruments. | |
6 | All rights reserved. | |
7 | | |
8 | This file is confidential and a trade secret of Texas | |
9 | Instruments . | |
10 | The receipt of or possession of this file does not convey | |
11 | any rights to reproduce or disclose its contents or to | |
12 | manufacture, use, or sell anything it may describe, in | |
13 | whole, or in part, without the specific written consent of | |
14 | Texas Instruments. | |
15 +----------------------------------------------------------------------------- | |
16 | Purpose: This module implements the process body interface | |
17 | for the User Plane Manager (UPM) entity. | |
18 | For design details, see: | |
19 | 8010.939 UPM Detailed Specification | |
20 +---------------------------------------------------------------------------*/ | |
21 | |
22 /*==== DECLARATION CONTROL =================================================*/ | |
23 | |
24 #ifndef UPM_PEI_C | |
25 #define UPM_PEI_C | |
26 #endif | |
27 | |
28 /*==== INCLUDES =============================================================*/ | |
29 | |
30 #include "upm.h" | |
31 | |
32 #include <pei.h> | |
33 #include <custom.h> | |
34 | |
35 #include "upm_dispatcher.h" | |
36 | |
37 #include "mon_upm.h" | |
38 | |
39 /*==== CONSTS ===============================================================*/ | |
40 | |
41 /*==== TYPES ================================================================*/ | |
42 | |
43 /*==== LOCALS ===============================================================*/ | |
44 | |
45 static T_MONITOR upm_mon; | |
46 static BOOL first_access = TRUE; | |
47 | |
48 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
49 | |
50 /* | |
51 +------------------------------------------------------------------------------ | |
52 | Function : pei_primitive | |
53 +------------------------------------------------------------------------------ | |
54 | Description : This function is called by the frame when a primitive is | |
55 | received and needs to be processed. | |
56 | | |
57 | | | |
58 | | UPPER LAYER | |
59 | v | |
60 | +---------------------------(DTI SAP)--------------------------+ | |
61 | | | | |
62 | | UPM | | |
63 | | | | |
64 | +-^---------^---------^---------^--------^---------^---------^-+ | |
65 | | | | | | | | | |
66 | | | | | | | | LOWER LAYER | |
67 | (SM SAP) (MMPM SAP) (RR SAP) (RRC SAP) (SN SAP) (PDCP SAP) (MEM SAP) | |
68 | | |
69 | Parameters : prim - Pointer to the received primitive | |
70 | | |
71 | Return : PEI_OK - function succeeded | |
72 | PEI_ERROR - function failed | |
73 +------------------------------------------------------------------------------ | |
74 */ | |
75 static short pei_primitive (void *primitive) | |
76 /*@globals upm_data@*/ | |
77 { | |
78 (void)TRACE_FUNCTION("UPM pei_primitive"); | |
79 | |
80 if (primitive != NULL) | |
81 { | |
82 T_PRIM_HEADER *prim; | |
83 U32 opc; | |
84 | |
85 opc = P_OPC(primitive); | |
86 | |
87 /*@i1@*/(void)PTRACE_IN (opc); | |
88 | |
89 prim = (T_PRIM_HEADER *)&((T_PRIM *)primitive)->data; | |
90 | |
91 /* Memory supervision ? */ | |
92 VSI_PPM_RCV (primitive); | |
93 | |
94 switch (opc) | |
95 { | |
96 #ifndef UPM_WITHOUT_USER_PLANE | |
97 /* DTI SAP */ | |
98 #ifdef DTI2 | |
99 case DTI2_CONNECT_REQ: | |
100 upm_disp_dti_connect_req((T_DTI2_CONNECT_REQ *)(prim)); | |
101 /* PFREE is called in the DTILIB */ | |
102 break; | |
103 | |
104 case DTI2_CONNECT_CNF: | |
105 upm_disp_dti_connect_cnf ((T_DTI2_CONNECT_CNF *)(prim)); | |
106 /* PFREE is called in the DTILIB */ | |
107 break; | |
108 | |
109 case DTI2_CONNECT_IND: | |
110 upm_disp_dti_connect_ind ((T_DTI2_CONNECT_IND *)(prim)); | |
111 /* PFREE is called in the DTILIB */ | |
112 break; | |
113 | |
114 case DTI2_CONNECT_RES: | |
115 upm_disp_dti_connect_res((T_DTI2_CONNECT_RES *)(prim)); | |
116 /* PFREE is called in the DTILIB */ | |
117 break; | |
118 | |
119 case DTI2_DISCONNECT_IND: | |
120 upm_disp_dti_disconnect_ind((T_DTI2_DISCONNECT_IND *)(prim)); | |
121 /* PFREE is called in the DTILIB */ | |
122 break; | |
123 | |
124 case DTI2_DISCONNECT_REQ: | |
125 upm_disp_dti_disconnect_req((T_DTI2_DISCONNECT_REQ *)(prim)); | |
126 /* PFREE is called in the DTILIB */ | |
127 break; | |
128 #endif /* DTI2 */ | |
129 | |
130 case DTI2_GETDATA_REQ: | |
131 upm_disp_dti_getdata_req((T_DTI2_GETDATA_REQ *)(prim)); | |
132 /* PFREE is called in the DTILIB */ | |
133 break; | |
134 | |
135 case DTI2_READY_IND: | |
136 upm_disp_dti_ready_ind ((T_DTI2_READY_IND *)(prim)); | |
137 /* PFREE is called in the DTILIB */ | |
138 break; | |
139 | |
140 case DTI2_DATA_REQ: | |
141 upm_disp_dti_data_req((T_DTI2_DATA_REQ *)(prim)); | |
142 /* PFREE is called in the upm_sig_callback function in upm_dti_handler.c */ | |
143 break; | |
144 | |
145 case DTI2_DATA_IND: | |
146 upm_disp_dti_data_ind ((T_DTI2_DATA_IND *)(prim)); | |
147 /* PFREE is called in the upm_sig_callback function in upm_dti_handler.c */ | |
148 break; | |
149 | |
150 #ifdef DEBUG | |
151 case DTI2_DATA_TEST_REQ: | |
152 upm_disp_dti_data_test_req((T_DTI2_DATA_TEST_REQ *)(prim)); | |
153 /* PFREE is called in the DTILIB */ | |
154 break; | |
155 case DTI2_DATA_TEST_IND: | |
156 upm_disp_dti_data_test_ind((T_DTI2_DATA_TEST_IND *)(prim)); | |
157 /* PFREE is called in the DTILIB */ | |
158 break; | |
159 #endif /* DEBUG */ | |
160 | |
161 #endif /* UPM_WITHOUT_USER_PLANE */ | |
162 | |
163 /* SM SAP */ | |
164 case SM_ACTIVATE_STARTED_IND: | |
165 upm_disp_sm_activate_started_ind((T_SM_ACTIVATE_STARTED_IND *)(prim)); | |
166 PFREE(prim); | |
167 break; | |
168 | |
169 case SM_ACTIVATE_IND: | |
170 upm_disp_sm_activate_ind((T_SM_ACTIVATE_IND *)(prim)); | |
171 PFREE(prim); | |
172 break; | |
173 | |
174 case SM_DEACTIVATE_IND: | |
175 upm_link_dispatch_sm_deactivate_ind((T_SM_DEACTIVATE_IND *)(prim)); | |
176 PFREE(prim); | |
177 break; | |
178 | |
179 case SM_MODIFY_IND: | |
180 upm_disp_sm_modify_ind((T_SM_MODIFY_IND *)(prim)); | |
181 PFREE(prim); | |
182 break; | |
183 | |
184 #ifndef UPM_WITHOUT_USER_PLANE | |
185 /* MMPM SAP */ | |
186 case MMPM_SUSPEND_IND: | |
187 upm_disp_mmpm_suspend_ind((T_MMPM_SUSPEND_IND *)(prim)); | |
188 PFREE(prim); | |
189 break; | |
190 | |
191 case MMPM_RESUME_IND: | |
192 upm_disp_mmpm_resume_ind((T_MMPM_RESUME_IND *)(prim)); | |
193 PFREE(prim); | |
194 break; | |
195 #endif /* UPM_WITHOUT_USER_PLANE */ | |
196 | |
197 #ifdef TI_UMTS | |
198 case MMPM_REESTABLISH_CNF: | |
199 upm_disp_mmpm_reestablish_cnf((T_MMPM_REESTABLISH_CNF *)(prim)); | |
200 PFREE(prim); | |
201 break; | |
202 | |
203 case MMPM_REESTABLISH_REJ: | |
204 upm_disp_mmpm_reestablish_rej((T_MMPM_REESTABLISH_REJ *)(prim)); | |
205 PFREE(prim); | |
206 break; | |
207 #endif /* TI_UMTS */ | |
208 #ifdef TI_GPRS | |
209 case MMPM_SEQUENCE_IND: | |
210 upm_disp_mmpm_sequence_ind((T_MMPM_SEQUENCE_IND *)(prim)); | |
211 PFREE(prim); | |
212 break; | |
213 #endif /* TI_GPRS */ | |
214 #ifdef TI_DUAL_MODE | |
215 case MMPM_RAT_CHANGE_COMPLETED_IND: | |
216 upm_disp_mmpm_rat_change_completed_ind((T_MMPM_RAT_CHANGE_COMPLETED_IND *)(prim)); | |
217 PFREE(prim); | |
218 break; | |
219 | |
220 case MMPM_RAT_CHANGE_IND: | |
221 upm_disp_mmpm_rat_change_ind((T_MMPM_RAT_CHANGE_IND *)(prim)); | |
222 PFREE(prim); | |
223 break; | |
224 #endif /* TI_DUAL_MODE */ | |
225 | |
226 #ifdef TI_UMTS | |
227 /* PDCP SAP */ | |
228 case PDCP_DATA_IND: | |
229 upm_disp_pdcp_data_ind((T_PDCP_DATA_IND *)(prim)); | |
230 PFREE(prim); | |
231 break; | |
232 | |
233 #ifdef DEBUG | |
234 case PDCP_TEST_DATA_IND: | |
235 upm_disp_pdcp_test_data_ind((T_PDCP_TEST_DATA_IND *)(prim)); | |
236 PFREE(prim); | |
237 break; | |
238 #endif /* DEBUG */ | |
239 | |
240 #ifdef TI_DUAL_MODE | |
241 case PDCP_AM_GET_PENDING_PDU_CNF: | |
242 upm_disp_pdcp_get_pending_pdu_cnf((T_PDCP_AM_GET_PENDING_PDU_CNF *)(prim)); | |
243 PFREE(prim); | |
244 break; | |
245 | |
246 #ifdef DEBUG | |
247 case PDCP_TEST_AM_GET_PENDING_PDU_CNF: | |
248 upm_disp_pdcp_test_am_get_pending_pdu_cnf((T_PDCP_TEST_AM_GET_PENDING_PDU_CNF *)(prim)); | |
249 PFREE(prim); | |
250 break; | |
251 #endif | |
252 | |
253 /* RRC SAP */ | |
254 case RRC_MOVE_USER_DATA_IND: | |
255 upm_disp_rrc_move_user_data_ind((T_RRC_MOVE_USER_DATA_IND *)(prim)); | |
256 PFREE(prim); | |
257 break; | |
258 #endif /* TI_DUAL_MODE */ | |
259 case RRC_RAB_ESTABLISH_IND: | |
260 upm_disp_rrc_rab_establish_ind((T_RRC_RAB_ESTABLISH_IND *)(prim)); | |
261 PFREE(prim); | |
262 break; | |
263 case RRC_RAB_ESTABLISH_COMPLETE_IND: | |
264 upm_disp_rrc_rab_establish_complete_ind((T_RRC_RAB_ESTABLISH_COMPLETE_IND *)(prim)); | |
265 PFREE(prim); | |
266 break; | |
267 case RRC_RAB_RELEASE_IND: | |
268 upm_disp_rrc_rab_release_ind((T_RRC_RAB_RELEASE_IND *)(prim)); | |
269 PFREE(prim); | |
270 break; | |
271 | |
272 /* MEM SAP */ | |
273 case MEM_READY_IND: | |
274 upm_disp_mem_ready_ind((T_MEM_READY_IND *)(prim)); | |
275 PFREE(prim); | |
276 break; | |
277 #endif /* TI_UMTS */ | |
278 | |
279 #ifdef TI_GPRS | |
280 /* SN SAP */ | |
281 case SN_ACTIVATE_CNF: | |
282 upm_disp_sn_activate_cnf((T_SN_ACTIVATE_CNF *)(prim)); | |
283 PFREE(prim); | |
284 break; | |
285 | |
286 case SN_COUNT_CNF: | |
287 upm_disp_sn_count_cnf((T_SN_COUNT_CNF *)(prim)); | |
288 PFREE(prim); | |
289 break; | |
290 | |
291 case SN_MODIFY_CNF: | |
292 upm_disp_sn_modify_cnf((T_SN_MODIFY_CNF *)(prim)); | |
293 PFREE(prim); | |
294 break; | |
295 | |
296 case SN_DEACTIVATE_CNF: | |
297 upm_disp_sn_deactivate_cnf((T_SN_DEACTIVATE_CNF *)(prim)); | |
298 PFREE(prim); | |
299 break; | |
300 | |
301 case SN_STATUS_IND: | |
302 /* May affect multiple contexts. Special dispatch handling. */ | |
303 upm_sndcp_dispatch_sn_status_ind((T_SN_STATUS_IND *)(prim)); | |
304 PFREE(prim); | |
305 break; | |
306 | |
307 case SN_SEQUENCE_CNF: | |
308 /* May affect multiple contexts. Special dispatch handling. */ | |
309 upm_sndcp_dispatch_sn_sequence_cnf((T_SN_SEQUENCE_CNF *)(prim)); | |
310 PFREE(prim); | |
311 break; | |
312 | |
313 #ifdef TI_DUAL_MODE | |
314 case SN_GET_PENDING_PDU_CNF: | |
315 upm_disp_sn_get_pending_pdu_cnf((T_SN_GET_PENDING_PDU_CNF *)(prim)); | |
316 PFREE(prim); | |
317 break; | |
318 | |
319 #ifdef DEBUG | |
320 case SN_TEST_GET_PENDING_PDU_CNF: | |
321 upm_disp_sn_test_get_pending_pdu_cnf((T_SN_TEST_GET_PENDING_PDU_CNF *)(prim)); | |
322 PFREE(prim); | |
323 break; | |
324 #endif /* DEBUG */ | |
325 | |
326 /* RR SAP */ | |
327 case RR_MOVE_USER_DATA_IND: | |
328 upm_disp_rr_move_user_data_ind((T_RR_MOVE_USER_DATA_IND *)(prim)); | |
329 PFREE(prim); | |
330 break; | |
331 #endif /* TI_DUAL_MODE */ | |
332 #endif /* TI_GPRS */ | |
333 | |
334 /* UPM SAP */ | |
335 case UPM_COUNT_REQ: | |
336 upm_disp_upm_count_req((T_UPM_COUNT_REQ *)(prim)); | |
337 PFREE(prim); | |
338 break; | |
339 | |
340 #ifndef UPM_WITHOUT_USER_PLANE | |
341 case UPM_DTI_REQ: | |
342 upm_disp_upm_dti_req((T_UPM_DTI_REQ *)(prim)); | |
343 PFREE(prim); | |
344 break; | |
345 #endif /* UPM_WITHOUT_USER_PLANE */ | |
346 | |
347 default: | |
348 /* forward sys primitives to the environment */ | |
349 if ( (opc & SYS_MASK) != 0) { | |
350 (void)vsi_c_primitive(VSI_CALLER primitive); | |
351 return (short)PEI_OK; | |
352 } else { | |
353 PFREE(prim); | |
354 return (short)PEI_ERROR; | |
355 } | |
356 } /* switch */ | |
357 } /* if (prim != NULL) */ | |
358 | |
359 return PEI_OK; | |
360 } | |
361 | |
362 /* | |
363 +------------------------------------------------------------------------------ | |
364 | Function : pei_init | |
365 +------------------------------------------------------------------------------ | |
366 | Description : This function is called by the frame. It is used | |
367 | to initialise the entity. | |
368 | | |
369 | Parameters : handle - task handle | |
370 | | |
371 | Return : PEI_OK - entity initialised | |
372 | PEI_ERROR - entity not (yet) initialised | |
373 +------------------------------------------------------------------------------ | |
374 */ | |
375 static short pei_init (T_HANDLE handle) | |
376 /*@globals undef upm_data@*/ | |
377 /*@modifies upm_data@*/ | |
378 { | |
379 (void)TRACE_FUNCTION ("UPM pei_init"); | |
380 | |
381 /* Clear static entity data store */ | |
382 memset(&upm_data, 0, sizeof(upm_data)); | |
383 | |
384 /* | |
385 * Initialize task handles | |
386 */ | |
387 upm_data.upm_handle = handle; | |
388 hCommACI = VSI_ERROR; | |
389 hCommSM = VSI_ERROR; | |
390 hCommMM = VSI_ERROR; | |
391 #ifdef TI_UMTS | |
392 hCommPDCP = VSI_ERROR; | |
393 hCommRRC = VSI_ERROR; | |
394 #endif /* TI_UMTS */ | |
395 #ifdef TI_GPRS | |
396 hCommSNDCP = VSI_ERROR; | |
397 hCommRR = VSI_ERROR; | |
398 #endif /* TI_GPRS */ | |
399 | |
400 /* | |
401 * Open communication channels | |
402 */ | |
403 if (hCommACI < VSI_OK) | |
404 { | |
405 if ((hCommACI = vsi_c_open(VSI_CALLER ACI_NAME)) < VSI_OK) | |
406 { | |
407 return (short)PEI_ERROR; | |
408 } | |
409 } | |
410 | |
411 if (hCommSM < VSI_OK) | |
412 { | |
413 if ((hCommSM = vsi_c_open(VSI_CALLER SM_NAME)) < VSI_OK) | |
414 { | |
415 return (short)PEI_ERROR; | |
416 } | |
417 } | |
418 | |
419 if (hCommMM < VSI_OK) | |
420 { | |
421 /*#ifdef UPM_EDGE */ | |
422 if ((hCommMM = vsi_c_open(VSI_CALLER GMM_NAME)) < VSI_OK) | |
423 /*#else */ /*#ifdef UPM_EDGE*/ | |
424 /* if ((hCommMM = vsi_c_open(VSI_CALLER MM_NAME)) < VSI_OK) | |
425 #endif */ /*#ifdef UPM_EDGE*/ | |
426 { | |
427 return (short)PEI_ERROR; | |
428 } | |
429 } | |
430 | |
431 | |
432 #ifdef TI_UMTS | |
433 if (hCommPDCP < VSI_OK) | |
434 { | |
435 if ((hCommPDCP = vsi_c_open(VSI_CALLER PDCP_NAME)) < VSI_OK) | |
436 { | |
437 return (short)PEI_ERROR; | |
438 } | |
439 } | |
440 | |
441 if (hCommRRC < VSI_OK) | |
442 { | |
443 if ((hCommRRC = vsi_c_open(VSI_CALLER RRC_NAME)) < VSI_OK) | |
444 { | |
445 return (short)PEI_ERROR; | |
446 } | |
447 } | |
448 #endif /* TI_UMTS */ | |
449 | |
450 #ifdef TI_GPRS | |
451 if (hCommSNDCP < VSI_OK) | |
452 { | |
453 if ((hCommSNDCP = vsi_c_open (VSI_CALLER SNDCP_NAME)) < VSI_OK) | |
454 { | |
455 return (short)PEI_ERROR; | |
456 } | |
457 } | |
458 | |
459 if (hCommRR < VSI_OK) | |
460 { | |
461 if ((hCommRR = vsi_c_open (VSI_CALLER RR_NAME)) < VSI_OK) | |
462 { | |
463 return (short)PEI_ERROR; | |
464 } | |
465 } | |
466 #endif /* TI_GPRS */ | |
467 | |
468 /* | |
469 * Initialize entity data (call init functions) | |
470 */ | |
471 | |
472 #ifdef TI_UMTS | |
473 mem_init(); | |
474 #endif /* TI_UMTS */ | |
475 | |
476 /* | |
477 * Initialize DTI | |
478 */ | |
479 #ifndef UPM_WITHOUT_USER_PLANE | |
480 assert (upm_hDTI == NULL); | |
481 upm_hDTI = dti_init((U8)NAS_SIZE_NSAPI, upm_data.upm_handle, | |
482 DTI_DEFAULT_OPTIONS, upm_sig_callback); | |
483 #endif /* UPM_WITHOUT_USER_PLANE */ | |
484 | |
485 return (short)PEI_OK; | |
486 } | |
487 | |
488 /* | |
489 +------------------------------------------------------------------------------ | |
490 | Function : pei_exit | |
491 +------------------------------------------------------------------------------ | |
492 | Description : This function is called by the frame when the entity | |
493 | is terminated. All open resources are freed. | |
494 | | |
495 | Parameters : - | |
496 | | |
497 | Return : PEI_OK - exit sucessful | |
498 | PEI_ERROR - exit not successful | |
499 +------------------------------------------------------------------------------ | |
500 */ | |
501 static short pei_exit (void) | |
502 { | |
503 int nsapi; | |
504 (void)TRACE_FUNCTION ("UPM pei_exit"); | |
505 | |
506 /* | |
507 * Clean up entity data | |
508 */ | |
509 | |
510 for (nsapi = (int)NAS_NSAPI_5; nsapi < NAS_SIZE_NSAPI; nsapi++) { | |
511 struct T_CONTEXT_DATA *ptr_context_data; | |
512 | |
513 ptr_context_data = upm_get_context_data_from_nsapi(nsapi); | |
514 if (ptr_context_data != NULL) { | |
515 #ifdef TI_GPRS | |
516 upm_sndcp_control_exit (ptr_context_data); | |
517 #endif /* TI_GPRS */ | |
518 #ifdef TI_UMTS | |
519 upm_rab_control_exit (ptr_context_data); | |
520 #endif | |
521 upm_link_control_exit (ptr_context_data); | |
522 #ifndef UPM_WITHOUT_USER_PLANE | |
523 upm_downlink_data_control_exit(ptr_context_data); | |
524 upm_uplink_data_control_exit (ptr_context_data); | |
525 upm_dti_control_exit (ptr_context_data); | |
526 #endif /* UPM_WITHOUT_USER_PLANE */ | |
527 | |
528 #ifdef DEBUG | |
529 #ifdef TI_UMTS | |
530 upm_free_mem_buffer(ptr_context_data); | |
531 #endif | |
532 #endif | |
533 upm_free_context_data(nsapi); | |
534 } | |
535 } | |
536 #ifdef TI_DUAL_MODE | |
537 upm_rat_control_exit(); | |
538 #endif | |
539 | |
540 #ifndef UPM_WITHOUT_USER_PLANE | |
541 /* | |
542 * Clean-up DTILIB | |
543 */ | |
544 dti_deinit(upm_hDTI); | |
545 | |
546 /* Disable forced DTI neighbor routing */ | |
547 #ifdef DEBUG | |
548 upm_disp_force_neighbor(NULL); | |
549 #endif | |
550 #endif /* UPM_WITHOUT_USER_PLANE */ | |
551 | |
552 /* | |
553 * Close communication channels | |
554 */ | |
555 (void)vsi_c_close(VSI_CALLER hCommACI); | |
556 hCommACI = VSI_ERROR; | |
557 | |
558 (void)vsi_c_close(VSI_CALLER hCommSM); | |
559 hCommSM = VSI_ERROR; | |
560 | |
561 (void)vsi_c_close(VSI_CALLER hCommMM); | |
562 hCommMM = VSI_ERROR; | |
563 | |
564 #ifdef TI_UMTS | |
565 (void)vsi_c_close(VSI_CALLER hCommPDCP); | |
566 hCommPDCP = VSI_ERROR; | |
567 | |
568 (void)vsi_c_close(VSI_CALLER hCommRRC); | |
569 hCommRRC = VSI_ERROR; | |
570 #endif /* TI_UMTS */ | |
571 | |
572 #ifdef TI_GPRS | |
573 (void)vsi_c_close(VSI_CALLER hCommSNDCP); | |
574 hCommSNDCP = VSI_ERROR; | |
575 | |
576 (void)vsi_c_close(VSI_CALLER hCommRR); | |
577 hCommRR = VSI_ERROR; | |
578 #endif /* TI_GPRS */ | |
579 | |
580 return PEI_OK; | |
581 } | |
582 | |
583 /* | |
584 +------------------------------------------------------------------------------ | |
585 | Function : pei_config | |
586 +------------------------------------------------------------------------------ | |
587 | Description : This function is called by the frame when a primitive is | |
588 | received indicating dynamic configuration. | |
589 | | |
590 | This function is not used in this entity. | |
591 | | |
592 | Parameters : handle - Communication handle | |
593 | | |
594 | Return : PEI_OK - sucessful | |
595 | PEI_ERROR - not successful | |
596 +------------------------------------------------------------------------------ | |
597 */ | |
598 static short pei_config (char *inString) | |
599 { | |
600 #ifdef DEBUG | |
601 const size_t neighbor_strlen = strlen("NEIGHBOR_ENTITY"); | |
602 #endif | |
603 (void)TRACE_FUNCTION ("UPM pei_config"); | |
604 (void)TRACE_FUNCTION (inString); | |
605 | |
606 #ifdef DEBUG | |
607 | |
608 #ifdef TI_UMTS | |
609 if ( strcmp(inString, "MEM_FLOW_CONTROL ON") == 0) | |
610 { | |
611 upm_disp_adjust_mem_flow_control(TRUE); | |
612 } | |
613 else if ( strcmp(inString, "MEM_FLOW_CONTROL OFF") == 0) | |
614 { | |
615 upm_disp_adjust_mem_flow_control(FALSE); | |
616 } | |
617 else if ( strncmp(inString, "NEIGHBOR_ENTITY", neighbor_strlen) == 0) | |
618 { | |
619 if (strncmp(&inString[neighbor_strlen + 1], "CLEAR", sizeof("CLEAR")) != 0) | |
620 { | |
621 upm_disp_force_neighbor(&inString[neighbor_strlen + 1]); | |
622 } else { | |
623 upm_disp_force_neighbor(NULL); | |
624 } | |
625 } else | |
626 #endif /* TI_UMTS */ | |
627 if ( strcmp(inString, "LL_ENTITY_TEST") == 0) | |
628 { | |
629 upm_activate_ll_entity_test(); | |
630 } | |
631 #endif /* DEBUG */ | |
632 | |
633 return PEI_OK; | |
634 } | |
635 | |
636 /* | |
637 +------------------------------------------------------------------------------ | |
638 | Function : pei_monitor | |
639 +------------------------------------------------------------------------------ | |
640 | Description : This function is called by the frame in case sudden entity | |
641 | specific data is requested (e.g. entity Version). | |
642 | | |
643 | Parameters : out_monitor - return the address of the data to be | |
644 | monitoredCommunication handle | |
645 | | |
646 | Return : PEI_OK - sucessful (address in out_monitor is valid) | |
647 | PEI_ERROR - not successful | |
648 +------------------------------------------------------------------------------ | |
649 */ | |
650 /*@-compdef@*/ /*@-mods@*/ | |
651 static short pei_monitor (void **out_monitor) /*@globals undef upm_mon@*/ | |
652 { | |
653 (void)TRACE_FUNCTION ("UPM pei_monitor"); | |
654 | |
655 /* | |
656 * Version = "0.S" (S = Step). | |
657 */ | |
658 upm_mon.version = "UPM 0.1"; | |
659 *out_monitor = &upm_mon; | |
660 | |
661 return PEI_OK; | |
662 } | |
663 /*@=compdef@*/ /*@=mods@*/ | |
664 | |
665 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
666 | |
667 /* | |
668 +------------------------------------------------------------------------------ | |
669 | Function : pei_create | |
670 +------------------------------------------------------------------------------ | |
671 | Description : This function is called by the frame when the process is | |
672 | created. | |
673 | | |
674 | Parameters : out_name - Pointer to the buffer in which to locate | |
675 | the name of this entity | |
676 | | |
677 | Return : PEI_OK - entity created successfuly | |
678 | PEI_ERROR - entity could not be created | |
679 | | |
680 +------------------------------------------------------------------------------ | |
681 */ | |
682 short pei_create (T_PEI_INFO **info) | |
683 /*@globals first_access@*/ /*@modifies first_access@*/ | |
684 { | |
685 /*@-nullassign@*/ | |
686 static T_PEI_INFO pei_info = | |
687 { | |
688 /*@i1@*/ UPM_NAME, /* name */ | |
689 { /* pei-table */ | |
690 pei_init, | |
691 pei_exit, | |
692 pei_primitive, | |
693 NULL, /* no pei_timeout function */ | |
694 NULL, /* no pei_signal function */ | |
695 NULL, /* no pei_run function */ | |
696 pei_config, | |
697 pei_monitor | |
698 }, | |
699 (U32)1024, /* stack size */ | |
700 (U16)20, /* queue entries */ | |
701 (U16)216, /* priority (1->low, 255->high) */ | |
702 (U16)0, /* number of timers */ | |
703 (U8)0x03 /* flags: bit 0 active(0) body/passive(1) */ | |
704 }; /* bit 1 com by copy(0)/reference(1) */ | |
705 /*@+nullassign@*/ | |
706 | |
707 (void)TRACE_FUNCTION ("UPM pei_create"); | |
708 | |
709 /* | |
710 * Close Resources if open | |
711 */ | |
712 if (first_access) | |
713 { | |
714 first_access = FALSE; | |
715 } else { | |
716 (void)pei_exit(); | |
717 } | |
718 | |
719 /* | |
720 * Export startup configuration data | |
721 */ | |
722 *info = &pei_info; | |
723 | |
724 return PEI_OK; | |
725 } | |
726 | |
727 /*==== END OF FILE ==========================================================*/ |