diff src/g23m-aci/aci/hl_audio_drv.c @ 597:f18b29e27be5

First attempt at MCSI voice path automatic switching The function is implemented at the ACI level in both aci2 and aci3, successfully avoids triggering the DSP bug on the first call, but the shutdown of MCSI upon call completion is not working properly yet in either version.
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 27 Mar 2019 22:18:35 +0000
parents 53929b40109c
children 717ed17d82c6
line wrap: on
line diff
--- a/src/g23m-aci/aci/hl_audio_drv.c	Mon Mar 18 17:56:04 2019 +0000
+++ b/src/g23m-aci/aci/hl_audio_drv.c	Wed Mar 27 22:18:35 2019 +0000
@@ -29,6 +29,9 @@
 #include "aci.h"
 #include "psa.h"
 #include "hl_audio_drv.h"
+#include "rv/rv_general.h"
+#include "audio/audio_api.h"
+#include "fc-target.cfg"
 
 #ifdef VOCODER_FUNC_INTERFACE
 #include "l4_tim.h"
@@ -43,6 +46,10 @@
 GLOBAL T_HL_VOCODER_ACTION currVocoderAction;
 #endif
 
+#ifdef CONFIG_TARGET_FCDEV3B
+GLOBAL UBYTE aci_digital_voice_autoswitch;
+#endif
+
 /* This flag helps enable the vocoder interface testing for
    specific tescases 
 */
@@ -101,6 +108,12 @@
 */
 GLOBAL void hl_drv_set_vocoder_state(BOOL user_attach)
 {
+#ifdef CONFIG_TARGET_FCDEV3B
+  T_AUDIO_VOICE_PATH_SETTING vpath;
+  T_AUDIO_FULL_ACCESS_WRITE audio_param;
+  T_RV_RETURN return_path = { NULL, 0 };
+#endif
+
   TRACE_FUNCTION("hl_drv_set_vocoder_state");
 
   #ifdef VOCODER_FUNC_INTERFACE
@@ -192,12 +205,30 @@
         enable_tch_vocoder(TRUE);
         vocoder_mute_dl (FALSE);      /* un-mute speaker    */
         vocoder_mute_ul (FALSE);      /* un-mute microphone */
+      #ifdef CONFIG_TARGET_FCDEV3B
+        if (aci_digital_voice_autoswitch)
+        {
+          vpath = AUDIO_BLUETOOTH_HEADSET;
+          audio_param.variable_indentifier = AUDIO_PATH_USED;
+          audio_param.data = &vpath;
+          audio_full_access_write(&audio_param, return_path);
+        }
+      #endif
       }
       else
       {
         vocoder_mute_dl (TRUE);       /* mute speaker    */
         vocoder_mute_ul (TRUE);       /* mute microphone */
         enable_tch_vocoder (FALSE);   /* disable vocoder */
+      #ifdef CONFIG_TARGET_FCDEV3B
+        if (aci_digital_voice_autoswitch)
+        {
+          vpath = AUDIO_GSM_VOICE_PATH;
+          audio_param.variable_indentifier = AUDIO_PATH_USED;
+          audio_param.data = &vpath;
+          audio_full_access_write(&audio_param, return_path);
+        }
+      #endif
       }
     #endif /* _SIMULATION_ */
     #endif /* VOCODER_FUNC_INTERFACE */