blob: 3b97e99e95c297f8a853b03ffb80c0b9e51cd3ef [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001
2#include "kal_public_api.h"
3#include "kal_general_types.h"
4
5#include "kal_trace.h"
6#include "l1sp_trc.h"
7
8#include "l1audio.h"
9#include "drv_sap.h"
10#include "speech_def.h"
11#include "bgSnd.h"
12//#include "afe_def.h" // for output device setting
13//#include "sp_drv.h"
14
15
16
17#include "audio_msgid.h"
18#include "sp_drv.h"
19
20#define MIN(a, b) ((a) < (b) ? (a) : (b))
21
22typedef struct{
23 uint32 id;
24 bool is_used;
25}VOLTE_TONE_T;
26VOLTE_TONE_T volte_tone;
27
28extern kal_spinlockid MCUTONESpinLockID;
29
30extern void DTMF_MCU_DataRequestCallback();
31extern void DTMF_MCU_GetReadBuffer(kal_int16 **pBuf_16b, kal_uint32 *uDataWord);
32extern kal_bool DTMF_MCU_IsPlaying();
33extern void DTMF_MCU_ReadDataDone(kal_uint32 uDataWord);
34extern void EXT_BGSND_Hisr(BGSND_PROCESS_TYPE type);
35
36
37
38uint32 VolteToneGetID()
39{
40 return(volte_tone.id);
41}
42
43void VolteToneSetID(uint32 u32val)
44{
45 volte_tone.id = u32val;
46}
47
48bool VolteToneGetUsed()
49{
50 return(volte_tone.is_used);
51}
52
53void VolteToneSetUsed(bool bval)
54{
55 volte_tone.is_used = bval;
56}
57
58void SP4G_PSR_Tone_init()
59{
60
61}
62//tone
63void SP4G_PSR_DL_Tone_Play(const L1SP_Tones *pToneList)
64{
65 ilm_PSR_DL_TONE_t *local_para;
66
67 MD_TRC_SP4G_PSR_DL_TONE_PLAY_ENTER();
68
69 //TONE_Play(pToneList, DSP_TONE);
70 local_para = (ilm_PSR_DL_TONE_t *) construct_local_para( sizeof(ilm_PSR_DL_TONE_t), TD_CTRL/*TD_RESET*/ );
71 local_para->pToneList = (L1SP_Tones *)pToneList;
72 msg_send6(MOD_LTECSR, MOD_MED, AUDIO_SAP, MSG_ID_AUDIO_M2M_VOLTE_DL_TONE_PLAY, (local_para_struct *)local_para, NULL);
73
74 MD_TRC_SP4G_PSR_DL_TONE_PLAY_LEAVE();
75}
76
77void SP4G_PSR_DL_Tone_Stop( void )
78{
79 MD_TRC_SP4G_PSR_DL_TONE_STOP_ENTER();
80 //TONE_Stop(DSP_TONE);
81 msg_send6(MOD_LTECSR, MOD_MED, AUDIO_SAP, MSG_ID_AUDIO_M2M_VOLTE_DL_TONE_STOP, NULL, NULL);
82 MD_TRC_SP4G_PSR_DL_TONE_STOP_LEAVE();
83}
84
85
86#if 0
87/* under construction !*/
88/* under construction !*/
89/* under construction !*/
90/* under construction !*/
91/* under construction !*/
92/* under construction !*/
93/* under construction !*/
94/* under construction !*/
95/* under construction !*/
96/* under construction !*/
97/* under construction !*/
98/* under construction !*/
99/* under construction !*/
100/* under construction !*/
101/* under construction !*/
102/* under construction !*/
103#endif
104
105
106#if 0
107/* under construction !*/
108/* under construction !*/
109/* under construction !*/
110/* under construction !*/
111/* under construction !*/
112/* under construction !*/
113/* under construction !*/
114#endif
115
116
117void volte_Tone_bgSnd_closeHandler(void);//BGSND HISR to MED ToDO
118void volte_BGSND_ULHdr(void);
119//TONE
120void SP4G_PSR_UL_Tone_Play(const L1SP_Tones *pToneList )
121{
122 ilm_PSR_DL_TONE_t *local_para;
123
124 MD_TRC_SP4G_PSR_UL_TONE_PLAY_ENTER();
125 /*if( !volte_tone.is_used ){
126 TONE_Play(pToneList, MCU_TONE);
127 volte_tone.id = EXT_BGSND_Start(volte_Tone_bgSnd_closeHandler, NULL, volte_BGSND_ULHdr, 7, 7);
128 volte_tone.is_used = true;
129 }else{
130 MD_TRC_SP4G_PSR_UL_TONE_PLAY_SKIP();
131 }*/
132 local_para = (ilm_PSR_DL_TONE_t *) construct_local_para( sizeof(ilm_PSR_DL_TONE_t), TD_CTRL/*TD_RESET*/ );
133 local_para->pToneList = (L1SP_Tones *)pToneList;
134 msg_send6(MOD_LTECSR, MOD_MED, AUDIO_SAP, MSG_ID_AUDIO_M2M_VOLTE_UL_TONE_PLAY, (local_para_struct *)local_para, NULL);
135
136 MD_TRC_SP4G_PSR_UL_TONE_PLAY_LEAVE();
137}
138
139void SP4G_PSR_UL_Tone_Stop( void )
140{
141 MD_TRC_SP4G_PSR_UL_TONE_STOP_ENTER();
142 /*if( volte_tone.is_used ){
143 EXT_BGSND_Flush(volte_tone.id);
144 TONE_Stop(MCU_TONE);
145 }else{
146 MD_TRC_SP4G_PSR_UL_TONE_STOP_SKIP();
147 }*/
148 msg_send6(MOD_LTECSR, MOD_MED, AUDIO_SAP, MSG_ID_AUDIO_M2M_VOLTE_UL_TONE_STOP, NULL, NULL);
149 MD_TRC_SP4G_PSR_UL_TONE_STOP_LEAVE();
150}
151
152void volte_Tone_bgSnd_closeHandler(void)//BGSND HISR to MED ToDO
153{
154 MD_TRC_VOLTE_BGSND_CLOSEHANDLER_ENTER();
155 ASSERT( volte_tone.is_used );
156 msg_send4(MOD_L1SP, MOD_MED, AUDIO_SAP, MSG_ID_AUDIO_M2M_VOLTE_TONE_BGSND_CLOSE);
157 MD_TRC_VOLTE_BGSND_CLOSEHANDLER_LEAVE();
158}
159
160void volte_Tone_BgSndClose(void)//trigger by MED
161{
162 MD_TRC_VOLTE_BGSNDCLOSE_LEAVE();
163 ASSERT( volte_tone.is_used );
164 EXT_BGSND_Close(volte_tone.id);
165 volte_tone.is_used = false;
166 MD_TRC_VOLTE_BGSNDCLOSE_LEAVE();
167}
168
169//#############################################
170//KT
171void volte_KT_bgSnd_closeHandler(void);//BGSND HISR to MED ToDO
172
173
174#if 0
175/* under construction !*/
176/* under construction !*/
177/* under construction !*/
178/* under construction !*/
179/* under construction !*/
180/* under construction !*/
181/* under construction !*/
182/* under construction !*/
183/* under construction !*/
184/* under construction !*/
185/* under construction !*/
186/* under construction !*/
187/* under construction !*/
188/* under construction !*/
189/* under construction !*/
190/* under construction !*/
191/* under construction !*/
192/* under construction !*/
193/* under construction !*/
194/* under construction !*/
195/* under construction !*/
196#endif
197
198
199#if 0
200/* under construction !*/
201/* under construction !*/
202/* under construction !*/
203/* under construction !*/
204/* under construction !*/
205/* under construction !*/
206/* under construction !*/
207/* under construction !*/
208/* under construction !*/
209/* under construction !*/
210/* under construction !*/
211/* under construction !*/
212#endif
213
214#if 0
215/* under construction !*/
216/* under construction !*/
217/* under construction !*/
218/* under construction !*/
219/* under construction !*/
220/* under construction !*/
221/* under construction !*/
222/* under construction !*/
223/* under construction !*/
224/* under construction !*/
225/* under construction !*/
226/* under construction !*/
227/* under construction !*/
228/* under construction !*/
229/* under construction !*/
230/* under construction !*/
231/* under construction !*/
232/* under construction !*/
233/* under construction !*/
234/* under construction !*/
235/* under construction !*/
236/* under construction !*/
237/* under construction !*/
238/* under construction !*/
239/* under construction !*/
240/* under construction !*/
241/* under construction !*/
242/* under construction !*/
243/* under construction !*/
244/* under construction !*/
245/* under construction !*/
246/* under construction !*/
247/* under construction !*/
248/* under construction !*/
249/* under construction !*/
250/* under construction !*/
251/* under construction !*/
252/* under construction !*/
253/* under construction !*/
254/* under construction !*/
255/* under construction !*/
256/* under construction !*/
257/* under construction !*/
258/* under construction !*/
259/* under construction !*/
260/* under construction !*/
261/* under construction !*/
262/* under construction !*/
263/* under construction !*/
264/* under construction !*/
265/* under construction !*/
266/* under construction !*/
267/* under construction !*/
268/* under construction !*/
269/* under construction !*/
270/* under construction !*/
271/* under construction !*/
272/* under construction !*/
273/* under construction !*/
274/* under construction !*/
275/* under construction !*/
276/* under construction !*/
277/* under construction !*/
278/* under construction !*/
279/* under construction !*/
280/* under construction !*/
281/* under construction !*/
282/* under construction !*/
283/* under construction !*/
284/* under construction !*/
285/* under construction !*/
286/* under construction !*/
287/* under construction !*/
288/* under construction !*/
289/* under construction !*/
290/* under construction !*/
291/* under construction !*/
292/* under construction !*/
293/* under construction !*/
294/* under construction !*/
295/* under construction !*/
296/* under construction !*/
297/* under construction !*/
298/* under construction !*/
299/* under construction !*/
300/* under construction !*/
301/* under construction !*/
302/* under construction !*/
303/* under construction !*/
304/* under construction !*/
305/* under construction !*/
306/* under construction !*/
307/* under construction !*/
308/* under construction !*/
309#endif