comparison src/cs/services/audio/audio_mode.c @ 0:92470e5d0b9e

src: partial import from FC Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 01:28:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92470e5d0b9e
1 /****************************************************************************/
2 /* */
3 /* File Name: audio_mode.c */
4 /* */
5 /* Purpose: This file contains all the functions used for audio mode misc */
6 /* services. */
7 /* */
8 /* Version 0.1 */
9 /* */
10 /* Date Modification */
11 /* ------------------------------------------------------------------------*/
12 /* 14 Jan 2002 Create */
13 /* */
14 /* Author Francois Mazard */
15 /* */
16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
17 /****************************************************************************/
18
19 #include "rv/rv_defined_swe.h"
20
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 "l1_confg.h"
29 #include "rv/rv_general.h"
30 #include "rvm/rvm_gen.h"
31 #include "audio/audio_ffs_i.h"
32 #include "audio/audio_api.h"
33 #include "audio/audio_structs_i.h"
34 #include "audio/audio_error_hdlr_i.h"
35 #include "audio/audio_var_i.h"
36 #include "audio/audio_messages_i.h"
37 #include "audio/audio_macro_i.h"
38 #include "rvf/rvf_target.h"
39 #include "audio/audio_const_i.h"
40
41 /* include the usefull L1 header */
42 #ifdef _WINDOWS
43 #define BOOL_FLAG
44 //#define CHAR_FLAG
45 #endif
46 #include "l1_types.h"
47 #include "l1audio_const.h"
48 #include "l1audio_cust.h"
49 #include "l1audio_defty.h"
50 #include "l1audio_msgty.h"
51 #include "l1audio_signa.h"
52 #if TESTMODE
53 #include "l1tm_defty.h"
54 #endif
55 #if (L1_GTT == 1)
56 #include "l1gtt_const.h"
57 #include "l1gtt_defty.h"
58 #endif
59 #include "l1_const.h"
60 #include "l1_defty.h"
61 #include "l1_msgty.h"
62 #include "l1_signa.h"
63 #ifdef _WINDOWS
64 #define L1_ASYNC_C
65 #endif
66 #include "l1_varex.h"
67
68 /* external functions */
69 extern void audio_mode_full_access_write_send_status (T_AUDIO_RET status, T_RV_RETURN return_path);
70 extern void audio_mode_load_send_status (T_AUDIO_RET status, T_RV_RETURN return_path);
71 extern void audio_mode_save_send_status (T_AUDIO_RET status, T_RV_RETURN return_path);
72 extern void audio_mode_speaker_volume_send_status (T_AUDIO_RET status, T_RV_RETURN return_path);
73
74 /********************************************************************************/
75 /* */
76 /* Function Name: audio_mode_message_switch */
77 /* */
78 /* Purpose: This function manages the dispatching of the message usefull */
79 /* for audio mode services. */
80 /* */
81 /* Input Parameters: */
82 /* Audio message. */
83 /* */
84 /* Output Parameters: */
85 /* ID of the message receptor. */
86 /* */
87 /* Note: */
88 /* None. */
89 /* */
90 /* Revision History: */
91 /* None. */
92 /* */
93 /********************************************************************************/
94 UINT8 audio_mode_message_switch(T_RV_HDR *p_message)
95 {
96 switch(p_message->msg_id)
97 {
98 case AUDIO_MODE_LOAD_REQ :
99 {
100 if ( (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE) ||
101 (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE) )
102 {
103 AUDIO_SEND_TRACE("AUDIO MODE LOAD: an entity already uses this service", RV_TRACE_LEVEL_ERROR);
104 audio_mode_load_send_status (AUDIO_ERROR, ((T_AUDIO_MODE_LOAD_REQ *)p_message)->return_path);
105 p_audio_gbl_var->message_processed = TRUE;
106 return (AUDIO_MODE_NONE);
107 }
108 return(AUDIO_MODE_LOAD);
109 break;
110 }
111 case AUDIO_MODE_SAVE_REQ :
112 {
113 if ( (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE) ||
114 (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE) )
115 {
116 AUDIO_SEND_TRACE("AUDIO MODE SAVE: an entity currently changes the audio mode", RV_TRACE_LEVEL_ERROR);
117 audio_mode_save_send_status (AUDIO_ERROR, ((T_AUDIO_MODE_SAVE_REQ *)p_message)->return_path);
118 p_audio_gbl_var->message_processed = TRUE;
119 return (AUDIO_MODE_NONE);
120 }
121 return(AUDIO_MODE_SAVE);
122 break;
123 }
124 case AUDIO_MODE_WRITE_REQ :
125 {
126 if ( (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE) ||
127 (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE) )
128 {
129 AUDIO_SEND_TRACE("AUDIO MODE FULL ACCESS WRITE: an entity currently changes the audio mode", RV_TRACE_LEVEL_ERROR);
130 audio_mode_full_access_write_send_status (AUDIO_ERROR,
131 ((T_AUDIO_MODE_FULL_ACCESS_WRITE_REQ *)p_message)->return_path);
132 p_audio_gbl_var->message_processed = TRUE;
133 return (AUDIO_MODE_NONE);
134 }
135 return(AUDIO_FULL_ACCESS_WRITE);
136 break;
137 }
138 case OML1_START_DAI_TEST_CON :
139 case OML1_STOP_DAI_TEST_CON :
140 #if (AUDIO_MODE)
141 case MMI_AUDIO_MODE_CON :
142 #endif
143 #if (FIR)
144 case MMI_AUDIO_FIR_CON :
145 #endif
146 case MMI_AEC_CON :
147 {
148 if (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE)
149 {
150 return(AUDIO_MODE_LOAD);
151 }
152 else
153 if (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE)
154 {
155 return(AUDIO_FULL_ACCESS_WRITE);
156 }
157 break;
158 }
159 case AUDIO_SPEAKER_VOLUME_REQ:
160 {
161 if ( (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE) ||
162 (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE) )
163 {
164 AUDIO_SEND_TRACE("AUDIO MODE SPEAKER VOLUME: an entity currently changes the audio mode", RV_TRACE_LEVEL_ERROR);
165 audio_mode_speaker_volume_send_status (AUDIO_ERROR,
166 ((T_AUDIO_SPEAKER_VOLUME_REQ *)p_message)->return_path);
167 p_audio_gbl_var->message_processed = TRUE;
168 return (AUDIO_MODE_NONE);
169 }
170 return(AUDIO_SPEAKER_VOLUME);
171 break;
172 }
173 }
174 return (AUDIO_MODE_NONE);
175 }
176 #endif /*RVM_AUDIO_MAIN_SWE*/