FreeCalypso > hg > fc-magnetite
annotate src/g23m-aci/aci/ati_fcmisc.c @ 702:9394305d4ff5 default tip
etm_audio.c: fix off-by-one error in auw of FIR coefficients
This fix was already made in FC Tourmaline a while back, but it is also
the kind of bugfix that deserves to be backported to Magnetite and
Selenite as well.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 31 Oct 2022 00:14:44 +0000 |
parents | def882d1b354 |
children |
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" |
668
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
60 #include "fc-target.h" |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
61 #include "armio.h" |
663
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 extern SYS_UWORD8 SIM_allow_speed_enhancement; |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 /* AT@SPENH - enable or disable SIM speed enhancement */ |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 GLOBAL T_ATI_RSLT atAtSPENH ( char *cl, UBYTE srcId ) |
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 int state, nonvol = 0; |
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 TRACE_FUNCTION("atAtSPENH()"); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 cl = parse(cl, "Dd", &state, &nonvol); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 if (!cl) |
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 if (state != 0 && state != 1) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 return (ATI_FAIL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 SIM_allow_speed_enhancement = state; |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 if (!nonvol) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 return (ATI_CMPL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 ffs_mkdir("/etc"); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 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
|
82 FFS_O_CREATE | FFS_O_TRUNC) == EFFS_OK) |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 return (ATI_CMPL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 else |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 return (ATI_FAIL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 } |
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 GLOBAL T_ATI_RSLT queatAtSPENH (char *cl, UBYTE srcId) |
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 char *me="@SPENH: "; |
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 TRACE_FUNCTION("queatAtSPENH()"); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 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
|
95 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 return (ATI_CMPL); |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 } |
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 |
668
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
99 #ifdef TARGET_HAS_LPG |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
100 /* AT@LPG - program LPG output */ |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
101 GLOBAL T_ATI_RSLT atAtLPG ( char *cl, UBYTE srcId ) |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
102 { |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
103 unsigned glob, period = 0, ontime = 0; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
104 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
105 TRACE_FUNCTION("atAtLPG()"); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
106 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
107 cl = parse(cl, "Ddd", &glob, &period, &ontime); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
108 if (!cl) |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
109 return (ATI_FAIL); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
110 if (glob > 3 || period > 7 || ontime > 7) |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
111 return (ATI_FAIL); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
112 *(volatile SYS_UWORD8 *)0xFFFE7801 = 0x01; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
113 *(volatile SYS_UWORD8 *)0xFFFE7800 = |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
114 (glob << 6) | (ontime << 3) | period; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
115 return (ATI_CMPL); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
116 } |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
117 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
118 GLOBAL T_ATI_RSLT queatAtLPG (char *cl, UBYTE srcId) |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
119 { |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
120 char *me="@LPG: "; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
121 SYS_UWORD8 regval; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
122 unsigned glob, period, ontime; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
123 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
124 TRACE_FUNCTION("queatAtLPG()"); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
125 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
126 regval = *(volatile SYS_UWORD8 *)0xFFFE7800; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
127 glob = (regval >> 6) & 3; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
128 ontime = (regval >> 3) & 7; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
129 period = regval & 7; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
130 sprintf(g_sa, "%s%u,%u,%u", me, glob, period, ontime); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
131 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
132 return (ATI_CMPL); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
133 } |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
134 #endif /* TARGET_HAS_LPG */ |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
135 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
136 #ifdef TARGET_HAS_PWL |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
137 /* AT@PWL - program PWL output */ |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
138 GLOBAL T_ATI_RSLT atAtPWL ( char *cl, UBYTE srcId ) |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
139 { |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
140 unsigned level; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
141 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
142 TRACE_FUNCTION("atAtPWL()"); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
143 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
144 cl = parse(cl, "D", &level); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
145 if (!cl) |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
146 return (ATI_FAIL); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
147 if (level > 255) |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
148 return (ATI_FAIL); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
149 *(volatile SYS_UWORD8 *)0xFFFE8000 = level; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
150 *(volatile SYS_UWORD8 *)0xFFFE8001 = 0x01; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
151 return (ATI_CMPL); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
152 } |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
153 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
154 GLOBAL T_ATI_RSLT queatAtPWL (char *cl, UBYTE srcId) |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
155 { |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
156 char *me="@PWL: "; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
157 SYS_UWORD8 regval; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
158 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
159 TRACE_FUNCTION("queatAtPWL()"); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
160 |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
161 regval = *(volatile SYS_UWORD8 *)0xFFFE8000; |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
162 sprintf(g_sa, "%s%u", me, regval); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
163 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
164 return (ATI_CMPL); |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
165 } |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
166 #endif /* TARGET_HAS_PWL */ |
4011858168a1
AT@LPG and AT@PWL implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
663
diff
changeset
|
167 |
670
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
168 /* AT+IOR - read GPIO pin */ |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
169 GLOBAL T_ATI_RSLT atPlusIOR (char *cl, UBYTE srcId) |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
170 { |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
171 char *me="+IOR: "; |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
172 unsigned ionum; |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
173 int state; |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
174 |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
175 TRACE_FUNCTION("atPlusIOR()"); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
176 |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
177 cl = parse(cl, "D", &ionum); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
178 if (!cl) |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
179 return (ATI_FAIL); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
180 if (ionum > 13) |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
181 return (ATI_FAIL); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
182 state = AI_ReadBit(ionum); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
183 sprintf(g_sa, "%s%u,%d", me, ionum, state); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
184 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
185 return (ATI_CMPL); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
186 } |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
187 |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
188 /* AT+IOW - set GPIO pin */ |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
189 GLOBAL T_ATI_RSLT atPlusIOW (char *cl, UBYTE srcId) |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
190 { |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
191 unsigned ionum; |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
192 int state; |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
193 |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
194 TRACE_FUNCTION("atPlusIOW()"); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
195 |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
196 cl = parse(cl, "DD", &ionum, &state); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
197 if (!cl) |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
198 return (ATI_FAIL); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
199 if (ionum > 13) |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
200 return (ATI_FAIL); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
201 if (state) |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
202 AI_SetBit(ionum); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
203 else |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
204 AI_ResetBit(ionum); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
205 return (ATI_CMPL); |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
206 } |
def882d1b354
AT+IOR and AT+IOW GPIO commands implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
668
diff
changeset
|
207 |
663
cf1cfe12a54a
AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 #endif /* ATI_FCMISC_C */ |