FreeCalypso > hg > fc-magnetite
annotate src/g23m-aci/aci/ati_audio.c @ 563:d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 06 Jan 2019 23:37:13 +0000 |
parents | 8473cabf491d |
children | ade27cd84b97 |
rev | line source |
---|---|
247
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This ATI module and the AT commands implemented therein are a FreeCalypso |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * addition. The purpose of these AT commands is to exercise the audio |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * capabilities of the firmware - by using these commands, you should be |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * able to emit sounds from the speaker or record voice from the microphone |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * without needing to be in a call, and without bringing up GSM at all. |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 * Our corrected implementation of the AT@AUL command (originally added |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * by Openmoko) has been moved into this module as well. |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #ifndef ATI_AUDIO_C |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #define ATI_AUDIO_C |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "aci_all.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include <ctype.h> |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include <string.h> |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #include "aci_cmh.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #include "ati_cmd.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "aci_cmd.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "aci_io.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "aci_cmd.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "l4_tim.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "line_edit.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "aci_lst.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #include "pcm.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #include "audio.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "aci.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "rx.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #include "pwr.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #include "l4_tim.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #ifdef GPRS |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 #ifdef DTI |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #include "dti.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 #include "dti_conn_mng.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #include "dti_cntrl_mng.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 #endif /* DTI */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 #include "gaci.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 #include "gaci_cmh.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 #include "gaci_cmd.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 #endif /* GPRS */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 #include "aci_mem.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 #include "aci_prs.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 #include "ati_int.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 #ifndef _SIMULATION_ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 #include "ffs/ffs.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 #endif |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 #ifdef FF_ATI_BAT |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 #include "typedefs.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 #include "gdd.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 #include "bat.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 #include "ati_bat.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 #endif /*FF_ATI_BAT*/ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 #include "audio/audio_api.h" |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 #include "audio.h" /* Condat */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
292
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
69 #include "fc-target.cfg" |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
70 #include "armio.h" |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
71 |
454
8473cabf491d
aci3: AT@SPKR command enabled for D-Sample target like in aci2
Mychaela Falconia <falcon@freecalypso.org>
parents:
292
diff
changeset
|
72 #if defined(CONFIG_TARGET_DSAMPLE) || defined(CONFIG_TARGET_FCDEV3B) |
292
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
73 /* AT@SPKR - turn loudspeaker amplifier on or off */ |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
74 GLOBAL T_ATI_RSLT atAtSPKR ( char *cl, UBYTE srcId ) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
75 { |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
76 int state; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
77 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
78 TRACE_FUNCTION("atAtSPKR()"); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
79 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
80 cl = parse(cl, "D", &state); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
81 if (!cl) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
82 return (ATI_FAIL); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
83 if (state) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
84 AI_SetBit(1); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
85 else |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
86 AI_ResetBit(1); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
87 return (ATI_CMPL); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
88 } |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
89 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
90 GLOBAL T_ATI_RSLT queatAtSPKR (char *cl, UBYTE srcId) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
91 { |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
92 char *me="@SPKR: "; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
93 int state; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
94 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
95 TRACE_FUNCTION("queatAtSPKR()"); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
96 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
97 state = AI_ReadBit(1); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
98 sprintf(g_sa, "%s%d", me, state); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
99 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
100 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
101 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
102 return (ATI_CMPL); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
103 } |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
104 #endif |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
105 |
247
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 /* AT@SND - emit sound through Condat API */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 GLOBAL T_ATI_RSLT atAtSND ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 UBYTE sound_id = TONES_KEYBEEP; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 cl = parse(cl, "x", &sound_id); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 audio_PlaySoundID(AUDIO_SPEAKER, sound_id, 0, AUDIO_PLAY_ONCE); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 static void audio_callback(void *event_from_audio) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 /* do nothing at this time */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 /* |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 * PURPOSE : @AUL command (Audio table load) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 static char aul_name[AUDIO_MODE_FILENAME_MAX_SIZE]; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 GLOBAL T_ATI_RSLT atAtAUL (char *cl, UBYTE srcId) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 T_AUDIO_MODE_LOAD aul_param; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 TRACE_FUNCTION("atAtAUL()"); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 cl = parse(cl, "S", (LONG)(sizeof(aul_param.audio_mode_filename)), |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 aul_param.audio_mode_filename); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 if (!cl || !aul_param.audio_mode_filename[0]) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 /* Openmoko backward compatibility */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 if (isdigit(aul_param.audio_mode_filename[0]) && |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 !aul_param.audio_mode_filename[1]) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 sprintf(aul_param.audio_mode_filename, "para%c", |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 aul_param.audio_mode_filename[0]); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 return_path.callback_func = audio_callback; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 if (audio_mode_load(&aul_param, return_path) == AUDIO_OK) { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 strcpy(aul_name, aul_param.audio_mode_filename); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 } else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 GLOBAL T_ATI_RSLT queatAtAUL (char *cl, UBYTE srcId) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 char *me="@AUL: "; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 TRACE_FUNCTION("queatAtAUL()"); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 if (aul_name[0]) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 sprintf(g_sa, "%s/aud/%s.cfg", me, aul_name); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 sprintf(g_sa, "%s", me); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 |
292
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
170 #ifdef CONFIG_TARGET_FCDEV3B |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
171 /* AT@VPATH - configure digital voice path */ |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
172 GLOBAL T_ATI_RSLT atAtVPATH ( char *cl, UBYTE srcId ) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
173 { |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
174 int vpath_int; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
175 T_AUDIO_VOICE_PATH_SETTING vpath; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
176 T_AUDIO_FULL_ACCESS_WRITE audio_param; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
177 T_RV_RETURN return_path; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
178 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
179 TRACE_FUNCTION("atAtVPATH()"); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
180 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
181 cl = parse(cl, "D", &vpath_int); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
182 if (!cl) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
183 return (ATI_FAIL); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
184 vpath = vpath_int; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
185 audio_param.variable_indentifier = AUDIO_PATH_USED; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
186 audio_param.data = &vpath; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
187 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
188 return_path.addr_id = NULL; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
189 return_path.callback_func = audio_callback; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
190 if (audio_full_access_write(&audio_param, return_path) == AUDIO_OK) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
191 return (ATI_CMPL); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
192 else |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
193 return (ATI_FAIL); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
194 } |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
195 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
196 GLOBAL T_ATI_RSLT queatAtVPATH (char *cl, UBYTE srcId) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
197 { |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
198 char *me="@VPATH: "; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
199 T_AUDIO_VOICE_PATH_SETTING vpath; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
200 T_AUDIO_FULL_ACCESS_READ audio_param; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
201 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
202 TRACE_FUNCTION("queatAtVPATH()"); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
203 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
204 audio_param.variable_indentifier = AUDIO_PATH_USED; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
205 audio_param.data = &vpath; |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
206 if (audio_full_access_read(&audio_param) != AUDIO_OK) |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
207 return (ATI_FAIL); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
208 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
209 sprintf(g_sa, "%s%d", me, vpath); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
210 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
211 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
212 |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
213 return (ATI_CMPL); |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
214 } |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
215 #endif |
85b38e37810b
AT@SPKR and AT@VPATH ported over to aci3
Mychaela Falconia <falcon@freecalypso.org>
parents:
247
diff
changeset
|
216 |
563
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
217 static char melody_E1_name[AUDIO_PATH_NAME_MAX_SIZE]; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
218 |
247
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 /* AT@E1 - play an E1 format melody */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 T_AUDIO_MELODY_E1_PARAMETER e1_param; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 cl = parse(cl, "S", (LONG)(sizeof(e1_param.melody_name)), |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 e1_param.melody_name); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 if (!cl || !e1_param.melody_name[0]) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 e1_param.loopback = AUDIO_MELODY_NO_LOOPBACK; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 e1_param.melody_mode = AUDIO_MELODY_NORMAL_MODE; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 return_path.callback_func = audio_callback; |
563
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
234 if (audio_melody_E1_start(&e1_param, return_path) == AUDIO_OK) { |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
235 strcpy(melody_E1_name, e1_param.melody_name); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
236 return (ATI_CMPL); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
237 } else |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
238 return (ATI_FAIL); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
239 } |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
240 |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
241 /* AT@E1STOP - stop melody started with AT@E1 */ |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
242 GLOBAL T_ATI_RSLT atAtE1STOP ( char *cl, UBYTE srcId ) |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
243 { |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
244 T_AUDIO_MELODY_E1_STOP_PARAMETER e1stop_param; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
245 T_RV_RETURN return_path; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
246 |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
247 if (!melody_E1_name[0]) |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
248 return (ATI_FAIL); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
249 strcpy(e1stop_param.melody_name, melody_E1_name); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
250 |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
251 return_path.addr_id = NULL; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
252 return_path.callback_func = audio_callback; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
253 if (audio_melody_E1_stop(&e1stop_param, return_path) == AUDIO_OK) |
247
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 |
563
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
259 static char melody_E2_name[AUDIO_PATH_NAME_MAX_SIZE]; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
260 |
247
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 /* AT@E2 - play an E2 format melody */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 GLOBAL T_ATI_RSLT atAtE2 ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 T_AUDIO_MELODY_E2_PARAMETER e2_param; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 cl = parse(cl, "S", (LONG)(sizeof(e2_param.melody_E2_name)), |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 e2_param.melody_E2_name); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 if (!cl || !e2_param.melody_E2_name[0]) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 e2_param.E2_loopback = AUDIO_MELODY_NO_LOOPBACK; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 e2_param.melody_E2_mode = AUDIO_MELODY_NORMAL_MODE; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 return_path.callback_func = audio_callback; |
563
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
276 if (audio_melody_E2_start(&e2_param, return_path) == AUDIO_OK) { |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
277 strcpy(melody_E2_name, e2_param.melody_E2_name); |
247
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 return (ATI_CMPL); |
563
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
279 } else |
247
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 /* AT@E2LSI - load melody E2 instrument list file */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 GLOBAL T_ATI_RSLT atAtE2LSI ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 T_AUDIO_MELODY_E2_LOAD_FILE_INSTR_PARAMETER e2_lsi_param; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 cl = parse(cl, "S", (LONG)(sizeof(e2_lsi_param.melody_E2_file_name)), |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 e2_lsi_param.melody_E2_file_name); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 if (!cl || !e2_lsi_param.melody_E2_file_name[0]) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 if (audio_melody_E2_load_file_instruments(&e2_lsi_param) == AUDIO_OK) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 |
563
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
299 /* AT@E2STOP - stop melody started with AT@E2 */ |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
300 GLOBAL T_ATI_RSLT atAtE2STOP ( char *cl, UBYTE srcId ) |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
301 { |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
302 T_AUDIO_MELODY_E2_STOP_PARAMETER e2stop_param; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
303 T_RV_RETURN return_path; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
304 |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
305 if (!melody_E2_name[0]) |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
306 return (ATI_FAIL); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
307 strcpy(e2stop_param.melody_E2_name, melody_E2_name); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
308 |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
309 return_path.addr_id = NULL; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
310 return_path.callback_func = audio_callback; |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
311 if (audio_melody_E2_stop(&e2stop_param, return_path) == AUDIO_OK) |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
312 return (ATI_CMPL); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
313 else |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
314 return (ATI_FAIL); |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
315 } |
d648cafa30cf
aci3: implemented AT@E1STOP and AT@E2STOP commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
454
diff
changeset
|
316 |
247
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 /* AT@TONE - exercise TONES through RiViera Audio Service API */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 GLOBAL T_ATI_RSLT atAtTONE ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 int tone_start[3], tone_stop[3], tone_freq[3], tone_ampl[3]; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 int frame_dur, sequence_dur, period_dur, repetition; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 int i; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 T_AUDIO_TONES_PARAMETER t; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 cl = parse(cl, "DDDDDDDDDDDDDDDD", |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 &tone_start[0], &tone_stop[0], &tone_freq[0], &tone_ampl[0], |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 &tone_start[1], &tone_stop[1], &tone_freq[1], &tone_ampl[1], |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 &tone_start[2], &tone_stop[2], &tone_freq[2], &tone_ampl[2], |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 &frame_dur, &sequence_dur, &period_dur, &repetition); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 if (!cl) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 for (i = 0; i < 3; i++) { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 t.tones[i].start_tone = tone_start[i]; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 t.tones[i].stop_tone = tone_stop[i]; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 t.tones[i].frequency_tone = tone_freq[i]; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 t.tones[i].amplitude_tone = -tone_ampl[i]; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 t.frame_duration = frame_dur; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 t.sequence_duration = sequence_dur; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 t.period_duration = period_dur; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 t.repetition = repetition; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 return_path.callback_func = audio_callback; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 if (audio_tones_start(&t, return_path) == AUDIO_OK) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 /* AT@TSTOP - stop tones started with AT@TONE */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 GLOBAL T_ATI_RSLT atAtTSTOP ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 return_path.callback_func = audio_callback; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 if (audio_tones_stop(return_path) == AUDIO_OK) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 /* AT@VMP - play back a voice memo recording */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 GLOBAL T_ATI_RSLT atAtVMP ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 T_AUDIO_VM_PLAY_PARAMETER play_param; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 cl = parse(cl, "S", (LONG)(sizeof(play_param.memo_name)), |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 play_param.memo_name); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
373 if (!cl || !play_param.memo_name[0]) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
374 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 return_path.callback_func = audio_callback; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
378 if (audio_vm_play_start(&play_param, return_path) == AUDIO_OK) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 /* AT@VMPS - stop VM play started with AT@VMP */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
385 GLOBAL T_ATI_RSLT atAtVMPS ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
386 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
389 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 return_path.callback_func = audio_callback; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
391 if (audio_vm_play_stop(return_path) == AUDIO_OK) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 static const T_AUDIO_TONES_PARAMETER recorder_warning_tone = { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 0, 500, 1400, -5, |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 0, 500, 0, 0, |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 0, 500, 0, 0, |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
401 500, 500, 15000, TONE_INFINITE |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
402 }; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
404 /* AT@VMR - record a voice memo */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 GLOBAL T_ATI_RSLT atAtVMR ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
406 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
407 T_AUDIO_VM_RECORD_PARAMETER record_param; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
408 int duration = 0, compression = 0; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
409 LONG mic_gain = 0x100, network_gain = 0x100; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
410 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
411 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
412 cl = parse(cl, "Sddyy", (LONG)(sizeof(record_param.memo_name)), |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
413 record_param.memo_name, &duration, &compression, |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
414 &mic_gain, &network_gain); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
415 if (!cl || !record_param.memo_name[0] || !duration) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
416 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
417 record_param.memo_duration = duration; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
418 record_param.compression_mode = compression; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
419 record_param.microphone_gain = mic_gain; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
420 record_param.network_gain = network_gain; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
421 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
422 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
423 return_path.callback_func = audio_callback; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
424 if (audio_vm_record_start(&record_param, |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
425 (T_AUDIO_TONES_PARAMETER *) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
426 &recorder_warning_tone, |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
427 return_path) == AUDIO_OK) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
428 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
429 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
430 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
431 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
432 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
433 /* AT@VMRS - stop VM recording started with AT@VMR */ |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
434 GLOBAL T_ATI_RSLT atAtVMRS ( char *cl, UBYTE srcId ) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
435 { |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
436 T_RV_RETURN return_path; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
437 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
438 return_path.addr_id = NULL; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
439 return_path.callback_func = audio_callback; |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
440 if (audio_vm_record_stop(return_path) == AUDIO_OK) |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
441 return (ATI_CMPL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
442 else |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
443 return (ATI_FAIL); |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
444 } |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
445 |
294c26c07561
aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
446 #endif /* ATI_AUDIO_C */ |