FreeCalypso > hg > fc-magnetite
annotate src/aci2/aci/ati_fcmisc.c @ 664:afcb1115b9b3
AT@SPENH command implemented in aci2
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 24 May 2020 07:38:44 +0000 |
parents | src/g23m-aci/aci/ati_fcmisc.c@cf1cfe12a54a |
children | 36df58db1640 |
rev | line source |
---|---|
663
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements miscellaneous FreeCalypso-added AT commands. |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #ifndef ATI_FCMISC_C |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #define ATI_FCMISC_C |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include "aci_all.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <ctype.h> |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <string.h> |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "aci_cmh.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "ati_cmd.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "aci_cmd.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "aci_io.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include "aci_cmd.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include "l4_tim.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "line_edit.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #include "aci_lst.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "pcm.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "audio.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "aci.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "rx.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "pwr.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "l4_tim.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #ifdef GPRS |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #ifdef DTI |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "dti.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "dti_conn_mng.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #include "dti_cntrl_mng.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #endif /* DTI */ |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 #include "gaci.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #include "gaci_cmh.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 #include "gaci_cmd.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #endif /* GPRS */ |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #include "aci_mem.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 #include "aci_prs.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 #include "ati_int.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 #ifndef _SIMULATION_ |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 #include "ffs/ffs.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 #endif |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 #ifdef FF_ATI_BAT |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 #include "typedefs.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 #include "gdd.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 #include "bat.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 #include "ati_bat.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 #endif /*FF_ATI_BAT*/ |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 #include "main/sys_types.h" |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 extern SYS_UWORD8 SIM_allow_speed_enhancement; |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 /* AT@SPENH - enable or disable SIM speed enhancement */ |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 GLOBAL T_ATI_RSLT atAtSPENH ( char *cl, UBYTE srcId ) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 { |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 int state, nonvol = 0; |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 TRACE_FUNCTION("atAtSPENH()"); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 cl = parse(cl, "Dd", &state, &nonvol); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 if (!cl) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 return (ATI_FAIL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 if (state != 0 && state != 1) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 return (ATI_FAIL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 SIM_allow_speed_enhancement = state; |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 if (!nonvol) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 return (ATI_CMPL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 ffs_mkdir("/etc"); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 if (ffs_file_write("/etc/SIM_spenh", &SIM_allow_speed_enhancement, 1, |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 FFS_O_CREATE | FFS_O_TRUNC) == EFFS_OK) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 return (ATI_CMPL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 else |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 return (ATI_FAIL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 } |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 GLOBAL T_ATI_RSLT queatAtSPENH (char *cl, UBYTE srcId) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 { |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 char *me="@SPENH: "; |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 TRACE_FUNCTION("queatAtSPENH()"); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 sprintf(g_sa, "%s%u", me, SIM_allow_speed_enhancement); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 return (ATI_CMPL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 } |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 #endif /* ATI_FCMISC_C */ |