annotate src/aci2/aci/ati_audio.c @ 600:8f50b202e81f

board preprocessor conditionals: prep for more FC hw in the future This change eliminates the CONFIG_TARGET_FCDEV3B preprocessor symbol and all preprocessor conditionals throughout the code base that tested for it, replacing them with CONFIG_TARGET_FCFAM or CONFIG_TARGET_FCMODEM. These new symbols are specified as follows: CONFIG_TARGET_FCFAM is intended to cover all hardware designs created by Mother Mychaela under the FreeCalypso trademark. This family will include modem products (repackagings of the FCDEV3B, possibly with RFFE or even RF transceiver changes), and also my desired FreeCalypso handset product. CONFIG_TARGET_FCMODEM is intended to cover all FreeCalypso modem products (which will be firmware-compatible with the FCDEV3B if they use TI Rita transceiver, or will require a different fw build if we switch to one of Silabs Aero transceivers), but not the handset product. Right now this CONFIG_TARGET_FCMODEM preprocessor symbol is used to conditionalize everything dealing with MCSI. At the present moment the future of FC hardware evolution is still unknown: it is not known whether we will ever have any beyond-FCDEV3B hardware at all (contingent on uncertain funding), and if we do produce further FC hardware designs, it is not known whether they will retain the same FIC modem core (triband), if we are going to have a quadband design that still retains the classic Rita transceiver, or if we are going to switch to Silabs Aero II or some other transceiver. If we produce a quadband modem that still uses Rita, it will run exactly the same fw as the FCDEV3B thanks to the way we define TSPACT signals for the RF_FAM=12 && CONFIG_TARGET_FCFAM combination, and the current fcdev3b build target will be renamed to fcmodem. OTOH, if that putative quadband modem will be Aero-based, then it will require a different fw build target, the fcdev3b target will stay as it is, and the two targets will both define CONFIG_TARGET_FCFAM and CONFIG_TARGET_FCMODEM, but will have different RF_FAM numbers. But no matter which way we are going to evolve, it is not right to have conditionals on CONFIG_TARGET_FCDEV3B in places like ACI, and the present change clears the way for future evolution.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 01 Apr 2019 01:05:24 +0000
parents f18b29e27be5
children 92dbfa906f66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This ATI module and the AT commands implemented therein are a FreeCalypso
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * addition. The purpose of these AT commands is to exercise the audio
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * capabilities of the firmware - by using these commands, you should be
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * able to emit sounds from the speaker or record voice from the microphone
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * without needing to be in a call, and without bringing up GSM at all.
245
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
7 *
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
8 * Our corrected implementation of the AT@AUL command (originally added
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
9 * by Openmoko) has been moved into this module as well.
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #ifndef ATI_AUDIO_C
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #define ATI_AUDIO_C
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "aci_all.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include <ctype.h>
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 #include <string.h>
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 #include "aci_cmh.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #include "ati_cmd.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #include "aci_cmd.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #include "aci_io.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "aci_cmd.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #include "l4_tim.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #include "line_edit.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #include "aci_lst.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include "pcm.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "audio.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "aci.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "rx.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "pwr.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include "l4_tim.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #ifdef GPRS
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #ifdef DTI
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "dti.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include "dti_conn_mng.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #include "dti_cntrl_mng.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #endif /* DTI */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 #include "gaci.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 #include "gaci_cmh.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 #include "gaci_cmd.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 #endif /* GPRS */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 #include "aci_mem.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 #include "aci_prs.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 #include "ati_int.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 #ifndef _SIMULATION_
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 #include "ffs/ffs.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 #endif
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 #ifdef FF_ATI_BAT
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 #include "typedefs.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 #include "gdd.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 #include "bat.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 #include "ati_bat.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 #endif /*FF_ATI_BAT*/
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 #include "audio/audio_api.h"
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 #include "audio.h" /* Condat */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
264
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
69 #include "fc-target.cfg"
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
70 #include "armio.h"
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
71
600
8f50b202e81f board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents: 597
diff changeset
72 #if defined(CONFIG_TARGET_DSAMPLE) || defined(CONFIG_TARGET_FCFAM)
264
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
73 /* AT@SPKR - turn loudspeaker amplifier on or off */
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
74 GLOBAL T_ATI_RSLT atAtSPKR ( char *cl, UBYTE srcId )
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
75 {
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
76 int state;
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
77
287
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
78 TRACE_FUNCTION("atAtSPKR()");
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
79
264
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
80 cl = parse(cl, "D", &state);
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
81 if (!cl)
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
82 return (ATI_FAIL);
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
83 if (state)
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
84 AI_SetBit(1);
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
85 else
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
86 AI_ResetBit(1);
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
87 return (ATI_CMPL);
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
88 }
287
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
89
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
90 GLOBAL T_ATI_RSLT queatAtSPKR (char *cl, UBYTE srcId)
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
91 {
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
92 char *me="@SPKR: ";
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
93 int state;
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
94
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
95 TRACE_FUNCTION("queatAtSPKR()");
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
96
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
97 state = AI_ReadBit(1);
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
98 sprintf(g_sa, "%s%d", me, state);
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
99
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
100 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
101
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
102 return (ATI_CMPL);
d85305a74518 aci2 AT@SPKR command: added query operation
Mychaela Falconia <falcon@freecalypso.org>
parents: 264
diff changeset
103 }
264
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
104 #endif
3edeadec6804 aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 245
diff changeset
105
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 /* AT@SND - emit sound through Condat API */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 GLOBAL T_ATI_RSLT atAtSND ( char *cl, UBYTE srcId )
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 {
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 UBYTE sound_id = TONES_KEYBEEP;
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 cl = parse(cl, "x", &sound_id);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 audio_PlaySoundID(AUDIO_SPEAKER, sound_id, 0, AUDIO_PLAY_ONCE);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 return (ATI_CMPL);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 }
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 static void audio_callback(void *event_from_audio)
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 {
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 /* do nothing at this time */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 }
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120
245
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
121 /*
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
122 * PURPOSE : @AUL command (Audio table load)
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
123 */
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
124
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
125 static char aul_name[AUDIO_MODE_FILENAME_MAX_SIZE];
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
126
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
127 GLOBAL T_ATI_RSLT atAtAUL (char *cl, UBYTE srcId)
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
128 {
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
129 T_AUDIO_MODE_LOAD aul_param;
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
130 T_RV_RETURN return_path;
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
131
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
132 TRACE_FUNCTION("atAtAUL()");
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
133
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
134 cl = parse(cl, "S", (LONG)(sizeof(aul_param.audio_mode_filename)),
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
135 aul_param.audio_mode_filename);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
136 if (!cl || !aul_param.audio_mode_filename[0])
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
137 return (ATI_FAIL);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
138
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
139 /* Openmoko backward compatibility */
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
140 if (isdigit(aul_param.audio_mode_filename[0]) &&
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
141 !aul_param.audio_mode_filename[1])
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
142 sprintf(aul_param.audio_mode_filename, "para%c",
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
143 aul_param.audio_mode_filename[0]);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
144
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
145 return_path.addr_id = NULL;
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
146 return_path.callback_func = audio_callback;
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
147 if (audio_mode_load(&aul_param, return_path) == AUDIO_OK) {
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
148 strcpy(aul_name, aul_param.audio_mode_filename);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
149 return (ATI_CMPL);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
150 } else
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
151 return (ATI_FAIL);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
152 }
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
153
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
154 GLOBAL T_ATI_RSLT queatAtAUL (char *cl, UBYTE srcId)
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
155 {
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
156 char *me="@AUL: ";
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
157
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
158 TRACE_FUNCTION("queatAtAUL()");
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
159
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
160 if (aul_name[0])
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
161 sprintf(g_sa, "%s/aud/%s.cfg", me, aul_name);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
162 else
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
163 sprintf(g_sa, "%s", me);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
164
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
165 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
166
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
167 return (ATI_CMPL);
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
168 }
3b8d291ed45a aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents: 244
diff changeset
169
600
8f50b202e81f board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents: 597
diff changeset
170 #ifdef CONFIG_TARGET_FCMODEM
597
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
171 extern UBYTE aci_digital_voice_autoswitch;
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
172
288
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
173 /* AT@VPATH - configure digital voice path */
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
174 GLOBAL T_ATI_RSLT atAtVPATH ( char *cl, UBYTE srcId )
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
175 {
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
176 int vpath_int;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
177 T_AUDIO_VOICE_PATH_SETTING vpath;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
178 T_AUDIO_FULL_ACCESS_WRITE audio_param;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
179 T_RV_RETURN return_path;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
180
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
181 TRACE_FUNCTION("atAtVPATH()");
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
182
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
183 cl = parse(cl, "D", &vpath_int);
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
184 if (!cl)
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
185 return (ATI_FAIL);
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
186 vpath = vpath_int;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
187 audio_param.variable_indentifier = AUDIO_PATH_USED;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
188 audio_param.data = &vpath;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
189
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
190 return_path.addr_id = NULL;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
191 return_path.callback_func = audio_callback;
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
192 if (audio_full_access_write(&audio_param, return_path) == AUDIO_OK)
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
193 return (ATI_CMPL);
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
194 else
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
195 return (ATI_FAIL);
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
196 }
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
197
289
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
198 GLOBAL T_ATI_RSLT queatAtVPATH (char *cl, UBYTE srcId)
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
199 {
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
200 char *me="@VPATH: ";
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
201 T_AUDIO_VOICE_PATH_SETTING vpath;
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
202 T_AUDIO_FULL_ACCESS_READ audio_param;
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
203
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
204 TRACE_FUNCTION("queatAtVPATH()");
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
205
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
206 audio_param.variable_indentifier = AUDIO_PATH_USED;
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
207 audio_param.data = &vpath;
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
208 if (audio_full_access_read(&audio_param) != AUDIO_OK)
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
209 return (ATI_FAIL);
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
210
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
211 sprintf(g_sa, "%s%d", me, vpath);
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
212
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
213 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
214
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
215 return (ATI_CMPL);
8dd51b740701 AT@VPATH query implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 288
diff changeset
216 }
597
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
217
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
218 /* AT@VSEL - configure digital voice path automatic operation */
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
219 GLOBAL T_ATI_RSLT atAtVSEL ( char *cl, UBYTE srcId )
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
220 {
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
221 int vsel_int;
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
222
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
223 TRACE_FUNCTION("atAtVSEL()");
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
224
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
225 cl = parse(cl, "D", &vsel_int);
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
226 if (!cl)
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
227 return (ATI_FAIL);
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
228 if (vsel_int != 0 && vsel_int != 1)
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
229 return (ATI_FAIL);
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
230 aci_digital_voice_autoswitch = vsel_int;
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
231 return (ATI_CMPL);
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
232 }
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
233
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
234 GLOBAL T_ATI_RSLT queatAtVSEL (char *cl, UBYTE srcId)
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
235 {
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
236 char *me="@VSEL: ";
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
237
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
238 TRACE_FUNCTION("queatAtVSEL()");
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
239
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
240 sprintf(g_sa, "%s%u", me, aci_digital_voice_autoswitch);
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
241 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
242 return (ATI_CMPL);
f18b29e27be5 First attempt at MCSI voice path automatic switching
Mychaela Falconia <falcon@freecalypso.org>
parents: 565
diff changeset
243 }
288
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
244 #endif
dd3374eac8a3 AT@VPATH setting implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 287
diff changeset
245
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
246 static char melody_E1_name[AUDIO_PATH_NAME_MAX_SIZE];
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
247
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 /* AT@E1 - play an E1 format melody */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId )
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 {
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 T_AUDIO_MELODY_E1_PARAMETER e1_param;
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
252 int loopback = 0;
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 T_RV_RETURN return_path;
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
255 cl = parse(cl, "Sd", (LONG)(sizeof(e1_param.melody_name)),
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
256 e1_param.melody_name, &loopback);
244
bec9198fc306 aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents: 240
diff changeset
257 if (!cl || !e1_param.melody_name[0])
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 return (ATI_FAIL);
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
259 e1_param.loopback = loopback;
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 e1_param.melody_mode = AUDIO_MELODY_NORMAL_MODE;
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 return_path.addr_id = NULL;
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 return_path.callback_func = audio_callback;
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
264 if (audio_melody_E1_start(&e1_param, return_path) == AUDIO_OK) {
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
265 strcpy(melody_E1_name, e1_param.melody_name);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
266 return (ATI_CMPL);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
267 } else
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
268 return (ATI_FAIL);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
269 }
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
270
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
271 /* AT@E1STOP - stop melody started with AT@E1 */
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
272 GLOBAL T_ATI_RSLT atAtE1STOP ( char *cl, UBYTE srcId )
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
273 {
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
274 T_AUDIO_MELODY_E1_STOP_PARAMETER e1stop_param;
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
275 T_RV_RETURN return_path;
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
276
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
277 if (!melody_E1_name[0])
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
278 return (ATI_FAIL);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
279 strcpy(e1stop_param.melody_name, melody_E1_name);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
280
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
281 return_path.addr_id = NULL;
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
282 return_path.callback_func = audio_callback;
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
283 if (audio_melody_E1_stop(&e1stop_param, return_path) == AUDIO_OK)
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 return (ATI_CMPL);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 else
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 return (ATI_FAIL);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 }
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
289 static char melody_E2_name[AUDIO_PATH_NAME_MAX_SIZE];
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
290
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 /* AT@E2 - play an E2 format melody */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 GLOBAL T_ATI_RSLT atAtE2 ( char *cl, UBYTE srcId )
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 {
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 T_AUDIO_MELODY_E2_PARAMETER e2_param;
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
295 int loopback = 0;
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 T_RV_RETURN return_path;
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
298 cl = parse(cl, "Sd", (LONG)(sizeof(e2_param.melody_E2_name)),
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
299 e2_param.melody_E2_name, &loopback);
244
bec9198fc306 aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents: 240
diff changeset
300 if (!cl || !e2_param.melody_E2_name[0])
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 return (ATI_FAIL);
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
302 e2_param.E2_loopback = loopback;
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 e2_param.melody_E2_mode = AUDIO_MELODY_NORMAL_MODE;
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 return_path.addr_id = NULL;
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 return_path.callback_func = audio_callback;
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
307 if (audio_melody_E2_start(&e2_param, return_path) == AUDIO_OK) {
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
308 strcpy(melody_E2_name, e2_param.melody_E2_name);
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 return (ATI_CMPL);
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
310 } else
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 return (ATI_FAIL);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 }
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 /* AT@E2LSI - load melody E2 instrument list file */
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 GLOBAL T_ATI_RSLT atAtE2LSI ( char *cl, UBYTE srcId )
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 {
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 T_AUDIO_MELODY_E2_LOAD_FILE_INSTR_PARAMETER e2_lsi_param;
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318
244
bec9198fc306 aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents: 240
diff changeset
319 cl = parse(cl, "S", (LONG)(sizeof(e2_lsi_param.melody_E2_file_name)),
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 e2_lsi_param.melody_E2_file_name);
244
bec9198fc306 aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents: 240
diff changeset
321 if (!cl || !e2_lsi_param.melody_E2_file_name[0])
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 return (ATI_FAIL);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 if (audio_melody_E2_load_file_instruments(&e2_lsi_param) == AUDIO_OK)
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 return (ATI_CMPL);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 else
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 return (ATI_FAIL);
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 }
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329
565
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
330 /* AT@E2STOP - stop melody started with AT@E2 */
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
331 GLOBAL T_ATI_RSLT atAtE2STOP ( char *cl, UBYTE srcId )
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
332 {
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
333 T_AUDIO_MELODY_E2_STOP_PARAMETER e2stop_param;
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
334 T_RV_RETURN return_path;
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
335
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
336 if (!melody_E2_name[0])
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
337 return (ATI_FAIL);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
338 strcpy(e2stop_param.melody_E2_name, melody_E2_name);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
339
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
340 return_path.addr_id = NULL;
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
341 return_path.callback_func = audio_callback;
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
342 if (audio_melody_E2_stop(&e2stop_param, return_path) == AUDIO_OK)
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
343 return (ATI_CMPL);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
344 else
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
345 return (ATI_FAIL);
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
346 }
96c1d047b3c6 aci2: AT%VBAT and melody play enhancements matching aci3
Mychaela Falconia <falcon@freecalypso.org>
parents: 410
diff changeset
347
239
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
348 /* AT@TONE - exercise TONES through RiViera Audio Service API */
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
349 GLOBAL T_ATI_RSLT atAtTONE ( char *cl, UBYTE srcId )
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
350 {
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
351 int tone_start[3], tone_stop[3], tone_freq[3], tone_ampl[3];
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
352 int frame_dur, sequence_dur, period_dur, repetition;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
353 int i;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
354 T_AUDIO_TONES_PARAMETER t;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
355 T_RV_RETURN return_path;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
356
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
357 cl = parse(cl, "DDDDDDDDDDDDDDDD",
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
358 &tone_start[0], &tone_stop[0], &tone_freq[0], &tone_ampl[0],
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
359 &tone_start[1], &tone_stop[1], &tone_freq[1], &tone_ampl[1],
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
360 &tone_start[2], &tone_stop[2], &tone_freq[2], &tone_ampl[2],
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
361 &frame_dur, &sequence_dur, &period_dur, &repetition);
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
362 if (!cl)
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
363 return (ATI_FAIL);
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
364 for (i = 0; i < 3; i++) {
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
365 t.tones[i].start_tone = tone_start[i];
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
366 t.tones[i].stop_tone = tone_stop[i];
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
367 t.tones[i].frequency_tone = tone_freq[i];
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
368 t.tones[i].amplitude_tone = -tone_ampl[i];
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
369 }
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
370 t.frame_duration = frame_dur;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
371 t.sequence_duration = sequence_dur;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
372 t.period_duration = period_dur;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
373 t.repetition = repetition;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
374
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
375 return_path.addr_id = NULL;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
376 return_path.callback_func = audio_callback;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
377 if (audio_tones_start(&t, return_path) == AUDIO_OK)
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
378 return (ATI_CMPL);
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
379 else
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
380 return (ATI_FAIL);
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
381 }
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
382
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
383 /* AT@TSTOP - stop tones started with AT@TONE */
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
384 GLOBAL T_ATI_RSLT atAtTSTOP ( char *cl, UBYTE srcId )
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
385 {
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
386 T_RV_RETURN return_path;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
387
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
388 return_path.addr_id = NULL;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
389 return_path.callback_func = audio_callback;
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
390 if (audio_tones_stop(return_path) == AUDIO_OK)
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
391 return (ATI_CMPL);
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
392 else
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
393 return (ATI_FAIL);
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
394 }
e0b9c21d7908 AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
395
240
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
396 /* AT@VMP - play back a voice memo recording */
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
397 GLOBAL T_ATI_RSLT atAtVMP ( char *cl, UBYTE srcId )
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
398 {
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
399 T_AUDIO_VM_PLAY_PARAMETER play_param;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
400 T_RV_RETURN return_path;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
401
244
bec9198fc306 aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents: 240
diff changeset
402 cl = parse(cl, "S", (LONG)(sizeof(play_param.memo_name)),
240
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
403 play_param.memo_name);
244
bec9198fc306 aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents: 240
diff changeset
404 if (!cl || !play_param.memo_name[0])
240
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
405 return (ATI_FAIL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
406
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
407 return_path.addr_id = NULL;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
408 return_path.callback_func = audio_callback;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
409 if (audio_vm_play_start(&play_param, return_path) == AUDIO_OK)
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
410 return (ATI_CMPL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
411 else
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
412 return (ATI_FAIL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
413 }
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
414
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
415 /* AT@VMPS - stop VM play started with AT@VMP */
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
416 GLOBAL T_ATI_RSLT atAtVMPS ( char *cl, UBYTE srcId )
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
417 {
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
418 T_RV_RETURN return_path;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
419
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
420 return_path.addr_id = NULL;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
421 return_path.callback_func = audio_callback;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
422 if (audio_vm_play_stop(return_path) == AUDIO_OK)
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
423 return (ATI_CMPL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
424 else
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
425 return (ATI_FAIL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
426 }
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
427
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
428 static const T_AUDIO_TONES_PARAMETER recorder_warning_tone = {
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
429 0, 500, 1400, -5,
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
430 0, 500, 0, 0,
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
431 0, 500, 0, 0,
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
432 500, 500, 15000, TONE_INFINITE
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
433 };
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
434
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
435 /* AT@VMR - record a voice memo */
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
436 GLOBAL T_ATI_RSLT atAtVMR ( char *cl, UBYTE srcId )
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
437 {
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
438 T_AUDIO_VM_RECORD_PARAMETER record_param;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
439 int duration = 0, compression = 0;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
440 LONG mic_gain = 0x100, network_gain = 0x100;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
441 T_RV_RETURN return_path;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
442
244
bec9198fc306 aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents: 240
diff changeset
443 cl = parse(cl, "Sddyy", (LONG)(sizeof(record_param.memo_name)),
240
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
444 record_param.memo_name, &duration, &compression,
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
445 &mic_gain, &network_gain);
244
bec9198fc306 aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents: 240
diff changeset
446 if (!cl || !record_param.memo_name[0] || !duration)
240
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
447 return (ATI_FAIL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
448 record_param.memo_duration = duration;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
449 record_param.compression_mode = compression;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
450 record_param.microphone_gain = mic_gain;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
451 record_param.network_gain = network_gain;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
452
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
453 return_path.addr_id = NULL;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
454 return_path.callback_func = audio_callback;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
455 if (audio_vm_record_start(&record_param,
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
456 (T_AUDIO_TONES_PARAMETER *)
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
457 &recorder_warning_tone,
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
458 return_path) == AUDIO_OK)
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
459 return (ATI_CMPL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
460 else
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
461 return (ATI_FAIL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
462 }
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
463
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
464 /* AT@VMRS - stop VM recording started with AT@VMR */
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
465 GLOBAL T_ATI_RSLT atAtVMRS ( char *cl, UBYTE srcId )
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
466 {
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
467 T_RV_RETURN return_path;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
468
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
469 return_path.addr_id = NULL;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
470 return_path.callback_func = audio_callback;
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
471 if (audio_vm_record_stop(return_path) == AUDIO_OK)
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
472 return (ATI_CMPL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
473 else
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
474 return (ATI_FAIL);
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
475 }
9034c3a7267e Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 239
diff changeset
476
226
67fe1b3f4bd7 aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
477 #endif /* ATI_AUDIO_C */