comparison src/g23m-aci/aci/hl_audio_drv.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : AOC
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 functions for the high level audio
18 driver interface.
19 +-----------------------------------------------------------------------------
20 */
21
22
23 #ifndef HL_AUDIO_DRV_C
24 #define HL_AUDIO_DRV_C
25 #endif
26
27 #include "aci_all.h"
28 #include "aci_cmh.h"
29 #include "aci.h"
30 #include "psa.h"
31 #include "hl_audio_drv.h"
32 #include "rv/rv_general.h"
33 #include "audio/audio_api.h"
34 #include "fc-target.h"
35
36
37 /* ===============GLOBAL VARIABLES====================*/
38
39 LOCAL T_HL_VOCODER_STATE currVocoderState;
40
41 #ifdef CONFIG_MCSI_MODEM
42 GLOBAL UBYTE aci_digital_voice_autoswitch;
43 #endif
44
45
46 /* =============FUNCTION DEFINITIONS FOR L1===========*/
47 #ifdef VOCODER_FUNC_INTERFACE
48 void vocoder_mute_dl( BOOL mute );
49 void vocoder_mute_ul( BOOL mute );
50 void enable_tch_vocoder (BOOL vocoder_on);
51 #endif /* VOCODER_FUNC_INTERFACE */
52
53
54 /*================= FUNCTIONS ========================*/
55
56 /*
57 +-------------------------------------------------------------------+
58 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
59 | ROUTINE : hl_audio_drv_init |
60 +-------------------------------------------------------------------+
61
62 PURPOSE : This function is called to initialise the variables in
63 the High Level Audio driver
64 */
65 GLOBAL void hl_audio_drv_init (void)
66 {
67 TRACE_FUNCTION("hl_audio_drv_init()");
68
69 currVocoderState = HL_VOCODER_DISABLED;
70 }
71
72 #ifdef CONFIG_MCSI_MODEM
73 static void audio_mode_callback(void *event_from_audio)
74 {
75 /* do nothing at this time */
76 }
77 #endif
78
79 /*
80 +-------------------------------------------------------------------+
81 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF |
82 | ROUTINE : hl_drv_set_vocoder_state|
83 +-------------------------------------------------------------------+
84
85 PURPOSE : This function will enable or disable vocoder as needed,
86 and possibly also enable/disable the MCSI digital voice
87 path if running on a FreeCalypso modem in the digital
88 voice interface configuration.
89 */
90 GLOBAL void hl_drv_set_vocoder_state(BOOL user_attach)
91 {
92 #ifdef CONFIG_MCSI_MODEM
93 T_AUDIO_VOICE_PATH_SETTING vpath;
94 T_AUDIO_FULL_ACCESS_WRITE audio_param;
95 T_RV_RETURN return_path;
96 #endif
97
98 TRACE_FUNCTION("hl_drv_set_vocoder_state");
99
100 if ( (user_attach EQ TRUE AND currVocoderState EQ HL_VOCODER_ENABLED) OR
101 (user_attach EQ FALSE AND currVocoderState EQ HL_VOCODER_DISABLED) )
102 return; /* No state change requested */
103
104 if (user_attach)
105 {
106 enable_tch_vocoder(TRUE);
107 vocoder_mute_dl (FALSE); /* un-mute speaker */
108 vocoder_mute_ul (FALSE); /* un-mute microphone */
109 #ifdef CONFIG_MCSI_MODEM
110 if (aci_digital_voice_autoswitch)
111 {
112 vpath = AUDIO_BLUETOOTH_HEADSET;
113 audio_param.variable_indentifier = AUDIO_PATH_USED;
114 audio_param.data = &vpath;
115 return_path.addr_id = NULL;
116 return_path.callback_func = audio_mode_callback;
117 audio_full_access_write(&audio_param, return_path);
118 }
119 #endif
120 currVocoderState = HL_VOCODER_ENABLED;
121 }
122 else
123 {
124 vocoder_mute_dl (TRUE); /* mute speaker */
125 vocoder_mute_ul (TRUE); /* mute microphone */
126 enable_tch_vocoder (FALSE); /* disable vocoder */
127 #ifdef CONFIG_MCSI_MODEM
128 if (aci_digital_voice_autoswitch)
129 {
130 vpath = AUDIO_GSM_VOICE_PATH;
131 audio_param.variable_indentifier = AUDIO_PATH_USED;
132 audio_param.data = &vpath;
133 return_path.addr_id = NULL;
134 return_path.callback_func = audio_mode_callback;
135 audio_full_access_write(&audio_param, return_path);
136 }
137 #endif
138 currVocoderState = HL_VOCODER_DISABLED;
139 }
140
141 return;
142 }
143
144 /*
145 +-------------------------------------------------------------------+
146 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
147 | ROUTINE : hl_drv_get_vocoder_state |
148 +-------------------------------------------------------------------+
149
150 PURPOSE : This function returns the state of the vocoder
151 */
152
153 GLOBAL T_HL_VOCODER_STATE hl_drv_get_vocoder_state (void)
154 {
155 return currVocoderState;
156 }
157
158 #ifndef VOCODER_FUNC_INTERFACE
159 /*
160 +-------------------------------------------------------------------+
161 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
162 | ROUTINE : hl_drv_vocoder_enabled |
163 +-------------------------------------------------------------------+
164
165 PURPOSE : Currently this function does nothing
166 */
167
168 GLOBAL void hl_drv_vocoder_state_set (void)
169 {
170 TRACE_FUNCTION("hl_drv_vocoder_enabled()");
171
172 switch(currVocoderState)
173 {
174 case HL_VOCODER_ENABLE_INITIATED:
175 currVocoderState = HL_VOCODER_ENABLED;
176 break;
177
178 case HL_VOCODER_DISABLE_INITIATED:
179 currVocoderState = HL_VOCODER_DISABLED;
180 break;
181
182 default:
183 break;
184
185 }
186 }
187 #endif