annotate src/aci2/aci/ati_fcmisc.c @ 678:edaceb78719a

doc/Leonardo-target: Tango unused Calypso signals update
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 20 Jun 2020 05:08:39 +0000
parents 227d37a968ec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
667
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
60 #include "fc-target.h"
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
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
667
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
99 #ifdef TARGET_HAS_LPG
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
100 /* AT@LPG - program LPG output */
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
101 GLOBAL T_ATI_RSLT atAtLPG ( char *cl, UBYTE srcId )
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
102 {
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
103 unsigned glob, period = 0, ontime = 0;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
104
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
105 TRACE_FUNCTION("atAtLPG()");
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
106
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
107 cl = parse(cl, "Ddd", &glob, &period, &ontime);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
108 if (!cl)
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
109 return (ATI_FAIL);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
110 if (glob > 3 || period > 7 || ontime > 7)
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
111 return (ATI_FAIL);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
112 *(volatile SYS_UWORD8 *)0xFFFE7801 = 0x01;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
113 *(volatile SYS_UWORD8 *)0xFFFE7800 =
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
114 (glob << 6) | (ontime << 3) | period;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
115 return (ATI_CMPL);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
116 }
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
117
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
118 GLOBAL T_ATI_RSLT queatAtLPG (char *cl, UBYTE srcId)
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
119 {
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
120 char *me="@LPG: ";
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
121 SYS_UWORD8 regval;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
122 unsigned glob, period, ontime;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
123
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
124 TRACE_FUNCTION("queatAtLPG()");
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
125
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
126 regval = *(volatile SYS_UWORD8 *)0xFFFE7800;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
127 glob = (regval >> 6) & 3;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
128 ontime = (regval >> 3) & 7;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
129 period = regval & 7;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
130 sprintf(g_sa, "%s%u,%u,%u", me, glob, period, ontime);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
131 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
132 return (ATI_CMPL);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
133 }
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
134 #endif /* TARGET_HAS_LPG */
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
135
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
136 #ifdef TARGET_HAS_PWL
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
137 /* AT@PWL - program PWL output */
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
138 GLOBAL T_ATI_RSLT atAtPWL ( char *cl, UBYTE srcId )
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
139 {
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
140 unsigned level;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
141
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
142 TRACE_FUNCTION("atAtPWL()");
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
143
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
144 cl = parse(cl, "D", &level);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
145 if (!cl)
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
146 return (ATI_FAIL);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
147 if (level > 255)
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
148 return (ATI_FAIL);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
149 *(volatile SYS_UWORD8 *)0xFFFE8000 = level;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
150 *(volatile SYS_UWORD8 *)0xFFFE8001 = 0x01;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
151 return (ATI_CMPL);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
152 }
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
153
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
154 GLOBAL T_ATI_RSLT queatAtPWL (char *cl, UBYTE srcId)
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
155 {
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
156 char *me="@PWL: ";
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
157 SYS_UWORD8 regval;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
158
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
159 TRACE_FUNCTION("queatAtPWL()");
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
160
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
161 regval = *(volatile SYS_UWORD8 *)0xFFFE8000;
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
162 sprintf(g_sa, "%s%u", me, regval);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
163 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
164 return (ATI_CMPL);
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
165 }
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
166 #endif /* TARGET_HAS_PWL */
36df58db1640 AT@LPG and AT@PWL implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 664
diff changeset
167
669
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
168 /* AT+IOR - read GPIO pin */
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
169 GLOBAL T_ATI_RSLT atPlusIOR (char *cl, UBYTE srcId)
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
170 {
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
171 char *me="+IOR: ";
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
172 unsigned ionum;
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
173 int state;
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
174
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
175 TRACE_FUNCTION("atPlusIOR()");
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
176
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
177 cl = parse(cl, "D", &ionum);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
178 if (!cl)
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
179 return (ATI_FAIL);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
180 if (ionum > 13)
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
181 return (ATI_FAIL);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
182 state = AI_ReadBit(ionum);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
183 sprintf(g_sa, "%s%u,%d", me, ionum, state);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
184 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
185 return (ATI_CMPL);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
186 }
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
187
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
188 /* AT+IOW - set GPIO pin */
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
189 GLOBAL T_ATI_RSLT atPlusIOW (char *cl, UBYTE srcId)
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
190 {
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
191 unsigned ionum;
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
192 int state;
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
193
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
194 TRACE_FUNCTION("atPlusIOW()");
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
195
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
196 cl = parse(cl, "DD", &ionum, &state);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
197 if (!cl)
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
198 return (ATI_FAIL);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
199 if (ionum > 13)
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
200 return (ATI_FAIL);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
201 if (state)
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
202 AI_SetBit(ionum);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
203 else
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
204 AI_ResetBit(ionum);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
205 return (ATI_CMPL);
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
206 }
227d37a968ec AT+IOR and AT+IOW GPIO commands implemented in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents: 667
diff changeset
207
663
cf1cfe12a54a AT@SPENH command implemented in aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 #endif /* ATI_FCMISC_C */