FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/aci_bat_bas.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 : GSM-F&D (8411) | |
4 | Modul : ACI_BAT | |
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 BAT wrapper modul is ... | |
18 | | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #include "aci_all.h" /* includes prim.h, which includes p_bat.h */ | |
23 #include "aci_cmh.h" /* prototypes of sAT_,qAT_,tAT_ */ | |
24 #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */ | |
25 #include "aci_bat.h" | |
26 #include "pwr.h" /* see sBAT_PlusCBC() */ | |
27 #include "audio.h" /* see sBAT_PlusCLVL(), qBAT_PlusCLVL() */ | |
28 #include "pcm.h" /* see aciBatPrcsPlusCG() */ | |
29 | |
30 LOCAL T_ACI_BAT_RSLT aciBatPrcsPlusCG (UBYTE *rc, USHORT *le, size_t ml, CHAR *ef); | |
31 | |
32 /* | |
33 +--------------------------------------------------------------------+ | |
34 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
35 | STATE : code ROUTINE : BAT_Z | | |
36 +--------------------------------------------------------------------+ | |
37 | |
38 PURPOSE : | |
39 */ | |
40 GLOBAL T_ACI_BAT_RSLT BAT_Z (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
41 T_BAT_cmd_send *cmd) | |
42 { | |
43 T_ACI_BAT_RSLT ret; | |
44 | |
45 TRACE_FUNCTION ("BAT_Z()"); | |
46 | |
47 ret=(T_ACI_BAT_RSLT)sAT_Z((T_ACI_CMD_SRC)src_infos_psi->srcId,0); | |
48 | |
49 return(ret); | |
50 } | |
51 | |
52 | |
53 /* | |
54 +--------------------------------------------------------------------+ | |
55 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
56 | STATE : code ROUTINE : sBAT_PlusCPAS | | |
57 +--------------------------------------------------------------------+ | |
58 | |
59 PURPOSE : | |
60 */ | |
61 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPAS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
62 T_BAT_cmd_send *cmd) | |
63 { | |
64 T_ACI_BAT_RSLT ret; | |
65 T_ACI_CPAS_PAS pas; | |
66 | |
67 TRACE_FUNCTION ("sBAT_PlusCPAS()"); | |
68 | |
69 /* | |
70 * The ACI has implemented the 'set' operation of +CPAS as a qAT function. | |
71 */ | |
72 ret=(T_ACI_BAT_RSLT)qAT_PlusCPAS((T_ACI_CMD_SRC)src_infos_psi->srcId,&pas); | |
73 | |
74 if (ret EQ ACI_BAT_CMPL) | |
75 { | |
76 T_BAT_cmd_response resp; | |
77 T_BAT_res_set_plus_cpas cpas_data; | |
78 | |
79 resp.ctrl_response=BAT_RES_SET_PLUS_CPAS; | |
80 resp.response.ptr_set_plus_cpas=&cpas_data; | |
81 | |
82 /* | |
83 * This relies on T_BAT_plus_cpas_pas being identical to | |
84 * T_ACI_CPAS_PAS. They aren't quite the same, the BAT version | |
85 * doesn't have a 'not present' value, but as the parameter in | |
86 * question is mandatory this shouldn't be a problem. | |
87 */ | |
88 cpas_data.pas=(T_BAT_plus_cpas_pas)pas; | |
89 | |
90 aci_bat_send(src_infos_psi,&resp); | |
91 } | |
92 | |
93 return(ret); | |
94 } | |
95 | |
96 /* | |
97 +--------------------------------------------------------------------+ | |
98 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
99 | STATE : code ROUTINE : BAT_ANDC | | |
100 +--------------------------------------------------------------------+ | |
101 | |
102 PURPOSE : | |
103 */ | |
104 GLOBAL T_ACI_BAT_RSLT BAT_ANDC (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
105 T_BAT_cmd_send *cmd) | |
106 { | |
107 T_ACI_BAT_RSLT ret; | |
108 T_ACI_DCD_MOD dcd; | |
109 | |
110 TRACE_FUNCTION ("BAT_ANDC()"); | |
111 | |
112 /* | |
113 * This relies on T_BAT_andc_value being identical to | |
114 * T_ACI_DCD_MOD. | |
115 */ | |
116 dcd=(T_ACI_DCD_MOD)cmd->params.ptr_andc->value; | |
117 | |
118 /* | |
119 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
120 * assumed to be equivalent to T_ACI_RESULT. | |
121 */ | |
122 ret=(T_ACI_BAT_RSLT)sAT_AndC((T_ACI_CMD_SRC)src_infos_psi->srcId,dcd); | |
123 | |
124 return(ret); | |
125 } | |
126 | |
127 /* | |
128 +--------------------------------------------------------------------+ | |
129 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
130 | STATE : code ROUTINE : BAT_ANDF | | |
131 +--------------------------------------------------------------------+ | |
132 | |
133 PURPOSE : | |
134 */ | |
135 GLOBAL T_ACI_BAT_RSLT BAT_ANDF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
136 T_BAT_cmd_send *cmd) | |
137 { | |
138 T_ACI_BAT_RSLT ret; | |
139 | |
140 TRACE_FUNCTION ("BAT_ANDF()"); | |
141 | |
142 /* | |
143 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
144 * assumed to be equivalent to T_ACI_RESULT. | |
145 */ | |
146 ret=(T_ACI_BAT_RSLT)sAT_AndF((T_ACI_CMD_SRC)src_infos_psi->srcId,0); | |
147 | |
148 return(ret); | |
149 } | |
150 | |
151 /* | |
152 +--------------------------------------------------------------------+ | |
153 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
154 | STATE : code ROUTINE : sBAT_PlusCSQ | | |
155 +--------------------------------------------------------------------+ | |
156 | |
157 PURPOSE : | |
158 */ | |
159 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSQ (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
160 T_BAT_cmd_send *cmd) | |
161 { | |
162 T_ACI_BAT_RSLT ret; | |
163 UBYTE rssi; | |
164 UBYTE ber; | |
165 UBYTE actlevel; | |
166 #ifdef FF_PS_RSSI | |
167 UBYTE min_access_level; | |
168 #endif | |
169 | |
170 TRACE_FUNCTION ("sBAT_PlusCSQ()"); | |
171 | |
172 /* | |
173 * The ACI has implemented the 'set' operation of +CSQ as a qAT function. | |
174 * There isn't a separate qAT_PlusCSQ() function, so we must use the | |
175 * 'percent' version and ignore the extra 'actlevel' and min_access_level | |
176 * value returned. | |
177 */ | |
178 #ifdef FF_PS_RSSI | |
179 ret=(T_ACI_BAT_RSLT)qAT_PercentCSQ((T_ACI_CMD_SRC)src_infos_psi->srcId, | |
180 &rssi, | |
181 &ber, | |
182 &actlevel, | |
183 &min_access_level); | |
184 #else | |
185 ret=(T_ACI_BAT_RSLT)qAT_PercentCSQ(src_infos_psi->srcId,&rssi,&ber,&actlevel); | |
186 #endif | |
187 | |
188 if (ret EQ ACI_BAT_CMPL) | |
189 { | |
190 T_BAT_cmd_response resp; | |
191 T_BAT_res_set_plus_csq csq_data; | |
192 | |
193 resp.ctrl_response=BAT_RES_SET_PLUS_CSQ; | |
194 resp.response.ptr_set_plus_csq=&csq_data; | |
195 | |
196 csq_data.rssi=(U8)rssi; | |
197 csq_data.ber=(U8)ber; | |
198 | |
199 aci_bat_send(src_infos_psi,&resp); | |
200 } | |
201 | |
202 return(ret); | |
203 } | |
204 | |
205 /* | |
206 +--------------------------------------------------------------------+ | |
207 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
208 | STATE : code ROUTINE : sBAT_PercentCSQ | | |
209 +--------------------------------------------------------------------+ | |
210 | |
211 PURPOSE : | |
212 */ | |
213 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCSQ (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
214 T_BAT_cmd_send *cmd) | |
215 { | |
216 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
217 | |
218 TRACE_FUNCTION ("sBAT_PercentCSQ()"); | |
219 | |
220 ret = (T_ACI_BAT_RSLT)sAT_PercentCSQ ((T_ACI_CMD_SRC)src_infos_psi->srcId, | |
221 (T_ACI_CSQ_MODE)cmd->params.ptr_set_percent_csq->csq_mode); | |
222 | |
223 if (ret EQ ACI_BAT_CMPL) | |
224 { | |
225 T_BAT_cmd_response resp; | |
226 T_BAT_res_set_percent_csq csq_data; | |
227 | |
228 resp.ctrl_response = BAT_RES_SET_PERCENT_CSQ; | |
229 resp.response.ptr_set_percent_csq = &csq_data; | |
230 | |
231 csq_data.csq_mode = cmd->params.ptr_set_percent_csq->csq_mode; | |
232 | |
233 aci_bat_send(src_infos_psi,&resp); | |
234 } | |
235 | |
236 return(ret); | |
237 } | |
238 | |
239 /* | |
240 +--------------------------------------------------------------------+ | |
241 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
242 | STATE : code ROUTINE : qBAT_PercentCSQ | | |
243 +--------------------------------------------------------------------+ | |
244 | |
245 PURPOSE : | |
246 */ | |
247 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCSQ (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
248 T_BAT_cmd_send *cmd) | |
249 { | |
250 T_ACI_BAT_RSLT ret; | |
251 UBYTE rssi; | |
252 UBYTE ber; | |
253 UBYTE actlevel; | |
254 #ifdef FF_PS_RSSI | |
255 UBYTE min_access_level; | |
256 #endif | |
257 | |
258 TRACE_FUNCTION ("qBAT_PercentCSQ()"); | |
259 | |
260 /* | |
261 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
262 * assumed to be equivalent to T_ACI_RESULT. | |
263 */ | |
264 #ifdef FF_PS_RSSI | |
265 ret=(T_ACI_BAT_RSLT)qAT_PercentCSQ((T_ACI_CMD_SRC)src_infos_psi->srcId, | |
266 &rssi, | |
267 &ber, | |
268 &actlevel, | |
269 &min_access_level); | |
270 #else | |
271 ret=(T_ACI_BAT_RSLT)qAT_PercentCSQ(src_infos_psi->srcId,&rssi,&ber,&actlevel); | |
272 #endif | |
273 | |
274 if (ret EQ ACI_BAT_CMPL) | |
275 { | |
276 T_BAT_cmd_response resp; | |
277 T_BAT_res_que_percent_csq csq_data; | |
278 | |
279 resp.ctrl_response=BAT_RES_QUE_PERCENT_CSQ; | |
280 resp.response.ptr_que_percent_csq=&csq_data; | |
281 | |
282 csq_data.rssi=(U8)rssi; | |
283 csq_data.ber=(U8)ber; | |
284 csq_data.actlevel=(U8)actlevel; | |
285 | |
286 #ifdef FF_PS_RSSI | |
287 csq_data.min_access_level = (U8)min_access_level; | |
288 #endif | |
289 | |
290 aci_bat_send(src_infos_psi,&resp); | |
291 } | |
292 | |
293 return(ret); | |
294 } | |
295 | |
296 /* | |
297 +--------------------------------------------------------------------+ | |
298 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
299 | STATE : code ROUTINE : sBAT_PlusCBC | | |
300 +--------------------------------------------------------------------+ | |
301 | |
302 PURPOSE : | |
303 */ | |
304 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCBC (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
305 T_BAT_cmd_send *cmd) | |
306 { | |
307 pwr_Status_Type powerStat; | |
308 T_BAT_cmd_response resp; | |
309 T_BAT_res_set_plus_cbc cbc_data; | |
310 | |
311 TRACE_FUNCTION("sBAT_PlusCBC()"); | |
312 | |
313 /* | |
314 * There is no equivalent ACI function, so we must handle this | |
315 * within BAT. This code is adapted from the ATI function | |
316 * atPlusCBC(). | |
317 */ | |
318 | |
319 if (pwr_GetStatus(&powerStat) NEQ DRV_OK) | |
320 { | |
321 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
322 return(ACI_BAT_FAIL); | |
323 } | |
324 | |
325 resp.ctrl_response=BAT_RES_SET_PLUS_CBC; | |
326 resp.response.ptr_set_plus_cbc=&cbc_data; | |
327 | |
328 switch(powerStat.Status) | |
329 { | |
330 case PWR_EXTPOWER_ON: | |
331 cbc_data.bsc=BAT_CBC_BSC_NOBATTERY; | |
332 break; | |
333 | |
334 case PWR_CHARGER_ON: | |
335 cbc_data.bsc=BAT_CBC_BSC_BATTERY; | |
336 break; | |
337 | |
338 default: | |
339 cbc_data.bsc=BAT_CBC_BSC_BATTERYPOWERED; | |
340 break; | |
341 } | |
342 | |
343 cbc_data.bcl=(T_BAT_plus_cbc_bcl)powerStat.ChargeLevel; | |
344 | |
345 aci_bat_send(src_infos_psi,&resp); | |
346 | |
347 return(ACI_BAT_CMPL); | |
348 } | |
349 | |
350 /* | |
351 +--------------------------------------------------------------------+ | |
352 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
353 | STATE : code ROUTINE : sBAT_PlusCLVL | | |
354 +--------------------------------------------------------------------+ | |
355 | |
356 PURPOSE : | |
357 */ | |
358 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCLVL (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
359 T_BAT_cmd_send *cmd) | |
360 { | |
361 TRACE_FUNCTION ("sBAT_PlusCLVL()"); | |
362 | |
363 /* | |
364 * There is no equivalent ACI function, so we must handle this | |
365 * within BAT. | |
366 */ | |
367 | |
368 if (audio_SetAmplf(AUDIO_SPEAKER,(UBYTE)cmd->params.ptr_set_plus_clvl->level) NEQ DRV_OK) | |
369 { | |
370 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
371 return(ACI_BAT_FAIL); | |
372 } | |
373 | |
374 return(ACI_BAT_CMPL); | |
375 } | |
376 | |
377 /* | |
378 +--------------------------------------------------------------------+ | |
379 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
380 | STATE : code ROUTINE : qBAT_PlusCLVL | | |
381 +--------------------------------------------------------------------+ | |
382 | |
383 PURPOSE : | |
384 */ | |
385 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCLVL (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
386 T_BAT_cmd_send *cmd) | |
387 { | |
388 UBYTE vol; | |
389 T_BAT_cmd_response resp; | |
390 T_BAT_res_que_plus_clvl clvl_data; | |
391 | |
392 TRACE_FUNCTION ("qBAT_PlusCLVL()"); | |
393 | |
394 /* | |
395 * There is no equivalent ACI function, so we must handle this | |
396 * within BAT. | |
397 */ | |
398 | |
399 if (audio_GetAmplf(AUDIO_MICROPHONE,&vol) NEQ DRV_OK) | |
400 { | |
401 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
402 return(ACI_BAT_FAIL); | |
403 } | |
404 | |
405 resp.ctrl_response=BAT_RES_QUE_PLUS_CLVL; | |
406 resp.response.ptr_que_plus_clvl=&clvl_data; | |
407 | |
408 clvl_data.level=(U8)vol; | |
409 | |
410 aci_bat_send(src_infos_psi,&resp); | |
411 | |
412 return(ACI_BAT_CMPL); | |
413 } | |
414 | |
415 /* | |
416 +--------------------------------------------------------------------+ | |
417 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
418 | STATE : code ROUTINE : sBAT_PlusCMUT | | |
419 +--------------------------------------------------------------------+ | |
420 | |
421 PURPOSE : | |
422 */ | |
423 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMUT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
424 T_BAT_cmd_send *cmd) | |
425 { | |
426 UBYTE mute; | |
427 | |
428 TRACE_FUNCTION ("sBAT_PlusCMUT()"); | |
429 | |
430 /* | |
431 * There is no equivalent ACI function, so we must handle this | |
432 * within BAT. | |
433 */ | |
434 mute=(cmd->params.ptr_set_plus_cmut->n EQ BAT_CMUT_N_ON) ? AUDIO_MUTING_ON:AUDIO_MUTING_OFF; | |
435 | |
436 if(audio_SetMute(AUDIO_MICROPHONE,mute) NEQ DRV_OK) | |
437 { | |
438 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
439 return(ACI_BAT_FAIL); | |
440 } | |
441 | |
442 return(ACI_BAT_CMPL); | |
443 } | |
444 | |
445 /* | |
446 +--------------------------------------------------------------------+ | |
447 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
448 | STATE : code ROUTINE : qBAT_PlusCMUT | | |
449 +--------------------------------------------------------------------+ | |
450 | |
451 PURPOSE : | |
452 */ | |
453 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCMUT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
454 T_BAT_cmd_send *cmd) | |
455 { | |
456 UBYTE mute; | |
457 T_BAT_cmd_response resp; | |
458 T_BAT_res_que_plus_cmut cmut_data; | |
459 | |
460 TRACE_FUNCTION ("qBAT_PlusCMUT()"); | |
461 | |
462 /* | |
463 * There is no equivalent ACI function, so we must handle this | |
464 * within BAT. | |
465 */ | |
466 | |
467 if (audio_GetMute(AUDIO_MICROPHONE,&mute) NEQ DRV_OK) | |
468 { | |
469 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
470 return(ACI_BAT_FAIL); | |
471 } | |
472 | |
473 resp.ctrl_response=BAT_RES_QUE_PLUS_CMUT; | |
474 resp.response.ptr_que_plus_cmut=&cmut_data; | |
475 | |
476 cmut_data.n=(U8)(mute EQ AUDIO_MUTING_ON) ? BAT_CMUT_N_ON:BAT_CMUT_N_OFF; | |
477 | |
478 aci_bat_send(src_infos_psi,&resp); | |
479 | |
480 return(ACI_BAT_CMPL); | |
481 } | |
482 | |
483 /* | |
484 +--------------------------------------------------------------------+ | |
485 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
486 | STATE : code ROUTINE : sBAT_PlusCSCS | | |
487 +--------------------------------------------------------------------+ | |
488 | |
489 PURPOSE : | |
490 */ | |
491 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSCS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
492 T_BAT_cmd_send *cmd) | |
493 { | |
494 T_BAT_plus_cscs_cs cs; | |
495 | |
496 TRACE_FUNCTION ("sBAT_PlusCSCS()"); | |
497 | |
498 /* | |
499 * There is no equivalent ACI function, so we must handle this | |
500 * within BAT. | |
501 */ | |
502 | |
503 cs=cmd->params.ptr_set_plus_cscs->cs; | |
504 | |
505 /* | |
506 * As we are handling this within BAT and not forwarding it to | |
507 * the ACI we should check the input parameter. | |
508 */ | |
509 if ((cs<BAT_CSCS_CS_IRA) || (cs>BAT_CSCS_CS_UCS2)) | |
510 { | |
511 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
512 return(ACI_BAT_FAIL); | |
513 } | |
514 | |
515 aci_bat_cs_set(src_infos_psi,cs); | |
516 | |
517 return(ACI_BAT_CMPL); | |
518 } | |
519 | |
520 /* | |
521 +--------------------------------------------------------------------+ | |
522 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
523 | STATE : code ROUTINE : qBAT_PlusCSCS | | |
524 +--------------------------------------------------------------------+ | |
525 | |
526 PURPOSE : | |
527 */ | |
528 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCSCS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
529 T_BAT_cmd_send *cmd) | |
530 { | |
531 T_BAT_cmd_response resp; | |
532 T_BAT_res_que_plus_cscs cscs_data; | |
533 | |
534 TRACE_FUNCTION ("qBAT_PlusCSCS()"); | |
535 | |
536 /* | |
537 * There is no equivalent ACI function, so we must handle this | |
538 * within BAT. | |
539 */ | |
540 | |
541 resp.ctrl_response=BAT_RES_QUE_PLUS_CSCS; | |
542 resp.response.ptr_que_plus_cscs=&cscs_data; | |
543 | |
544 cscs_data.cs=aci_bat_cs_get(src_infos_psi); | |
545 | |
546 aci_bat_send(src_infos_psi,&resp); | |
547 | |
548 return(ACI_BAT_CMPL); | |
549 } | |
550 | |
551 /* | |
552 +--------------------------------------------------------------------+ | |
553 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
554 | STATE : code ROUTINE : sBAT_PercentCCBS | | |
555 +--------------------------------------------------------------------+ | |
556 | |
557 PURPOSE : | |
558 */ | |
559 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCCBS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
560 T_BAT_cmd_send *cmd) | |
561 { | |
562 T_ACI_BAT_RSLT ret; | |
563 SHORT idx; | |
564 | |
565 TRACE_FUNCTION ("sBAT_PercentCCBS()"); | |
566 | |
567 idx=(SHORT)cmd->params.ptr_set_percent_ccbs->idx; | |
568 | |
569 /* | |
570 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
571 * assumed to be equivalent to T_ACI_RESULT. | |
572 */ | |
573 ret=(T_ACI_BAT_RSLT)sAT_PercentCCBS((T_ACI_CMD_SRC)src_infos_psi->srcId,idx); | |
574 | |
575 return(ret); | |
576 } | |
577 | |
578 /* | |
579 +--------------------------------------------------------------------+ | |
580 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
581 | STATE : code ROUTINE : qBAT_PercentCCBS | | |
582 +--------------------------------------------------------------------+ | |
583 | |
584 PURPOSE : | |
585 */ | |
586 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCCBS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
587 T_BAT_cmd_send *cmd) | |
588 { | |
589 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
590 | |
591 TRACE_FUNCTION ("qBAT_PercentCCBS()"); | |
592 | |
593 ret=(T_ACI_BAT_RSLT)qAT_PercentCCBS((T_ACI_CMD_SRC)src_infos_psi->srcId); | |
594 | |
595 /* | |
596 * qAT_PercentCCBS() never returns AT_CMPL, so we do not send | |
597 * the response here. | |
598 */ | |
599 | |
600 return(ret); | |
601 } | |
602 | |
603 /* | |
604 +--------------------------------------------------------------------+ | |
605 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
606 | STATE : code ROUTINE : sBAT_PlusCMUX | | |
607 +--------------------------------------------------------------------+ | |
608 | |
609 PURPOSE : | |
610 */ | |
611 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMUX (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
612 T_BAT_cmd_send *cmd) | |
613 { | |
614 T_ACI_BAT_RSLT ret; | |
615 T_BAT_cmd_set_plus_cmux *cmux; | |
616 | |
617 TRACE_FUNCTION ("sBAT_PlusCMUX()"); | |
618 | |
619 /* | |
620 * Get a pointer to the CMUX data for convenience. | |
621 */ | |
622 cmux=cmd->params.ptr_set_plus_cmux; | |
623 | |
624 /* | |
625 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
626 * assumed to be equivalent to T_ACI_RESULT. Note that we lose | |
627 * 'k' as it is not in the ACI. | |
628 */ | |
629 ret=(T_ACI_BAT_RSLT)sAT_PlusCMUX( | |
630 (T_ACI_CMD_SRC)src_infos_psi->srcId, | |
631 (UBYTE)cmux->mode, | |
632 (UBYTE)cmux->subset, | |
633 (UBYTE)cmux->port_speed, | |
634 (USHORT)cmux->n1, | |
635 (UBYTE)cmux->t1, | |
636 (UBYTE)cmux->n2, | |
637 (UBYTE)cmux->t2, | |
638 (UBYTE)cmux->t3); | |
639 | |
640 return(ret); | |
641 } | |
642 | |
643 /* | |
644 +--------------------------------------------------------------------+ | |
645 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
646 | STATE : code ROUTINE : qBAT_PlusCMUX | | |
647 +--------------------------------------------------------------------+ | |
648 | |
649 PURPOSE : | |
650 */ | |
651 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCMUX (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
652 T_BAT_cmd_send *cmd) | |
653 { | |
654 TRACE_FUNCTION ("qBAT_PlusCMUX()"); | |
655 | |
656 /* | |
657 * There is no ACI equivalent. | |
658 */ | |
659 return(ACI_BAT_CMPL); | |
660 } | |
661 | |
662 /* | |
663 +--------------------------------------------------------------------+ | |
664 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
665 | STATE : code ROUTINE : sBAT_PlusIPR | | |
666 +--------------------------------------------------------------------+ | |
667 | |
668 PURPOSE : | |
669 */ | |
670 GLOBAL T_ACI_BAT_RSLT sBAT_PlusIPR (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
671 T_BAT_cmd_send *cmd) | |
672 { | |
673 T_ACI_BAT_RSLT ret; | |
674 T_ACI_BD_RATE rate; | |
675 | |
676 TRACE_FUNCTION ("sBAT_PlusIPR()"); | |
677 | |
678 /* | |
679 * This relies on T_ACI_BD_RATE and T_BAT_plus_ipr_rate being | |
680 * identical. In fact the BAT has an extra value, but this should | |
681 * not cause problems as there is a parameter check in | |
682 * sAT_PlusIPR(). | |
683 */ | |
684 rate=(T_ACI_BD_RATE)cmd->params.ptr_set_plus_ipr->rate; | |
685 | |
686 /* | |
687 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
688 * assumed to be equivalent to T_ACI_RESULT. | |
689 */ | |
690 ret=(T_ACI_BAT_RSLT)sAT_PlusIPR((T_ACI_CMD_SRC)src_infos_psi->srcId,rate); | |
691 | |
692 return(ret); | |
693 } | |
694 | |
695 /* | |
696 +--------------------------------------------------------------------+ | |
697 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
698 | STATE : code ROUTINE : qBAT_PlusIPR | | |
699 +--------------------------------------------------------------------+ | |
700 | |
701 PURPOSE : | |
702 */ | |
703 GLOBAL T_ACI_BAT_RSLT qBAT_PlusIPR (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
704 T_BAT_cmd_send *cmd) | |
705 { | |
706 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
707 T_ACI_BD_RATE rate; | |
708 | |
709 TRACE_FUNCTION ("qBAT_PlusIPR()"); | |
710 | |
711 /* | |
712 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
713 * assumed to be equivalent to T_ACI_RESULT. | |
714 */ | |
715 ret=(T_ACI_BAT_RSLT)qAT_PlusIPR((T_ACI_CMD_SRC)src_infos_psi->srcId,&rate); | |
716 | |
717 if (ret EQ ACI_BAT_CMPL) | |
718 { | |
719 T_BAT_cmd_response resp; | |
720 T_BAT_res_que_plus_ipr ipr_data; | |
721 | |
722 resp.ctrl_response=BAT_RES_QUE_PLUS_IPR; | |
723 resp.response.ptr_que_plus_ipr=&ipr_data; | |
724 | |
725 /* | |
726 * This relies on T_ACI_BD_RATE and T_BAT_plus_ipr_rate being | |
727 * identical. In fact the BAT has an extra value, but that is | |
728 * irrelevant in this direction. | |
729 */ | |
730 ipr_data.rate=(T_BAT_plus_ipr_rate)rate; | |
731 | |
732 aci_bat_send(src_infos_psi,&resp); | |
733 } | |
734 | |
735 return(ret); | |
736 } | |
737 | |
738 /* | |
739 +--------------------------------------------------------------------+ | |
740 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
741 | STATE : code ROUTINE : sBAT_PlusICF | | |
742 +--------------------------------------------------------------------+ | |
743 | |
744 PURPOSE : | |
745 */ | |
746 GLOBAL T_ACI_BAT_RSLT sBAT_PlusICF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
747 T_BAT_cmd_send *cmd) | |
748 { | |
749 T_ACI_BAT_RSLT ret; | |
750 T_ACI_BS_FRM format; | |
751 T_ACI_BS_PAR parity; | |
752 | |
753 TRACE_FUNCTION ("sBAT_PlusICF()"); | |
754 | |
755 /* | |
756 * This relies on T_ACI_BS_FRM being identical to T_BAT_framing_format | |
757 * and T_ACI_BS_PAR being identical to T_BAT_framing_parity. | |
758 */ | |
759 format=(T_ACI_BS_FRM)cmd->params.ptr_set_plus_icf->framing_format; | |
760 parity=(T_ACI_BS_PAR)cmd->params.ptr_set_plus_icf->framing_parity; | |
761 | |
762 /* | |
763 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
764 * assumed to be equivalent to T_ACI_RESULT. | |
765 */ | |
766 ret=(T_ACI_BAT_RSLT)sAT_PlusICF((T_ACI_CMD_SRC)src_infos_psi->srcId,format,parity); | |
767 | |
768 return(ret); | |
769 } | |
770 | |
771 /* | |
772 +--------------------------------------------------------------------+ | |
773 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
774 | STATE : code ROUTINE : qBAT_PlusICF | | |
775 +--------------------------------------------------------------------+ | |
776 | |
777 PURPOSE : | |
778 */ | |
779 GLOBAL T_ACI_BAT_RSLT qBAT_PlusICF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
780 T_BAT_cmd_send *cmd) | |
781 { | |
782 T_ACI_BAT_RSLT ret; | |
783 T_ACI_BS_FRM format; | |
784 T_ACI_BS_PAR parity; | |
785 | |
786 TRACE_FUNCTION ("qBAT_PlusICF()"); | |
787 | |
788 /* | |
789 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
790 * assumed to be equivalent to T_ACI_RESULT. | |
791 */ | |
792 ret=(T_ACI_BAT_RSLT)qAT_PlusICF((T_ACI_CMD_SRC)src_infos_psi->srcId,&format,&parity); | |
793 | |
794 if (ret EQ ACI_BAT_CMPL) | |
795 { | |
796 T_BAT_cmd_response resp; | |
797 T_BAT_res_que_plus_icf icf_data; | |
798 | |
799 resp.ctrl_response=BAT_RES_QUE_PLUS_ICF; | |
800 resp.response.ptr_que_plus_icf=&icf_data; | |
801 | |
802 /* | |
803 * This relies on T_ACI_BS_FRM being identical to T_BAT_framing_format | |
804 * and T_ACI_BS_PAR being identical to T_BAT_framing_parity. | |
805 */ | |
806 icf_data.framing_format=(T_BAT_framing_format)format; | |
807 icf_data.framing_parity=(T_BAT_framing_parity)parity; | |
808 | |
809 aci_bat_send(src_infos_psi,&resp); | |
810 } | |
811 | |
812 return(ret); | |
813 } | |
814 | |
815 /* | |
816 +--------------------------------------------------------------------+ | |
817 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
818 | STATE : code ROUTINE : sBAT_PlusIFC | | |
819 +--------------------------------------------------------------------+ | |
820 | |
821 PURPOSE : | |
822 */ | |
823 GLOBAL T_ACI_BAT_RSLT sBAT_PlusIFC (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
824 T_BAT_cmd_send *cmd) | |
825 { | |
826 T_ACI_BAT_RSLT ret; | |
827 T_ACI_RX_FLOW_CTRL DCE_by_DTE; | |
828 T_ACI_RX_FLOW_CTRL DTE_by_DCE; | |
829 | |
830 TRACE_FUNCTION ("sBAT_PlusIFC()"); | |
831 | |
832 /* | |
833 * This relies on T_ACI_RX_FLOW_CONTROL being identical to both | |
834 * T_BAT_plus_ifc_by_te and T_BAT_plus_ifc_by_ta. Note that | |
835 * sAT_PlusIFC() really does use T_ACI_RX_FLOW_CTRL for both | |
836 * parameters even though a T_ACI_TX_FLOW_CTRL exists (they are | |
837 * equivalent anyway). | |
838 */ | |
839 DCE_by_DTE=(T_ACI_RX_FLOW_CTRL)cmd->params.ptr_set_plus_ifc->by_te; | |
840 DTE_by_DCE=(T_ACI_RX_FLOW_CTRL)cmd->params.ptr_set_plus_ifc->by_ta; | |
841 | |
842 /* | |
843 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
844 * assumed to be equivalent to T_ACI_RESULT. | |
845 */ | |
846 ret=(T_ACI_BAT_RSLT)sAT_PlusIFC((T_ACI_CMD_SRC)src_infos_psi->srcId,DCE_by_DTE,DTE_by_DCE); | |
847 | |
848 return(ret); | |
849 } | |
850 | |
851 /* | |
852 +--------------------------------------------------------------------+ | |
853 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
854 | STATE : code ROUTINE : qBAT_PlusIFC | | |
855 +--------------------------------------------------------------------+ | |
856 | |
857 PURPOSE : | |
858 */ | |
859 GLOBAL T_ACI_BAT_RSLT qBAT_PlusIFC (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
860 T_BAT_cmd_send *cmd) | |
861 { | |
862 T_ACI_BAT_RSLT ret; | |
863 T_ACI_RX_FLOW_CTRL DCE_by_DTE; | |
864 T_ACI_RX_FLOW_CTRL DTE_by_DCE; | |
865 | |
866 TRACE_FUNCTION ("qBAT_PlusIFC()"); | |
867 | |
868 /* | |
869 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
870 * assumed to be equivalent to T_ACI_RESULT. | |
871 */ | |
872 ret=(T_ACI_BAT_RSLT)qAT_PlusIFC((T_ACI_CMD_SRC)src_infos_psi->srcId,&DCE_by_DTE,&DTE_by_DCE); | |
873 | |
874 if (ret EQ ACI_BAT_CMPL) | |
875 { | |
876 T_BAT_cmd_response resp; | |
877 T_BAT_res_que_plus_ifc ifc_data; | |
878 | |
879 resp.ctrl_response=BAT_RES_QUE_PLUS_IFC; | |
880 resp.response.ptr_que_plus_ifc=&ifc_data; | |
881 | |
882 /* | |
883 * This relies on T_ACI_RX_FLOW_CONTROL being identical to both | |
884 * T_BAT_plus_ifc_by_te and T_BAT_plus_ifc_by_ta. Note that | |
885 * qAT_PlusIFC() really does use T_ACI_RX_FLOW_CTRL for both | |
886 * parameters even though a T_ACI_TX_FLOW_CTRL exists (they are | |
887 * equivalent anyway). | |
888 */ | |
889 ifc_data.by_te=(T_BAT_plus_ifc_by_te)DCE_by_DTE; | |
890 ifc_data.by_ta=(T_BAT_plus_ifc_by_ta)DTE_by_DCE; | |
891 | |
892 aci_bat_send(src_infos_psi,&resp); | |
893 } | |
894 | |
895 return(ret); | |
896 } | |
897 | |
898 /* | |
899 +--------------------------------------------------------------------+ | |
900 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
901 | STATE : code ROUTINE : sBAT_PlusCCLK | | |
902 +--------------------------------------------------------------------+ | |
903 | |
904 PURPOSE : | |
905 */ | |
906 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCCLK (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
907 T_BAT_cmd_send *cmd) | |
908 { | |
909 T_ACI_BAT_RSLT ret; | |
910 T_ACI_RTC_DATE date; | |
911 T_ACI_RTC_TIME time; | |
912 int time_zone; | |
913 | |
914 TRACE_FUNCTION ("sBAT_PlusCCLK()"); | |
915 | |
916 date.year=(USHORT)(cmd->params.ptr_set_plus_cclk->year+2000); | |
917 date.month=(UBYTE)cmd->params.ptr_set_plus_cclk->month; | |
918 date.day=(UBYTE)cmd->params.ptr_set_plus_cclk->day; | |
919 time.hour=(UBYTE)cmd->params.ptr_set_plus_cclk->hour; | |
920 time.minute=(UBYTE)cmd->params.ptr_set_plus_cclk->minutes; | |
921 time.second=(UBYTE)cmd->params.ptr_set_plus_cclk->seconds; | |
922 | |
923 /* | |
924 * Time format and PM flag are not in the BAT message. Use the same | |
925 * values that the ATI does in this situation. | |
926 */ | |
927 time.format=TIME_FORMAT_24HOUR; | |
928 time.PM_flag=0; | |
929 | |
930 time_zone=(int)cmd->params.ptr_set_plus_cclk->time_zone; | |
931 | |
932 /* | |
933 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
934 * assumed to be equivalent to T_ACI_RESULT. | |
935 */ | |
936 ret=(T_ACI_BAT_RSLT)sAT_PlusCCLK((T_ACI_CMD_SRC)src_infos_psi->srcId,&date,&time,time_zone); | |
937 | |
938 return(ret); | |
939 } | |
940 | |
941 /* | |
942 +--------------------------------------------------------------------+ | |
943 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
944 | STATE : code ROUTINE : qBAT_PlusCCLK | | |
945 +--------------------------------------------------------------------+ | |
946 | |
947 PURPOSE : | |
948 */ | |
949 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCCLK (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
950 T_BAT_cmd_send *cmd) | |
951 { | |
952 T_ACI_BAT_RSLT ret; | |
953 T_ACI_RTC_DATE date; | |
954 T_ACI_RTC_TIME time; | |
955 int time_zone; | |
956 | |
957 TRACE_FUNCTION ("qBAT_PlusCCLK()"); | |
958 | |
959 /* | |
960 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
961 * assumed to be equivalent to T_ACI_RESULT. | |
962 */ | |
963 ret=(T_ACI_BAT_RSLT)qAT_PlusCCLK((T_ACI_CMD_SRC)src_infos_psi->srcId,&date,&time,&time_zone); | |
964 | |
965 if (ret EQ ACI_BAT_CMPL) | |
966 { | |
967 T_BAT_cmd_response resp; | |
968 T_BAT_res_que_plus_cclk cclk_data; | |
969 | |
970 resp.ctrl_response=BAT_RES_QUE_PLUS_CCLK; | |
971 resp.response.ptr_que_plus_cclk=&cclk_data; | |
972 | |
973 cclk_data.year=(U8)(date.year-2000); | |
974 cclk_data.month=(U8)date.month; | |
975 cclk_data.day=(U8)date.day; | |
976 | |
977 cclk_data.hour=(U8)time.hour; | |
978 | |
979 /* | |
980 * BAT only handles a 24 hour clock. So if the information arrives | |
981 * in 12 hour format we must convert it. | |
982 */ | |
983 if (time.format EQ TIME_FORMAT_12HOUR) | |
984 { | |
985 if ((time.PM_flag) AND (time.hour<12)) | |
986 cclk_data.hour+=12; | |
987 else if ((time.PM_flag EQ 0) AND (time.hour EQ 12)) | |
988 cclk_data.hour=0; | |
989 } | |
990 | |
991 cclk_data.minutes=(U8)time.minute; | |
992 cclk_data.seconds=(U8)time.second; | |
993 | |
994 cclk_data.time_zone=(S8)time_zone; | |
995 | |
996 aci_bat_send(src_infos_psi,&resp); | |
997 } | |
998 | |
999 return(ret); | |
1000 } | |
1001 | |
1002 /* | |
1003 +--------------------------------------------------------------------+ | |
1004 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1005 | STATE : code ROUTINE : sBAT_PlusCGMI | | |
1006 +--------------------------------------------------------------------+ | |
1007 | |
1008 PURPOSE : | |
1009 */ | |
1010 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGMI(T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1011 T_BAT_cmd_send *cmd) | |
1012 { | |
1013 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
1014 T_BAT_cmd_response resp; | |
1015 T_BAT_res_set_plus_cgmi set_cgmi_buffer; | |
1016 | |
1017 TRACE_FUNCTION ("sBAT_PlusCGMI()"); | |
1018 | |
1019 resp.ctrl_response = BAT_RES_SET_PLUS_CGMI ; | |
1020 resp.response.ptr_set_plus_cgmi = &set_cgmi_buffer; | |
1021 | |
1022 ret = aciBatPrcsPlusCG(resp.response.ptr_set_plus_cgmi->manufacturer, &resp.response.ptr_set_plus_cgmi->c_manufacturer, | |
1023 sizeof(resp.response.ptr_set_plus_cgmi->manufacturer), EF_CGMI_ID); | |
1024 if (ret EQ ACI_BAT_CMPL) | |
1025 { | |
1026 aci_bat_send(src_infos_psi,&resp); | |
1027 } | |
1028 return ret; | |
1029 } | |
1030 | |
1031 /* | |
1032 +--------------------------------------------------------------------+ | |
1033 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1034 | STATE : code ROUTINE : sBAT_PlusCGMM | | |
1035 +--------------------------------------------------------------------+ | |
1036 | |
1037 PURPOSE : | |
1038 */ | |
1039 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGMM(T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1040 T_BAT_cmd_send *cmd) | |
1041 { | |
1042 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
1043 T_BAT_cmd_response resp; | |
1044 T_BAT_res_set_plus_cgmm set_cgmm_buffer; | |
1045 | |
1046 TRACE_FUNCTION ("sBAT_PlusCGMM()"); | |
1047 | |
1048 resp.ctrl_response = BAT_RES_SET_PLUS_CGMM ; | |
1049 resp.response.ptr_set_plus_cgmm = &set_cgmm_buffer; | |
1050 | |
1051 ret = aciBatPrcsPlusCG(resp.response.ptr_set_plus_cgmm->model, &resp.response.ptr_set_plus_cgmm->c_model, | |
1052 sizeof(resp.response.ptr_set_plus_cgmm->model), EF_CGMM_ID); | |
1053 if (ret EQ ACI_BAT_CMPL) | |
1054 { | |
1055 aci_bat_send(src_infos_psi,&resp); | |
1056 } | |
1057 return ret; | |
1058 } | |
1059 | |
1060 /* | |
1061 +--------------------------------------------------------------------+ | |
1062 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1063 | STATE : code ROUTINE : sBAT_PlusCGMR | | |
1064 +--------------------------------------------------------------------+ | |
1065 | |
1066 PURPOSE : | |
1067 */ | |
1068 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGMR(T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1069 T_BAT_cmd_send *cmd) | |
1070 { | |
1071 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
1072 T_BAT_cmd_response resp; | |
1073 T_BAT_res_set_plus_cgmr set_cgmr_buffer; | |
1074 | |
1075 TRACE_FUNCTION ("sBAT_PlusCGMR()"); | |
1076 | |
1077 resp.ctrl_response = BAT_RES_SET_PLUS_CGMR ; | |
1078 resp.response.ptr_set_plus_cgmr = &set_cgmr_buffer; | |
1079 | |
1080 ret = aciBatPrcsPlusCG(resp.response.ptr_set_plus_cgmr->revision, &resp.response.ptr_set_plus_cgmr->c_revision, | |
1081 sizeof(resp.response.ptr_set_plus_cgmr->revision), EF_CGMR_ID); | |
1082 if (ret EQ ACI_BAT_CMPL) | |
1083 { | |
1084 aci_bat_send(src_infos_psi,&resp); | |
1085 } | |
1086 return ret; | |
1087 } | |
1088 | |
1089 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGSN(T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1090 T_BAT_cmd_send *cmd) | |
1091 { | |
1092 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
1093 T_BAT_cmd_response resp; | |
1094 T_BAT_res_set_plus_cgsn set_cgsn_buffer; | |
1095 | |
1096 TRACE_FUNCTION ("sBAT_PlusCGSN()"); | |
1097 | |
1098 resp.ctrl_response = BAT_RES_SET_PLUS_CGSN ; | |
1099 resp.response.ptr_set_plus_cgsn = &set_cgsn_buffer; | |
1100 | |
1101 ret = aciBatPrcsPlusCG(resp.response.ptr_set_plus_cgsn->sn, &resp.response.ptr_set_plus_cgsn->c_sn, | |
1102 sizeof(resp.response.ptr_set_plus_cgsn->sn), EF_CGSN_ID); | |
1103 if (ret EQ ACI_BAT_CMPL) | |
1104 { | |
1105 aci_bat_send(src_infos_psi,&resp); | |
1106 } | |
1107 return ret; | |
1108 } | |
1109 | |
1110 /* | |
1111 +--------------------------------------------------------------------+ | |
1112 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1113 | STATE : code ROUTINE : aciBatPrcsPlusCG | | |
1114 +--------------------------------------------------------------------+ | |
1115 | |
1116 PURPOSE : | |
1117 */ | |
1118 LOCAL T_ACI_BAT_RSLT aciBatPrcsPlusCG (UBYTE *rc, USHORT *le, size_t ml, CHAR *ef) | |
1119 { | |
1120 pcm_FileInfo_Type fileInfo; | |
1121 USHORT i; | |
1122 | |
1123 TRACE_FUNCTION("aciBatPrcsPlusCG()"); | |
1124 | |
1125 if (pcm_GetFileInfo ((UBYTE* )ef, &fileInfo) NEQ DRV_OK) | |
1126 { | |
1127 cmdCmeError (CME_ERR_MemFail); | |
1128 return ACI_BAT_FAIL; | |
1129 } | |
1130 | |
1131 if (fileInfo.FileSize <= ml) | |
1132 { | |
1133 if (pcm_ReadFile ((UBYTE*)ef, fileInfo.FileSize, | |
1134 (UBYTE*)rc, &fileInfo.Version) NEQ DRV_OK) | |
1135 { | |
1136 cmdCmeError (CME_ERR_MemFail); | |
1137 return ACI_BAT_FAIL; | |
1138 } | |
1139 | |
1140 i = 0; | |
1141 while (rc[i] NEQ 0xFF) | |
1142 { | |
1143 i++; | |
1144 } | |
1145 *le = i; | |
1146 | |
1147 return ACI_BAT_CMPL; | |
1148 } | |
1149 else | |
1150 { | |
1151 TRACE_FUNCTION("aciBatPrcsPlusCG(): file size is larger than the defined response length!"); | |
1152 cmdCmeError (CME_ERR_MemFail); | |
1153 return ACI_BAT_FAIL; | |
1154 } | |
1155 } | |
1156 | |
1157 |