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