FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/cmh_sndr.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
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 functions which are responsible | |
18 | for the responses of the protocol stack adapter for SNDCP. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #if defined (GPRS) && defined (DTI) | |
23 | |
24 #ifndef CMH_SNDR_C | |
25 #define CMH_SNDR_C | |
26 #endif | |
27 | |
28 #include "aci_all.h" | |
29 /*==== INCLUDES ===================================================*/ | |
30 | |
31 #include "aci_cmh.h" | |
32 | |
33 #include "psa.h" | |
34 | |
35 #include "dti.h" | |
36 #include "dti_conn_mng.h" | |
37 #include "dti_cntrl_mng.h" | |
38 | |
39 #include "gaci_cmh.h" | |
40 #include "gaci.h" | |
41 | |
42 #include "cmh.h" | |
43 #include "cmh_snd.h" | |
44 #include "cmh_sm.h" | |
45 | |
46 #ifdef FF_GPF_TCPIP | |
47 #include "dcm_utils.h" | |
48 #include "dcm_state.h" | |
49 #include "dcm_env.h" | |
50 #endif | |
51 | |
52 /*==== CONSTANTS ==================================================*/ | |
53 | |
54 | |
55 /*==== TYPES ======================================================*/ | |
56 | |
57 | |
58 /*==== EXPORT =====================================================*/ | |
59 | |
60 | |
61 /*==== VARIABLES ==================================================*/ | |
62 | |
63 | |
64 /*==== FUNCTIONS ==================================================*/ | |
65 | |
66 /* | |
67 +-------------------------------------------------------------------+ | |
68 | PROJECT : UMTS MODULE : CMH_SNDR | | |
69 | STATE : finished ROUTINE : cmhUPM_Counted | | |
70 +-------------------------------------------------------------------+ | |
71 | |
72 PURPOSE : | |
73 | |
74 */ | |
75 GLOBAL void cmhUPM_Counted( UBYTE nsapi, | |
76 ULONG octets_uplink, | |
77 ULONG octets_downlink, | |
78 ULONG packets_uplink, | |
79 ULONG packets_downlink ) | |
80 { | |
81 TRACE_FUNCTION ("cmhUPM_Counted()"); | |
82 | |
83 R_AT( RAT_SNCNT, (T_ACI_CMD_SRC)sndcpShrdPrm.srcId ) ( NSAPI_TO_CID(nsapi), | |
84 octets_uplink, | |
85 octets_downlink, | |
86 packets_uplink, | |
87 packets_downlink ); | |
88 | |
89 R_AT( RAT_OK, (T_ACI_CMD_SRC)sndcpShrdPrm.srcId ) ( AT_CMD_SNCNT ); | |
90 } | |
91 | |
92 | |
93 #if defined(FF_PKTIO) OR defined(FF_TCP_IP) OR defined (FF_PSI) | |
94 /* | |
95 +---------------------------------------------------------------------------+ | |
96 | PROJECT : GSM-F&D (8411) MODULE : CMH_SNDR | | |
97 | STATE : code ROUTINE : PKTIO_SNDCP_connect_dti_cb | | |
98 +---------------------------------------------------------------------------+ | |
99 | |
100 PURPOSE : Callback for connection between PKTIO and SNDCP. | |
101 | |
102 */ | |
103 #ifdef GPRS | |
104 | |
105 GLOBAL BOOL PKTIO_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type) | |
106 { | |
107 U8 cid; | |
108 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL; | |
109 | |
110 TRACE_FUNCTION("PKTIO_SNDCP_connect_dti_cb"); | |
111 | |
112 switch( result_type) | |
113 { | |
114 case DTI_CONN_STATE_DISCONNECTING: | |
115 cid = (U8)gaci_get_cid_over_dti_id(dti_id); | |
116 p_pdp_context_node = pdp_context_find_node_from_cid( cid ); | |
117 if( ! p_pdp_context_node ) | |
118 { | |
119 TRACE_ERROR( "ERROR: PDP context not found, in function psa_smreg_pdp_activate_cnf" ); | |
120 return FALSE; | |
121 } | |
122 | |
123 if( INVALID_CID NEQ cid AND | |
124 PDP_CONTEXT_STATE_ACTIVATING EQ get_state_over_cid(cid) AND | |
125 ( DTI_ENTITY_PKTIO EQ p_pdp_context_node->internal_data.entity_id OR | |
126 DTI_ENTITY_PSI EQ p_pdp_context_node->internal_data.entity_id OR | |
127 DTI_ENTITY_AAA EQ p_pdp_context_node->internal_data.entity_id ) ) | |
128 { | |
129 cmhSM_deactivateAContext(CMD_SRC_NONE, cid); | |
130 set_state_over_cid( cid, PDP_CONTEXT_STATE_DEACTIVATE_NORMAL); | |
131 } | |
132 break; | |
133 case DTI_CONN_STATE_DISCONNECTED: | |
134 case DTI_CONN_STATE_CONNECTING: | |
135 case DTI_CONN_STATE_CONNECTED: | |
136 break ; | |
137 case DTI_CONN_STATE_ERROR: | |
138 /* connection not possible: disconnect SNDCP */ | |
139 dti_cntrl_close_dpath_from_dti_id( dti_id ); | |
140 break; | |
141 case DTI_CONN_STATE_UNKNOWN: | |
142 default: | |
143 TRACE_EVENT("PKTIO_SNDCP_connect_dti_cb call with not awaited value"); | |
144 break; | |
145 } | |
146 return TRUE; | |
147 } | |
148 #endif /* FF_PKTIO OR FF_TCP_IP OR FF_PSI*/ | |
149 | |
150 #endif /* GPRS */ | |
151 | |
152 #ifdef CO_UDP_IP | |
153 /* | |
154 +--------------------------------------------------------------------------+ | |
155 | PROJECT : GSM-F&D (8411) MODULE : CMH_SNDR | | |
156 | STATE : code ROUTINE : IP_SNDCP_connect_dti_cb | | |
157 +--------------------------------------------------------------------------+ | |
158 | |
159 PURPOSE : Callback for connection between IP Server and SNDCP. | |
160 | |
161 */ | |
162 | |
163 GLOBAL BOOL IP_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type) | |
164 { | |
165 TRACE_FUNCTION("IP_SNDCP_connect_dti_cb"); | |
166 | |
167 switch( result_type) | |
168 { | |
169 case DTI_CONN_STATE_DISCONNECTING: | |
170 case DTI_CONN_STATE_CONNECTED: | |
171 case DTI_CONN_STATE_CONNECTING: | |
172 break; | |
173 case DTI_CONN_STATE_DISCONNECTED: | |
174 /* Deactivate the context if necessary. */ | |
175 /*cmhUPM_Disable( dti_id );*/ | |
176 break; | |
177 case DTI_CONN_STATE_ERROR: | |
178 /* connection not possible: disconnect SNDCP */ | |
179 TRACE_EVENT("IP_SNDCP_connect_dti_cb connection not possible: disconnect SNDCP"); | |
180 dti_cntrl_close_dpath_from_dti_id( dti_id); | |
181 break; | |
182 case DTI_CONN_STATE_UNKNOWN: | |
183 default: | |
184 TRACE_EVENT("IP_SNDCP_connect_dti_cb call with not awaited value"); | |
185 break; | |
186 } | |
187 return TRUE; | |
188 } | |
189 #endif /* CO_UDP_IP */ | |
190 | |
191 | |
192 #ifdef FF_GPF_TCPIP | |
193 GLOBAL BOOL TCPIP_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type) | |
194 { | |
195 TRACE_FUNCTION("TCPIP_SNDCP_connect_dti_cb"); | |
196 TRACE_EVENT_P1("TCPIP_SNDCP_connect_dti_cb() result = %d",result_type); | |
197 | |
198 switch( result_type) | |
199 { | |
200 case DTI_CONN_STATE_DISCONNECTING: | |
201 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_DISCONNECTING") ; | |
202 break ; | |
203 | |
204 case DTI_CONN_STATE_CONNECTING: | |
205 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_CONNECTING") ; | |
206 break; | |
207 | |
208 case DTI_CONN_STATE_DISCONNECTED: | |
209 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_DISCONNECTED") ; | |
210 dti_cntrl_erase_entry(dti_id); | |
211 { | |
212 T_DCM_STATUS_IND_MSG msg; | |
213 msg.hdr.msg_id = DCM_NEXT_CMD_READY_MSG; | |
214 dcm_send_message(msg, DCM_SUB_WAIT_CGACT_CNF); | |
215 } | |
216 break; | |
217 | |
218 case DTI_CONN_STATE_CONNECTED: | |
219 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_CONNECTED"); | |
220 { | |
221 T_DCM_STATUS_IND_MSG msg; | |
222 msg.hdr.msg_id = DCM_NEXT_CMD_READY_MSG; | |
223 dcm_send_message(msg, DCM_SUB_WAIT_CGACT_CNF); | |
224 } | |
225 break; | |
226 | |
227 case DTI_CONN_STATE_ERROR: | |
228 /* connection not possible: disconnect SNDCP */ | |
229 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb connection not possible: disconnect SNDCP"); | |
230 dti_cntrl_close_dpath_from_dti_id( dti_id); | |
231 break; | |
232 | |
233 case DTI_CONN_STATE_UNKNOWN: | |
234 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_UNKNOWN") ; | |
235 break; | |
236 | |
237 default: | |
238 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb call with not awaited value"); | |
239 break; | |
240 } | |
241 return TRUE; | |
242 } | |
243 #endif /* FF_GPF_TCPIP */ | |
244 | |
245 #endif /* GPRS && DTI*/ |