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