comparison src/aci2/aci/ati_src_riv.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 : ACI
4 | Modul : ati_src_riv
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 modul ...
18 +-----------------------------------------------------------------------------
19 */
20 #ifndef ATI_SRC_RIV_C
21 #define ATI_SRC_RIV_C
22 #endif
23
24 #ifdef MFW
25 #define ENTITY_MFW
26 #else
27 #ifdef SMI
28 #define ENTITY_SMI
29 #else
30 #define ENTITY_ACI
31 #endif
32 #endif
33
34 #define ACI_MEMBER
35
36 #include "aci_all.h"
37 #include "pei.h"
38 #include "dti.h" /* functionality of the dti library */
39 #include "aci.h"
40 #include "line_edit.h"
41 #include "aci_cmh.h"
42 #include "ati_cmd.h"
43 #include "aci_cmd.h"
44
45 #include "aci_lst.h"
46 #include "aci_mem.h"
47
48 #include "dti_conn_mng.h"
49 #include "dti_cntrl_mng.h"
50
51 #include "psa.h"
52 #include "cmh.h"
53
54 #include "psa_uart.h"
55 #include "ati_io.h"
56 #include "aci_io.h"
57
58 #include "psa_aaa.h"
59 #include "ati_src_riv.h"
60 #include "ati_src_uart.h"
61
62
63 EXTERN T_ACI_LIST *ati_src_list;
64
65 /*
66 +-----------------------------------------------------------------------+
67 | PROJECT : GSM-F&D (8411) MODULE : ati_src_riv |
68 | STATE : code ROUTINE : ati_src_riv_open_port |
69 +-----------------------------------------------------------------------+
70
71 PURPOSE : - port_number = dev_no
72 */
73 GLOBAL UBYTE ati_src_riv_open_port (UBYTE port_number, UBYTE sub_no, UBYTE capability )
74 {
75 UBYTE src_id = DTI_SRC_ID_NOTPRESENT;
76 UBYTE dti_id = DTI_DTI_ID_NOTPRESENT;
77 T_DTI_ENTITY_ID dev_id = DTI_ENTITY_AAA ; /* id(name) of device = RIV */
78 UBYTE dev_no = port_number; /* instance of device */
79 T_ATI_SRC_PARAMS *src_params = NULL;
80 T_DTI_CNTRL *info = NULL;
81
82 TRACE_FUNCTION("ati_src_riv_open_port()");
83
84 ACI_MALLOC (info, sizeof (T_DTI_CNTRL));
85 /*
86 * if dti_cntrl_get_info_from_dev_id() returns with TRUE means
87 * that the port_number is already in use, so deny this request
88 */
89 if (dti_cntrl_get_info_from_dev_id (dev_id, dev_no, sub_no, info) EQ FALSE)
90 {
91 if (BITFIELD_CHECK (capability, DTI_CPBLTY_CMD))
92 {
93 if (src_id NEQ 0)
94 {
95 T_LEDIT line;
96
97 src_id = ati_init (ATI_SRC_TYPE_RIV, riv_src_result_cb, riv_src_line_state_cb);
98 ati_switch_mode(src_id, ATI_CMD_MODE);
99
100 src_params = find_element (ati_src_list, src_id, search_ati_src_id);
101
102 /*
103 * tell line edit that the line termination for Rivera is not default '\r'
104 */
105 line.S3 = 0x00; /* Rivera terminates cmd line with NULL */
106 line.S4 = 0x0A; /* LF default value */
107 line.S5 = 0x08; /* BS default value */
108 line.smsEnd = 0x00; /* Rivera does not terminate a SMS with Ctrl-Z, but NULL */
109 line.atE = 0;
110 ati_user_output_cfg[src_params->src_id].atE = 0;
111
112 ledit_set_config (src_params->src_id, line);
113
114 if (dti_cntrl_new_device (src_id, (UBYTE)dev_id, dev_no, sub_no, port_number, capability, DTI_DRIVER_ID_NOTPRESENT, DTI_DIO_ID_NOTPRESENT))
115 {
116 if (dti_cntrl_get_info_from_src_id (src_id, info))
117 {
118 dti_id = info->dti_id;
119 }
120 else
121 {
122 TRACE_EVENT_P2("[ERR] no info available for port_number/src_id: %d/%d", port_number, src_id);
123 }
124 }
125 else
126 {
127 TRACE_EVENT_P1("[ERR] no dti_id available for port_number: %d", port_number);
128 }
129 }
130 else
131 {
132 TRACE_EVENT_P1("[ERR] no srd_id available for port_number: %d", port_number);
133 }
134 }
135 else
136 {
137 TRACE_EVENT_P1("[ERR] device with port_number: %d has no AT cmd capability", port_number);
138 }
139 }
140 else
141 {
142 TRACE_EVENT_P1("[ERR] port_number: %d already in use", port_number);
143 }
144
145 if ((src_id NEQ DTI_SRC_ID_NOTPRESENT) AND (dti_id NEQ DTI_DTI_ID_NOTPRESENT))
146 {
147 TRACE_EVENT_P3("port = %d, src_id = %d, dti_id = %d", port_number, src_id, dti_id);
148 }
149
150 ACI_MFREE(info);
151
152 return (dti_id);
153 }
154
155 /*
156 +-----------------------------------------------------------------------+
157 | PROJECT : GSM-F&D (8411) MODULE : ati_src_riv |
158 | STATE : code ROUTINE : ati_src_riv_close_port|
159 +-----------------------------------------------------------------------+
160
161 PURPOSE : -
162 */
163 GLOBAL void ati_src_riv_close_port (UBYTE port_number, UBYTE sub_no)
164 {
165 UBYTE src_id = DTI_SRC_ID_NOTPRESENT;
166 T_DTI_ENTITY_ID dev_id = DTI_ENTITY_AAA ; /* id(name) of device = RIV */
167 UBYTE dev_no = port_number; /* instance of device */
168 T_DTI_CNTRL *info = NULL;
169
170 TRACE_FUNCTION("ati_src_riv_close_port");
171
172 ACI_MALLOC (info, sizeof (T_DTI_CNTRL));
173
174 if (dti_cntrl_get_info_from_dev_id (dev_id, dev_no, sub_no, info))
175 {
176 src_id = info->src_id;
177
178 ati_finit (src_id);
179
180 dti_cntrl_erase_entry (info->dti_id);
181
182 TRACE_EVENT_P1("Source nb %d deleted", src_id);
183 }
184 else
185 {
186 TRACE_EVENT_P1("there is no info to port_number %d", port_number);
187 }
188
189 ACI_MFREE(info);
190 }
191
192 /*
193 +----------------------------------------------------------------------+
194 | PROJECT : GSM-F&D (8411) MODULE : ati_src_riv |
195 | STATE : code ROUTINE : ati_src_riv_proc_cmd |
196 +----------------------------------------------------------------------+
197
198 PURPOSE : -
199 */
200 GLOBAL BOOL ati_src_riv_proc_cmd (T_AAA_CMD_REQ *cmd)
201 {
202 UBYTE src_id = DTI_SRC_ID_NOTPRESENT;
203 T_DTI_ENTITY_ID dev_id = DTI_ENTITY_AAA; /* id(name) of device = RIV */
204 UBYTE dev_no = cmd->port_number; /* instance of device */
205 UBYTE sub_no = cmd->sub_no; /* multiplexed channel of device */
206 T_DTI_CNTRL info;
207 T_ATI_SRC_PARAMS *src_params = NULL;
208
209 //ACI_MALLOC (info, sizeof (T_DTI_CNTRL));
210
211 if (dti_cntrl_get_info_from_dev_id (dev_id, dev_no, sub_no, &info))
212 {
213 src_id = info.src_id;
214 src_params = find_element (ati_src_list, src_id, search_ati_src_id);
215
216 //ACI_MFREE (info);
217 TRACE_EVENT_P1("AT command: %s", cmd->cmd_seq);
218
219 if (src_params->text_mode EQ CMD_MODE)
220 {
221 TRACE_FUNCTION ("ati_src_riv_proc_cmd(): CMD MODE");
222 }
223 else
224 {
225 TRACE_FUNCTION ("ati_src_riv_proc_cmd(): TEXT MODE");
226 }
227 #ifdef _SIMULATION_
228 return (ati_execute (src_id, cmd->cmd_seq, (USHORT)(cmd->cmd_len+1)));
229 #else
230 return (ati_execute (src_id, cmd->cmd_seq, cmd->cmd_len));
231 #endif
232 }
233 else
234 {
235 TRACE_EVENT_P1("ati_src_riv_proc_cmd(): there is no info to port_number %d", cmd->port_number);
236 }
237
238 //ACI_MFREE (info);
239 return (FALSE);
240 }
241
242 /*
243 +-------------------------------------------------------------------+
244 | PROJECT : GSM-F&D (8411) MODULE : ati_src_riv |
245 | STATE : code ROUTINE : riv_src_result_cb |
246 +-------------------------------------------------------------------+
247
248 PURPOSE : -
249 */
250 GLOBAL void riv_src_result_cb (UBYTE src_id,
251 T_ATI_OUTPUT_TYPE output_type,
252 UBYTE *output,
253 USHORT output_len)
254 {
255 UBYTE port_number = 0xFF;
256 UBYTE sub_no = 0xFF;
257 T_DTI_CNTRL *info = NULL;
258
259 TRACE_FUNCTION("riv_src_result_cb()");
260
261 ACI_MALLOC (info, sizeof (T_DTI_CNTRL));
262
263 if (dti_cntrl_get_info_from_src_id (src_id, info))
264 {
265 port_number = info->dev_no;
266 sub_no = info->sub_no;
267 ACI_MFREE(info);
268
269 if (IS_INDICATION_OUTPUT(output_type))
270 {
271 psaAAA_ures_ind (port_number, sub_no, output_len, output);
272 return;
273 }
274
275 if (IS_CONFIRM_OUTPUT(output_type))
276 {
277 psaAAA_cmd_cnf (port_number, sub_no, output_len, output);
278 return;
279 }
280
281 if (IS_NORMAL_OUTPUT(output_type))
282 {
283 psaAAA_pres_ind (port_number, sub_no, output_len, output);
284 return;
285 }
286 }
287 else
288 {
289 ACI_MFREE(info);
290 TRACE_EVENT("riv_src_result_cb(): did not get port_number or unknown output_type !");
291 }
292 }
293
294 /*
295 +-----------------------------------------------------------------------+
296 | PROJECT : GSM-F&D (8411) MODULE : ati_src_riv |
297 | STATE : code ROUTINE : riv_src_line_state_cb |
298 +-----------------------------------------------------------------------+
299
300 PURPOSE : - this is just a dummy function to match
301 the function parameters of ati_init()
302 */
303 GLOBAL void riv_src_line_state_cb (UBYTE src_id,
304 T_ATI_LINE_STATE_TYPE line_state_type,
305 ULONG line_state_param)
306 {
307 }
308
309
310 /*
311 +-----------------------------------------------------------------------+
312 | PROJECT : GSM-F&D (8411) MODULE : ati_src_riv |
313 | STATE : code ROUTINE : ati_riv_src_dti_rsp |
314 +-----------------------------------------------------------------------+
315
316 PURPOSE : -
317 */
318 GLOBAL void ati_src_riv_dti_rsp (ULONG link_id)
319 {
320 #ifndef FF_ESIM
321 dti_cntrl_connect_after_aaa_dti_rsp(EXTRACT_DTI_ID(link_id)) ;
322 dti_cntrl_entity_connected (link_id, DTI_ENTITY_AAA, DTI_OK);
323 #endif
324 }
325
326 /*
327 +-----------------------------------------------------------------------+
328 | PROJECT : GSM-F&D (8411) MODULE : ati_src_riv |
329 | STATE : code ROUTINE : ati_riv_src_disconnect_rsp |
330 +-----------------------------------------------------------------------+
331
332 PURPOSE : -
333 */
334 GLOBAL void ati_src_riv_disconnect_rsp (ULONG link_id)
335 {
336 /* T_DTI_CNTRL dti_cntr; */
337
338 /* if(dti_cntrl_get_info_from_dti_id(EXTRACT_DTI_ID(link_id), &dti_cntr)) */
339 /* { */
340 /* R_AT( RAT_OK, dti_cntr.src_id ) ( AT_CMD_CGACT ); */
341 /* } */
342
343 dti_cntrl_entity_disconnected (link_id, DTI_ENTITY_AAA);
344 }
345