blob: ef8094cf0011830da2e9a46914762d4bd553a35c [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) 2005
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 * pcm4way.h
41 *
42 * Project:
43 * --------
44 * MAUI
45 *
46 * Description:
47 * ------------
48 * PCM4WAY/PCM2WAY interface
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 *
62 * removed!
63 * removed!
64 * removed!
65 * removed!
66 *
67 * removed!
68 * removed!
69 * removed!
70 * removed!
71 *
72 * removed!
73 * removed!
74 * removed!
75 * removed!
76 *
77 * removed!
78 * removed!
79 * removed!
80 * removed!
81 *
82 * removed!
83 * removed!
84 * removed!
85 *
86 * removed!
87 * removed!
88 * removed!
89 *
90 * removed!
91 * removed!
92 * removed!
93 * removed!
94 *
95 * removed!
96 * removed!
97 * removed!
98 *
99 * removed!
100 * removed!
101 * removed!
102 *
103 * removed!
104 * removed!
105 * removed!
106 *
107 * removed!
108 * removed!
109 * removed!
110 *
111 * removed!
112 * removed!
113 * removed!
114 *
115 * removed!
116 * removed!
117 * removed!
118 * removed!
119 * removed!
120 * removed!
121 * removed!
122 * removed!
123 * removed!
124 * removed!
125 * removed!
126 *
127 * removed!
128 * removed!
129 * removed!
130 *
131 * removed!
132 * removed!
133 * removed!
134 *
135 * removed!
136 * removed!
137 * removed!
138 *
139 *------------------------------------------------------------------------------
140 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
141 *==============================================================================
142 *******************************************************************************/
143#ifndef __PCM4WAY_H
144#define __PCM4WAY_H
145#include "l1aud_common_def.h"
146
147
148// #define PNW_ENBLE (1<<8)
149#define DATA_SELECT_AFTER_ENH (1<<9)
150#define USE_D2M_PATH (1<<10)
151#define USE_M2D_PATH (1<<11)
152
153// #define PNW_DSP_IDLE (0)
154// #define PNW_DSP_ON (1)
155// #define PNW_DSP_READY (2)
156
157// #define PCM4WAY_STATE 0x1
158// #define PCM2WAY_STATE 0x2
159
160typedef enum{
161 PNW_STATE_IDLE = 0,
162 PNW_STATE_RUN,
163
164}PCMEX_STATE;
165
166typedef enum {
167 PCMEX_BAND_UNSET = 0,
168 PCMEX_BAND_NB,
169 PCMEX_BAND_WB,
170 PCMEX_BAND_SWB,
171 PCMEX_BAND_FB,
172 PCMEX_BAND_DYNAMIC, // follow codec, only for delication mode
173}PCMEX_BAND;
174
175typedef enum {
176 PCMEX_IDLE_ENH_SETTING_NONE = 0,
177 PCMEX_IDLE_ENH_SETTING_WITH,
178 PCMEX_IDLE_ENH_SETTING_WITHOUT,
179#if 0
180/* under construction !*/
181/* under construction !*/
182#endif
183}PCMEX_IDLE_ENH_SETTING;
184
185
186typedef struct{
187 uint16 aud_id; // to lock sleep mode
188 bool isEnhOn;
189 kal_uint32 running;
190 kal_spinlockid PCMEXspinLockID;
191
192 PCMEX_STATE state; // on/off
193 kal_uint32 am_type;
194 // kal_uint32 app_type;
195
196 PCMEX_BAND bandInfo; //to record the band information,
197
198 kal_uint32 cfgUL1;
199 kal_uint32 cfgUL2;
200 kal_uint32 cfgUL3;
201 kal_uint32 cfgUL4;
202 kal_uint32 cfgDL;
203
204 // kal_int16 dspPcmExMicLen; // unit is 16-bit (sampel), -1 means useless
205 // kal_int16 dspPcmExSpkLen; // unit is 16-bit (sampel), 0xFFFFFFFF means useless
206
207 void (*pnw_dl_hdlr)(void);
208 void (*pnw_ul_hdlr)(void);
209}_PCMEX_T;
210
211
212typedef enum{
213 PNW_APP_TYPE_IDLE = 0,
214 PNW_APP_TYPE_UNDER_CALL,
215}PCMEX_APP_TYPE;
216
217
218typedef enum{
219 MCU_SET_P4W_OFF = 0,
220 MCU_SET_P4W_ON = 1,
221 DSP_SET_P4W_READY = 2
222}P4W_CTRL_STATUS;
223
224typedef enum{
225 MCU_SET_P2W_OFF = 0<<4,
226 MCU_SET_P2W_ON = 1<<4,
227 DSP_SET_P2W_READY = 2<<4
228}P2W_CTRL_STATUS;
229
230
231typedef enum {
232 P4W_APP_CTM = 0,
233 P4W_APP_TYPE_UNDER_CALL, //p2w acts as I/O to get/put pcm data under idle
234 P4W_APP_TYPE_WITHOUT_CALL,
235 P4W_APP_TYPE_WITHOUT_CALL_WB,
236 P4W_APP_ECALL_DETECT,
237
238 P4W_APP_TYPE_UNDEFINE = 0xFFFF
239}P4W_APP_TYPE;
240
241typedef enum {
242 P2W_APP_TYPE_UNDER_CALL = 0, //p2w acts as I/O to get/put pcm data under phone call
243 P2W_APP_TYPE_WITHOUT_CALL, //p2w acts as I/O to get/put pcm data when idle
244 P2W_APP_TYPE_VOIP, //VOIP, speech quality like phone call but not under calling
245 // P2W_APP_TYPE_REC_ONLY_CAL, //dmnr calibration, record only
246 // P2W_APP_TYPE_REC_PLAY_CAL //dmnr calibration, record and playback at the same time
247 P2W_APP_TYPE_UNDEFINE = 0xFFFF
248}P2W_App_Type;
249
250
251void PCM4WAY_Start(void (*pcm4way_hdlr)(void), uint32 type);
252void PCM4WAY_Stop(uint32 type);
253// void Extended_PCM4WAY_Start(void (*pcm4way_dl_hdlr)(void), void (*pcm4way_ul_hdlr)(void), uint32 type, uint32 cfgUL, uint32 cfgDL);
254// void Extended_PCM4WAY_Stop(uint32 type);
255
256uint16 PCM4WAY_GetFromMic(uint16 *ul_buf);
257uint16 PCM4WAY_GetFromMic2(uint16 *ul_buf);
258uint16 PCM4WAY_PutToSE(const uint16 *ul_data);
259uint16 PCM4WAY_PutToSE2(const uint16 *ul_data);
260uint16 PCM4WAY_FillSE(uint16 value);
261uint16 PCM4WAY_FillSE2(uint16 value);
262
263uint16 PCM4WAY_GetFromSD(uint16 *dl_buf);
264uint16 PCM4WAY_PutToSpk(const uint16 *dl_data);
265uint16 PCM4WAY_FillSpk(uint16 value);
266
267void PCM2WAY_Start(void (*pcm2way_hdlr)(void), uint32 type);
268void PCM2WAY_Stop(uint32 type);
269// void Extended_PCM2WAY_Start(void (*pcm2way_dl_hdlr)(void), void (*pcm2way_ul_hdlr)(void), uint32 type, uint32 cfgUL, uint32 cfgDL);
270// void Extended_PCM2WAY_Stop(uint32 type);
271
272uint16 PCM2WAY_GetFromMic(uint16 *ul_buf);
273uint16 PCM2WAY_PutToSpk(const uint16 *dl_data);
274uint16 PCM2WAY_FillSpk(uint16 value);
275
276void Idle_PcmEx_Start(void (*pcmNway_dl_hdlr)(void), void (*pcmNway_ul_hdlr)(void), uint32 cfgUL1, uint32 cfgUL2, uint32 cfgUL3, uint32 cfgUL4, uint32 cfgDL, PCMEX_BAND band, PCMEX_IDLE_ENH_SETTING enhSetting);
277void Del_PcmEx_Start(void (*pcmNway_dl_hdlr)(void), void (*pcmNway_ul_hdlr)(void), uint32 cfgUL1, uint32 cfgUL2, uint32 cfgUL3, uint32 cfgUL4, uint32 cfgDL);
278void PcmEx_Stop(void);
279void pcmEx_Init();
280bool pcmEx_isRunInIdleMode(void);
281#endif