FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/aci/cmh_uartr.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_UARTR | |
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 : | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #include "config.h" | |
22 #include "fixedconf.h" | |
23 #include "condat-features.h" | |
24 #include "aci_conf.h" | |
25 | |
26 #ifdef UART | |
27 | |
28 #ifndef CMH_UARTR_C | |
29 #define CMH_UARTR_C | |
30 #endif | |
31 | |
32 #include "aci_all.h" | |
33 /*==== INCLUDES ===================================================*/ | |
34 #include "aci_cmh.h" | |
35 #include "ati_cmd.h" | |
36 #include "aci_cmd.h" | |
37 #include "dti.h" /* functionality of the dti library */ | |
38 #include "dti_conn_mng.h" | |
39 #include "dti_cntrl_mng.h" | |
40 | |
41 | |
42 #include "aci_io.h" | |
43 | |
44 #include "psa_uart.h" | |
45 | |
46 #include "aci_lst.h" | |
47 #include "cmh_uart.h" | |
48 #include "gaci.h" | |
49 | |
50 | |
51 #include "psa.h" | |
52 #ifdef FAX_AND_DATA | |
53 #include "aci_fd.h" | |
54 #endif | |
55 #include "cmh.h" | |
56 | |
57 #include "aci_mem.h" | |
58 | |
59 #include "psa_l2r.h" | |
60 #include "cmh_sm.h" | |
61 | |
62 EXTERN T_ACI_UART_MUX_PARMS holdMuxParms; | |
63 | |
64 /*==== CONSTANTS ==================================================*/ | |
65 | |
66 /*==== EXPORT =====================================================*/ | |
67 | |
68 /*==== VARIABLES ==================================================*/ | |
69 | |
70 /*==== FUNCTIONS ==================================================*/ | |
71 | |
72 /* | |
73 +-------------------------------------------------------------------+ | |
74 | PROJECT : GSM-PS (6147) MODULE : PSA_UART | | |
75 | ROUTINE : cmhUART_ParmsUpdated | | |
76 +-------------------------------------------------------------------+ | |
77 | |
78 PURPOSE : . | |
79 | |
80 */ | |
81 | |
82 GLOBAL void cmhUART_ParmsUpdated( UBYTE device ) | |
83 { | |
84 T_ACI_DTI_PRC *src_infos = NULL; | |
85 T_ACI_DEVICE_TYPE curr_device_type; | |
86 T_ACI_UART_MUX_PARMS *MuxParms; | |
87 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_ACI}; | |
88 | |
89 TRACE_FUNCTION("cmhUART_ParmsUpdated"); | |
90 | |
91 src_infos = cmhUART_find_dlci (uart_src_params, | |
92 device, | |
93 UART_DLCI_NOT_MULTIPLEXED); | |
94 | |
95 if (src_infos EQ NULL) | |
96 { | |
97 TRACE_EVENT ("Error: wrong device number"); | |
98 return; | |
99 } | |
100 | |
101 curr_device_type = cmhUART_GetDeviceType (src_infos->srcId); | |
102 | |
103 if (curr_device_type EQ DEVICE_TYPE_URT) | |
104 { | |
105 switch ( uartEntcurCmd[src_infos->srcId] ) | |
106 { | |
107 case AT_CMD_IPR: | |
108 /* do not send OK: this has been done at the beginning */ | |
109 TRACE_EVENT("IPR successfully processed"); | |
110 break; | |
111 | |
112 case AT_CMD_ICF: | |
113 case AT_CMD_IFC: | |
114 #ifdef FF_FAX | |
115 case AT_CMD_FLO: | |
116 #endif | |
117 R_AT( RAT_OK, (T_ACI_CMD_SRC)src_infos->srcId )( uartEntcurCmd[src_infos->srcId] ); | |
118 break; | |
119 | |
120 default: | |
121 #ifdef DTI | |
122 /* request of a DTI channel to communicate with UART */ | |
123 dti_cntrl_est_dpath_indirect ( src_infos->srcId, | |
124 entity_list, | |
125 1, | |
126 SPLIT, | |
127 atiUART_dti_cb, | |
128 DTI_CPBLTY_CMD, | |
129 DTI_CID_NOTPRESENT); | |
130 #endif | |
131 break; | |
132 } | |
133 /* reinitialize */ | |
134 uartEntcurCmd[src_infos->srcId] = AT_CMD_NONE; | |
135 } | |
136 else if (curr_device_type EQ DEVICE_TYPE_UNKNOWN) | |
137 { | |
138 MuxParms = src_infos->MuxParms; | |
139 if( MuxParms EQ NULL ) | |
140 { | |
141 TRACE_EVENT("Multiplexer could not be initialized: wrong parameters"); | |
142 return; | |
143 } | |
144 | |
145 psaUART_StartMux( device, | |
146 MuxParms->mode, | |
147 MuxParms->subset, | |
148 MuxParms->N1, | |
149 MuxParms->T1, | |
150 MuxParms->N2, | |
151 MuxParms->T2, | |
152 MuxParms->T3); | |
153 | |
154 memcpy( (CHAR *)&holdMuxParms, (CHAR *)src_infos->MuxParms, sizeof(T_ACI_UART_MUX_PARMS)); | |
155 ACI_MFREE( MuxParms ); | |
156 src_infos->MuxParms = NULL; | |
157 } | |
158 else | |
159 { | |
160 TRACE_EVENT("Multiplexer could not be initialized: wrong state"); | |
161 } | |
162 } | |
163 | |
164 /* | |
165 +-------------------------------------------------------------------+ | |
166 | PROJECT : GSM-PS (6147) MODULE : PSA_UART | | |
167 | ROUTINE : cmhUART_DetectedESC_DTR | | |
168 +-------------------------------------------------------------------+ | |
169 | |
170 PURPOSE : . | |
171 | |
172 */ | |
173 | |
174 GLOBAL void cmhUART_DetectedESC_DTR( UBYTE device, UBYTE dlci, UBYTE cause ) | |
175 { | |
176 T_DTI_ENTITY_ID peer_id; | |
177 | |
178 T_ACI_DTI_PRC* src_infos = NULL; | |
179 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_ACI}; | |
180 | |
181 TRACE_FUNCTION("cmhUART_DetectedESC_DTR()"); | |
182 | |
183 uartShrdPrm.dtr_clearcall = FALSE; | |
184 uartShrdPrm.escape_seq = cause; | |
185 | |
186 src_infos = cmhUART_find_dlci (uart_src_params, | |
187 device, | |
188 dlci); | |
189 | |
190 if (src_infos EQ NULL) | |
191 { | |
192 TRACE_EVENT("[ERR] Wrong dlci"); | |
193 return; | |
194 } | |
195 | |
196 /* escape sequence detected */ | |
197 if ((cause EQ UART_DETECT_ESC) OR | |
198 ((cause EQ UART_DETECT_DTR) AND | |
199 ((uartShrdPrm.dtr_behaviour EQ DTR_BEHAVIOUR_CommandMode) OR | |
200 (uartShrdPrm.dtr_behaviour EQ DTR_BEHAVIOUR_ClearCall)) )) | |
201 { | |
202 #ifdef DTI | |
203 peer_id = dti_cntrl_get_peer( DTI_ENTITY_UART, device, dlci ); | |
204 if ( (uartShrdPrm.dtr_behaviour EQ DTR_BEHAVIOUR_ClearCall) AND | |
205 (cause EQ UART_DETECT_DTR) AND | |
206 ( (peer_id EQ DTI_ENTITY_TRA) | |
207 OR (peer_id EQ DTI_ENTITY_L2R) | |
208 /* OR (peer_id EQ DTI_ENTITY_ACI) don't disconnect if we are currently in CMD-Mode, | |
209 otherwise this would kill the next call attempt */ | |
210 OR (peer_id EQ DTI_ENTITY_PPPS) /* also drop PPP sessions */ | |
211 OR (peer_id EQ DTI_ENTITY_PPPC) | |
212 ) ) | |
213 { | |
214 TRACE_EVENT("uartShrdPrm.dtr_clearcall = TRUE"); | |
215 uartShrdPrm.dtr_clearcall = TRUE; /* this is only for CSD (TRA, L2R) */ | |
216 } | |
217 /* | |
218 * Inform the relevant CMH or close the user plane. | |
219 */ | |
220 switch ( peer_id ) | |
221 { | |
222 | |
223 #if defined FAX_AND_DATA | |
224 case ( DTI_ENTITY_L2R ): | |
225 { | |
226 psaL2R_ESC ( src_infos->srcId ); | |
227 break; | |
228 } | |
229 #endif /* FAX_AND_DATA */ | |
230 | |
231 #if defined GPRS | |
232 case ( DTI_ENTITY_PPPS ): | |
233 { | |
234 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = pdp_context_find_node_from_dti_id ( EXTRACT_DTI_ID( dti_cntrl_get_link_id( DTI_ENTITY_UART, device, dlci ) ) ); | |
235 if( !p_pdp_context_node ) | |
236 { | |
237 TRACE_EVENT("ERROR: PDP context not defined"); | |
238 return; | |
239 } | |
240 cmhSM_deactivateAContext(CMD_SRC_NONE, p_pdp_context_node->cid); | |
241 break; | |
242 } | |
243 #endif /* GPRS */ | |
244 default: | |
245 { | |
246 dti_cntrl_est_dpath_indirect ( src_infos->srcId, | |
247 entity_list, | |
248 1, | |
249 SPLIT, | |
250 atiUART_dti_cb, | |
251 DTI_CPBLTY_CMD, | |
252 DTI_CID_NOTPRESENT); | |
253 break; | |
254 } | |
255 } | |
256 #endif | |
257 } | |
258 /* DTR line of serial link drops */ | |
259 else if (cause EQ UART_DETECT_DTR) | |
260 { | |
261 if (uartShrdPrm.dtr_behaviour EQ DTR_BEHAVIOUR_Ignore) | |
262 { | |
263 TRACE_EVENT("DCE ignores DTR"); | |
264 } | |
265 else | |
266 { | |
267 TRACE_EVENT("[ERR] Wrong dtr_behaviour value"); | |
268 } | |
269 } | |
270 else | |
271 { | |
272 TRACE_EVENT("[ERR] Wrong cause value in UART_DETECTED_IND"); | |
273 } | |
274 } | |
275 | |
276 #endif /* UART */ |