blob: f80d33eced4ef24d01b13a519006d56df9d56cb0 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2008
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*******************************************************************************
37 *
38 * Filename:
39 * ---------
40 * dtmf_exp.h
41 *
42 * Project:
43 * --------
44 *
45 *
46 * Description:
47 * ------------
48 * The DTMF Tone Generator include file
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *============================================================================
55 * HISTORY
56 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
57 *------------------------------------------------------------------------------
58 * removed!
59 * removed!
60 * removed!
61 * removed!
62 * removed!
63 * removed!
64 * removed!
65 *
66 *------------------------------------------------------------------------------
67 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
68 *============================================================================
69 ****************************************************************************/
70
71#ifndef _DTMF_EXP_H
72#define _DTMF_EXP_H
73
74/*
75********************************************************************************
76* INCLUDE FILES
77********************************************************************************
78*/
79
80/*
81********************************************************************************
82* DEFINITION OF DATA TYPES
83********************************************************************************
84*/
85
86typedef enum {
87 DTMFKEY_0 = 0,
88 DTMFKEY_1,
89 DTMFKEY_2,
90 DTMFKEY_3,
91 DTMFKEY_4,
92 DTMFKEY_5,
93 DTMFKEY_6,
94 DTMFKEY_7,
95 DTMFKEY_8,
96 DTMFKEY_9,
97 DTMFKEY_STAR,
98 DTMFKEY_HASH,
99 DTMFKEY_A,
100 DTMFKEY_B,
101 DTMFKEY_C,
102 DTMFKEY_D,
103 DTMFKEY_Ext0,
104 DTMFKEY_Ext1,
105 DTMFKEY_Ext2,
106 DTMFKEY_Ext3,
107 DTMFKEY_Ext4,
108 DTMFKEY_Ext5,
109 DTMFKEY_Ext6,
110 DTMFKEY_Ext7
111} DTMF_KEY;
112
113typedef enum {
114 DTMF_8K = 0,
115 DTMF_11K,
116 DTMF_12K,
117 DTMF_16K,
118 DTMF_22K,
119 DTMF_24K,
120 DTMF_32K,
121 DTMF_44K,
122 DTMF_48K
123} DTMF_SR;
124
125typedef enum{
126 DTMF_MONO = 0,
127 DTMF_STEREO
128}DTMF_CHANNEL;
129
130typedef enum {
131 DTMF_SUCCESS = 0,
132 DTMF_FAIL,
133 DTMF_DONE
134} DTMF_STATUS;
135
136typedef enum{
137 DTMF_CONTINUOUS = 0,
138 DTMF_FIXPERIOD
139}DTMF_MODE;
140
141/*****************************************************************************
142 * STRUCTURE
143 * DTMF_HANDLE
144 *
145 * DESCRIPTION
146 * DTMF Generator handler
147 *
148 *
149********************************************************************************
150* DECLARATION OF PROTOTYPES
151********************************************************************************
152*/
153
154/*****************************************************************************
155 * FUNCTION
156 * DTMF_GetBufferSize
157 *
158 * DESCRIPTION
159 * This function gets the buffers size for DTMF Generator.
160 *
161 * PARAMETERS
162 * InterBufSize Internal buffer size
163 * PcmBufSize Output PCM buffer size
164 *
165 * RETURNS
166 * DTMF_Status
167 *****************************************************************************
168 */
169DTMF_STATUS DTMF_GetBufferSize( unsigned int *InterBufSize,
170 unsigned int *PcmBufSize,
171 DTMF_SR samplerate,
172 DTMF_CHANNEL channel
173 );
174
175/*****************************************************************************
176 * FUNCTION
177 * DTMF_Init
178 *
179 * DESCRIPTION
180 * This function initializes DTMF Generator.
181 *
182 * PARAMETERS
183 * InterBuf Internal buffer
184 * channel Output channels, DTMF_MONO --> mono, DTMF_STEREO --> stereo
185 *
186 * RETURNS
187 * DTMF_Status
188 *****************************************************************************
189 */
190void* DTMF_Init( void *InterBuf,
191 DTMF_MODE mode,
192 DTMF_SR samplerate,
193 DTMF_CHANNEL channel
194 );
195
196/*****************************************************************************
197 * FUNCTION
198 * DTMF_Gen
199 *
200 * DESCRIPTION
201 * This function generates PCM data of DTMF tones.
202 *
203 * PARAMETERS
204 * PcmBuf Output PCM buffer
205 *
206 * RETURNS
207 * DTMF_Status
208 *****************************************************************************
209 */
210DTMF_STATUS DTMF_Gen( void *hdl,
211 void *PcmBuf
212 );
213
214/*****************************************************************************
215 * FUNCTION
216 * DTMF_Tone
217 *
218 * DESCRIPTION
219 * This function is used to turn on/off DTMF tones
220 *
221 * PARAMETERS
222 * key Specify a key
223 * dtmfswitch 1 --> press the key, 0 --> release the key
224 *
225 * RETURNS
226 * DTMF_Status
227 *****************************************************************************
228 */
229DTMF_STATUS DTMF_Tone( void *hdl,
230 DTMF_KEY key,
231 int dtmfswitch
232 );
233
234/*****************************************************************************
235 * FUNCTION
236 * DTMF_SetDuration
237 *
238 * DESCRIPTION
239 * This function specifies the DTMF duration of each tone on FIXDURATION mode.
240 *
241 * PARAMETERS
242 * duration To specify the frame counts
243 *
244 * RETURNS
245 * DTMF_Status
246 *****************************************************************************
247 */
248DTMF_STATUS DTMF_SetDuration( void *hdl,
249 unsigned int duration
250 );
251
252/*****************************************************************************
253 * FUNCTION
254 * DTMF_GetKey
255 *
256 * DESCRIPTION
257 * This function is used to get the frequency of specified key.
258 *
259 * PARAMETERS
260 * key Specify a key
261 * freq1 Frequency of the first tone
262 * freq2 Frequency of the second tone
263 *
264 * RETURNS
265 * DTMF_Status
266 *****************************************************************************
267 */
268DTMF_STATUS DTMF_GetKey( void *hdl,
269 DTMF_KEY key,
270 int *freq1,
271 int *freq2
272 );
273
274/*****************************************************************************
275 * FUNCTION
276 * DTMF_SetKey
277 *
278 * DESCRIPTION
279 * This function is used to define the frequency of DTMF tone.
280 *
281 * PARAMETERS
282 * key Specify a key
283 * freq1 Frequency of the first tone
284 * freq2 Frequency of the second tone
285 *
286 * RETURNS
287 * DTMF_Status
288 *****************************************************************************
289 */
290DTMF_STATUS DTMF_SetKey( void *hdl,
291 DTMF_KEY key,
292 int freq1,
293 int freq2
294 );
295
296/*****************************************************************************
297 * FUNCTION
298 * DTMF_SetGain
299 *
300 * DESCRIPTION
301 * This function is used to set the digital gain of each DTMF tone.
302 *
303 * PARAMETERS
304 * gain Digital gain, ranges from 0~0x3FFF
305 *
306 * RETURNS
307 * DTMF_Status
308 *****************************************************************************
309 */
310DTMF_STATUS DTMF_SetGain( void *hdl,
311 int gain
312 );
313
314#endif