annotate src/g23m-aci/aci/ati_audio.c @ 247:294c26c07561

aci3: started adding Openmoko and FreeCalypso AT commands
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 24 Jul 2017 06:52:58 +0000
parents
children 85b38e37810b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 /* AT@SND - emit sound through Condat API */
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 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
71 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 UBYTE sound_id = TONES_KEYBEEP;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 cl = parse(cl, "x", &sound_id);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 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
76 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 }
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 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
80 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 /* do nothing at this time */
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 }
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 /*
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 * PURPOSE : @AUL command (Audio table load)
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 */
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 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
89
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 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
91 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 T_AUDIO_MODE_LOAD aul_param;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 T_RV_RETURN return_path;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 TRACE_FUNCTION("atAtAUL()");
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 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
98 aul_param.audio_mode_filename);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 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
100 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 /* Openmoko backward compatibility */
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 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
104 !aul_param.audio_mode_filename[1])
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 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
106 aul_param.audio_mode_filename[0]);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 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
111 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
112 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 } else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 return (ATI_FAIL);
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
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 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
118 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 char *me="@AUL: ";
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 TRACE_FUNCTION("queatAtAUL()");
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 if (aul_name[0])
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 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
125 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 sprintf(g_sa, "%s", me);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 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
129
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 return (ATI_CMPL);
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
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 /* AT@E1 - play an E1 format melody */
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 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
135 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 T_AUDIO_MELODY_E1_PARAMETER e1_param;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 T_RV_RETURN return_path;
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 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
140 e1_param.melody_name);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 if (!cl || !e1_param.melody_name[0])
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 e1_param.loopback = AUDIO_MELODY_NO_LOOPBACK;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 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
145
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 if (audio_melody_E1_start(&e1_param, return_path) == AUDIO_OK)
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 /* AT@E2 - play an E2 format melody */
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 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
156 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 T_AUDIO_MELODY_E2_PARAMETER e2_param;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 T_RV_RETURN return_path;
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 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
161 e2_param.melody_E2_name);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 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
163 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 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
165 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
166
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 if (audio_melody_E2_start(&e2_param, return_path) == AUDIO_OK)
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 }
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 /* 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
176 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
177 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 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
179
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 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
181 e2_lsi_param.melody_E2_file_name);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 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
183 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 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
186 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 }
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 /* 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
192 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
193 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 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
195 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
196 int i;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 T_AUDIO_TONES_PARAMETER t;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 T_RV_RETURN return_path;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 cl = parse(cl, "DDDDDDDDDDDDDDDD",
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 &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
202 &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
203 &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
204 &frame_dur, &sequence_dur, &period_dur, &repetition);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 if (!cl)
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 for (i = 0; i < 3; i++) {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 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
209 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
210 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
211 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
212 }
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 t.frame_duration = frame_dur;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 t.sequence_duration = sequence_dur;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 t.period_duration = period_dur;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 t.repetition = repetition;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 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
221 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 return (ATI_FAIL);
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
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 /* 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
227 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
228 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 T_RV_RETURN return_path;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 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
234 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 }
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 /* 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
240 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
241 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 T_AUDIO_VM_PLAY_PARAMETER play_param;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 T_RV_RETURN return_path;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 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
246 play_param.memo_name);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 if (!cl || !play_param.memo_name[0])
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 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
253 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 }
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 /* 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
259 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
260 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 T_RV_RETURN return_path;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 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
266 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 }
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 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
272 0, 500, 1400, -5,
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 0, 500, 0, 0,
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 0, 500, 0, 0,
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 500, 500, 15000, TONE_INFINITE
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 };
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 /* AT@VMR - record a voice memo */
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 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
280 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 T_AUDIO_VM_RECORD_PARAMETER record_param;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 int duration = 0, compression = 0;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 LONG mic_gain = 0x100, network_gain = 0x100;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 T_RV_RETURN return_path;
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 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
287 record_param.memo_name, &duration, &compression,
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 &mic_gain, &network_gain);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 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
290 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 record_param.memo_duration = duration;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 record_param.compression_mode = compression;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 record_param.microphone_gain = mic_gain;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 record_param.network_gain = network_gain;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 if (audio_vm_record_start(&record_param,
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 (T_AUDIO_TONES_PARAMETER *)
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 &recorder_warning_tone,
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 return_path) == AUDIO_OK)
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 }
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 /* 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
308 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
309 {
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 T_RV_RETURN return_path;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 return_path.addr_id = NULL;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 return_path.callback_func = audio_callback;
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 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
315 return (ATI_CMPL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 else
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 return (ATI_FAIL);
294c26c07561 aci3: started adding Openmoko and FreeCalypso AT commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 }
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 #endif /* ATI_AUDIO_C */