FreeCalypso > hg > freecalypso-citrine
comparison g23m-glue/gdi/audio.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS | |
4 | Modul : DRV_AUDIO | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This Module defines the audio driver interface. | |
18 | for the G23 protocol stack. | |
19 | | |
20 | This driver is used to control all audio and audio-related | |
21 | devices of the mobile such as speaker, microphone, etc. | |
22 | A device, e.g. a speaker, may have the capability to play | |
23 | sounds and/or melodies indirectly. This means a sound | |
24 | generator may be attached to a speaker or its amplifier. | |
25 | The format of the sound/melody images is implementation | |
26 | dependent and therefore not in the scope of the generic | |
27 | driver interface. Therefore a application may play pre- | |
28 | defined, driver specific sounds identifying them via a | |
29 | sound ID. In addition the API of this driver has foreseen | |
30 | that an application may copy a sound image into its local | |
31 | buffer, modify it and let it play by the driver. In this | |
32 | case the application has to have the knowledge about the | |
33 | sound image format. | |
34 +----------------------------------------------------------------------------- | |
35 | History : | |
36 | Apr 04, 2005 REF: ENH 30063 xdeepadh | |
37 | Description: Buzzer removal activity for Locosto MMI | |
38 | Fix:All the Buzzer related calls are under the compilation flag FF_BUZZER. | |
39 | The GSM tones which were playing in the buzzer are now routed to the speaker(Audio). | |
40 +----------------------------------------------------------------------------- | |
41 $History: | |
42 | |
43 | |
44 xpradipg - GSM-ENH-32494 : 23 June 2005 | |
45 Description: Support for various audio profiles | |
46 Solution: The support for audio device's carkit/headset/loudspeaker/handheld. | |
47 The audio device is enabled as per the user actions. | |
48 | |
49 June 13, 2005 REF : GSM_ENH_32062 - xpradipg | |
50 Description:The audio uplink not working in the connected call | |
51 Solution: The audio uplink was configured to mute state at initialization | |
52 The configuration is changed to be in unmute state | |
53 | |
54 Apr 26, 2005 REF : CRR 30627 xpradipg | |
55 Bug : Replace the ABB APIs with Audio Service APIs | |
56 Fix : The ABB APIs are used in muting/unmuting and setting the volume of | |
57 the speaker and microphone. These ABB APIs are replaced with the | |
58 audio serivce APIs | |
59 ******************************************************************************/ | |
60 | |
61 #ifndef DRV_AUDIO_C | |
62 #define DRV_AUDIO_C | |
63 #endif | |
64 #define ENTITY_CST | |
65 | |
66 #include "config.h" | |
67 #include "fixedconf.h" | |
68 #include "condat-features.h" | |
69 | |
70 /* | |
71 in order to stay backwardcompatible this riv_audio define is entered as only | |
72 ti15++ version do have the riveria frame it needs to be disabled for the rest | |
73 */ | |
74 | |
75 #if 0 //defined (ALR) | |
76 #define RIV_AUDIO 1 | |
77 #else | |
78 #undef RIV_AUDIO | |
79 #endif | |
80 | |
81 #if defined (_SIMULATION_) | |
82 #define _TTY_SIMU | |
83 #endif | |
84 | |
85 /*==== INCLUDES ===================================================*/ | |
86 | |
87 #include <string.h> | |
88 #include "typedefs.h" | |
89 #include "vsi.h" | |
90 #include "custom.h" | |
91 #ifdef ALR | |
92 #include "p_mphc.h" | |
93 #elif defined(FF_GTI) | |
94 /* GTI*/ | |
95 /* do nothing */ | |
96 #else | |
97 #include "p_mph5.h" | |
98 #endif /* ALR, FF_GTI */ | |
99 #include "prim.h" | |
100 #include "gsm.h" | |
101 #include "tok.h" | |
102 #include "../cst/cst.h" | |
103 #include "../cst/cus_cst.h" | |
104 #include "gdi.h" | |
105 #include "audio.h" | |
106 | |
107 #if defined (RIV_AUDIO) | |
108 | |
109 /* #include "bt_general.h" */ | |
110 #include "rv/rv_general.h" | |
111 #if /*!defined (_TTY_SIMU) &&*/ defined (FF_TTY) | |
112 #include "tty/tty_api.h" | |
113 #endif | |
114 #include "audio/audio_api.h" | |
115 | |
116 #elif AUDIO_TASK | |
117 | |
118 #define BOOL_FLAG | |
119 #define CHAR_FLAG | |
120 #include "../../L1/include/l1_confg.h" | |
121 #include "../../L1/include/l1_types.h" | |
122 #include "../../L1/audio_cust0/l1audio_cust.h" | |
123 #include "../../L1/audio_include/l1audio_msgty.h" | |
124 #include "../../L1/audio_include/l1audio_signa.h" | |
125 | |
126 #endif | |
127 | |
128 /*==== DEFINE =====================================================*/ | |
129 | |
130 #define AUDIO_TRC_EVENT(_f_)\ | |
131 vsi_o_ttrace(VSI_CALLER TC_EVENT, _f_) | |
132 #define AUDIO_TRC_EVENT_P1(_f_, _p_)\ | |
133 vsi_o_ttrace(VSI_CALLER TC_EVENT, _f_, _p_) | |
134 #define AUDIO_TRC_EVENT_P2(_f_, _p1_, _p2_)\ | |
135 vsi_o_ttrace(VSI_CALLER TC_EVENT, _f_, _p1_, _p2_) | |
136 #define AUDIO_TRC_FUNC(_f_)\ | |
137 vsi_o_ttrace(VSI_CALLER TC_FUNC, _f_) | |
138 #define AUDIO_TRC_FUNC_P1(_f_, _p_)\ | |
139 vsi_o_ttrace(VSI_CALLER TC_FUNC, _f_, _p_) | |
140 | |
141 /*==== EXPORT =====================================================*/ | |
142 | |
143 #if defined (NEW_FRAME) | |
144 #define CST_AUDIOTIMER 2 | |
145 #endif | |
146 | |
147 /*==== VARIABLES ==================================================*/ | |
148 | |
149 #if defined (RIV_AUDIO) | |
150 static T_AUDIO_KEYBEEP_PARAMETER beep; | |
151 static T_AUDIO_TONES_PARAMETER t; | |
152 #endif | |
153 | |
154 drv_SignalCB_Type audio_signal_callback = NULL; | |
155 #if !defined (NEW_FRAME) | |
156 T_VSI_THANDLE audio_handle = VSI_ERROR; | |
157 #endif | |
158 T_ACT_TONE act_tone; | |
159 UBYTE act_speakerVolume; | |
160 UBYTE act_micVolume; | |
161 UBYTE act_buzVolume; | |
162 UBYTE act_speakerMute; | |
163 UBYTE act_micMute; | |
164 | |
165 #if defined (NEW_FRAME) | |
166 EXTERN T_HANDLE hCommL1; | |
167 #else | |
168 EXTERN T_VSI_CHANDLE hCommL1; | |
169 #endif | |
170 | |
171 #if defined (RIV_AUDIO) | |
172 void audio_riv_audio_cb (void*); | |
173 | |
174 static T_RV_RETURN_PATH const riv_audio_rp = | |
175 { | |
176 0, audio_riv_audio_cb | |
177 }; | |
178 | |
179 #ifdef FF_TTY | |
180 T_AUDIO_TTY_CONFIG_PARAMETER static tty_cfg; | |
181 UBYTE static tty_state = FALSE; | |
182 UBYTE static tty_cmd = (UBYTE)TTY_OFF; | |
183 | |
184 | |
185 char const * const audio_mode_names_tty[] = { | |
186 "default", | |
187 "tty_vco", | |
188 "tty_hco", | |
189 "tty_all" | |
190 }; | |
191 #endif | |
192 #endif | |
193 | |
194 UBYTE audio_is_free = TRUE; /* variable for disable no muting */ | |
195 | |
196 /*==== FUNCTIONS ==================================================*/ | |
197 | |
198 #if 1 //defined (_TMS470) | |
199 | |
200 #if CONFIG_BUZZER | |
201 EXTERN void BZ_Init (void); | |
202 EXTERN void BZ_Enable (void); | |
203 EXTERN void BZ_Disable (void); | |
204 EXTERN void BZ_Tone (int f); | |
205 EXTERN void BZ_Volume (int v); | |
206 #endif | |
207 | |
208 #ifdef ALR | |
209 EXTERN void ABB_DlVolume (UBYTE v); | |
210 EXTERN void ABB_DlMute (UBYTE mute); | |
211 EXTERN void ABB_UlMute (UBYTE value); | |
212 EXTERN void ABB_SideTone (UBYTE v); | |
213 /*#include "l1audio_abb.h" does not work: there's no definition of types UWORDx */ | |
214 #else | |
215 EXTERN void VG_UlVolume (UBYTE v); | |
216 EXTERN void VG_DlVolume (UBYTE v); | |
217 EXTERN void VG_DlMute (UBYTE mute); | |
218 EXTERN void VG_SideTone (UBYTE v); | |
219 #endif | |
220 | |
221 #else | |
222 | |
223 LOCAL void BZ_Init (void); | |
224 LOCAL void BZ_Enable (void); | |
225 LOCAL void BZ_Disable (void); | |
226 LOCAL void BZ_Tone (int f); | |
227 LOCAL void BZ_Volume (int v); | |
228 | |
229 #ifdef ALR | |
230 LOCAL void ABB_DlVolume (UBYTE v); | |
231 LOCAL void ABB_DlMute (UBYTE mute); | |
232 LOCAL void ABB_UlMute (UBYTE value); | |
233 LOCAL void ABB_SideTone (UBYTE v); | |
234 #else | |
235 LOCAL void VG_UlVolume (UBYTE v); | |
236 LOCAL void VG_DlVolume (UBYTE v); | |
237 LOCAL void VG_DlMute (UBYTE mute); | |
238 LOCAL void VG_SideTone (UBYTE v); | |
239 #endif | |
240 | |
241 #endif | |
242 LOCAL void audio_buzzer (void); | |
243 LOCAL void audio_audio (void); | |
244 LOCAL void audio_UlMute (UBYTE mute); | |
245 | |
246 #if defined (RIV_AUDIO) AND !defined (_TTY_SIMU) AND defined (FF_TTY) | |
247 LOCAL void audio_tty_return (void *tty_result); | |
248 LOCAL void audio_save_def_return (void *result); | |
249 LOCAL void audio_load_return (void *result); | |
250 LOCAL void audio_dyn_load_return (void *result); | |
251 #endif | |
252 | |
253 // xpradipg - GSM-ENH-32494 : 23 June 2005 | |
254 #ifdef FF_MMI_AUDIO_PROFILE | |
255 typedef struct | |
256 { | |
257 int status; | |
258 }T_AUDIO_MODE_LOAD_DONE; | |
259 EXTERN T_AUDIO_RET audio_mode_load (T_AUDIO_MODE_LOAD *p_parameter, T_RV_RETURN_PATH return_path); | |
260 #endif | |
261 /*==== CONSTANTS ==================================================*/ | |
262 | |
263 #define BUZZER 0 | |
264 #define AUDIO 1 | |
265 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
266 #ifdef FF_MMI_SERVICES_MIGRATION | |
267 #define AUDIO_SIDE_TONE 175 | |
268 #endif | |
269 | |
270 #if defined (RIV_AUDIO) | |
271 | |
272 #define TDMA_12 12 | |
273 #define TDMA_23 23 | |
274 #define TDMA_43 43 | |
275 #define TDMA_71 71 | |
276 #define TDMA_108 108 | |
277 #define TDMA_130 130 | |
278 #define TDMA_216 216 | |
279 #define TDMA_650 650 | |
280 #define TDMA_866 866 | |
281 | |
282 /* | |
283 * with the original table spec (USHORT for Freq. and Ampl.), | |
284 * we can go down to -31 dB only. Obviously this is sufficient | |
285 * for all currently defined sounds. | |
286 */ | |
287 #define F_425 (( 425 << 5) + 7) /* (( 242 << 8 ) + 35) */ | |
288 #define F_697 (( 697 << 5) + 7) /* (( 219 << 8 ) + 56) */ | |
289 #define F_770 (( 770 << 5) + 7) /* (( 211 << 8 ) + 61) */ | |
290 #define F_852 (( 852 << 5) + 7) /* (( 201 << 8 ) + 67) */ | |
291 #define F_941 (( 941 << 5) + 7) /* (( 189 << 8 ) + 73) */ | |
292 #define F_1209 ((1209 << 5) + 5) /* (( 149 << 8 ) + 111) */ | |
293 #define F_1336 ((1336 << 5) + 5) /* (( 128 << 8 ) + 118) */ | |
294 #define F_1477 ((1477 << 5) + 5) /* (( 102 << 8 ) + 125) */ | |
295 #define F_1633 ((1633 << 5) + 5) /* (( 73 << 8 ) + 130) */ | |
296 | |
297 #else /* (RIV_AUDIO) */ | |
298 | |
299 #if 1 //defined (_TMS470) | |
300 | |
301 /* | |
302 * unit is TDMA frames | |
303 */ | |
304 #define TDMA_12 12 | |
305 #define TDMA_23 23 | |
306 #define TDMA_43 43 | |
307 #define TDMA_71 71 | |
308 #define TDMA_108 108 | |
309 #define TDMA_130 130 | |
310 #define TDMA_216 216 | |
311 #define TDMA_650 650 | |
312 #define TDMA_866 866 | |
313 | |
314 | |
315 #define F_425 (( 242 << 8) + 35) | |
316 #define F_697 (( 219 << 8) + 56) | |
317 #define F_770 (( 211 << 8) + 61) | |
318 #define F_852 (( 201 << 8) + 67) | |
319 #define F_941 (( 189 << 8) + 73) | |
320 #define F_1209 (( 149 << 8) + 111) | |
321 #define F_1336 (( 128 << 8) + 118) | |
322 #define F_1477 (( 102 << 8) + 125) | |
323 #define F_1633 (( 73 << 8) + 130) | |
324 | |
325 #else | |
326 | |
327 /* | |
328 * unit is milliseconds | |
329 */ | |
330 #define TDMA_12 55 | |
331 #define TDMA_23 100 | |
332 #define TDMA_43 200 | |
333 #define TDMA_71 330 | |
334 #define TDMA_108 500 | |
335 #define TDMA_130 650 | |
336 #define TDMA_216 1000 | |
337 #define TDMA_650 3000 | |
338 #define TDMA_866 4000 | |
339 | |
340 #define F_425 (( 35 << 8) + 242) | |
341 #define F_697 (( 56 << 8) + 219) | |
342 #define F_770 (( 61 << 8) + 211) | |
343 #define F_852 (( 67 << 8) + 201) | |
344 #define F_941 (( 73 << 8) + 189) | |
345 #define F_1209 ((111 << 8) + 149) | |
346 #define F_1336 ((118 << 8) + 128) | |
347 #define F_1477 ((125 << 8) + 102) | |
348 #define F_1633 ((130 << 8) + 73) | |
349 | |
350 #endif | |
351 | |
352 #endif /* (RIV_AUDIO) */ | |
353 | |
354 #if 0 | |
355 extern const T_DESCR The_Ale_is_dear[111]; | |
356 extern const T_DESCR Danza_de_Astureses[21]; | |
357 extern const T_DESCR rising_chromatic[47]; | |
358 extern const T_DESCR rising_cscale[27]; | |
359 extern const T_DESCR MELODY_ONE[11]; | |
360 extern const T_DESCR MELODY_HELLO[23]; | |
361 extern const T_DESCR bugle[39]; | |
362 #endif | |
363 | |
364 /* | |
365 * Tone generation tables | |
366 */ | |
367 #if CONFIG_BUZZER | |
368 static const T_DESCR ct_ring [] = /* command 1 command 2 length */ | |
369 { 800, 0, TDMA_12, | |
370 900, 0, TDMA_12, | |
371 800, 0, TDMA_12, | |
372 900, 0, TDMA_12, | |
373 800, 0, TDMA_12, | |
374 900, 0, TDMA_12, | |
375 800, 0, TDMA_12, | |
376 900, 0, TDMA_12, | |
377 800, 0, TDMA_12, | |
378 900, 0, TDMA_12, | |
379 800, 0, TDMA_12, | |
380 900, 0, TDMA_12, | |
381 800, 0, TDMA_12, | |
382 900, 0, TDMA_12, | |
383 800, 0, TDMA_12, | |
384 900, 0, TDMA_12, | |
385 800, 0, TDMA_12, | |
386 900, 0, TDMA_12, | |
387 800, 0, TDMA_12, | |
388 900, 0, TDMA_12, | |
389 0, 0, TDMA_866, | |
390 0xFFFF, 0xFFFF, 0 | |
391 }; | |
392 #else | |
393 static const T_DESCR ct_ring [] = /* command 1 command 2 length */ | |
394 { F_770, 0, TDMA_12, | |
395 F_941, 0, TDMA_12, | |
396 F_770, 0, TDMA_12, | |
397 F_941, 0, TDMA_12, | |
398 F_770, 0, TDMA_12, | |
399 F_941, 0, TDMA_12, | |
400 F_770, 0, TDMA_12, | |
401 F_941, 0, TDMA_12, | |
402 F_770, 0, TDMA_12, | |
403 F_941, 0, TDMA_12, | |
404 F_770, 0, TDMA_12, | |
405 F_941, 0, TDMA_12, | |
406 F_770, 0, TDMA_12, | |
407 F_941, 0, TDMA_12, | |
408 F_770, 0, TDMA_12, | |
409 F_941, 0, TDMA_12, | |
410 F_770, 0, TDMA_12, | |
411 F_941, 0, TDMA_12, | |
412 F_770, 0, TDMA_12, | |
413 F_941, 0, TDMA_12, | |
414 0, 0, TDMA_866, | |
415 0xFFFF, 0xFFFF, 0 | |
416 }; | |
417 #endif | |
418 | |
419 #if CONFIG_BUZZER | |
420 static const T_DESCR ct_auth_num [] = /* command 1 command 2 length */ | |
421 { 950, 0, TDMA_71, | |
422 1400, 0, TDMA_71, | |
423 1800, 0, TDMA_71, | |
424 0, 0, TDMA_216, | |
425 0xFFFF, 0xFFFF, 0 | |
426 }; | |
427 #else | |
428 static const T_DESCR ct_auth_num [] = /* command 1 command 2 length */ | |
429 { F_941, 0, TDMA_71, | |
430 F_1477, 0, TDMA_71, | |
431 F_1633, 0, TDMA_71, | |
432 0, 0, TDMA_216, | |
433 0xFFFF, 0xFFFF, 0 | |
434 }; | |
435 #endif | |
436 | |
437 static const T_DESCR ct_busy [] = /* command 1 command 2 length */ | |
438 { F_425, 0, TDMA_108, | |
439 0, 0, TDMA_108, | |
440 F_425, 0, TDMA_108, | |
441 0, 0, TDMA_108, | |
442 F_425, 0, TDMA_108, | |
443 0, 0, TDMA_108, | |
444 F_425, 0, TDMA_108, | |
445 0, 0, TDMA_108, | |
446 0xFFFF, 0xFFFF, 0 | |
447 }; | |
448 | |
449 #if CONFIG_BUZZER | |
450 static const T_DESCR ct_congest [] = /* command 1 command 2 length */ | |
451 { 425, 0, TDMA_43, | |
452 0, 0, TDMA_43, | |
453 0xFFFF, 0xFFFF, 0 | |
454 }; | |
455 | |
456 static const T_DESCR ct_dropped [] = /* command 1 command 2 length */ | |
457 { 425, 0, TDMA_43, | |
458 0, 0, TDMA_43, | |
459 425, 0, TDMA_43, | |
460 0, 0, TDMA_43, | |
461 425, 0, TDMA_43, | |
462 0, 0, TDMA_43, | |
463 0xFFFF, 0xFFFF, 0 | |
464 }; | |
465 | |
466 static const T_DESCR ct_ack [] = /* command 1 command 2 length */ | |
467 { 425, 0, TDMA_43, | |
468 0xFFFF, 0xFFFF, 0 | |
469 }; | |
470 #else | |
471 static const T_DESCR ct_congest [] = /* command 1 command 2 length */ | |
472 { F_425, 0, TDMA_43, | |
473 0, 0, TDMA_43, | |
474 0xFFFF, 0xFFFF, 0 | |
475 }; | |
476 | |
477 static const T_DESCR ct_dropped [] = /* command 1 command 2 length */ | |
478 { F_425, 0, TDMA_43, | |
479 0, 0, TDMA_43, | |
480 F_425, 0, TDMA_43, | |
481 0, 0, TDMA_43, | |
482 F_425, 0, TDMA_43, | |
483 0, 0, TDMA_43, | |
484 0xFFFF, 0xFFFF, 0 | |
485 }; | |
486 | |
487 static const T_DESCR ct_ack [] = /* command 1 command 2 length */ | |
488 { F_425, 0, TDMA_43, | |
489 0xFFFF, 0xFFFF, 0 | |
490 }; | |
491 #endif | |
492 | |
493 static const T_DESCR ct_cw [] = /* command 1 command 2 length */ | |
494 { F_425, 0, TDMA_43, | |
495 0, 0, TDMA_130, | |
496 F_425, 0, TDMA_43, | |
497 0, 0, TDMA_650, | |
498 F_425, 0, TDMA_43, | |
499 0, 0, TDMA_130, | |
500 F_425, 0, TDMA_43, | |
501 0xFFFF, 0xFFFF, 0 | |
502 }; | |
503 | |
504 static const T_DESCR ct_dtmf_0 [] = /* command 1 command 2 length */ | |
505 { F_941, F_1336, TDMA_23, | |
506 0xFFFF, 0xFFFF, 0 | |
507 }; | |
508 | |
509 static const T_DESCR ct_dtmf_1 [] = /* command 1 command 2 length */ | |
510 { F_697, F_1209, TDMA_23, | |
511 0xFFFF, 0xFFFF, 0 | |
512 }; | |
513 | |
514 static const T_DESCR ct_dtmf_2 [] = /* command 1 command 2 length */ | |
515 { F_697, F_1336, TDMA_23, | |
516 0xFFFF, 0xFFFF, 0 | |
517 }; | |
518 | |
519 static const T_DESCR ct_dtmf_3 [] = /* command 1 command 2 length */ | |
520 { F_697, F_1477, TDMA_23, | |
521 0xFFFF, 0xFFFF, 0 | |
522 }; | |
523 | |
524 static const T_DESCR ct_dtmf_4 [] = /* command 1 command 2 length */ | |
525 { F_770, F_1209, TDMA_23, | |
526 0xFFFF, 0xFFFF, 0 | |
527 }; | |
528 | |
529 static const T_DESCR ct_dtmf_5 [] = /* command 1 command 2 length */ | |
530 { F_770, F_1336, TDMA_23, | |
531 0xFFFF, 0xFFFF, 0 | |
532 }; | |
533 | |
534 static const T_DESCR ct_dtmf_6 [] = /* command 1 command 2 length */ | |
535 { F_770, F_1477, TDMA_23, | |
536 0xFFFF, 0xFFFF, 0 | |
537 }; | |
538 | |
539 static const T_DESCR ct_dtmf_7 [] = /* command 1 command 2 length */ | |
540 { F_852, F_1209, TDMA_23, | |
541 0xFFFF, 0xFFFF, 0 | |
542 }; | |
543 | |
544 static const T_DESCR ct_dtmf_8 [] = /* command 1 command 2 length */ | |
545 { F_852, F_1336, TDMA_23, | |
546 0xFFFF, 0xFFFF, 0 | |
547 }; | |
548 | |
549 static const T_DESCR ct_dtmf_9 [] = /* command 1 command 2 length */ | |
550 { F_852, F_1477, TDMA_23, | |
551 0xFFFF, 0xFFFF, 0 | |
552 }; | |
553 | |
554 static const T_DESCR ct_dtmf_a [] = /* command 1 command 2 length */ | |
555 { F_697, F_1633, TDMA_23, | |
556 0xFFFF, 0xFFFF, 0 | |
557 }; | |
558 | |
559 static const T_DESCR ct_dtmf_b [] = /* command 1 command 2 length */ | |
560 { F_770, F_1633, TDMA_23, | |
561 0xFFFF, 0xFFFF, 0 | |
562 }; | |
563 static const T_DESCR ct_dtmf_c [] = /* command 1 command 2 length */ | |
564 { F_852, F_1633, TDMA_23, | |
565 0xFFFF, 0xFFFF, 0 | |
566 }; | |
567 | |
568 static const T_DESCR ct_dtmf_d [] = /* command 1 command 2 length */ | |
569 { F_941, F_1633, TDMA_23, | |
570 0xFFFF, 0xFFFF, 0 | |
571 }; | |
572 | |
573 static const T_DESCR ct_dtmf_s [] = /* command 1 command 2 length */ | |
574 { F_941, F_1209, TDMA_23, | |
575 0xFFFF, 0xFFFF, 0 | |
576 }; | |
577 | |
578 static const T_DESCR ct_dtmf_h [] = /* command 1 command 2 length */ | |
579 { F_941, F_1477, TDMA_23, | |
580 0xFFFF, 0xFFFF, 0 | |
581 }; | |
582 | |
583 /* keybeep not used at the moment */ | |
584 static const T_DESCR ct_keybeep [] = /* command 1 command 2 length */ | |
585 { F_697, F_697, TDMA_43, | |
586 0xFFFF, 0xFFFF, 0 | |
587 }; | |
588 | |
589 static const T_DESCR ct_ringing [] = /* command 1 command 2 length */ | |
590 { F_425, 0, TDMA_216, | |
591 0, 0, TDMA_866, | |
592 0xFFFF, 0xFFFF, 0 | |
593 }; | |
594 | |
595 /* | |
596 * Tone Type Table | |
597 */ | |
598 #if CONFIG_BUZZER | |
599 static const UBYTE TONE_TYPE [] = { BUZZER, /* ringing tone 0 */ | |
600 BUZZER, /* ringing tone 1 */ | |
601 BUZZER, /* ringing tone 2 */ | |
602 BUZZER, /* ringing tone 3 */ | |
603 BUZZER, /* ringing tone 4 */ | |
604 BUZZER, /* ringing tone 5 */ | |
605 BUZZER, /* ringing tone 6 */ | |
606 BUZZER, /* ringing tone 7 */ | |
607 BUZZER, /* ringing tone 8 */ | |
608 BUZZER, /* ringing tone 9 */ | |
609 BUZZER, /* ringing tone 10 */ | |
610 BUZZER, /* ringing tone 11 */ | |
611 BUZZER, /* ringing tone 12 */ | |
612 BUZZER, /* ringing tone 13 */ | |
613 BUZZER, /* ringing tone 14 */ | |
614 BUZZER, /* ringing tone 15 */ | |
615 BUZZER, /* error/special information */ | |
616 AUDIO, /* subscriber busy */ | |
617 BUZZER, /* congestion */ | |
618 BUZZER, /* call dropped */ | |
619 BUZZER, /* radio acknowledge */ | |
620 AUDIO, /* call waiting */ | |
621 AUDIO, /* DTMF digit 0 */ | |
622 AUDIO, /* DTMF digit 1 */ | |
623 AUDIO, /* DTMF digit 2 */ | |
624 AUDIO, /* DTMF digit 3 */ | |
625 AUDIO, /* DTMF digit 4 */ | |
626 AUDIO, /* DTMF digit 5 */ | |
627 AUDIO, /* DTMF digit 6 */ | |
628 AUDIO, /* DTMF digit 7 */ | |
629 AUDIO, /* DTMF digit 8 */ | |
630 AUDIO, /* DTMF digit 9 */ | |
631 AUDIO, /* DTMF digit A */ | |
632 AUDIO, /* DTMF digit B */ | |
633 AUDIO, /* DTMF digit C */ | |
634 AUDIO, /* DTMF digit D */ | |
635 AUDIO, /* DTMF digit * */ | |
636 AUDIO, /* DTMF digit # */ | |
637 AUDIO, /* keybeep */ | |
638 AUDIO /* ringing tone if NOIBT */ | |
639 }; | |
640 #endif | |
641 | |
642 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
643 /* | |
644 * Tone Description Table | |
645 This table will have the ringing tones and the gsm tones. | |
646 When the buzzer is not available, the ringing tones will be played with midi ringer | |
647 */ | |
648 static const T_DESCR * const TONE_DESCR [] = | |
649 { | |
650 ct_ring, /* ringing tone 0 */ | |
651 ct_ring, /* ringing tone 1 */ | |
652 ct_ring, /* ringing tone 2 */ | |
653 ct_ring, /* ringing tone 3 */ | |
654 ct_ring, /* ringing tone 4 */ | |
655 ct_ring, /* ringing tone 5 */ | |
656 ct_ring, /* ringing tone 6 */ | |
657 ct_ring, /* ringing tone 7 */ | |
658 ct_ring, /* ringing tone 8 */ | |
659 ct_ring, /* ringing tone 9 */ | |
660 ct_ring, /* ringing tone 10 */ | |
661 ct_ring, /* ringing tone 11 */ | |
662 ct_ring, /* ringing tone 12 */ | |
663 ct_ring, /* ringing tone 13 */ | |
664 ct_ring, /* ringing tone 14 */ | |
665 ct_ring, /* ringing tone 15 */ | |
666 ct_auth_num,/* error/special information */ | |
667 ct_busy, /* subscriber busy */ | |
668 ct_congest, /* congestion */ | |
669 ct_dropped, /* call dropped */ | |
670 ct_ack, /* radio acknowledge */ | |
671 ct_cw, /* call waiting */ | |
672 ct_dtmf_0, /* DTMF digit 0 */ | |
673 ct_dtmf_1, /* DTMF digit 1 */ | |
674 ct_dtmf_2, /* DTMF digit 2 */ | |
675 ct_dtmf_3, /* DTMF digit 3 */ | |
676 ct_dtmf_4, /* DTMF digit 4 */ | |
677 ct_dtmf_5, /* DTMF digit 5 */ | |
678 ct_dtmf_6, /* DTMF digit 6 */ | |
679 ct_dtmf_7, /* DTMF digit 7 */ | |
680 ct_dtmf_8, /* DTMF digit 8 */ | |
681 ct_dtmf_9, /* DTMF digit 9 */ | |
682 ct_dtmf_a, /* DTMF digit A */ | |
683 ct_dtmf_b, /* DTMF digit B */ | |
684 ct_dtmf_c, /* DTMF digit C */ | |
685 ct_dtmf_d, /* DTMF digit D */ | |
686 ct_dtmf_s, /* DTMF digit * */ | |
687 ct_dtmf_h, /* DTMF digit # */ | |
688 ct_keybeep, /* dummy for keybeep */ | |
689 ct_ringing /* ringing tone if NIBT */ | |
690 }; | |
691 | |
692 | |
693 /*==== CONSTANTS ==================================================*/ | |
694 | |
695 | |
696 | |
697 // xpradipg - GSM-ENH-32494 : 23 June 2005 | |
698 #ifdef FF_MMI_AUDIO_PROFILE | |
699 /******************************************************************************* | |
700 $Function: audio_mode_load_cb | |
701 | |
702 $Description: callback function for the auido_mode_load() | |
703 | |
704 $Returns: none | |
705 | |
706 $Arguments: status of the load operation | |
707 | |
708 *******************************************************************************/ | |
709 void audio_mode_load_cb(void *ret_param) | |
710 { | |
711 | |
712 //if((T_AUDIO_MODE_LOAD_DONE *)ret_param->status != AUDIO_OK) | |
713 AUDIO_TRC_FUNC("ERROR Loading the audio profile"); | |
714 } | |
715 | |
716 /******************************************************************************* | |
717 $Function: audio_full_access_write_cb() | |
718 | |
719 $Description: callback function for the audio_full_access_write() | |
720 | |
721 $Returns: none | |
722 | |
723 $Arguments: status of the write operation | |
724 | |
725 *******************************************************************************/ | |
726 void audio_full_access_write_cb(void *ret_param) | |
727 { | |
728 // if( (T_AUDIO_FULL_ACCESS_WRITE_DONE *)ret_param->status != AUDIO_OK) | |
729 AUDIO_TRC_FUNC ("ERROR setting the value"); | |
730 } | |
731 #if 0 | |
732 /******************************************************************************* | |
733 $Function: audio_speaker_volume_cb() | |
734 | |
735 $Description: callback function for the audio_speaker_volume() | |
736 | |
737 $Returns: none | |
738 | |
739 $Arguments: status of the speaker volume setting operation | |
740 | |
741 *******************************************************************************/ | |
742 void audio_speaker_volume_cb(ret_param) | |
743 { | |
744 if((T_AUDIO_SPEAKER_VOLUME_DONE)ret_param->status != AUDIO_OK) | |
745 AUDIO_TRC_FUNC ("ERROR setting the volume"); | |
746 } | |
747 #endif | |
748 /******************************************************************************* | |
749 $Function: audio_set_device() | |
750 | |
751 $Description: initiates the audio_mode_load() for various devices | |
752 | |
753 $Returns: none | |
754 | |
755 $Arguments: successfull execution of the audio_mode_load operation | |
756 | |
757 *******************************************************************************/ | |
758 int audio_set_device(char* mode) | |
759 { | |
760 T_RV_RETURN_PATH return_path = {0,audio_mode_load_cb}; | |
761 T_AUDIO_RET status; | |
762 T_AUDIO_MODE_LOAD p_parameter; | |
763 | |
764 strcpy((char*)p_parameter.audio_mode_filename,mode); | |
765 status = audio_mode_load(& p_parameter,return_path); | |
766 return status; | |
767 | |
768 } | |
769 | |
770 /******************************************************************************* | |
771 $Function: audio_set_path() | |
772 | |
773 $Description: sets the audio speaker path to the current audio device and also either to voice or | |
774 stereo | |
775 | |
776 $Returns: none | |
777 | |
778 $Arguments: | |
779 audioDevice - Indicates the device to which the path has to be set | |
780 stereo - If false the path is for voice | |
781 If true the path is for stereo | |
782 *******************************************************************************/ | |
783 | |
784 void audio_set_path(int audioDevice,int stereo) | |
785 { | |
786 T_RV_RETURN_PATH return_path = {0,audio_full_access_write_cb}; | |
787 T_AUDIO_FULL_ACCESS_WRITE p_parameter; | |
788 int status; | |
789 if( stereo) | |
790 p_parameter.variable_indentifier = AUDIO_STEREO_SPEAKER_MODE; | |
791 else | |
792 p_parameter.variable_indentifier = AUDIO_SPEAKER_MODE; | |
793 p_parameter.data = (void*)&audioDevice; | |
794 status = audio_full_access_write(&p_parameter,return_path); | |
795 | |
796 } | |
797 #endif | |
798 | |
799 /* | |
800 +--------------------------------------------------------------------+ | |
801 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
802 | STATE : code ROUTINE : audio_Init | | |
803 +--------------------------------------------------------------------+ | |
804 | |
805 PURPOSE : The function initializes the driver's internal data. | |
806 The function returns DRV_OK in case of a successful | |
807 completition. The function returns DRV_INITIALIZED if | |
808 the driver has already been initialized and is ready to | |
809 be used or is already in use. In case of an initialization | |
810 failure, which means the that the driver cannot be used, | |
811 the function returns DRV_INITFAILURE. | |
812 | |
813 */ | |
814 // xpradipg - GSM-ENH-32494 : 23 June 2005 | |
815 // the interface for the audio profiles has changed, it accepts an array of | |
816 // type T_ACCESSORY_CALLBACK | |
817 #ifdef FF_MMI_AUDIO_PROFILE | |
818 GLOBAL UBYTE audio_Init(T_ACCESSORY_CALLBACK *audioConfig) | |
819 #else | |
820 GLOBAL UBYTE audio_Init (drv_SignalCB_Type in_SignalCBPtr) | |
821 #endif | |
822 { | |
823 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
824 // local variable declarations | |
825 #ifdef FF_MMI_SERVICES_MIGRATION | |
826 T_AUDIO_FULL_ACCESS_WRITE side_tone_cfg; | |
827 T_RV_RETURN_PATH return_path = {0, NULL}; | |
828 T_AUDIO_RET result; | |
829 INT8 side_tone = AUDIO_SIDE_TONE; | |
830 #endif | |
831 // xpradipg - GSM-ENH-32494 : 23 June 2005 | |
832 #ifdef FF_MMI_AUDIO_PROFILE | |
833 T_AUDIO_RET status; | |
834 T_AUDIO_MODE_LOAD handheld= {"handheld"}; | |
835 #endif | |
836 | |
837 // xpradipg - GSM-ENH-32494 : 23 June 2005 | |
838 // the callback functions for the headset and carkit indication are registered | |
839 // and the defualt mode handheld is loaded | |
840 #ifdef FF_MMI_AUDIO_PROFILE | |
841 #if 0 | |
842 status = audio_accessory_register_notification(audioConfig[CALLBACK_HEADSET],AUDIO_ACCESSORY_HEADSET); | |
843 if( status != AUDIO_OK) | |
844 { | |
845 AUDIO_TRC_FUNC("Error - registering the callback for headset"); | |
846 } | |
847 | |
848 status = audio_accessory_register_notification(audioConfig[CALLBACK_CARKIT],AUDIO_ACCESSORY_CARKIT); | |
849 if(status != AUDIO_OK) | |
850 { | |
851 AUDIO_TRC_FUNC("Error - registering the callback for carkit"); | |
852 } | |
853 #endif | |
854 return_path.callback_func = audio_mode_load_cb; | |
855 status = audio_mode_load(&handheld, return_path); | |
856 if (status != AUDIO_OK) | |
857 { | |
858 AUDIO_TRC_FUNC("Error - loading the handheld profile"); | |
859 } | |
860 #else | |
861 audio_signal_callback = in_SignalCBPtr; /* store call-back function */ | |
862 #endif | |
863 | |
864 #if !defined (NEW_FRAME) | |
865 audio_handle = vsi_t_open (VSI_CALLER "AUDIO"); | |
866 | |
867 if (audio_handle < VSI_OK) | |
868 return DRV_INITFAILURE; | |
869 #endif | |
870 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
871 //For Buzzer init | |
872 #if CONFIG_BUZZER | |
873 BZ_Init (); /* initialize buzzer */ | |
874 #endif | |
875 audio_SetMute ( AUDIO_SPEAKER, AUDIO_MUTING_OFF ); | |
876 audio_SetMute ( AUDIO_MICROPHONE, AUDIO_MUTING_OFF ); | |
877 | |
878 audio_SetAmplf ( AUDIO_SPEAKER, 175 ); | |
879 audio_SetAmplf ( AUDIO_MICROPHONE, 75 ); | |
880 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
881 //Set volume for Buzzer | |
882 #if CONFIG_BUZZER | |
883 audio_SetAmplf ( AUDIO_BUZZER, 175 ); | |
884 #endif | |
885 | |
886 /* Setting the Side Tone has been moved from audio_SetAmplf CQ21055*/ | |
887 #ifdef ALR | |
888 #ifdef FF_TTY | |
889 if (!tty_state) | |
890 #endif | |
891 { | |
892 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
893 // set the sidetone value to 175 this is the optimum value | |
894 #ifdef FF_MMI_SERVICES_MIGRATION | |
895 side_tone_cfg.variable_indentifier = AUDIO_MICROPHONE_SPEAKER_LOOP_SIDETONE; | |
896 side_tone_cfg.data = (void*)&side_tone; | |
897 result = audio_full_access_write(&side_tone_cfg, return_path); | |
898 #else | |
899 ABB_SideTone (175); | |
900 #endif | |
901 } | |
902 #else | |
903 VG_SideTone (175); | |
904 #endif | |
905 | |
906 | |
907 return DRV_OK; | |
908 } | |
909 | |
910 /* | |
911 +--------------------------------------------------------------------+ | |
912 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
913 | STATE : code ROUTINE : audio_Exit | | |
914 +--------------------------------------------------------------------+ | |
915 | |
916 PURPOSE : The function is called when the driver functionality is | |
917 not longer required. | |
918 */ | |
919 | |
920 GLOBAL void audio_Exit (void) | |
921 { | |
922 audio_signal_callback = NULL; | |
923 #if !defined (NEW_FRAME) | |
924 vsi_t_close (VSI_CALLER audio_handle); | |
925 audio_handle = VSI_ERROR; | |
926 #endif | |
927 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
928 //Disable Buzzer | |
929 #if CONFIG_BUZZER | |
930 BZ_Disable (); | |
931 #endif | |
932 act_tone.status = NO_TONE_STATE; | |
933 } | |
934 | |
935 /* | |
936 +--------------------------------------------------------------------+ | |
937 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
938 | STATE : code ROUTINE : audio_SetMute | | |
939 +--------------------------------------------------------------------+ | |
940 | |
941 PURPOSE : This function is used to enable or disable muting for | |
942 the device identified by the parameter in_Device. If the | |
943 mode for the specified device could be changed, the | |
944 function returns DRV_OK. If the specified device is | |
945 unknown or the device does not support muting, the function | |
946 returns DRV_INVALID_PARAMS. | |
947 | |
948 */ | |
949 | |
950 GLOBAL UBYTE audio_SetMute (UBYTE in_DeviceID, UBYTE in_Mode) | |
951 { | |
952 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
953 // local variable declarations | |
954 #ifdef FF_MMI_SERVICES_MIGRATION | |
955 T_AUDIO_FULL_ACCESS_WRITE p_parameter; | |
956 T_AUDIO_FULL_ACCESS_READ p_parameter1; | |
957 T_RV_RETURN_PATH return_path = {0, NULL}; | |
958 T_AUDIO_RET result; | |
959 static INT8 speaker_volume = 0; | |
960 INT8 setvolume = AUDIO_SPEAKER_VOLUME_MUTE; | |
961 #endif | |
962 | |
963 if (in_DeviceID EQ AUDIO_SPEAKER) | |
964 { | |
965 if (in_Mode AND audio_is_free) | |
966 { | |
967 TRACE_EVENT ("No speaker muting"); | |
968 #ifdef ALR | |
969 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
970 // the previous volume is restored when we comeout of mute state (unmuting) | |
971 // At initialization we do not write the value since the new value is written | |
972 #ifdef FF_MMI_SERVICES_MIGRATION | |
973 p_parameter.variable_indentifier = AUDIO_SPEAKER_VOLUME_LEVEL; | |
974 p_parameter.data = (void*)&speaker_volume; | |
975 result = audio_full_access_write(&p_parameter,return_path); | |
976 if(result != 0) | |
977 TRACE_FUNCTION("error - setting speaker volume"); | |
978 #else | |
979 ABB_DlMute (0); | |
980 #endif | |
981 #else | |
982 VG_DlMute (0); | |
983 #endif | |
984 act_speakerMute = AUDIO_MUTING_OFF; | |
985 } | |
986 else | |
987 { | |
988 TRACE_EVENT ("Speaker muting"); | |
989 #ifdef ALR | |
990 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
991 // read the current value and store it to before setting it to mute | |
992 #ifdef FF_MMI_SERVICES_MIGRATION | |
993 p_parameter1.variable_indentifier = AUDIO_SPEAKER_VOLUME_LEVEL; | |
994 p_parameter1.data = (void*)&speaker_volume; | |
995 result = audio_full_access_read(&p_parameter1); | |
996 p_parameter.variable_indentifier = AUDIO_SPEAKER_VOLUME_MUTE; | |
997 p_parameter.data = (void*)&setvolume; | |
998 result = audio_full_access_write(&p_parameter,return_path); | |
999 #else | |
1000 ABB_DlMute (1); | |
1001 #endif | |
1002 #else | |
1003 VG_DlMute (1); | |
1004 #endif | |
1005 act_speakerMute = AUDIO_MUTING_ON; | |
1006 } | |
1007 } | |
1008 else if (in_DeviceID EQ AUDIO_MICROPHONE) | |
1009 { | |
1010 if (in_Mode AND audio_is_free) | |
1011 { | |
1012 TRACE_EVENT ("No microphone muting"); | |
1013 audio_UlMute (0); | |
1014 act_micMute = AUDIO_MUTING_OFF; | |
1015 } | |
1016 else | |
1017 { | |
1018 TRACE_EVENT ("Microphone muting"); | |
1019 audio_UlMute (1); | |
1020 act_micMute = AUDIO_MUTING_ON; | |
1021 } | |
1022 } | |
1023 else | |
1024 { | |
1025 return DRV_INVALID_PARAMS; | |
1026 } | |
1027 | |
1028 return DRV_OK; | |
1029 } | |
1030 | |
1031 /* | |
1032 +--------------------------------------------------------------------+ | |
1033 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1034 | STATE : code ROUTINE : audio_GetMute | | |
1035 +--------------------------------------------------------------------+ | |
1036 | |
1037 PURPOSE : This function is used to get the status whether muting | |
1038 is enabled or disabled for the device identified by the | |
1039 parameter in_Device. If the specified device is unknown | |
1040 or the device does not support muting, the function | |
1041 returns DRV_INVALID_PARAMS. | |
1042 | |
1043 */ | |
1044 | |
1045 GLOBAL UBYTE audio_GetMute (UBYTE in_DeviceID, UBYTE* out_Mode) | |
1046 { | |
1047 if (in_DeviceID EQ AUDIO_SPEAKER) | |
1048 { | |
1049 *out_Mode = act_speakerMute; | |
1050 } | |
1051 else if (in_DeviceID EQ AUDIO_MICROPHONE) | |
1052 { | |
1053 *out_Mode = act_micMute; | |
1054 } | |
1055 else | |
1056 { | |
1057 return DRV_INVALID_PARAMS; | |
1058 } | |
1059 | |
1060 return DRV_OK; | |
1061 } | |
1062 | |
1063 /* | |
1064 +--------------------------------------------------------------------+ | |
1065 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1066 | STATE : code ROUTINE : audio_GetStatus | | |
1067 +--------------------------------------------------------------------+ | |
1068 | |
1069 PURPOSE : This function is used to retrieve the status of the driver. | |
1070 In case of a successful completion the driver returns | |
1071 DRV_OK and the current status of the driver in the buffer | |
1072 out_StatusPtr points to. | |
1073 In case the driver is not configured yet, it returns | |
1074 DRV_NOTCONFIGURED. In this case the contents of the | |
1075 buffer out_StatusPtr is invalid. | |
1076 In case out_StatusPtr equals NULL or device is unknown | |
1077 the driver returns DRV_INVALID_PARAMS. | |
1078 | |
1079 */ | |
1080 | |
1081 GLOBAL UBYTE audio_GetStatus (UBYTE in_DeviceID, | |
1082 audio_Status_Type * out_StatusPtr) | |
1083 { | |
1084 if ( out_StatusPtr EQ NULL ) | |
1085 { | |
1086 return DRV_INVALID_PARAMS; | |
1087 } | |
1088 else | |
1089 { | |
1090 if (in_DeviceID EQ AUDIO_SPEAKER) | |
1091 { | |
1092 out_StatusPtr -> min_volume = AUDIO_MIN_VOLUME; | |
1093 out_StatusPtr -> max_volume = AUDIO_MAX_VOLUME; | |
1094 } | |
1095 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1096 //If Buzzer is available, set the minimum and maximum volume | |
1097 #if CONFIG_BUZZER | |
1098 else if (in_DeviceID EQ AUDIO_BUZZER) | |
1099 { | |
1100 out_StatusPtr -> min_volume = AUDIO_MIN_BUZ_VOLUME; | |
1101 out_StatusPtr -> max_volume = AUDIO_MAX_BUZ_VOLUME; | |
1102 } | |
1103 #endif | |
1104 else if (in_DeviceID EQ AUDIO_MICROPHONE) | |
1105 { | |
1106 out_StatusPtr -> min_volume = AUDIO_MIN_MIC_VOLUME; | |
1107 out_StatusPtr -> max_volume = AUDIO_MAX_MIC_VOLUME; | |
1108 } | |
1109 else | |
1110 { | |
1111 return DRV_INVALID_PARAMS; | |
1112 } | |
1113 } | |
1114 | |
1115 return DRV_OK; | |
1116 } | |
1117 | |
1118 /* | |
1119 +--------------------------------------------------------------------+ | |
1120 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1121 | STATE : code ROUTINE : audio_GetSoundImage | | |
1122 +--------------------------------------------------------------------+ | |
1123 | |
1124 PURPOSE : This function is used to copy the image of a driver | |
1125 internal sound image into an application specific sound | |
1126 image buffer. The application may modify the sound. | |
1127 In case of a successful completion the function returns | |
1128 DRV_OK. In case the size of the buffer where the sound image | |
1129 shall be copied to is too small the driver returns | |
1130 DRV_INVALID_PARAMS. In case a specific driver implementation | |
1131 does not support this functionality the driver returns | |
1132 DRV_FCT_NOTSUPPORTED. | |
1133 | |
1134 */ | |
1135 | |
1136 GLOBAL UBYTE audio_GetSoundImage (UBYTE in_SoundID, | |
1137 void * out_SoundImagePtr) | |
1138 { | |
1139 return AUDIO_FCT_NOTSUPPORTED; | |
1140 } | |
1141 | |
1142 /* | |
1143 +--------------------------------------------------------------------+ | |
1144 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1145 | STATE : code ROUTINE : audio_SetAmplf | | |
1146 +--------------------------------------------------------------------+ | |
1147 | |
1148 PURPOSE : This function is used to set the amplification for the | |
1149 device identified by the parameter in_DeviceID. | |
1150 In the case of a speaker this is the volume, for a | |
1151 microphone - the pre-amplifier that regulates the | |
1152 sensitivity of the microphone. The valid range depends on | |
1153 the hardware used. If the amplification could be changed | |
1154 for the specified device, the function returns DRV_OK. If | |
1155 the amplification value (in_Amplf) is out of range or the | |
1156 specified device is unknown or the specified device does | |
1157 not support the amplification setting, the function | |
1158 returns DRV_INVALID_PARAMS. | |
1159 | |
1160 */ | |
1161 | |
1162 GLOBAL UBYTE audio_SetAmplf (UBYTE in_DeviceID, UBYTE in_Amplf) | |
1163 { | |
1164 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
1165 // local variable | |
1166 #ifdef FF_MMI_SERVICES_MIGRATION | |
1167 T_AUDIO_FULL_ACCESS_WRITE p_parameter; | |
1168 T_RV_RETURN_PATH return_path = {0, NULL}; | |
1169 T_AUDIO_RET result; | |
1170 INT8 volume; | |
1171 #endif | |
1172 if (in_DeviceID EQ AUDIO_MICROPHONE) | |
1173 { | |
1174 act_micVolume = 75; /* voice quality is best at this microphone volume */ | |
1175 #ifdef ALR | |
1176 #else | |
1177 VG_UlVolume (act_micVolume); | |
1178 #endif | |
1179 } | |
1180 else if (in_DeviceID EQ AUDIO_SPEAKER) | |
1181 { | |
1182 TRACE_EVENT_P1("VOLUME=%d", in_Amplf); | |
1183 | |
1184 #ifdef ALR | |
1185 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
1186 // The ABB values are converted to the corresponding audio service values | |
1187 #ifdef FF_MMI_SERVICES_MIGRATION | |
1188 switch (in_Amplf) | |
1189 { | |
1190 case 255: | |
1191 volume = AUDIO_SPEAKER_VOLUME_0dB; | |
1192 break; | |
1193 case 190: | |
1194 volume = AUDIO_SPEAKER_VOLUME_6dB; | |
1195 break; | |
1196 case 125: | |
1197 volume = AUDIO_SPEAKER_VOLUME_12dB; | |
1198 break; | |
1199 case 60: | |
1200 volume = AUDIO_SPEAKER_VOLUME_18dB; | |
1201 break; | |
1202 case 1: | |
1203 volume = AUDIO_SPEAKER_VOLUME_24dB; | |
1204 break; | |
1205 default: | |
1206 volume = AUDIO_SPEAKER_VOLUME_12dB; | |
1207 break; | |
1208 } | |
1209 p_parameter.variable_indentifier = AUDIO_SPEAKER_VOLUME_LEVEL; | |
1210 p_parameter.data = (void*)&volume; | |
1211 result = audio_full_access_write(&p_parameter, return_path); | |
1212 if( result != 0) | |
1213 TRACE_FUNCTION("set volume failed"); | |
1214 #else | |
1215 ABB_DlVolume (in_Amplf); /* output volume */ | |
1216 #endif | |
1217 #ifdef FF_TTY | |
1218 if (!tty_state) | |
1219 #endif | |
1220 { | |
1221 /* ABB_SideTone (175); */ /* To avoid the side tone reseting */ | |
1222 } | |
1223 #else | |
1224 VG_DlVolume (in_Amplf); /* output volume */ | |
1225 /* VG_SideTone (175); */ /* To avoid the side tone reseting */ | |
1226 #endif | |
1227 act_speakerVolume = in_Amplf; | |
1228 } | |
1229 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1230 //If Buzzer is available , set the volume | |
1231 #if CONFIG_BUZZER | |
1232 else if (in_DeviceID EQ AUDIO_BUZZER) | |
1233 { | |
1234 act_buzVolume = in_Amplf; | |
1235 } | |
1236 #endif | |
1237 else | |
1238 { | |
1239 return DRV_INVALID_PARAMS; | |
1240 } | |
1241 | |
1242 return DRV_OK; | |
1243 } | |
1244 | |
1245 /* | |
1246 +--------------------------------------------------------------------+ | |
1247 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1248 | STATE : code ROUTINE : audio_GetAmplf | | |
1249 +--------------------------------------------------------------------+ | |
1250 | |
1251 PURPOSE : This function is used to get the amplification for the | |
1252 device identified by the parameter in_DeviceID. | |
1253 In the case of a speaker this is the volume, for a | |
1254 microphone - the pre-amplifier that regulates the | |
1255 sensitivity of the microphone. The valid range depends on | |
1256 the hardware used.If the specified device is unknown the | |
1257 function returns DRV_INVALID_PARAMS. | |
1258 | |
1259 */ | |
1260 | |
1261 GLOBAL UBYTE audio_GetAmplf (UBYTE in_DeviceID, UBYTE* out_Amplf) | |
1262 { | |
1263 if (in_DeviceID EQ AUDIO_MICROPHONE) | |
1264 { | |
1265 *out_Amplf = act_micVolume; | |
1266 } | |
1267 else if (in_DeviceID EQ AUDIO_SPEAKER) | |
1268 { | |
1269 *out_Amplf = act_speakerVolume; | |
1270 } | |
1271 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1272 //If Buzzer is available, set the out volume | |
1273 #if CONFIG_BUZZER | |
1274 else if (in_DeviceID EQ AUDIO_BUZZER) | |
1275 { | |
1276 *out_Amplf = act_buzVolume; | |
1277 } | |
1278 #endif | |
1279 else | |
1280 { | |
1281 return DRV_INVALID_PARAMS; | |
1282 } | |
1283 | |
1284 return DRV_OK; | |
1285 } | |
1286 | |
1287 /* | |
1288 +--------------------------------------------------------------------+ | |
1289 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1290 | STATE : code ROUTINE : audio_PlaySoundID | | |
1291 +--------------------------------------------------------------------+ | |
1292 | |
1293 PURPOSE : This function is used to play a sound or melody. The | |
1294 function returns immediately after the "play process" has | |
1295 been activated. It is implementation dependent if the | |
1296 device/driver supports playing multiple sounds simultan- | |
1297 eously, i.e. accepting multiple calls of audio_PlaySoundID(). | |
1298 If the calling process should be notified when the sound has | |
1299 stopped playing automatically, the signal AUDIO_SIGTYPE_ | |
1300 SOUNDEND must be set using the audio_SetSignal() function. | |
1301 If the special driver implementation or the device does | |
1302 not support volume control, the driver ignores the value. | |
1303 If the sound can be played, the function returns DRV_OK. | |
1304 If the device is currently playing the sound identified by | |
1305 the parameter in_SoundID, the function returns DRV_INPROCESS. | |
1306 If the device/driver is currently playing a sound, but does | |
1307 not support playing multiple sounds simultaneously, the | |
1308 driver returns DRV_INPROCESS. | |
1309 | |
1310 */ | |
1311 | |
1312 GLOBAL UBYTE audio_PlaySoundID (UBYTE in_DeviceID, | |
1313 UBYTE in_SoundID, | |
1314 BYTE in_RelVolume, | |
1315 UBYTE in_Repeats) | |
1316 { | |
1317 | |
1318 TRACE_EVENT_P1("audio_PlaySoundID in_SoundID is %d",in_SoundID); | |
1319 /* | |
1320 * switch off current tone | |
1321 */ | |
1322 switch (act_tone.status) | |
1323 { | |
1324 | |
1325 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1326 //If Buzzer is available, disable the buzzer | |
1327 #if CONFIG_BUZZER | |
1328 case BUZZER_ON: | |
1329 BZ_Disable (); | |
1330 case BUZZER_SILENT: | |
1331 #endif | |
1332 /* | |
1333 * No Break | |
1334 */ | |
1335 case TONE_ON: | |
1336 case TONE_SILENT: | |
1337 #if defined (NEW_FRAME) | |
1338 vsi_t_stop (VSI_CALLER CST_AUDIOTIMER); | |
1339 #else | |
1340 vsi_t_stop (VSI_CALLER audio_handle); | |
1341 #endif | |
1342 break; | |
1343 default: | |
1344 break; | |
1345 } | |
1346 | |
1347 /* | |
1348 * configure new tone | |
1349 */ | |
1350 if (in_SoundID EQ TONES_KEYBEEP) /* that is keybeep */ | |
1351 { | |
1352 #if defined (RIV_AUDIO) | |
1353 beep.frequency_beep[0] = ((F_697) >> 5) & 0x07ff; | |
1354 beep.amplitude_beep[0] = -((char) ((F_697) & 0x001f)); | |
1355 beep.frequency_beep[1] = ((F_697) >> 5) & 0x07ff; | |
1356 beep.amplitude_beep[1] = -((char) ((F_697) & 0x001f)); | |
1357 beep.duration = 120; | |
1358 #ifdef _TARGET_ | |
1359 /* | |
1360 * This function seems only to be available on target. (db / 2001-07-16) | |
1361 */ | |
1362 return audio_keybeep_start(beep,riv_audio_rp); | |
1363 #endif | |
1364 #else | |
1365 /* MPHC is not present in GTI case */ | |
1366 #if !defined(FF_GTI) && AUDIO_TASK | |
1367 PALLOC (keybeep, MMI_KEYBEEP_REQ); | |
1368 | |
1369 keybeep->d_k_x1_kt0 = F_697; | |
1370 keybeep->d_k_x1_kt1 = F_697; | |
1371 keybeep->d_dur_kb = 6; /* equal 120 ms */ | |
1372 PSENDX (L1, keybeep); | |
1373 #endif /* FF_GTI */ | |
1374 #endif | |
1375 } | |
1376 else | |
1377 { | |
1378 act_tone.call_tone = in_SoundID; | |
1379 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1380 //Before playing the tone, set the status and the tone type . | |
1381 #if CONFIG_BUZZER | |
1382 act_tone.status = BUZZER_SILENT; | |
1383 act_tone.type = (UBYTE)TONE_TYPE[in_SoundID]; | |
1384 #else //If Buzzer is not available | |
1385 act_tone.status = TONE_SILENT; | |
1386 act_tone.type = (UBYTE)AUDIO; | |
1387 #endif | |
1388 act_tone.descr = (T_DESCR *)TONE_DESCR[in_SoundID]; | |
1389 act_tone.style = in_Repeats; | |
1390 act_tone.descr_index = 0; | |
1391 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1392 //If Buzzer is available, call the audio_buzzer | |
1393 #if CONFIG_BUZZER | |
1394 if (act_tone.type EQ BUZZER) | |
1395 { | |
1396 act_tone.volume = act_buzVolume; | |
1397 audio_buzzer (); | |
1398 } | |
1399 else | |
1400 #endif | |
1401 { | |
1402 act_tone.volume = act_speakerVolume; | |
1403 audio_audio (); | |
1404 } | |
1405 } | |
1406 | |
1407 return DRV_OK; | |
1408 } | |
1409 | |
1410 /* | |
1411 +--------------------------------------------------------------------+ | |
1412 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1413 | STATE : code ROUTINE : audio_PlaySoundbyImage | | |
1414 +--------------------------------------------------------------------+ | |
1415 | |
1416 PURPOSE : This function is used to play a sound or melody. The | |
1417 image of the sound/melody is passed to the driver (the | |
1418 sound image format is implmementation dependent). | |
1419 | |
1420 */ | |
1421 | |
1422 GLOBAL UBYTE audio_PlaySoundbyImage (UBYTE in_DeviceID, | |
1423 void * in_SoundImagePtr, | |
1424 BYTE in_RelVolume, | |
1425 UBYTE in_Repeats) | |
1426 { | |
1427 return DRV_OK; | |
1428 } | |
1429 | |
1430 /* | |
1431 +--------------------------------------------------------------------+ | |
1432 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1433 | STATE : code ROUTINE : audio_StopSoundbyID | | |
1434 +--------------------------------------------------------------------+ | |
1435 | |
1436 PURPOSE : This function is used to manually stop playing a sound | |
1437 or melody. When a sound is stopped manually, no signal is | |
1438 created as to whether or not the signal AUDIO_SIGTYP_SOUNDEND | |
1439 has been defined. If the function could stop playing the | |
1440 specified sound, the function returns DRV_OK. If the device | |
1441 is unknown or does not support this function or the specified | |
1442 sound ID is invalid, the function returns DRV_INVALID_PARAMS. | |
1443 | |
1444 */ | |
1445 | |
1446 GLOBAL UBYTE audio_StopSoundbyID (UBYTE in_DeviceID, | |
1447 UBYTE in_SoundID) | |
1448 { | |
1449 | |
1450 TRACE_EVENT_P1("audio_StopSoundbyID in_SoundID is %d",in_SoundID); | |
1451 /* | |
1452 * switch off current tone | |
1453 */ | |
1454 switch (act_tone.status) | |
1455 { | |
1456 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1457 //If Buzzer is available, disable it. | |
1458 #if CONFIG_BUZZER | |
1459 case BUZZER_ON: | |
1460 BZ_Disable (); | |
1461 case BUZZER_SILENT: | |
1462 #endif | |
1463 /* | |
1464 * No Break | |
1465 */ | |
1466 case TONE_ON: | |
1467 case TONE_SILENT: | |
1468 | |
1469 /* Stop timer for reload */ | |
1470 | |
1471 #if defined (NEW_FRAME) | |
1472 vsi_t_stop (VSI_CALLER CST_AUDIOTIMER); | |
1473 #else | |
1474 vsi_t_stop (VSI_CALLER audio_handle); | |
1475 #endif | |
1476 | |
1477 if (act_tone.status EQ TONE_ON) | |
1478 { | |
1479 /* | |
1480 * stop the current playing audio tone immediately | |
1481 */ | |
1482 #if defined (RIV_AUDIO) | |
1483 #ifdef _TARGET_ | |
1484 /* | |
1485 * This function seems only to be available on target. (db / 2001-07-16) | |
1486 */ | |
1487 audio_tones_stop(riv_audio_rp); | |
1488 #endif | |
1489 #else | |
1490 #if !defined(FF_GTI) && AUDIO_TASK | |
1491 PALLOC (audio, MMI_TONE_REQ); | |
1492 | |
1493 audio->d_k_x1_t0 = 0; | |
1494 audio->d_k_x1_t1 = 0; | |
1495 audio->d_k_x1_t2 = 0; | |
1496 audio->d_pe_rep = 1; | |
1497 audio->d_pe_off = 0; | |
1498 audio->d_se_off = 0; | |
1499 audio->d_bu_off = 0; | |
1500 audio->d_t0_on = 0; | |
1501 audio->d_t0_off = 0; | |
1502 audio->d_t1_on = 0; | |
1503 audio->d_t1_off = 0; | |
1504 audio->d_t2_on = 0; | |
1505 audio->d_t2_off = 0; | |
1506 | |
1507 PSENDX (L1, audio); | |
1508 #endif /* FF_GTI */ | |
1509 #endif | |
1510 } | |
1511 act_tone.status = NO_TONE_STATE; | |
1512 | |
1513 break; | |
1514 default: | |
1515 break; | |
1516 } | |
1517 | |
1518 return DRV_OK; | |
1519 } | |
1520 | |
1521 | |
1522 /* | |
1523 +--------------------------------------------------------------------+ | |
1524 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1525 | STATE : code ROUTINE : audio_StopSoundbyImage | | |
1526 +--------------------------------------------------------------------+ | |
1527 | |
1528 PURPOSE : This function is used to manually stop playing a sound | |
1529 or melody. When a sound is stopped manually, no signal is | |
1530 created as to whether or not the signal AUDIO_SIGTYP_SOUNDEND | |
1531 has been defined. If the function could stop playing the | |
1532 specified sound image, the function returns DRV_OK. | |
1533 If the device is unknown or does not support this function | |
1534 or the specified sound ID is invalid, the function | |
1535 returns DRV_INVALID_PARAMS. | |
1536 | |
1537 */ | |
1538 | |
1539 GLOBAL UBYTE audio_StopSoundbyImage (UBYTE in_DeviceID, | |
1540 void * in_SoundImagePtr) | |
1541 { | |
1542 return DRV_OK; | |
1543 } | |
1544 | |
1545 /* | |
1546 +--------------------------------------------------------------------+ | |
1547 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1548 | STATE : code ROUTINE : audio_SetSignal | | |
1549 +--------------------------------------------------------------------+ | |
1550 | |
1551 PURPOSE : This function is used to defines a single signal or multiple | |
1552 signals that is/are indicated to the process when the | |
1553 event identified in the signal information data type as | |
1554 SignalType occurs. To remove a signal call the function | |
1555 audio_ResetSignal(). If one of the parameters of the | |
1556 signal information data is invalid, the function returns | |
1557 DRV_INVALID_PARAMS. If no signal call-back function has | |
1558 been defined at the time of initialization, the driver | |
1559 returns DRV_SIGFCT_NOTAVAILABLE. | |
1560 | |
1561 */ | |
1562 | |
1563 GLOBAL UBYTE audio_SetSignal (drv_SignalID_Type * in_SignalIDPtr) | |
1564 { | |
1565 return DRV_OK; | |
1566 } | |
1567 | |
1568 /* | |
1569 +--------------------------------------------------------------------+ | |
1570 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1571 | STATE : code ROUTINE : audio_ResetSignal | | |
1572 +--------------------------------------------------------------------+ | |
1573 | |
1574 PURPOSE : This function is used to remove a previously set single | |
1575 multiple signals. The signals that are removed are identified | |
1576 by the Signal Information Data element Signal Type. All other | |
1577 elements of the signal information data must be identical | |
1578 to the signal(s) that is/are to be removed. | |
1579 | |
1580 */ | |
1581 | |
1582 GLOBAL UBYTE audio_ResetSignal (drv_SignalID_Type * in_SignalIDPtr) | |
1583 { | |
1584 return DRV_OK; | |
1585 } | |
1586 | |
1587 /* | |
1588 +--------------------------------------------------------------------+ | |
1589 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1590 | STATE : code ROUTINE : audio_timeout | | |
1591 +--------------------------------------------------------------------+ | |
1592 | |
1593 PURPOSE : This function is used after timeout of the audio timer. | |
1594 | |
1595 */ | |
1596 | |
1597 #if defined (NEW_FRAME) | |
1598 GLOBAL void audio_timeout (USHORT index) | |
1599 #else | |
1600 GLOBAL void audio_timeout (T_VSI_THANDLE handle) | |
1601 #endif | |
1602 { | |
1603 #if defined (NEW_FRAME) | |
1604 if (index EQ CST_AUDIOTIMER) | |
1605 #else | |
1606 if (handle EQ audio_handle) | |
1607 #endif | |
1608 { | |
1609 /*ccc | |
1610 * only if it is the audio timer | |
1611 */ | |
1612 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1613 //For Buzzer | |
1614 #if CONFIG_BUZZER | |
1615 if (act_tone.type EQ BUZZER) | |
1616 audio_buzzer (); | |
1617 else | |
1618 #endif | |
1619 audio_audio (); | |
1620 } | |
1621 } | |
1622 | |
1623 | |
1624 /* | |
1625 +--------------------------------------------------------------------+ | |
1626 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1627 | STATE : code ROUTINE : audio_buzzer | | |
1628 +--------------------------------------------------------------------+ | |
1629 | |
1630 PURPOSE : Process a buzzer tone. | |
1631 | |
1632 */ | |
1633 //Apr 04, 2005 REF: ENH 30063 xdeepadh | |
1634 #if CONFIG_BUZZER | |
1635 LOCAL void audio_buzzer (void) | |
1636 { | |
1637 if (act_tone.status EQ NO_TONE_STATE) | |
1638 return; | |
1639 | |
1640 switch (act_tone.descr | |
1641 [act_tone.descr_index].command_1) | |
1642 { | |
1643 case 0: | |
1644 /* | |
1645 * switch buzzer off | |
1646 */ | |
1647 BZ_Disable (); | |
1648 #if defined (NEW_FRAME) | |
1649 vsi_t_start (VSI_CALLER CST_AUDIOTIMER, | |
1650 act_tone.descr | |
1651 [act_tone.descr_index++].length*60/13); | |
1652 #else | |
1653 vsi_t_start (VSI_CALLER audio_handle, | |
1654 act_tone.descr | |
1655 [act_tone.descr_index++].length*60/13); | |
1656 #endif | |
1657 act_tone.status = BUZZER_SILENT; | |
1658 break; | |
1659 | |
1660 case 0xFFFE: | |
1661 /* | |
1662 * switch buzzer on continously | |
1663 */ | |
1664 BZ_Enable (); | |
1665 BZ_Volume (act_buzVolume); | |
1666 BZ_Tone (act_tone.descr | |
1667 [act_tone.descr_index].command_1); | |
1668 act_tone.status = BUZZER_ON; | |
1669 break; | |
1670 | |
1671 case 0xFFFF: | |
1672 /* | |
1673 * end of list | |
1674 */ | |
1675 BZ_Disable (); | |
1676 if (act_tone.style EQ AUDIO_PLAY_INFINITE) | |
1677 { | |
1678 act_tone.descr_index = 0; | |
1679 audio_buzzer (); | |
1680 } | |
1681 else | |
1682 act_tone.status = NO_TONE_STATE; | |
1683 break; | |
1684 | |
1685 default: | |
1686 /* | |
1687 * switch buzzer on | |
1688 */ | |
1689 BZ_Enable (); | |
1690 BZ_Volume (act_buzVolume); | |
1691 BZ_Tone (act_tone.descr | |
1692 [act_tone.descr_index].command_1); | |
1693 #if defined (NEW_FRAME) | |
1694 vsi_t_start (VSI_CALLER | |
1695 CST_AUDIOTIMER, | |
1696 act_tone.descr | |
1697 [act_tone.descr_index++].length*60/13); | |
1698 #else | |
1699 vsi_t_start (VSI_CALLER | |
1700 audio_handle, | |
1701 act_tone.descr | |
1702 [act_tone.descr_index++].length*60/13); | |
1703 #endif | |
1704 act_tone.status = BUZZER_ON; | |
1705 break; | |
1706 } | |
1707 } | |
1708 #endif | |
1709 | |
1710 /* | |
1711 +--------------------------------------------------------------------+ | |
1712 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1713 | STATE : code ROUTINE : audio_audio | | |
1714 +--------------------------------------------------------------------+ | |
1715 | |
1716 PURPOSE : Process an audio tone. | |
1717 | |
1718 */ | |
1719 | |
1720 LOCAL void audio_audio (void) | |
1721 { | |
1722 | |
1723 TRACE_EVENT("audio_audio"); | |
1724 if (act_tone.status EQ NO_TONE_STATE) | |
1725 return; | |
1726 | |
1727 switch (act_tone.descr | |
1728 [act_tone.descr_index].command_1) | |
1729 { | |
1730 case 0: | |
1731 /* | |
1732 * switch audio off | |
1733 */ | |
1734 #if defined (NEW_FRAME) | |
1735 vsi_t_start (VSI_CALLER CST_AUDIOTIMER, | |
1736 act_tone.descr | |
1737 [act_tone.descr_index++].length*60/13); | |
1738 #else | |
1739 vsi_t_start (VSI_CALLER audio_handle, | |
1740 act_tone.descr | |
1741 [act_tone.descr_index++].length*60/13); | |
1742 #endif | |
1743 act_tone.status = TONE_SILENT; | |
1744 break; | |
1745 | |
1746 case 0xFFFF: | |
1747 /* | |
1748 * end of list | |
1749 */ | |
1750 if (act_tone.style EQ AUDIO_PLAY_INFINITE) | |
1751 { | |
1752 act_tone.descr_index = 0; | |
1753 audio_audio (); | |
1754 } | |
1755 else | |
1756 act_tone.status = NO_TONE_STATE; | |
1757 break; | |
1758 | |
1759 default: | |
1760 /* | |
1761 * switch audio tone on | |
1762 */ | |
1763 { | |
1764 #if defined (RIV_AUDIO) | |
1765 USHORT fa1 = act_tone.descr[act_tone.descr_index].command_1; | |
1766 USHORT fa2 = act_tone.descr[act_tone.descr_index].command_2; | |
1767 ULONG len = act_tone.descr[act_tone.descr_index].length; | |
1768 t.tones[0].start_tone = 0; | |
1769 t.tones[0].stop_tone = (USHORT) ((60 * len) / 13); | |
1770 t.tones[0].frequency_tone = (fa1 >> 5) & 0x07ff; | |
1771 t.tones[0].amplitude_tone = -((char) (fa1 & 0x001f)); | |
1772 t.tones[1].start_tone = 0; | |
1773 t.tones[1].stop_tone = (USHORT) ((60 * len) / 13); | |
1774 t.tones[1].frequency_tone = (fa2 >> 5) & 0x07ff; | |
1775 t.tones[1].amplitude_tone = -((char) (fa2 & 0x001f)); | |
1776 t.tones[2].start_tone = 0; | |
1777 // t.tones[2].stop_tone = 1; - NDH : Removed as this does not comply with the i/f spec | |
1778 t.tones[2].stop_tone = (USHORT) ((60 * len) / 13); | |
1779 t.tones[2].frequency_tone = 0; | |
1780 t.tones[2].amplitude_tone = 0; | |
1781 t.frame_duration = (USHORT) ((60 * len) / 13); | |
1782 t.sequence_duration = (USHORT) ((60 * len) / 13); /* why 120 ??? -> changed to 60 */ | |
1783 t.period_duration = (USHORT) ((60 * len) / 13); /* -"- */ | |
1784 t.repetition = 1; | |
1785 #ifdef _TARGET_ | |
1786 /* | |
1787 * This function seems only to be available on target. (db / 2001-07-16) | |
1788 */ | |
1789 audio_tones_start(&t,riv_audio_rp); | |
1790 #endif | |
1791 #else | |
1792 #if !defined(FF_GTI) && AUDIO_TASK | |
1793 PALLOC (audio, MMI_TONE_REQ); | |
1794 /* | |
1795 * Convert TDMA frames to 20 ms -> 3/13 | |
1796 */ | |
1797 | |
1798 audio->d_k_x1_t0 = act_tone.descr[act_tone.descr_index].command_1; | |
1799 audio->d_k_x1_t1 = act_tone.descr[act_tone.descr_index].command_2; | |
1800 audio->d_k_x1_t2 = 0; | |
1801 audio->d_pe_rep = 1; | |
1802 audio->d_pe_off = (6*act_tone.descr[act_tone.descr_index].length) / 13; | |
1803 audio->d_se_off = (6*act_tone.descr[act_tone.descr_index].length) / 13; | |
1804 audio->d_bu_off = (3*act_tone.descr[act_tone.descr_index].length) / 13; | |
1805 audio->d_t0_on = 0; | |
1806 audio->d_t0_off = (3*act_tone.descr[act_tone.descr_index].length) / 13; | |
1807 audio->d_t1_on = 0; | |
1808 audio->d_t1_off = (3*act_tone.descr[act_tone.descr_index].length) / 13; | |
1809 audio->d_t2_on = 0; | |
1810 audio->d_t2_off = 0; | |
1811 | |
1812 PSENDX (L1, audio); | |
1813 #endif /* FF_GTI */ | |
1814 #endif | |
1815 | |
1816 #if defined (NEW_FRAME) | |
1817 vsi_t_start (VSI_CALLER CST_AUDIOTIMER, | |
1818 act_tone.descr | |
1819 [act_tone.descr_index++].length*60/13); | |
1820 #else | |
1821 vsi_t_start (VSI_CALLER audio_handle, | |
1822 act_tone.descr | |
1823 [act_tone.descr_index++].length*60/13); | |
1824 #endif | |
1825 act_tone.status = TONE_ON; | |
1826 } | |
1827 break; | |
1828 } | |
1829 } | |
1830 | |
1831 | |
1832 /* | |
1833 +--------------------------------------------------------------------+ | |
1834 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1835 | STATE : code ROUTINE : audio_UlMute | | |
1836 +--------------------------------------------------------------------+ | |
1837 | |
1838 PURPOSE : This function mutes the uplink path. | |
1839 | |
1840 */ | |
1841 LOCAL void audio_UlMute (UBYTE mute) | |
1842 { | |
1843 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
1844 // local variable definition | |
1845 #ifdef FF_MMI_SERVICES_MIGRATION | |
1846 T_AUDIO_FULL_ACCESS_WRITE p_parameter; | |
1847 T_AUDIO_FULL_ACCESS_READ p_parameter1; | |
1848 T_RV_RETURN_PATH return_path = {0, NULL}; | |
1849 T_AUDIO_RET result; | |
1850 // June 13, 2005 REF : GSM_ENH_32062 - xpradipg | |
1851 // the default value is assigned to AUDIO_MICROPHONE_OUTPUT_BIAS_2_0V | |
1852 static INT8 microphone_gain = AUDIO_MICROPHONE_OUTPUT_BIAS_2_0V; | |
1853 INT8 setgain = AUDIO_MICROPHONE_MUTE; | |
1854 #endif | |
1855 if (mute) | |
1856 { | |
1857 #ifdef ALR | |
1858 // June 13, 2005 REF : GSM_ENH_32062 - xpradipg | |
1859 // the audio is unmuted for the variable "mute" with value greater than "0" | |
1860 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
1861 // read the microphone gain, store it and mute the microphone | |
1862 #ifdef FF_MMI_SERVICES_MIGRATION | |
1863 p_parameter1.variable_indentifier = AUDIO_MICROPHONE_GAIN; | |
1864 p_parameter1.data = (void*)µphone_gain; | |
1865 result = audio_full_access_read(&p_parameter1); | |
1866 if(result != 0) | |
1867 { | |
1868 TRACE_EVENT("error reading the handeld parameters"); | |
1869 } | |
1870 p_parameter.variable_indentifier = AUDIO_MICROPHONE_GAIN; | |
1871 setgain = AUDIO_MICROPHONE_MUTE; | |
1872 p_parameter.data = (void*)&setgain; | |
1873 result = audio_full_access_write(&p_parameter, return_path); | |
1874 if(result != 0) | |
1875 TRACE_EVENT("ERROR - not written1"); | |
1876 #else | |
1877 ABB_UlMute (1); | |
1878 #endif | |
1879 #else | |
1880 VG_UlVolume (0); | |
1881 #endif | |
1882 } | |
1883 else | |
1884 { | |
1885 #ifdef ALR | |
1886 // June 13, 2005 REF : GSM_ENH_32062 - xpradipg | |
1887 // the audio is muted for the variable "mute" with value <= to "0" | |
1888 // Apr 26, 2005 REF : CRR 30627 xpradipg | |
1889 // restore the volume back once the unmuting is done | |
1890 #ifdef FF_MMI_SERVICES_MIGRATION | |
1891 p_parameter.variable_indentifier = (UINT8)AUDIO_MICROPHONE_GAIN ; | |
1892 p_parameter.data = (void*)µphone_gain; | |
1893 result = audio_full_access_write(&p_parameter, return_path); | |
1894 if(result != 0) | |
1895 TRACE_EVENT("ERROR - not written"); | |
1896 #else | |
1897 ABB_UlMute (0); | |
1898 #endif | |
1899 #else | |
1900 VG_UlVolume (act_micVolume); | |
1901 #endif | |
1902 } | |
1903 } | |
1904 | |
1905 /* | |
1906 +--------------------------------------------------------------------+ | |
1907 | PROJECT : GSM-PS (6103) MODULE : DRV_AUDIO | | |
1908 | STATE : code ROUTINE : audio_set_tty | | |
1909 +--------------------------------------------------------------------+ | |
1910 | |
1911 PURPOSE : This function (de)activates the TTY codec. | |
1912 | |
1913 */ | |
1914 | |
1915 #if defined (FF_TTY) || defined (_TTY_SIMU) | |
1916 GLOBAL void audio_set_tty (T_TTY_CMD tty) | |
1917 { | |
1918 if (tty < TTY_OFF OR tty > TTY_ALL) | |
1919 { | |
1920 TRACE_EVENT_P1 ("TTY invalid parameter: %d", tty); | |
1921 return; | |
1922 } | |
1923 if (tty NEQ TTY_OFF) | |
1924 { | |
1925 #if defined (RIV_AUDIO) && !defined (_TTY_SIMU) | |
1926 T_AUDIO_MODE_SAVE audio_mode; | |
1927 T_RV_RETURN_PATH ret = {NOT_PRESENT_8BIT, NULL}; | |
1928 T_AUDIO_RET audio_ret; | |
1929 | |
1930 if (!tty_state) | |
1931 { | |
1932 tty_cfg.Mode = TTY_EXT_START; | |
1933 tty_cfg.ThresholdRead = tty_cfg.ThreshHoldWrite = 0; | |
1934 | |
1935 ret.callback_func = audio_save_def_return; | |
1936 strcpy (audio_mode.audio_mode_filename, audio_mode_names_tty[0]); | |
1937 audio_ret = audio_mode_save (&audio_mode, ret); | |
1938 | |
1939 if (audio_ret NEQ AUDIO_OK) | |
1940 { | |
1941 AUDIO_TRC_EVENT_P1 ("Error AUDIO MODE SAVE def: %d", (int)audio_ret); | |
1942 } | |
1943 else | |
1944 { | |
1945 AUDIO_TRC_FUNC ("AUDIO MODE SAVE def"); | |
1946 tty_cmd = (UBYTE)tty; | |
1947 } | |
1948 } | |
1949 else | |
1950 { | |
1951 AUDIO_TRC_EVENT ("TTY running"); | |
1952 } | |
1953 #else | |
1954 TRACE_EVENT_P1 ("TTY start: %d", tty); | |
1955 #endif | |
1956 } | |
1957 else | |
1958 { | |
1959 #if defined (RIV_AUDIO) && !defined (_TTY_SIMU) | |
1960 T_RV_RETURN_PATH ret = {NOT_PRESENT_8BIT, NULL}; | |
1961 T_AUDIO_RET audio_ret; | |
1962 | |
1963 if (tty_state) | |
1964 { | |
1965 ret.callback_func = audio_tty_return; | |
1966 tty_cfg.ThresholdRead = tty_cfg.ThreshHoldWrite = 0; | |
1967 tty_cfg.Mode = TTY_STOP; | |
1968 audio_ret = audio_tty_set_config (&tty_cfg, &ret); | |
1969 | |
1970 if (audio_ret NEQ AUDIO_OK) | |
1971 { | |
1972 tty_state = FALSE; | |
1973 AUDIO_TRC_EVENT_P1 ("Error TTY stop: %d", (int)audio_ret); | |
1974 } | |
1975 else | |
1976 { | |
1977 AUDIO_TRC_FUNC ("TTY to be stopped"); | |
1978 } | |
1979 } | |
1980 else | |
1981 { | |
1982 AUDIO_TRC_FUNC ("TTY already ended"); | |
1983 } | |
1984 #else | |
1985 TRACE_EVENT ("TTY stop"); | |
1986 #endif | |
1987 } | |
1988 } | |
1989 | |
1990 /* This function changes the TTY mode during an active TTY call */ | |
1991 GLOBAL void audio_dyn_set_tty (T_TTY_CMD tty) | |
1992 { | |
1993 T_AUDIO_MODE_LOAD audio_mode; | |
1994 T_RV_RETURN_PATH load_ret = {NOT_PRESENT_8BIT, NULL}; | |
1995 T_AUDIO_RET audio_ret; | |
1996 UBYTE cmd; | |
1997 | |
1998 if (tty < TTY_OFF OR tty > TTY_ALL) | |
1999 { | |
2000 TRACE_EVENT_P1 ("TTY invalid parameter: %d", tty); | |
2001 return; | |
2002 } | |
2003 | |
2004 #if defined (RIV_AUDIO) && !defined (_TTY_SIMU) | |
2005 | |
2006 cmd = (UBYTE)tty; | |
2007 if (tty_state) | |
2008 { | |
2009 load_ret.callback_func = audio_dyn_load_return; | |
2010 } | |
2011 else | |
2012 { | |
2013 /* | |
2014 * If the TTY mode was default before then need to start | |
2015 * the TTY driver | |
2016 */ | |
2017 tty_cfg.Mode = TTY_EXT_START; | |
2018 tty_cfg.ThresholdRead = tty_cfg.ThreshHoldWrite = 0; | |
2019 load_ret.callback_func = audio_load_return; | |
2020 } | |
2021 | |
2022 strcpy (audio_mode.audio_mode_filename, audio_mode_names_tty[(int)cmd]); | |
2023 audio_ret = audio_mode_load (&audio_mode, load_ret); | |
2024 | |
2025 if (audio_ret NEQ AUDIO_OK) | |
2026 { | |
2027 AUDIO_TRC_EVENT_P1 ("Error AUDIO MODE LOAD TTY: %d", (int)audio_ret); | |
2028 } | |
2029 else | |
2030 { | |
2031 AUDIO_TRC_FUNC ("AUDIO MODE LOAD def"); | |
2032 tty_cmd = (UBYTE)tty; | |
2033 } | |
2034 #else | |
2035 TRACE_EVENT_P1 ("TTY mode change: %d", tty); | |
2036 #endif | |
2037 | |
2038 } | |
2039 | |
2040 #if defined (RIV_AUDIO) AND !defined (_TTY_SIMU) | |
2041 LOCAL void audio_tty_return (void *tty_result) | |
2042 { | |
2043 T_AUDIO_MODE_LOAD audio_mode; | |
2044 T_RV_RETURN_PATH ret = {NOT_PRESENT_8BIT, NULL}; | |
2045 T_AUDIO_RET audio_ret; | |
2046 | |
2047 if (((T_AUDIO_TTY_STATUS *)tty_result)->status NEQ AUDIO_OK) | |
2048 { | |
2049 AUDIO_TRC_EVENT_P1 ("Error TTY callback: %d", | |
2050 (int)((T_AUDIO_TTY_STATUS *)tty_result)->status); | |
2051 } | |
2052 tty_state = FALSE; | |
2053 tty_cfg.Mode = TTY_STOP; | |
2054 AUDIO_TRC_FUNC ("TTY end"); | |
2055 | |
2056 ret.callback_func = audio_load_return; | |
2057 strcpy (audio_mode.audio_mode_filename, audio_mode_names_tty[0]); | |
2058 audio_ret = audio_mode_load (&audio_mode, ret); | |
2059 | |
2060 if (audio_ret NEQ AUDIO_OK) | |
2061 { | |
2062 AUDIO_TRC_EVENT_P1 ("Error AUDIO MODE LOAD def: %d", (int)audio_ret); | |
2063 } | |
2064 } | |
2065 | |
2066 LOCAL void audio_save_def_return (void *result) | |
2067 { | |
2068 T_AUDIO_MODE_LOAD audio_mode; | |
2069 T_RV_RETURN_PATH load_ret = {NOT_PRESENT_8BIT, NULL}; | |
2070 T_AUDIO_RET audio_ret; | |
2071 | |
2072 if (((T_AUDIO_SAVE_DONE *)result)->status NEQ AUDIO_OK) | |
2073 { | |
2074 AUDIO_TRC_EVENT_P1 ("Error AUDIO MODE SAVE def callback: %d", | |
2075 (int)((T_AUDIO_SAVE_DONE *)result)->status); | |
2076 } | |
2077 else | |
2078 { | |
2079 AUDIO_TRC_FUNC ("AUDIO def saved"); | |
2080 | |
2081 load_ret.callback_func = audio_load_return; | |
2082 strcpy (audio_mode.audio_mode_filename, audio_mode_names_tty[(int)tty_cmd]); | |
2083 audio_ret = audio_mode_load (&audio_mode, load_ret); | |
2084 | |
2085 if (audio_ret NEQ AUDIO_OK) | |
2086 { | |
2087 AUDIO_TRC_EVENT_P1 ("Error AUDIO MODE LOAD TTY: %d", (int)audio_ret); | |
2088 } | |
2089 } | |
2090 } | |
2091 | |
2092 LOCAL void audio_load_return (void *result) | |
2093 { | |
2094 if (((T_AUDIO_LOAD_DONE *)result)->status NEQ AUDIO_OK) | |
2095 { | |
2096 AUDIO_TRC_EVENT_P1 ("Error AUDIO MODE LOAD callback: %d", | |
2097 (int)((T_AUDIO_LOAD_DONE *)result)->status); | |
2098 } | |
2099 else | |
2100 { | |
2101 T_RV_RETURN_PATH ret = {NOT_PRESENT_8BIT, NULL}; | |
2102 T_AUDIO_RET audio_ret; | |
2103 | |
2104 if (!tty_state AND tty_cfg.Mode EQ TTY_EXT_START) | |
2105 { | |
2106 ret.callback_func = audio_tty_return; | |
2107 audio_ret = audio_tty_set_config (&tty_cfg, &ret); | |
2108 | |
2109 if (audio_ret NEQ AUDIO_OK) | |
2110 { | |
2111 AUDIO_TRC_EVENT_P1 ("Error TTY set: %d", (int)audio_ret); | |
2112 } | |
2113 else | |
2114 { | |
2115 tty_state = TRUE; | |
2116 AUDIO_TRC_FUNC ("AUDIO TTY loaded & start"); | |
2117 } | |
2118 } | |
2119 else if (!tty_state AND tty_cfg.Mode EQ TTY_STOP) | |
2120 { | |
2121 tty_cmd = (UBYTE)TTY_OFF; | |
2122 AUDIO_TRC_FUNC ("AUDIO def loaded"); | |
2123 } | |
2124 else | |
2125 { | |
2126 AUDIO_TRC_EVENT_P2 ("TTY improper state: %d; mode: %d", | |
2127 (int)tty_state, (int)tty_cfg.Mode); | |
2128 } | |
2129 } | |
2130 } | |
2131 | |
2132 LOCAL void audio_dyn_load_return (void *result) | |
2133 { | |
2134 if (((T_AUDIO_LOAD_DONE *)result)->status NEQ AUDIO_OK) | |
2135 { | |
2136 AUDIO_TRC_EVENT_P1 ("Error AUDIO MODE LOAD callback: %d", | |
2137 (int)((T_AUDIO_LOAD_DONE *)result)->status); | |
2138 } | |
2139 else | |
2140 { | |
2141 AUDIO_TRC_EVENT_P1 ("TTY mode changed: %d", (int)tty_cmd); | |
2142 } | |
2143 } | |
2144 #endif | |
2145 #endif | |
2146 | |
2147 /******************************************************************* | |
2148 * * | |
2149 * PART II: Simulation for Windows * | |
2150 * * | |
2151 *******************************************************************/ | |
2152 | |
2153 #if defined (_SIMULATION_) | |
2154 /* | |
2155 * Dummies for driver calls | |
2156 */ | |
2157 | |
2158 LOCAL void BZ_Init (void) | |
2159 { | |
2160 } | |
2161 | |
2162 LOCAL void BZ_Enable (void) | |
2163 { | |
2164 } | |
2165 | |
2166 LOCAL void BZ_Disable (void) | |
2167 { | |
2168 } | |
2169 | |
2170 LOCAL void BZ_Tone (int f) | |
2171 { | |
2172 } | |
2173 | |
2174 LOCAL void BZ_Volume (int v) | |
2175 { | |
2176 } | |
2177 | |
2178 #ifdef ALR | |
2179 LOCAL void ABB_DlVolume (UBYTE v) | |
2180 { | |
2181 } | |
2182 | |
2183 LOCAL void ABB_DlMute (UBYTE mute) | |
2184 { | |
2185 } | |
2186 | |
2187 LOCAL void ABB_UlMute (UBYTE value) | |
2188 { | |
2189 } | |
2190 | |
2191 LOCAL void ABB_SideTone (UBYTE v) | |
2192 { | |
2193 } | |
2194 #else | |
2195 LOCAL void VG_UlVolume (UBYTE v) | |
2196 { | |
2197 } | |
2198 | |
2199 LOCAL void VG_DlVolume (UBYTE v) | |
2200 { | |
2201 } | |
2202 | |
2203 LOCAL void VG_DlMute (UBYTE mute) | |
2204 { | |
2205 } | |
2206 | |
2207 LOCAL void VG_SideTone (UBYTE v) | |
2208 { | |
2209 } | |
2210 #endif | |
2211 | |
2212 #endif | |
2213 | |
2214 #if defined (RIV_AUDIO) | |
2215 void audio_riv_audio_cb (void *buf) | |
2216 { | |
2217 /* nothing to do for this time */ | |
2218 } | |
2219 #endif |