comparison src/cs/services/audio/audio_vm_amr.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /****************************************************************************/
2 /* */
3 /* File Name: audio_vm_amr.c */
4 /* */
5 /* Purpose: This file contains all the functions used to manage the */
6 /* Voice Memorization AMR. */
7 /* */
8 /* Version 0.1 */
9 /* */
10 /* Date Modification */
11 /* ------------------------------------ */
12 /* 2 November 2002 Create */
13 /* */
14 /* Author */
15 /* Frederic Turgis */
16 /* */
17 /* (C) Copyright 2002 by Texas Instruments Incorporated, All Rights Reserved*/
18 /****************************************************************************/
19
20 #include "rv/rv_defined_swe.h"
21 #ifdef RVM_AUDIO_MAIN_SWE
22 #ifndef _WINDOWS
23 #include "config/swconfig.cfg"
24 #include "config/sys.cfg"
25 #include "config/chipset.cfg"
26 #endif
27
28 /* include the usefull L1 header */
29 #include "l1_confg.h"
30
31 #if (L1_VOICE_MEMO_AMR)
32 #include "rv/rv_general.h"
33 #include "rvm/rvm_gen.h"
34 #include "audio/audio_features_i.h"
35 #include "audio/audio_ffs_i.h"
36 #include "audio/audio_api.h"
37 #include "audio/audio_structs_i.h"
38 #include "audio/audio_var_i.h"
39 #include "audio/audio_messages_i.h"
40 #include "rvf/rvf_target.h"
41 #include "audio/audio_const_i.h"
42 #include "audio/audio_error_hdlr_i.h"
43
44 /* include the usefull L1 header */
45 #define BOOL_FLAG
46 #define CHAR_FLAG
47 #include "l1_types.h"
48 #include "l1audio_cust.h"
49 #include "l1audio_msgty.h"
50 #include "l1audio_signa.h"
51
52 /********************************************************************************/
53 /* */
54 /* Function Name: audio_voice_memo_amr_message_switch */
55 /* */
56 /* Purpose: Manage the message supply between the voice memo play and the */
57 /* voice memo record AMR */
58 /* */
59 /* Input Parameters: */
60 /* start or stop message from the voice memo features */
61 /* */
62 /* Output Parameters: */
63 /* index of the manager */
64 /* */
65 /* Note: */
66 /* None. */
67 /* */
68 /* Revision History: */
69 /* None. */
70 /* */
71 /********************************************************************************/
72 #if (AUDIO_MEM_MANAGER)
73 UINT8 audio_voice_memo_amr_memory_message_switch (T_RV_HDR *p_message)
74 {
75 switch (p_message->msg_id)
76 {
77 #if(AUDIO_NEW_FFS_MANAGER)
78 case AUDIO_VM_AMR_RECORD_TO_FFS_START_REQ:
79 case AUDIO_VM_AMR_RECORD_TO_FFS_STOP_REQ:
80 {
81 return(AUDIO_VM_AMR_RECORD);
82 }
83 break;
84 #endif
85 #if(AUDIO_RAM_MANAGER)
86 case AUDIO_VM_AMR_RECORD_TO_RAM_START_REQ:
87 case AUDIO_VM_AMR_RECORD_TO_RAM_STOP_REQ:
88 {
89 return(AUDIO_VM_AMR_RECORD);
90 }
91 break;
92 #endif
93 #if (AUDIO_NEW_FFS_MANAGER)
94 case AUDIO_VM_AMR_PLAY_FROM_FFS_START_REQ:
95 case AUDIO_VM_AMR_PLAY_FROM_FFS_STOP_REQ:
96 {
97 return(AUDIO_VM_AMR_PLAY);
98 }
99 break;
100 #endif
101 #if (AUDIO_RAM_MANAGER)
102 case AUDIO_VM_AMR_PLAY_FROM_RAM_START_REQ:
103 case AUDIO_VM_AMR_PLAY_FROM_RAM_STOP_REQ:
104 {
105 return(AUDIO_VM_AMR_PLAY);
106 }
107 break;
108 #endif
109 #if (AUDIO_MEM_MANAGER)
110 /* check channel_id is the one given by driver initialization*/
111 case AUDIO_MEM_STATUS_MSG:
112 {
113 /* check VM AMR is active for the given channel_id */
114 if ((p_audio_gbl_var->audio_vm_amr_record.state != AUDIO_IDLE) &&
115 ( ((T_AUDIO_MEM_STATUS *)p_message)->channel_id == p_audio_gbl_var->audio_vm_amr_record.channel_id))
116 return(AUDIO_VM_AMR_RECORD);
117
118 if ((p_audio_gbl_var->audio_vm_amr_play.state != AUDIO_IDLE) &&
119 ( ((T_AUDIO_MEM_STATUS *)p_message)->channel_id == p_audio_gbl_var->audio_vm_amr_play.channel_id))
120 return(AUDIO_VM_AMR_PLAY);
121
122 return(AUDIO_VM_AMR_NONE);
123 }
124 break;
125 #endif
126 /* driver init => check session_id is VM AMR */
127 case AUDIO_DRIVER_INIT_STATUS_MSG:
128 {
129 UINT8 session_id = ((T_AUDIO_DRIVER_INIT_STATUS *)p_message)->session_id;
130
131 /* session_id is VM AMR */
132 if ( (session_id == AUDIO_VM_AMR_PLAY_SESSION_ID)&&
133 (p_audio_gbl_var->audio_vm_amr_play.state != AUDIO_IDLE))
134 {
135 return (AUDIO_VM_AMR_PLAY);
136 }
137
138 if ( (session_id == AUDIO_VM_AMR_RECORD_SESSION_ID)&&
139 (p_audio_gbl_var->audio_vm_amr_record.state != AUDIO_IDLE))
140 {
141 return (AUDIO_VM_AMR_RECORD);
142 }
143
144 return(AUDIO_VM_AMR_NONE);
145 }
146 break;
147
148 default:
149 return(AUDIO_VM_AMR_NONE);
150 break;
151 } /* switch */
152 }
153 #endif // #if (AUDIO_MEM_MANAGER)
154
155 #endif /* L1_VOICE_MEMO_AMR */
156 #endif /* RVM_AUDIO_MAIN_SWE */