comparison g23m-glue/cst/cst_exts.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-F&D (8411) $Workfile:: CST_EXTS.C $|
4 | $Author:: Sa $ CONDAT GmbH $Revision:: 7 $|
5 | CREATED: 03.08.99 $Modtime:: 14.02.00 16:06 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9
10 MODULE : CST_EXTS
11
12 PURPOSE : This Modul defines the custom specific AT commands
13 */
14
15 #ifndef CST_EXTS_C
16 #define CST_EXTS_C
17 #endif
18
19 #include "config.h"
20 #include "fixedconf.h"
21 #include "condat-features.h"
22
23 #define ENTITY_CST
24 /*==== INCLUDES ===================================================*/
25
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdio.h>
29 #include "typedefs.h"
30 #include "m_sms.val"
31 #include "m_fac.h"
32 #include "p_mnsms.h"
33 #include "p_mmreg.h"
34 #include "p_mncc.h"
35 #include "p_mnss.h"
36 #include "vsi.h"
37 #include "gsm.h"
38 #include "p_cst.h"
39 #include "cst.h"
40 #include "custom.h"
41 #include "p_mmi.h"
42 #include "p_em.h"
43 #include "../../g23m-aci/aci/aci_cmh.h"
44
45 #if 0 //#ifdef ALR
46 #include "main/sys_ver.h"
47 #endif
48
49 /*==== CONSTANTS ==================================================*/
50
51 #define EXT_ATD "EXT: D, I"
52 #define EXT_ATCFUN "EXT: +CFUN, I"
53 #define EXT_ATCOPS_START "EXT: +COPS, I"
54 #define EXT_ATCOPS_STOP "EXT: +COPS, O"
55 #define EXT_ENTER "EXT: I"
56 #define EXT_LEAVE "EXT: O"
57 #define EXT_UNEXPCTD "EXT: E"
58
59 #define EXT_DIAL_VOICE_PASS "DVCP"
60
61 #define EXT_MAX_BUF_LEN 41
62
63 #define EXT_VOICE_DELIMITER ';'
64
65 /*==== EXPORT =====================================================*/
66
67 /*==== TYPES ======================================================*/
68
69 #ifndef WIN32
70 extern USHORT IQ_GetBuild(void);
71 extern USHORT IQ_GetPoleStarVersion(void);
72 extern USHORT IQ_GetJtagId(void);
73 extern USHORT IQ_GetRevision(void);
74 extern void l1dmacro_init_hw(void);
75
76 extern BOOL SER_WriteConfig (char *new_config,
77 BOOL write_to_flash);
78 extern BOOL SER_ImmediateSwitch (void);
79 #endif
80
81 LOCAL CHAR* percentCFG ( CHAR* cmd );
82 LOCAL CHAR* percentDBG ( CHAR* cmd );
83 LOCAL void ext_LeaveEXT ( BOOL final );
84 LOCAL void ext_CreatePString ( CHAR* buffer,
85 CHAR* text );
86 GLOBAL void ext_ContinueTest ( CHAR* id );
87
88 /*==== VARIABLES ==================================================*/
89
90 LOCAL CHAR* extCmd; /* remaining unparsed command string, */
91 /* will be needed in case of asynchronous */
92 /* command handling */
93 LOCAL USHORT extCmdLen; /* length of command string, will be */
94 /* needed in case of asynchronous */
95 /* command handling */
96 LOCAL CHAR extBuffer[EXT_MAX_BUF_LEN]; /* outbut buffer */
97
98 LOCAL CHAR extDialNum[MAX_PHB_NUM_LEN];
99 /* number to be dialled during testing */
100 GLOBAL SHORT extCallId = ACI_NumParmNotPresent;
101 /* identifier of the call which was */
102 /* set-up using AT extension mechansim */
103 GLOBAL T_ACI_AT_CMD currExtCmd = AT_CMD_NONE;
104 /* used for indicating asynchronous */
105 /* command handling */
106 LOCAL T_ACI_AT_CMD currAbrtCmd = AT_CMD_NONE;
107 /* used for indicating abort of */
108 /* asynchronous command handling */
109
110 /*==== FUNCTIONS ==================================================*/
111
112 USHORT * csf_return_adc (void);
113
114 /*
115 +--------------------------------------------------------------------+
116 | PROJECT : GSM-PS (8403) MODULE : TIL_CSF |
117 | STATE : code ROUTINE : cmh_show_version |
118 +--------------------------------------------------------------------+
119
120 PURPOSE : Trace Layer 1 DSP version numbers
121
122 */
123
124 #ifndef WIN32
125
126 #if 0
127 static void jtagid_to_chipset (USHORT jtagid, CHAR *chipset)
128 {
129
130 switch (jtagid) {
131
132 case 0xB268:
133
134 strcpy (chipset, "Hercules");
135 break;
136
137 case 0xB2B5:
138
139 strcpy (chipset, "Ulysse 1Mbits rev. B");
140 break;
141
142 case 0xB335:
143
144 strcpy (chipset, "Ulysse 1Mbits rev. A");
145 break;
146
147 case 0xB334:
148
149 strcpy (chipset, "Ulysse 2Mbits");
150 break;
151
152 case 0xB393:
153
154 strcpy (chipset, "Ulysse G1");
155 break;
156
157
158 case 0xB396:
159
160 strcpy (chipset, "Calypso rev. B");
161 break;
162
163 case 0xB2AC:
164
165 // Samson and Calypso rev. A share the same JTAG ID.
166 #if (CHIPSET != 7)
167 strcpy (chipset, "Samson");
168 #else
169 strcpy (chipset, "Calypso rev. A");
170 #endif
171 break;
172
173 case 0xB217:
174
175 strcpy (chipset, "Ulysse C035");
176 break;
177
178 case 0xB496:
179
180 strcpy (chipset, "Calypso C035");
181 break;
182
183 case 0xB4FB:
184
185 strcpy (chipset, "Calypso Lite C035");
186 break;
187
188 default:
189
190 strcpy (chipset, "Unknown");
191 break;
192 }
193 }
194 #endif
195
196 GLOBAL void cmh_show_version (
197 CHAR *command,
198 USHORT *len,
199 CHAR *output
200 )
201 {
202 #if 1 //#ifndef ALR
203 CHAR buf[80];
204 USHORT build, hw, rev;
205 #else
206 CHAR buf[160];
207 CHAR chipset[25];
208 #endif
209 USHORT jtag;
210 UCHAR size;
211
212 /*
213 * Retrieve hardware JTAG ID info
214 */
215 jtag = IQ_GetJtagId();
216
217 #if 1 //#ifndef ALR
218 /*
219 * Retrieve others hardware info and build from library
220 */
221 build = IQ_GetBuild();
222 hw = IQ_GetPoleStarVersion();
223 rev = IQ_GetRevision();
224
225 sprintf (buf, "Build %d, Silicon Revision %04X/%04X/%04X",
226 build, hw, jtag, rev);
227 #else
228
229 /*
230 * Retrieve CHIPSET name from JTAG ID
231 */
232 jtagid_to_chipset (jtag, chipset);
233
234 sprintf (buf,
235 "Chipset Version:\n\r\t%s\n\rS/W Versions:\n\n\r\tLayer1\t%4X_%3X\n\r\tLayer2-3 %3XBERLIN_S420\n\r\tNICE\t %3X_I64",
236 chipset,
237 OFFICIAL_VERSION,
238 INTERNAL_VERSION,
239 G23VERSION,
240 SYSTEMVERSION);
241 #endif
242
243 // Format output as a list of Pascal-like strings
244 size = strlen(buf);
245 output[0] = size;
246 strcpy(&(output[1]), buf);
247 output[size+1] = (CHAR) 0xFF; // terminate list of strings
248 }
249
250 #endif /* #ifndef WIN32 */
251
252
253
254 /*
255 +--------------------------------------------------------------------+
256 | PROJECT : GSM-PS (8403) MODULE : TIL_CSF |
257 | STATE : code ROUTINE : show_adc_conversion |
258 +--------------------------------------------------------------------+
259
260 PURPOSE : Trace Layer 1 AD conversions results
261
262 */
263
264 GLOBAL void show_adc_conversion (CHAR *output)
265 {
266 USHORT * adc_conversion;
267 #ifdef ALR
268 CHAR buf[160];
269 #else
270 CHAR buf[80];
271 #endif
272 UCHAR size;
273
274 adc_conversion = csf_return_adc ();
275 #ifdef ALR
276 sprintf (buf, "ADC 0 = %x, ADC 1 = %x, ADC 2 = %x, ADC 3 = %x, ADC 4 = %x, ADC 5 = %x, ADC 6 = %x, ADC 7 = %x, ADC 8 = %x",
277 *adc_conversion++, *adc_conversion++, *adc_conversion++,
278 *adc_conversion++, *adc_conversion++, *adc_conversion++,
279 *adc_conversion++, *adc_conversion++, *adc_conversion);
280
281 #else
282 sprintf (buf, "ADC 0 = %x, ADC 1 = %x, ADC 2 = %x, ADC 3 = %x, ADC 4 = %x",
283 *adc_conversion++, *adc_conversion++, *adc_conversion++,
284 *adc_conversion++, *adc_conversion);
285 #endif
286
287 // Format output as a list of Pascal-like strings
288 size = strlen(buf);
289 output[0] = size;
290 strcpy(&(output[1]), buf);
291 output[size+1] = (CHAR) 0xFF; // terminate list of strings
292 }
293
294
295 /*
296 +--------------------------------------------------------------------+
297 | PROJECT : GSM-PS (8403) MODULE : CST_EXTS |
298 | STATE : code ROUTINE : AEC_Enable |
299 +--------------------------------------------------------------------+
300
301 PURPOSE : activate the Acoustic Echo Cancelation
302
303 */
304
305 GLOBAL void AEC_Enable (CHAR *command, CHAR *output)
306 {
307
308 /* -------------------------------------------------------------------------- */
309 /* MMI_AEC_REQ : 0283 = Long AEC, 105 = SPENH, 187 = AEC+SPENH, 1 = STOP */
310 /* aec_control register bits | 0 0 Sa t2|t1 g3 g2 g1|g0 e2 e1 ak| */
311 /* bit 0 : ACK bit : set to 1 in order to warn DSP that a new command */
312 /* is present. */
313 /* bit 1 : enable AEC */
314 /* bit 2 : enable SPENH (= Speech Enhancement = noise reduction) */
315 /* bit 3 : additionnal AEC gain attenuation (lsb) */
316 /* bit 4 : additionnal AEC gain attenuation (msb) */
317 /* bit 5 : additionnal SPENH gain attenuation (lsb) */
318 /* bit 6 : additionnal SPENH gain attenuation (msb) */
319 /* bit 7 : reset trigger for AEC */
320 /* bit 8 : reset trigger for SPENH */
321 /* bit 9 : AEC selector 0 : short AEC, 1 : long AEC */
322 /* */
323 /* for Short AEC 0083 */
324 /* for long AEC 0283 */
325 /* for long AEC -6 dB 028B */
326 /* for long AEC -12 dB 0293 */
327 /* for long AEC -18 dB 029B */
328 /* for SPENH 0105 */
329 /* for SPENH -6 dB 0125 */
330 /* for SPENH -12 dB 0145 */
331 /* for SPENH -18 dB 0165 */
332 /* for BOTH 0187 */
333 /* for STOP ALL 0001 (all bits reset + ACK to 1 to warn the DSP) */
334 /* -------------------------------------------------------------------------- */
335
336
337 command++; /* increment command pointer to point on the hexa value of the command */
338
339
340 if (!strncmp(command, "0083", 4))
341 {
342 output[0] = strlen ("Short AEC is active");
343 memcpy (&output[1], "Short AEC is active", 19);
344
345 /* end of string list */
346 output [20] = (CHAR) 0xff;
347 csf_aec_enable(0x0083);
348 }
349
350 else if (!strncmp(command, "0283", 4))
351 {
352 output[0] = strlen ("Long AEC is active");
353 memcpy (&output[1], "Long AEC is active", 18);
354
355 /* end of string list */
356 output [19] = (CHAR) 0xff;
357 csf_aec_enable(0x0283);
358 }
359
360 else if (!strncmp(command, "028B", 4))
361 {
362 output[0] = strlen ("Long AEC -6 dB is active");
363 memcpy (&output[1], "Long AEC -6 dB is active", 24);
364
365 /* end of string list */
366 output [25] = (CHAR) 0xff;
367 csf_aec_enable(0x028B);
368 }
369
370 else if (!strncmp(command, "0293", 4))
371 {
372 output[0] = strlen ("Long AEC -12 dB is active");
373 memcpy (&output[1], "Long AEC -12 dB is active", 25);
374
375 /* end of string list */
376 output [26] = (CHAR) 0xff;
377 csf_aec_enable(0x0293);
378 }
379
380 else if (!strncmp(command, "029B", 4))
381 {
382 output[0] = strlen ("Long AEC -18 dB is active");
383 memcpy (&output[1], "Long AEC -18 dB is active", 25);
384
385 /* end of string list */
386 output [26] = (CHAR) 0xff;
387 csf_aec_enable(0x029B);
388 }
389
390 else if (!strncmp(command, "0105", 4))
391 {
392 output[0] = strlen ("Noise reduction is active");
393 memcpy (&output[1], "Noise reduction is active", 25);
394
395 /* end of string list */
396 output [26] = (CHAR) 0xff;
397 csf_aec_enable(0x0105);
398 }
399
400 else if (!strncmp(command, "0125", 4))
401 {
402 output[0] = strlen ("Noise reduction -6 dB is active");
403 memcpy (&output[1], "Noise reduction -6 dB is active", 31);
404
405 /* end of string list */
406 output [32] = (CHAR) 0xff;
407 csf_aec_enable(0x0125);
408 }
409
410 else if (!strncmp(command, "0145", 4))
411 {
412 output[0] = strlen ("Noise reduction -12 dB is active");
413 memcpy (&output[1], "Noise reduction -12 dB is active", 32);
414
415 /* end of string list */
416 output [33] = (CHAR) 0xff;
417 csf_aec_enable(0x0145);
418 }
419
420 else if (!strncmp(command, "0165", 4))
421 {
422 output[0] = strlen ("Noise reduction -18 dB is active");
423 memcpy (&output[1], "Noise reduction -18 dB is active", 32);
424
425 /* end of string list */
426 output [33] = (CHAR) 0xff;
427 csf_aec_enable(0x0165);
428 }
429
430 else if (!strncmp(command, "0187", 4))
431 {
432 output[0] = strlen ("Both AEC and Noise reduction are active");
433 memcpy (&output[1], "Both AEC and Noise reduction are active", 39);
434
435 /* end of string list */
436 output [40] = (CHAR) 0xff;
437 csf_aec_enable(0x0187);
438 }
439
440 else if (!strncmp(command, "0001", 4))
441 {
442 output[0] = strlen ("AEC and Noise reduction are unactivated");
443 memcpy (&output[1], "AEC and Noise reduction are unactivated", 39);
444
445 /* end of string list */
446 output [40] = (CHAR) 0xff;
447 csf_aec_enable(0x0001);
448 }
449
450 else
451 {
452 output[0] = strlen ("Bad AT command");
453 memcpy (&output[1], "Bad AT command", 14);
454
455 /* end of string list */
456 output [15] = (CHAR) 0xff;
457 }
458
459 }
460
461
462
463
464 /*
465 +--------------------------------------------------------------------+
466 | PROJECT : GSM-PS (6147) MODULE : CST_EXTS |
467 | STATE : code ROUTINE : rAT_EXT |
468 +--------------------------------------------------------------------+
469
470 PURPOSE : This function is called by the interpreter part of the
471 ACI in case of the detection of an unknown command.
472
473 <cmd> : remaining unparsed command string.
474 <cmdLen> : length of command string. This value must be
475 incremented by the amount of parsed characters
476 by this function.
477 <out> : this parameter can be used to display some
478 strings at the AT command interface.
479 The first char of one string must contain
480 the length of the following string. The
481 special length 0xff must be used to define
482 the end of the string list.
483 <outLen> : maximum length of output buffer referenced
484 by parameter <out>.
485
486 */
487
488 GLOBAL T_ACI_RETURN rAT_EXT (
489 CHAR* cmd,
490 USHORT* cmdLen,
491 CHAR* out,
492 USHORT outLen
493 )
494 {
495 /*
496 * store command string in case it will be needed later on, when
497 * result code of this function is equal to AT_EXCT
498 */
499 extCmd = cmd;
500 extCmdLen = *cmdLen;
501
502 /*
503 * example how to send an unsolicited result code via the AT interface
504 */
505 ext_CreatePString ( extBuffer, EXT_ENTER );
506
507 sAT_URC ( extBuffer );
508
509 /*
510 * example how to process the command AT%H
511 */
512 if (*cmd == '%')
513 {
514 cmd++;
515
516 switch (*cmd)
517 {
518 case 'A':
519 /*
520 * Display AD conversions results
521 */
522 *cmdLen -= 2;
523 show_adc_conversion(out);
524 return( AT_CMPL );
525
526 case 'C':
527 case 'c':
528 case 'D':
529 case 'd':
530 {
531 CHAR* nextCmd;
532
533 *cmdLen -= 2;
534
535 switch ( *cmd )
536 {
537 case 'C':
538 case 'c':
539 /* dynamic configuration via AT command interface */
540 nextCmd = percentCFG ( ++cmd );
541
542 break;
543
544 case 'D':
545 case 'd':
546 /* set debug pin for reset purposes */
547 nextCmd = percentDBG ( ++cmd );
548
549 break;
550 }
551
552 *out = ( CHAR ) 0xFF;
553
554 if ( nextCmd EQ NULL )
555 {
556 return ( AT_FAIL );
557 }
558 else
559 {
560 *cmdLen -= ( nextCmd - cmd );
561
562 return ( AT_CMPL );
563 }
564 }
565
566 case 'N':
567 /*
568 * Enables the AEC by sending a primitive to L1A
569 */
570 *cmdLen -= 6;
571 AEC_Enable(cmd, out);
572 return( AT_CMPL );
573
574 //---------------------------------------------------------------------------//
575 // Added by Matthieu Vanin for the test of melody E2/E1
576 //---------------------------------------------------------------------------//
577
578
579
580 // End
581 //---------------------------------------------------------------------------//
582 case 'S':
583 case 's':
584 {
585 cmd++;
586
587 switch (*cmd) {
588
589 case 'e':
590 case 'E':
591 /* 's''e' already detected => assume the command is at%ser. */
592 {
593 cmd += 3; /* Discard the following characters */
594 *cmdLen -= 9;
595 if (SER_WriteConfig (cmd, (BOOL) (*(cmd + 3) - '0')))
596 return( AT_CMPL );
597 else
598 return( AT_FAIL );
599 }
600
601 case 'w':
602 case 'W':
603 /* 's''w' already detected => assume the command is at%switch. */
604 {
605 *cmdLen -= 7;
606 if (SER_ImmediateSwitch())
607 return( AT_CMPL );
608 else
609 return( AT_FAIL );
610 }
611
612 case 'l':
613 case 'L':
614 /* 's''l' already detected => assume the command is at%sleep. */
615 {
616 cmd += 5; /* Discard the following characters */
617 *cmdLen -= 8;
618 /*
619 * Checks if the parameter is valid:
620 * 0 -> NO_SLEEP
621 * 1 -> SMALL_SLEEP
622 * 2 -> BIG_SLEEP
623 * 3 -> DEEP_SLEEP
624 * 4 -> ALL_SLEEP
625 */
626
627 if (((*cmd - '0') >= 0) && ((*cmd - '0') <= 4))
628 {
629 power_down_config ((UBYTE) (*cmd - '0'), UWIRE_CLK_CUT);
630 return( AT_CMPL );
631 }
632 else
633 return( AT_FAIL );
634 }
635
636 default:
637 *cmdLen -= 2;
638 return ( AT_FAIL );
639
640 }
641 }
642
643 case 'H':
644 *cmdLen -= 2;
645
646 /*
647 * here you can perform some actions with drivers etc.
648 */
649
650 /*
651 * and create some additional output at the AT interface
652 * The strings:
653 *"Hello"
654 *""
655 *"World"
656 * will be displayed at the terminal.
657 *
658 * first string Hello
659 */
660 out[0] = strlen ("Hello");
661 memcpy (&out[1], "Hello", 5);
662 /*
663 * add a spare line with an empty string
664 */
665 out [6] = 0;
666 /*
667 * second string World
668 */
669 out [7] = strlen ("World");
670 memcpy (&out[8], "World", 5);
671
672 /*
673 * end of string list
674 */
675 out [13] = (CHAR) 0xff;
676 return( AT_CMPL );
677
678 #ifndef WIN32
679 case 'R':
680 case 'r':
681 *cmdLen -= 2;
682 l1dmacro_init_hw();
683 out[0] = 0;
684 out[1] = (CHAR) 0xFF;
685 return( AT_CMPL );
686 #endif
687
688 #ifndef WIN32
689 case 'V':
690 case 'v':
691 *cmdLen -= 2;
692
693 /*
694 * Display version numbers
695 */
696
697 cmh_show_version (cmd, cmdLen, out);
698 return( AT_CMPL );
699 #endif
700 #if defined (ALR)
701 case 'T':
702 case 't':
703 /*
704 * Enables RTC or AUDIO tests
705 */
706 cmd++;
707 *cmdLen -= 3;
708 if (!strncmp(cmd, "A", 1) || !strncmp(cmd, "a", 1))
709 {
710 //audio_test_misc();
711 out[0] = 22;
712 memcpy (&out[1], "Performing Audio Tests", 22);
713 out [23] = (CHAR) 0xff;
714 }
715 else
716 {
717 if (!strncmp(cmd, "R", 1) || !strncmp(cmd, "r", 1))
718 {
719 //rtc_test_misc();
720 out[0] = 20;
721 memcpy (&out[1], "Performing RTC Tests", 20);
722 out [21] = (CHAR) 0xff;
723 }
724 else
725 return( AT_FAIL );
726 }
727 return( AT_CMPL );
728 #endif
729 default:
730 *cmdLen -= 2;
731 return ( AT_FAIL );
732 }
733 }
734 else if ( *cmd EQ 'D' )
735 {
736 T_ACI_RETURN rslt;
737
738 /*
739 * this is only a test implementation. As soon as a "ATD" command
740 * string is detected in the AT interpreter and the mobile is not
741 * yet registered (neither limited nor full service is availbale)
742 * this function is called. Then instead of dialling immediately
743 * an activation of the mobile is performed in advance.
744 */
745 strncpy ( extDialNum, cmd + 1, MINIMUM ( MAX_PHB_NUM_LEN - 1,
746 *cmdLen - 1 ) );
747 extDialNum[MINIMUM ( MAX_PHB_NUM_LEN - 1, *cmdLen - 1 )] = '\0';
748
749 extCmdLen = 0;
750 *cmdLen = 0;
751
752 rslt = sAT_PlusCFUN ( CMD_SRC_LCL,
753 CFUN_FUN_Full,
754 CFUN_RST_NotPresent );
755
756 if ( rslt EQ AT_EXCT )
757 {
758 /*
759 * generate some output at the AT interface
760 */
761 ext_CreatePString ( out, EXT_ATCFUN );
762
763 /*
764 * indicating that an extended AT command is still in progress
765 */
766 currExtCmd = AT_CMD_CFUN;
767 }
768 else
769 {
770 ext_LeaveEXT ( TRUE );
771 rCI_PlusCME ( AT_CMD_EXT, CME_ERR_Unknown );
772 }
773
774 return ( rslt );
775 }
776 else
777 return( AT_FAIL );
778 }
779
780 /*
781 +--------------------------------------------------------------------+
782 | PROJECT : GSM-PS (6147) MODULE : CST_EXTS |
783 | STATE : code ROUTINE : percentCFG |
784 +--------------------------------------------------------------------+
785
786 PURPOSE : %CFG command (enables dynamic configuration of the
787 protocol stack using the AT command interface)
788 */
789
790 EXTERN char *parse (char *b, char *f, ...);
791
792 GLOBAL SHORT cc_pei_config (char * inString,
793 char * outString);
794 GLOBAL SHORT cst_pei_config (char * inString,
795 char * outString);
796 GLOBAL SHORT dl_pei_config (char * inString,
797 char * outString);
798 GLOBAL SHORT mm_pei_config (char * inString,
799 char * outString);
800 GLOBAL SHORT rr_pei_config (char * inString,
801 char * outString);
802 GLOBAL SHORT sim_pei_config (char * inString,
803 char * outString);
804 GLOBAL SHORT sms_pei_config (char * inString,
805 char * outString);
806 GLOBAL SHORT ss_pei_config (char * inString,
807 char * outString);
808 GLOBAL SHORT pl_pei_config (char * inString,
809 char * outString);
810
811 #ifdef FAX_AND_DATA
812 GLOBAL SHORT fad_pei_config (char * inString,
813 char * outString);
814 GLOBAL SHORT l2r_pei_config (char * inString,
815 char * outString);
816 GLOBAL SHORT ra_pei_config (char * inString,
817 char * outString);
818 GLOBAL SHORT rlp_pei_config (char * inString,
819 char * outString);
820 GLOBAL SHORT t30_pei_config (char * inString,
821 char * outString);
822 #endif
823
824 GLOBAL CHAR* percentCFG ( CHAR* cl )
825 {
826 CHAR entity[5];
827 CHAR config[40];
828 CHAR dummy;
829
830 TRACE_FUNCTION ( "percentCFG()" );
831
832 switch ( *cl )
833 {
834 case('='):
835 {
836 cl++;
837
838 cl = parse ( cl, "ss", ( LONG )sizeof(entity), entity,
839 ( LONG )sizeof(config), config );
840
841 if( !cl OR
842 *entity EQ '\0' OR
843 *config EQ '\0' )
844 {
845 return ( NULL );
846 }
847
848 break;
849 }
850
851 default:
852 {
853 return ( NULL );
854 }
855 }
856
857 if ( strcmp ( entity, CC_NAME ) EQ 0 )
858 {
859 cc_pei_config ( config, &dummy );
860 }
861 else if ( strcmp ( entity, CST_NAME ) EQ 0 )
862 {
863 cst_pei_config ( config, &dummy );
864 }
865 else if ( strcmp ( entity, DL_NAME ) EQ 0 )
866 {
867 dl_pei_config ( config, &dummy );
868 }
869 else if ( strcmp ( entity, MM_NAME ) EQ 0 )
870 {
871 mm_pei_config ( config, &dummy );
872 }
873 else if ( strcmp ( entity, RR_NAME ) EQ 0 )
874 {
875 rr_pei_config ( config, &dummy );
876 }
877 else if ( strcmp ( entity, SIM_NAME ) EQ 0 )
878 {
879 sim_pei_config ( config, &dummy );
880 }
881 else if ( strcmp ( entity, SMS_NAME ) EQ 0 )
882 {
883 sms_pei_config ( config, &dummy );
884 }
885 else if ( strcmp ( entity, SS_NAME ) EQ 0 )
886 {
887 ss_pei_config ( config, &dummy );
888 }
889 else if ( strcmp ( entity, PL_NAME ) EQ 0 )
890 {
891 pl_pei_config ( config, &dummy );
892 }
893
894 #ifdef FAX_AND_DATA
895
896 else if ( strcmp ( entity, FAD_NAME ) EQ 0 )
897 {
898 fad_pei_config ( config, &dummy );
899 }
900 else if ( strcmp ( entity, L2R_NAME ) EQ 0 )
901 {
902 l2r_pei_config ( config, &dummy );
903 }
904 else if ( strcmp ( entity, RA_NAME ) EQ 0 )
905 {
906 ra_pei_config ( config, &dummy );
907 }
908 else if ( strcmp ( entity, RLP_NAME ) EQ 0 )
909 {
910 rlp_pei_config ( config, &dummy );
911 }
912 else if ( strcmp ( entity, T30_NAME ) EQ 0 )
913 {
914 t30_pei_config ( config, &dummy );
915 }
916
917 #endif
918
919 else
920 {
921 return ( NULL );
922 }
923
924 return ( cl );
925 }
926
927 /*
928 +--------------------------------------------------------------------+
929 | PROJECT : GSM-PS (6147) MODULE : CST_EXTS |
930 | STATE : code ROUTINE : percentDBG |
931 +--------------------------------------------------------------------+
932
933 PURPOSE : %RST command (simulates pressing the reset button
934 of the ASample)
935 */
936
937 #ifndef TRACE_PORT_TIMING
938 #ifdef _TMS470
939 #if (CHIPSET == 0)
940 EXTERN void l1s_set_debug_pin ( UBYTE, UBYTE );
941 #endif
942 #endif
943 #endif
944
945 GLOBAL CHAR* percentDBG ( CHAR* cl )
946 {
947 SHORT line = 1;
948 SHORT polarity = 1;
949 SHORT delay = 650;
950
951 TRACE_FUNCTION ( "atPercentDBG()" );
952
953 switch ( *cl )
954 {
955 case( '\0' ):
956 {
957 break;
958 }
959
960 case('='):
961 {
962 cl++;
963
964 cl = parse ( cl, "rrr", &line, &polarity, &delay );
965
966 if( !cl OR
967 polarity < 0 OR polarity > 1 OR
968 line < 0 OR line > 7 OR
969 delay < 0 )
970 {
971 return ( NULL );
972 }
973
974 break;
975 }
976
977 default:
978 {
979 return ( NULL );
980 }
981 }
982
983 #ifndef TRACE_PORT_TIMING
984 #ifdef _TMS470
985 #if (CHIPSET == 0)
986 #if defined (NEW_FRAME)
987 vsi_t_sleep ( VSI_CALLER ( T_TIME ) delay );
988 #else
989 vsi_t_sleep ( VSI_CALLER ( T_VSI_TVALUE ) delay );
990 #endif
991
992 l1s_set_debug_pin ( ( UBYTE ) line, ( UBYTE ) polarity );
993 #endif
994 #endif
995 #endif
996
997 return ( cl );
998 }
999
1000 /*
1001 +--------------------------------------------------------------------+
1002 | PROJECT : GSM-PS (6147) MODULE : CMH_EXTS |
1003 | STATE : code ROUTINE : rAT_ACP |
1004 +--------------------------------------------------------------------+
1005
1006 PURPOSE : This function is called by the interpreter part of the
1007 ACI in case of aborting a pending extension command.
1008
1009 <out> : this parameter can be used to display some
1010 strings at the AT command interface.
1011 The first char of one string must contain
1012 the length of the following string. The
1013 special length 0xff must be used to define
1014 the end of the string list.
1015 <outLen> : maximum length of output buffer referenced
1016 by parameter <out>.
1017
1018 */
1019
1020 GLOBAL T_ACI_RETURN rAT_ACP (
1021 CHAR* out,
1022 USHORT outLen
1023 )
1024 {
1025 T_ACI_RETURN rslt = AT_CMPL;
1026
1027 /* call the abort function if necessary */
1028 if ( currExtCmd NEQ AT_CMD_NONE )
1029 rslt = sAT_Abort (CMD_SRC_LCL, currExtCmd );
1030
1031 switch ( rslt )
1032 {
1033 case ( AT_CMPL ):
1034 {
1035 currExtCmd = AT_CMD_NONE;
1036
1037 ext_LeaveEXT ( TRUE );
1038 }
1039 break;
1040
1041 case ( AT_EXCT ):
1042 {
1043 currExtCmd = AT_CMD_ABRT;
1044 }
1045 break;
1046
1047 default:
1048 {
1049 /* do nothing */
1050 }
1051 break;
1052 }
1053
1054 return rslt;
1055 }
1056
1057 /*
1058 +--------------------------------------------------------------------+
1059 | PROJECT : GSM-PS (6147) MODULE : CMH_EXTS |
1060 | STATE : code ROUTINE : ext_OK |
1061 +--------------------------------------------------------------------+
1062
1063 PURPOSE : This function is called by the MMI in case the positive
1064 result of the asynchronous command handling is available.
1065
1066 <cmdId>: command identity
1067
1068 */
1069 GLOBAL void ext_OK ( T_ACI_AT_CMD cmdId )
1070 {
1071 T_ACI_RETURN rslt;
1072
1073 if ( cmdId EQ AT_CMD_CFUN AND currAbrtCmd EQ AT_CMD_NONE )
1074 {
1075 rslt = sAT_PlusCOPS ( CMD_SRC_LCL,
1076 COPS_MOD_Auto,
1077 COPS_FRMT_NotPresent,
1078 NULL );
1079
1080 if ( rslt EQ AT_EXCT )
1081 {
1082 /*
1083 * generate some output at the AT interface
1084 */
1085 ext_CreatePString ( extBuffer, EXT_ATCOPS_START );
1086
1087 sAT_URC ( extBuffer );
1088
1089 /*
1090 * indicating that an extended AT command is still in progress
1091 */
1092 currExtCmd = AT_CMD_COPS;
1093 }
1094 else
1095 {
1096 ext_LeaveEXT ( TRUE );
1097 rCI_PlusCME ( AT_CMD_EXT, CME_ERR_Unknown );
1098 }
1099 }
1100 else if ( cmdId EQ AT_CMD_COPS AND currAbrtCmd EQ AT_CMD_NONE )
1101 {
1102 currExtCmd = AT_CMD_NONE;
1103
1104 /*
1105 * generate some output at the AT interface
1106 */
1107 ext_CreatePString ( extBuffer, EXT_ATCOPS_STOP );
1108
1109 sAT_URC ( extBuffer );
1110
1111 #ifndef WIN32
1112 ext_ContinueTest ( EXT_DIAL_VOICE_PASS );
1113 #endif
1114 }
1115 else if ( cmdId EQ AT_CMD_D AND currAbrtCmd EQ AT_CMD_NONE )
1116 {
1117 extCallId = 1;
1118
1119 ext_LeaveEXT ( TRUE );
1120 rCI_OK ( AT_CMD_EXT );
1121 }
1122 else if ( currAbrtCmd NEQ AT_CMD_NONE )
1123 {
1124 currAbrtCmd = AT_CMD_NONE;
1125
1126 ext_LeaveEXT ( TRUE );
1127 rCI_OK ( AT_CMD_EXT );
1128 }
1129 else
1130 {
1131 /*
1132 * generate some output at the AT interface
1133 */
1134 ext_CreatePString ( extBuffer, EXT_UNEXPCTD );
1135
1136 sAT_URC ( extBuffer );
1137 }
1138 }
1139
1140 /*
1141 +--------------------------------------------------------------------+
1142 | PROJECT : GSM-PS (6147) MODULE : CMH_EXTS |
1143 | STATE : code ROUTINE : ext_LeaveExtension |
1144 +--------------------------------------------------------------------+
1145
1146 PURPOSE : This function is called in case the extensin mechansim
1147 should be left finally.
1148
1149 <final>: indicates whether final result code should be
1150 sent explicitly
1151
1152 */
1153 LOCAL void ext_LeaveEXT ( BOOL final )
1154 {
1155 /*
1156 * generate some output at the AT interface
1157 */
1158 ext_CreatePString ( extBuffer, EXT_LEAVE );
1159
1160 /*
1161 * indicating that no extended AT command is still in progress
1162 */
1163 currExtCmd = AT_CMD_NONE;
1164
1165 /*
1166 * indicate end of extended command handling to the AT interpreter
1167 */
1168 sAT_URC ( extBuffer );
1169
1170 if ( final )
1171 {
1172 sAT_FRI ( extCmdLen );
1173 }
1174 }
1175
1176 /*
1177 +--------------------------------------------------------------------+
1178 | PROJECT : GSM-PS (6147) MODULE : CMH_EXTS |
1179 | STATE : code ROUTINE : ext_ContinueTest |
1180 +--------------------------------------------------------------------+
1181
1182 PURPOSE : This function is called in case the AT extension
1183 procedure should be continued.
1184
1185 <id>: identifies the specific procedure to be continued
1186
1187 */
1188 GLOBAL void ext_ContinueTest ( CHAR* id )
1189 {
1190 T_ACI_RETURN rslt;
1191
1192 if ( strcmp ( id, EXT_DIAL_VOICE_PASS ) EQ 0 )
1193 {
1194 T_ACI_D_TOC callType = D_TOC_Data;
1195
1196 if ( extDialNum [strlen ( extDialNum ) - 1] EQ EXT_VOICE_DELIMITER )
1197 callType = D_TOC_Voice;
1198
1199 extDialNum[strlen ( extDialNum ) - 1] = '\0';
1200
1201 rslt = sAT_Dn ( CMD_SRC_LCL,
1202 extDialNum,
1203 D_CLIR_OVRD_Default,
1204 D_CUG_CTRL_NotPresent,
1205 callType );
1206
1207 if ( rslt EQ AT_EXCT )
1208 {
1209 /*
1210 * generate some output at the AT interface
1211 */
1212 ext_CreatePString ( extBuffer, EXT_ATD );
1213
1214 sAT_URC ( extBuffer );
1215
1216 /*
1217 * indicating that an extended AT command is still in progress
1218 */
1219 currExtCmd = AT_CMD_D;
1220 }
1221 else
1222 {
1223 ext_LeaveEXT ( TRUE );
1224 rCI_PlusCME ( AT_CMD_EXT, CME_ERR_Unknown );
1225 }
1226 }
1227 }
1228
1229 /*
1230 +--------------------------------------------------------------------+
1231 | PROJECT : GSM-PS (6147) MODULE : CMH_EXTS |
1232 | STATE : code ROUTINE : ext_CreatePString |
1233 +--------------------------------------------------------------------+
1234
1235 PURPOSE :
1236
1237 */
1238 LOCAL void ext_CreatePString ( CHAR* buffer, CHAR* text )
1239 {
1240 buffer[0] = strlen (text);
1241 memcpy (&buffer[1], text, buffer[0]);
1242 buffer [buffer[0]+1] = (CHAR) 0xff;
1243 }