annotate src/g23m-aci/aci/ati_fcmisc.c @ 196:5f3544fc0308

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