changeset 267:8d577190e377

l1audio_sync.c: passes compilation
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 Mar 2017 04:48:37 +0000
parents 35e8e0637eba
children 67b777cee725
files chipsetsw/layer1/audio_cfile/l1audio_sync.c
diffstat 1 files changed, 55 insertions(+), 190 deletions(-) [+]
line wrap: on
line diff
--- a/chipsetsw/layer1/audio_cfile/l1audio_sync.c	Mon Mar 13 04:10:04 2017 +0000
+++ b/chipsetsw/layer1/audio_cfile/l1audio_sync.c	Mon Mar 13 04:48:37 2017 +0000
@@ -159,12 +159,14 @@
 
   #include "l1audio_macro.h"
   #include "l1_trace.h"
- #if (CODE_VERSION != SIMULATION)
+
+#if (CHIPSET == 15) && (CODE_VERSION != SIMULATION)
   #include "bspTwl3029.h"
   #include "bspTwl3029_I2c.h"
   #include "bspTwl3029_Aud_Map.h"
   #include "bspTwl3029_Int_Map.h"
 #endif
+
   /**************************************/
   /* Prototypes for L1 SYNCH manager    */
   /**************************************/
@@ -202,10 +204,10 @@
     void l1s_sr_processing_manager(void);
     void l1s_sr_speech_manager    (void);
   #endif
-  #if (L1_AEC == 1)
+  #if (AEC == 1)
     void l1s_aec_manager          (void);
   #endif
-  #if (L1_AEC == 2)
+  #if (AEC == 2)
     void l1s_aec_manager          (void);
   #endif
   #if (FIR)
@@ -500,7 +502,7 @@
         l1_audio_it_com = TRUE;
       }
     #endif
-    #if (L1_AEC == 1)
+    #if (AEC == 1)
       // the AEC is activated?
       if ((l1a_l1s_com.aec_task.command.start) ||
           (l1s.audio_state[L1S_AEC_STATE] != 0))
@@ -511,19 +513,18 @@
         // already requested by the modem
       }
     #endif
-    #if (L1_AEC == 2)
+    #if (AEC == 2)
       // the AEC is activated?
       if ((l1a_l1s_com.aec_task.command.start) ||
           (l1s.audio_state[L1S_AEC_STATE] != 0))
       {
         l1s_aec_manager();
-		l1_audio_it_com = TRUE;
+	l1_audio_it_com = TRUE;
       }
     #endif
     #if (FIR)
       // the FIR is activated?
-if ((l1a_l1s_com.fir_task.command.start) ||
-          (l1s.audio_state[L1S_FIR_STATE] !=0 ))
+      if (l1a_l1s_com.fir_task.command.start)
       {
         l1s_fir_manager();
         l1_audio_it_com = TRUE;
@@ -762,12 +763,14 @@
       }
     #endif
 
+#if 0	/* FreeCalypso: LoCosto-ism not present in TCS211 */
     // the audio It task is activated?
     if (l1a_l1s_com.audioIt_task.command.start)
     {
       l1s_audio_it_manager();
       l1_audio_it_com = TRUE;
     }
+#endif
 
     #if (L1_MIDI == 1)
       if ((l1a_l1s_com.midi_task.command.start) ||
@@ -778,9 +781,11 @@
       }
     #endif  // L1_MIDI
 
+#if 0	/* FreeCalypso: LoCosto-ism not present in TCS211 */
     // The audio IT shall be foprwarded to the DSP in case the L1S is forcing the audio
     if (l1a_l1s_com.audio_forced_by_l1s == TRUE)
       l1_audio_it_com = TRUE;
+#endif
 
     l1s.l1_audio_it_com = l1_audio_it_com;
   }
@@ -3500,30 +3505,6 @@
           else
           // The DSP needs a new block ?
           {
-         if (l1a_l1s_com.voicememo_amr_task.play.command.pause)
-          {
-            // Stop the DSP voice memorization playing task
-            *(l1s.voicememo_amr.play.a_du_x) =*(l1s.voicememo_amr.play.a_du_x) | B_BLOCK_READY;
-           l1_vm_amr_in_pause= TRUE;
-             conf_msg = os_alloc_sig(0);
-            DEBUGMSG(status,NU_ALLOC_ERR)
-            conf_msg->SignalCode = L1_VM_AMR_PAUSE_CON;
-           // Send confirmation message...
-            os_send_sig(conf_msg, L1C1_QUEUE);
-            DEBUGMSG(status,NU_SEND_QUEUE_ERR)
-           //  *state =WAIT_DSP_REQUEST;
-
-          }
-           if (l1a_l1s_com.voicememo_amr_task.play.command.resume)
-           {
-              conf_msg = os_alloc_sig(0);
-              DEBUGMSG(status,NU_ALLOC_ERR)
-              conf_msg->SignalCode = L1_VM_AMR_RESUME_CON;
-            // Send confirmation message...
-              os_send_sig(conf_msg, L1C1_QUEUE);
-              DEBUGMSG(status,NU_SEND_QUEUE_ERR)
-
-          }
             // Determine which a_du buffer is currently used
             l1s.voicememo_amr.play.a_du_x = l1s_dsp_com.dsp_ndb_ptr->a_du_1;
             if (l1a_l1s_com.dedic_set.aset != NULL)
@@ -4828,7 +4809,7 @@
     }
 
   #endif  // SPEECH_RECO
-  #if (L1_AEC == 1)
+  #if (AEC == 1)
     /*-------------------------------------------------------*/
     /* l1s_aec_manager()                                     */
     /*-------------------------------------------------------*/
@@ -5028,7 +5009,7 @@
     }
   #endif // AEC
 
-  #if(L1_AEC == 2)
+  #if(AEC == 2)
 
   /*-------------------------------------------------------*/
   /* l1s_aec_manager()                                     */
@@ -5193,105 +5174,7 @@
     void l1s_fir_manager(void)
     {
 
-	  enum states
-	  {
-		  IDLE,
-		  WAIT_AUDIO_ON,
-		  FIR_LOOP_ON
-	  };
-
-      UWORD8            *state      = &l1s.audio_state[L1S_FIR_STATE];
       xSignalHeaderRec  *conf_msg;
-
-
-
-      switch (*state)
-      {
-         case IDLE:
-         {
-			 if (l1a_l1s_com.fir_task.parameters.fir_loop == 0)
-			 {
-                l1s_fir_set_params();
-				// Send the FIR confirmation message
-      			// Allocate confirmation message...
-      			conf_msg = os_alloc_sig(0);
-      			DEBUGMSG(status,NU_ALLOC_ERR)
-      			conf_msg->SignalCode = L1_AUDIO_FIR_CON;
-      			// Send confirmation message...
-      			os_send_sig(conf_msg, L1C1_QUEUE);
-      			DEBUGMSG(status,NU_SEND_QUEUE_ERR)
-      			// Reset the start command
-      			l1a_l1s_com.fir_task.command.start = FALSE;
-		     }
-             else  {
-				//enable UL and DL
-				l1s.audio_on_off_ctl.l1_audio_switch_on_ul_request++;
-		        l1s.audio_on_off_ctl.l1_audio_switch_on_dl_request++;
-                *state = WAIT_AUDIO_ON;
-			 }
-	     }
-	     break;
-
-	     case WAIT_AUDIO_ON:
-	     {
-			  if((l1s.audio_state[L1S_AUDIO_DL_ONOFF_STATE] == L1_AUDIO_DL_ON) &&
-			      (l1s.audio_state[L1S_AUDIO_UL_ONOFF_STATE] == L1_AUDIO_UL_ON))
-			  {
-                 l1s_fir_set_params();
-				// Send the FIR confirmation message
-      			// Allocate confirmation message...
-      			conf_msg = os_alloc_sig(0);
-      			DEBUGMSG(status,NU_ALLOC_ERR)
-      			conf_msg->SignalCode = L1_AUDIO_FIR_CON;
-      			// Send confirmation message...
-      			os_send_sig(conf_msg, L1C1_QUEUE);
-      			DEBUGMSG(status,NU_SEND_QUEUE_ERR)
-      			// Reset the start command
-      			l1a_l1s_com.fir_task.command.start = FALSE;
-                //set the Loop on the DSP side
-        l1s_dsp_com.dsp_ndb_ptr->d_audio_init |= B_FIR_LOOP;
-                *state = FIR_LOOP_ON;
-			  }
-
-		 }
-		 break;
-
-		 case FIR_LOOP_ON:
-		 {
-			 if (l1a_l1s_com.fir_task.command.start == TRUE)
-			 {
-			    if (l1a_l1s_com.fir_task.parameters.fir_loop == 0)
-			    {
-			       //disable UL and DL
-		           l1s.audio_on_off_ctl.l1_audio_switch_on_ul_request--;
-		           l1s.audio_on_off_ctl.l1_audio_switch_on_dl_request--;
-
-        l1s_dsp_com.dsp_ndb_ptr->d_audio_init &= ~(B_FIR_LOOP);
-		           *state = IDLE;
-			    }
-
-				// Reset the start command
-      			l1a_l1s_com.fir_task.command.start = FALSE;
-      			//download parameters
-      			l1s_fir_set_params();
-      			// Send the FIR confirmation message
-				// Allocate confirmation message...
-				conf_msg = os_alloc_sig(0);
-				DEBUGMSG(status,NU_ALLOC_ERR)
-				conf_msg->SignalCode = L1_AUDIO_FIR_CON;
-				// Send confirmation message...
-				os_send_sig(conf_msg, L1C1_QUEUE);
-      			DEBUGMSG(status,NU_SEND_QUEUE_ERR)
-			 }
-		 }
-		 break;
-      } // end switch
-
-    }
-
-    void l1s_fir_set_params(void)
-    {
-
       UWORD8            i;
 
       // Update the DL FIR?
@@ -5300,73 +5183,54 @@
         // Download the DL FIR coefficients to the melody a_fir31_downlink
         for (i=0; i<MAX_FIR_COEF; i++)
         {
-          #if ((DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)) // For this DSP code the FIR coefficients are in API param memory
-            l1s_dsp_com.dsp_param_ptr->a_fir31_downlink[i] = *l1a_l1s_com.fir_task.parameters.fir_dl_coefficient;
+          #if (DSP >= 33) // For this DSP code the FIR coefficients are in API param memory
+            l1s_dsp_com.dsp_param_ptr->a_fir31_downlink[i] = *l1a_l1s_com.fir_task.parameters.fir_dl_coefficient++;
           #else
-            l1s_dsp_com.dsp_ndb_ptr->a_fir31_downlink[i] = *l1a_l1s_com.fir_task.parameters.fir_dl_coefficient;
+            l1s_dsp_com.dsp_ndb_ptr->a_fir31_downlink[i] = *l1a_l1s_com.fir_task.parameters.fir_dl_coefficient++;
           #endif
-          l1a_l1s_com.fir_task.parameters.fir_dl_coefficient++;
         }
       }
-
       // Update the UL FIR?
       if (l1a_l1s_com.fir_task.parameters.update_fir & UL_FIR)
       {
-        if ((l1s_dsp_com.dsp_ndb_ptr->d_audio_status & B_FIR_LOOP) == 1) // loop mode --> do not invert coef
-        {
-          // Download the UL FIR coefficients to the melody a_fir31_uplink
-          for (i=0; i<MAX_FIR_COEF; i++)
-          {
-            #if (DSP == 33) || (DSP == 34) || (DSP == 35) // For this DSP code the FIR coefficients are in API param memory
-              l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[i] = *l1a_l1s_com.fir_task.parameters.fir_ul_coefficient;
-            #elif ((DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39))  // CQ #28839
-              l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[MAX_FIR_COEF-i-1] = *l1a_l1s_com.fir_task.parameters.fir_ul_coefficient;
-            #else
-              l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[i]   = *l1a_l1s_com.fir_task.parameters.fir_ul_coefficient;
-            #endif
-            l1a_l1s_com.fir_task.parameters.fir_ul_coefficient++;
-          }
-        }
-        else // normal mode --> invert coeff
-        {
-          // Download the UL FIR coefficients to the melody a_fir31_uplink
-          for (i=0; i<MAX_FIR_COEF; i++)
-          {
-            // In UL, coefs are inversed
-            #if ((DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36)  || (DSP == 37) || (DSP == 38) || (DSP == 39))// For this DSP code the FIR coefficients are in API param memory
-              l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[MAX_FIR_COEF-i-1] = *l1a_l1s_com.fir_task.parameters.fir_ul_coefficient;
-            #else
-              l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[MAX_FIR_COEF-i-1]   = *l1a_l1s_com.fir_task.parameters.fir_ul_coefficient;
-            #endif
-            l1a_l1s_com.fir_task.parameters.fir_ul_coefficient++;
-          }
+        // Download the UL FIR coefficients to the melody a_fir31_uplink
+        for (i=0; i<MAX_FIR_COEF; i++)
+        {
+          #if (DSP >= 33) // For this DSP code the FIR coefficients are in API param memory
+            l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[i] = *l1a_l1s_com.fir_task.parameters.fir_ul_coefficient++;
+          #else
+            l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[i] = *l1a_l1s_com.fir_task.parameters.fir_ul_coefficient++;
+          #endif
         }
       }
-      else // no UL update
-      {
-        if (((l1s_dsp_com.dsp_ndb_ptr->d_audio_status & B_FIR_LOOP) && (l1a_l1s_com.fir_task.parameters.fir_loop == FALSE))
-         || ((!(l1s_dsp_com.dsp_ndb_ptr->d_audio_status & B_FIR_LOOP)) && (l1a_l1s_com.fir_task.parameters.fir_loop == TRUE))) // changing mode
-        {
-          // we are changing mode, normal to loop or loop to normal
-          // so we have to invert the coefficients in the API
-          UWORD16 temp_coeff;
-
-          for (i=0; i<(MAX_FIR_COEF/2); i++)
-          {
-            #if ((DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)) // For this DSP code the FIR coefficients are in API param memory
-              temp_coeff = l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[i];
-              l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[i] = l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[MAX_FIR_COEF-i-1];
-              l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[MAX_FIR_COEF-i-1] = temp_coeff;
-            #else
-              temp_coeff = l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[i];
-              l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[i] = l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[MAX_FIR_COEF-i-1];
-              l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[MAX_FIR_COEF-i-1] = temp_coeff;
-            #endif
-          }
-        }
+
+      // Set the FIR loop back:
+      if (l1a_l1s_com.fir_task.parameters.fir_loop)
+      {
+        #if (DSP == 17) || (DSP == 32)
+	  l1s_dsp_com.dsp_ndb_ptr->d_audio_init &= ~(B_FIR_START);
+	#endif
+        l1s_dsp_com.dsp_ndb_ptr->d_audio_init |= B_FIR_LOOP;
       }
-
-
+      else
+      {
+        #if (DSP == 17) || (DSP == 32)
+	  l1s_dsp_com.dsp_ndb_ptr->d_audio_init |= B_FIR_START;
+	#endif
+        l1s_dsp_com.dsp_ndb_ptr->d_audio_init &= ~(B_FIR_LOOP);
+      }
+
+      // Send the FIR confirmation message
+      // Allocate confirmation message...
+      conf_msg = os_alloc_sig(0);
+      DEBUGMSG(status,NU_ALLOC_ERR)
+      conf_msg->SignalCode = L1_AUDIO_FIR_CON;
+      // Send confirmation message...
+      os_send_sig(conf_msg, L1C1_QUEUE);
+      DEBUGMSG(status,NU_SEND_QUEUE_ERR)
+
+      // Reset the start command
+      l1a_l1s_com.fir_task.command.start = FALSE;
     }
   #endif // FIR
   #if (AUDIO_MODE)
@@ -6202,6 +6066,7 @@
     }
   #endif // L1_CPORT == 1
 
+  #if 0	/* FreeCalypso: function not present in TCS211 */
     /*-------------------------------------------------------*/
     /*    l1s_audio_it_manager()                             */
     /*-------------------------------------------------------*/
@@ -6222,7 +6087,7 @@
       // audio IT to DSP in case another sw entity has changed
       // something in the API
     }
-
+  #endif
 
   #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1)
     /*-------------------------------------------------------*/