comparison g23m/condat/ms/src/aci/aci_bat_bas.c @ 0:509db1a7b7b8

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