comparison g23m/condat/ms/src/aci/hl_audio_drv.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
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
33
34
35 /* ===============GLOBAL VARIABLES====================*/
36
37 LOCAL T_HL_VOCODER_STATE currVocoderState;
38
39 /* This flag helps enable the vocoder interface testing for
40 specific tescases
41 */
42 #ifdef _SIMULATION_
43 BOOL vocoder_tst_flag;
44 #endif
45
46
47 /* =============FUNCTION DEFINITIONS FOR L1===========*/
48 #ifndef _SIMULATION_
49 #ifdef VOCODER_FUNC_INTERFACE
50 void vocoder_mute_dl( BOOL mute );
51 void vocoder_mute_ul( BOOL mute );
52 void enable_tch_vocoder (BOOL vocoder_on);
53 #endif /* VOCODER_FUNC_INTERFACE */
54 #endif /* _SIMULATION_ */
55
56
57 /*================= FUNCTIONS ========================*/
58
59 /*
60 +-------------------------------------------------------------------+
61 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
62 | ROUTINE : hl_audio_drv_init |
63 +-------------------------------------------------------------------+
64
65 PURPOSE : This function is called to initialise the variables in
66 the High Level Audio driver
67 */
68 GLOBAL void hl_audio_drv_init (void)
69 {
70 TRACE_FUNCTION("hl_audio_drv_init()");
71
72 currVocoderState = HL_VOCODER_DISABLED;
73 #ifdef _SIMULATION_
74 vocoder_tst_flag = FALSE;
75 #endif
76
77 }
78
79
80 /*
81 +-------------------------------------------------------------------+
82 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
83 | ROUTINE : hl_drv_enable_vocoder |
84 +-------------------------------------------------------------------+
85
86 PURPOSE : This function is called to initialise the variables in
87 the High Level Audio driver
88 */
89 GLOBAL T_HL_VOICE_DRV_RSLT hl_drv_enable_vocoder ( void )
90 {
91 TRACE_FUNCTION("hl_drv_enable_vocoder()");
92 /* If the vocoder is already enabled, then ignore the request */
93 switch(currVocoderState)
94 {
95 case HL_VOCODER_ENABLED:
96 TRACE_EVENT("*--Vocoder already active--*");
97 return HL_VOICE_DRV_SUCC;
98
99 case HL_VOCODER_ENABLE_REQ:
100 TRACE_EVENT("*--Vocoder cannot be enabled--*");
101 return HL_VOICE_DRV_FAIL;
102
103 case HL_VOCODER_DISABLED:
104 break;
105 }
106
107 #ifdef _SIMULATION_
108 if (vocoder_tst_flag)
109 #endif
110 {
111 #ifndef VOCODER_FUNC_INTERFACE
112 {
113 PALLOC(mmi_tch_vocoder_cfg_req, MMI_TCH_VOCODER_CFG_REQ);
114 mmi_tch_vocoder_cfg_req->vocoder_state = VOCODER_ENABLE;
115 PSENDX(L1, mmi_tch_vocoder_cfg_req);
116 }
117 currVocoderState = HL_VOCODER_ENABLE_REQ;
118 #else
119 #ifndef _SIMULATION_
120 TRACE_EVENT("Function interface for Vocoder");
121 enable_tch_vocoder(TRUE);
122 vocoder_mute_dl (FALSE); /* un-mute speaker */
123 vocoder_mute_ul (FALSE); /* un-mute microphone */
124 currVocoderState = HL_VOCODER_ENABLED;
125 #endif /* _SIMULATION_ */
126 #endif
127 }
128 return HL_VOICE_DRV_SUCC;
129 }
130
131 /*
132 +-------------------------------------------------------------------+
133 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
134 | ROUTINE : hl_drv_disable_vocoder |
135 +-------------------------------------------------------------------+
136
137 PURPOSE : This function is called to initialise the variables in
138 the High Level Audio driver
139 */
140 GLOBAL void hl_drv_disable_vocoder ( void )
141 {
142 TRACE_FUNCTION("hl_drv_disable_vocoder()");
143
144 currVocoderState = HL_VOCODER_DISABLED;
145 #ifndef VOCODER_FUNC_INTERFACE
146 /* Do nothing in this case */
147 #else
148 #ifndef _SIMULATION_
149 TRACE_EVENT("Function interface for Vocoder");
150 vocoder_mute_dl (TRUE); /* mute speaker */
151 vocoder_mute_ul (TRUE); /* mute microphone */
152 enable_tch_vocoder (FALSE); /* disable vocoder */
153 #endif
154 #endif
155 }
156
157
158 /*
159 +-------------------------------------------------------------------+
160 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
161 | ROUTINE : hl_drv_get_vocoder_state |
162 +-------------------------------------------------------------------+
163
164 PURPOSE : This function returns the state of the vocoder
165 */
166
167 GLOBAL T_HL_VOCODER_STATE hl_drv_get_vocoder_state (void)
168 {
169 return currVocoderState;
170 }
171
172 #ifndef VOCODER_FUNC_INTERFACE
173 /*
174 +-------------------------------------------------------------------+
175 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
176 | ROUTINE : hl_drv_vocoder_enabled |
177 +-------------------------------------------------------------------+
178
179 PURPOSE : Currently this function does nothing
180 */
181
182 GLOBAL void hl_drv_vocoder_enabled (void)
183 {
184 TRACE_FUNCTION("hl_drv_vocoder_enabled()");
185 currVocoderState = HL_VOCODER_ENABLED;
186 }
187 #endif
188
189 #ifdef _SIMULATION_
190 /*
191 +-------------------------------------------------------------------+
192 | PROJECT : GSM-PS (6147) MODULE : HL_AUDIO_DRV |
193 | ROUTINE : hl_audio_drv_initForTest |
194 +-------------------------------------------------------------------+
195
196 PURPOSE : Initialise global variables related to simulaed
197 */
198
199 GLOBAL void hl_audio_drv_initForTest(void)
200 {
201 vocoder_tst_flag = TRUE;
202 }
203 #endif