comparison src/g23m-gprs/upm/upm_dispatcher.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 dispatcher
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 /*==== INCLUDES =============================================================*/
25
26 #include "upm.h"
27 #include "upm_dispatcher.h"
28
29 /*==== CONSTS ===============================================================*/
30
31 /*==== TYPES ================================================================*/
32
33 /*==== LOCALS ===============================================================*/
34
35 /*==== PRIVATE FUNCTIONS ====================================================*/
36
37 /*==== PUBLIC FUNCTIONS =====================================================*/
38
39 /*
40 +------------------------------------------------------------------------------
41 | Function : upm_disp_sm_activate_started_ind
42 +------------------------------------------------------------------------------
43 | Description : Dispatch SM_ACTIVATE_STARTED_IND
44 |
45 | Parameters : sm_activate_started_ind - received primitive
46 +------------------------------------------------------------------------------
47 */
48 void upm_disp_sm_activate_started_ind(T_SM_ACTIVATE_STARTED_IND *prim)
49 {
50 int nsapi;
51 struct T_CONTEXT_DATA *ptr_context_data;
52
53 (void)TRACE_FUNCTION("upm_disp_sm_activate_started_ind");
54
55 nsapi = (int)prim->nsapi;
56 ptr_context_data = upm_get_context_data_from_nsapi(nsapi);
57
58 /* UPM_DTI_REQ arrived first (or activation override). Use present data structures. */
59 if (ptr_context_data != NULL)
60 {
61 #ifdef UPM_WITHOUT_USER_PLANE /*T_UPM_USER_PLANE_DATA is not visible for GPRS world*/
62 memset(ptr_context_data, 0, sizeof(struct T_CONTEXT_DATA)
63 /* - sizeof(struct T_UPM_USER_PLANE_DATA)*/);
64 #else /*#ifndef UPM_WITHOUT_USER_PLANE*/
65 memset(ptr_context_data, 0, sizeof(struct T_CONTEXT_DATA)
66 - sizeof(struct T_UPM_USER_PLANE_DATA));
67 #endif /*#ifndef UPM_WITHOUT_USER_PLANE*/
68 ptr_context_data->nsapi = (U8)nsapi;
69 } else {
70 MALLOC(ptr_context_data, (U32)sizeof(struct T_CONTEXT_DATA));
71
72 if (ptr_context_data == NULL)
73 {
74 (void)TRACE_ERROR("Unable to allocate data structure for new context!");
75 return;
76 }
77
78 memset(ptr_context_data, 0, sizeof(struct T_CONTEXT_DATA));
79
80 upm_assign_context_data_to_nsapi(ptr_context_data, nsapi);
81 }
82
83 TRACE_ASSERT(ptr_context_data != NULL);
84
85 upm_link_control_init(ptr_context_data);
86 #ifdef TI_UMTS
87 upm_rab_control_init(ptr_context_data);
88 #endif /* TI_UMTS */
89 #ifdef TI_GPRS
90 upm_sndcp_control_init(ptr_context_data);
91 #endif /* TI_GPRS */
92 #ifdef TI_DUAL_MODE
93 upm_rat_control_init( (T_PS_rat)prim->rat );
94 #endif /* TI_DUAL_MODE */
95 upm_link_control(ptr_context_data, UPM_P_SM_ACTIVATE_STARTED_IND, prim);
96 }
97
98 /*
99 +------------------------------------------------------------------------------
100 | Function : upm_disp_sm_activate_ind
101 +------------------------------------------------------------------------------
102 | Description : Dispatch SM_ACTIVATE_IND
103 |
104 | Parameters : sm_activate_ind - received primitive
105 +------------------------------------------------------------------------------
106 */
107 void upm_disp_sm_activate_ind(T_SM_ACTIVATE_IND *sm_activate_ind)
108 {
109 struct T_CONTEXT_DATA *ptr_context_data;
110
111 (void)TRACE_FUNCTION("upm_disp_sm_activate_ind");
112
113 ptr_context_data = upm_get_context_data_from_nsapi(sm_activate_ind->nsapi);
114 if (ptr_context_data != NULL)
115 {
116 upm_link_control(ptr_context_data, UPM_P_SM_ACTIVATE_IND, sm_activate_ind);
117 } else {
118 (void)TRACE_ERROR("Tried to complete activation of non-existent context!");
119 }
120 }
121
122 /*
123 +------------------------------------------------------------------------------
124 | Function : upm_disp_sm_modify_ind
125 +------------------------------------------------------------------------------
126 | Description : Dispatch SM_MODIFY_IND
127 |
128 | Parameters : sm_modify_ind - received primitive
129 +------------------------------------------------------------------------------
130 */
131 void upm_disp_sm_modify_ind (T_SM_MODIFY_IND *sm_modify_ind)
132 {
133 struct T_CONTEXT_DATA *ptr_context_data;
134
135 (void)TRACE_FUNCTION("upm_disp_sm_modify_ind");
136
137 ptr_context_data = upm_get_context_data_from_nsapi(sm_modify_ind->nsapi);
138 if (ptr_context_data != NULL)
139 {
140 upm_link_control(ptr_context_data, UPM_P_SM_MODIFY_IND, sm_modify_ind);
141 } else {
142 (void)TRACE_ERROR("Tried to modify non-existent context!");
143 }
144 }
145
146 /*
147 +------------------------------------------------------------------------------
148 | Function : upm_disp_upm_count_req
149 +------------------------------------------------------------------------------
150 | Description : Dispatch UPM_COUNT_REQ
151 |
152 | Parameters : prim - received primitive
153 +------------------------------------------------------------------------------
154 */
155 void upm_disp_upm_count_req (T_UPM_COUNT_REQ *prim)
156 {
157 struct T_CONTEXT_DATA *ptr_context_data;
158
159 (void)TRACE_FUNCTION("upm_disp_upm_count_req");
160
161 ptr_context_data = upm_get_context_data_from_nsapi(prim->nsapi);
162
163 if (ptr_context_data != NULL) {
164 #ifdef TI_GPRS
165 #ifdef TI_DUAL_MODE
166 if (upm_get_current_rat() == PS_RAT_GSM)
167 #endif /* TI_DUAL_MODE */
168 {
169 upm_sndcp_dispatch_upm_count_req(prim);
170 }
171 #endif /* TI_GPRS */
172 #ifdef TI_DUAL_MODE
173 else
174 #endif /* TI_DUAL_MODE */
175 #ifdef TI_UMTS
176 {
177 upm_dti_dispatch_upm_count_req(ptr_context_data, prim->reset);
178 }
179 #endif
180 } else {
181 (void)TRACE_EVENT_P1("Warning: Received COUNT_REQ for undefined "
182 "NSAPI/context; ignored...", prim->nsapi);
183 }
184 }
185
186 /*==== END OF FILE ==========================================================*/