//=============================================================================================
//                  Audio/8K Clock Related
//=============================================================================================
void AFE_TurnOn8K( void )
{
#ifdef L1D_TEST
 extern  int  PollLoopbackMode(void);
   if( PollLoopbackMode() !=1 )
#endif
   {
      // afe.v8k_off_request = KAL_FALSE;
      *MD2GSYS_CG_CLR2 =  PDN_CON2_VAFE;

		// choose BT v.s. voice down link 
		if( afe.bt_flag == KAL_TRUE) {// VBT (DAI)
			*AFE_VMCU_CON1 |= 0x1;
		}else {// voice downlink
			*AFE_VMCU_CON1 &= ~0x1;
		}
		
      if( afe.voice8kMode == 0 )//narrow band, 4k mode;
         *AFE_VMCU_CON1 |= 0x200;
      else
         *AFE_VMCU_CON1 &= ~0x200;
      *AFE_VMCU_CON    |= 0x0001;
      AFE_SetRefVol(KAL_TRUE);

		// [Remind] [MT6589] This sherif is used when sw sidetone
		// MT6589 uses hw sidetone. So remove it. 
		// For chip uses sw sidetone, please ask SAL to provide interface
      //*DP_8K_LIMITER_CTRL &= ~0x1;
      
		L1Audio_Msg_AFE_Switch( L1AUDIO_Str_onoff(1), AFE_Switch_Name(0) );
   }
}
Пример #2
0
//=============================================================================================
//                  Audio/8K Clock Related
//=============================================================================================
void AFE_TurnOn8K( void )
{
#ifdef L1D_TEST
 extern  int  PollLoopbackMode(void);
   if( PollLoopbackMode() !=1 )
#endif
   {

#if defined(MT6595) && (APAUDSYS_DVT_8K || APAUDSYS_DVT_16K || APAUDSYS_DVT_32K) && (APAUDSYS_DVT_RF2)
      *MD2GSYS_AFE_CK_SEL = 0x0; // clock source switch test
#endif
      
      // turn on clock gate
      *MD2GSYS_CG_CLR2 =  PDN_CON2_VAFE;

      // 1. config MDAFE_MCU_CON1, DSP DL/UL data rate 
      if( afe.voice8kMode == 0 )//narrow band, 4k mode;
         *AFE_MCU_CON1 = 0x0;
		else if ( afe.voice8kMode == 2 )
			*AFE_MCU_CON1 = 0x88;
      else // default is wide bank, 8k mode, 16k sampling rate
         *AFE_MCU_CON1 = 0x44;
         // *AFE_MCU_CON1 = 0x88;
         
      // 2. config MDAFE_VMCU_CON1
      *AFE_VMCU_CON1 = 0; // Fix value, may set it on init
      
      // 3. config MDAFE_PCM_CON0
      if( afe.voice8kMode == 0 )//narrow band, 4k mode;
      	*AFE_PCM_CON0 = 0x8400000A; // not turn on pcm 
      else if ( afe.voice8kMode == 2 )
			*AFE_PCM_CON0 = 0x8400800A;
      else // default is wide bank, 8k mode, 16k sampling rate
      	*AFE_PCM_CON0 = 0x8400400A;
      	
      // 4. config MDAFE_IRQ_CON1 for irq setting
      *AFE_IRQ_CON1 = 0x05; // Fix value, may set it on init
      
      // 5. config MDAFE_CONN0 for inteconnection
#if defined(MT6595) && (APAUDSYS_DVT_8K || APAUDSYS_DVT_16K || APAUDSYS_DVT_32K) && (APAUDSYS_DVT_RF2) 
		*AFE_CONN0 = 0x54321010; // [REMIND] loopback!! 
#else
      *AFE_CONN0 = 0x54321076; // Fix value, may set it on init 
#endif      
      
      // 6. config MDAFE_VMCU_CON0 = 0x00000001 to open Voice IRQ
      *AFE_VMCU_CON = 0x1; 
      
      // 7. config MDAFE_MCU_CON0 = 0x00000001 to open whole AFE
      *AFE_MCU_CON0 = 0x1;
      
      // 8. config MDAFE_PCM_CON0 = MDAFE_PCM_CON0 | 0x00000001 open PCM interface
		*AFE_PCM_CON0 |= 0x1; 
      
      // AFE_SetRefVol(KAL_TRUE);

      L1Audio_Msg_AFE_Switch( L1AUDIO_Str_onoff(1), AFE_Switch_Name(0) );
   }
}
void AFE_TurnOff8K( void )
{
   // afe.v8k_off_request = KAL_TRUE;
   *MD2GSYS_CG_SET2 = PDN_CON2_VAFE;
   *AFE_VMCU_CON  &= ~0x0001;   
	L1Audio_Msg_AFE_Switch( L1AUDIO_Str_onoff(0), AFE_Switch_Name(0) );
		
}
Пример #4
0
void AFE_TurnOff8K( void )
{

   // i.	close PCM interface
   *AFE_PCM_CON0 &= ~0x1;
    
   // ii.close 8k IRQ
   *AFE_VMCU_CON = 0x0;
   
   // iii.	close whole AFE
   *AFE_MCU_CON0  = 0;   

	// turn off clock gate
   *MD2GSYS_CG_SET2 = PDN_CON2_VAFE;
   
	L1Audio_Msg_AFE_Switch( L1AUDIO_Str_onoff(0), AFE_Switch_Name(0) );
}
Пример #5
0
//=============================================================================================
//                  Audio/8K Clock Related
//=============================================================================================
void AFE_TurnOn8K( void )
{
#ifdef L1D_TEST
 extern  int  PollLoopbackMode(void);
   if( PollLoopbackMode() !=1 )
#endif
   {
      // TODO:
      // turn on clock gate
      *MD2GSYS_CG_CLR2 =  PDN_CON2_VAFE;

      // 1. config MDAFE_MCU_CON1, DSP DL/UL data rate 
      if( afe.voice8kMode == 0 )//narrow band, 4k mode;
         *AFE_MCU_CON1 = 0x0;
      else
         *AFE_MCU_CON1 = 0x44;
         
      // 2. config MDAFE_VMCU_CON1
      *AFE_VMCU_CON1 = 0; // Fix value, may set it on init
      
      // 3. config MDAFE_PCM_CON0
      if( afe.voice8kMode == 0 )//narrow band, 4k mode;
      	*AFE_PCM_CON0 = 0x8400000A; // not turn on pcm 
      else 
      	*AFE_PCM_CON0 = 0x8400400A;
      	
      // 4. config MDAFE_IRQ_CON1 for irq setting
      *AFE_IRQ_CON1 = 0x05; // Fix value, may set it on init
      
      // 5. config MDAFE_CONN0 for inteconnection
      *AFE_CONN0 = 0x54321076; // Fix value, may set it on init
      
      // 6. config MDAFE_VMCU_CON0 = 0x00000001 to open Voice IRQ
      *AFE_VMCU_CON = 0x1; 
      
      // 7. config MDAFE_MCU_CON0 = 0x00000001 to open whole AFE
      *AFE_MCU_CON0 = 0x1;
      
      // 8. config MDAFE_PCM_CON0 = MDAFE_PCM_CON0 | 0x00000001 open PCM interface
		*AFE_PCM_CON0 |= 0x1; 
      
      // AFE_SetRefVol(KAL_TRUE);

      L1Audio_Msg_AFE_Switch( L1AUDIO_Str_onoff(1), AFE_Switch_Name(0) );
   }
}
void AFE_TurnOff8K_Direct( void )
{
   *MD2GSYS_CG_SET2 = PDN_CON2_VAFE;
   *AFE_VMCU_CON  &= ~0x0001;
	L1Audio_Msg_AFE_Switch( L1AUDIO_Str_onoff(0), AFE_Switch_Name(0) );
}