void DSP_BGSND_Shared_Hisr_DL_UL(void * param)
{
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_Shared_Hisr_DL_UL] Enter");   
   DSP_BGSND_Hisr(BGSND_UL_PROCESS);
   DSP_BGSND_Hisr(BGSND_DL_PROCESS);
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_Shared_Hisr_DL_UL] Leave");  
}
static void DSP_BGSND_INIT()
{	
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_INIT] Enter");
	memset(&DSP_BGSnd, 0, sizeof(DSP_BKGSND_T));
	//has_ul = has_dl = 0;
	kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_INIT] Leave");
}
/*static*/ int32 EXT_BGSND_GetDataCount(uint32 id, BGSND_PROCESS_TYPE type)
{
	int32 count = 0; 
	kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_GetDataCount] Enter");
	
	ASSERT( type == BGSND_DL_PROCESS || type == BGSND_UL_PROCESS );
	EXT_BGSND_SRC_T *pSrc = &Ext_BGSnd.src[id];
            
   count = (pSrc->bufSize[type] - EXT_BGSND_BUF_PTR_DIFF) - EXT_BGSND_GetFreeSpace(id, type);
/*   for(j=0; j<MAX_BGSND_BUFFER_PROCESS_BIT; j++){
      if(type & (1<<j)){         
         type = 1<<j;
      	if(pSrc->bufWrite[type]<pSrc->bufRead[type]){
      		count = (pSrc->bufSize[type] - EXT_BGSND_BUF_PTR_DIFF)+pSrc->bufWrite[type] - pSrc->bufRead[type];
      	} else {
      		count = pSrc->bufWrite[type] - pSrc->bufRead[type];
      	}	               
      }
   }	

	if( count > EXT_BGSND_BUF_PTR_DIFF) {
		count -= EXT_BGSND_BUF_PTR_DIFF;
	} else {
		count = 0;
	}

	if(count&1){
		count = count -1;
	}*/
	kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_GetDataCount] count=%d", count);
	kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_GetDataCount] Leave");
	return count;
}
void DSP_BGSND_Stop(void)
{
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_Stop] Enter");
   DSP_BGSnd.state = DSP_BGSND_STATE_STOPPING;
	{  //turn off DSP BGSND	
   	uint32 I;
   	if(SAL_Bgsnd_IsRunning())
   		SAL_Bgsnd_SetFinal();
   	for ( I = 0; ; I++ ) {
   		if ( SAL_Bgsnd_IsIdle())	 /* DSP returns to idle state */
   			break;
   		ASSERT_REBOOT( I < 20 );
   		kal_sleep_task( 2 );
   	}
   	
   	AM_SND_PlaybackOff( true );
   }
   
#ifdef DSP_BGS_UP_DOWN_INT_SEPERATE
	L1Audio_UnhookHisrHandler(D2C_SOUND_EFFECT_INT_ID_DL);  
	L1Audio_UnhookHisrHandler(D2C_SOUND_EFFECT_INT_ID_UL);  
#else
	L1Audio_UnhookHisrHandler(D2C_SOUND_EFFECT_INT_ID_DL);
#endif 
   DSP_BGSnd.state = DSP_BGSND_STATE_IDLE;
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_Stop] Leave");   
}
/*****************************************************************************
 * FUNCTION
 *  tp_ps_handling_at_indication
 * DESCRIPTION
 *  This function is used to handle the response/URC data from MOD_ATCI
 *
 * PARAMETERS
 *  channelId             [IN]              
 *  buf             [IN]       
 *  iDataLen        [IN]       
 *
 * RETURNS
 * void
 *****************************************************************************/
static void tp_ps_handling_at_indication(kal_uint8  channelId, kal_char *buf, kal_uint16 iDataLen)
{
    kal_char *data;
    
    if (tp_callback == NULL || tp_port_begin == -1)
    {
        if (tp_callback == NULL)
        {
            kal_prompt_trace(
                    stack_get_active_module_id(),
                    "[Hdlr] ERROR: havn't register TP callback function");
        }
        else if (tp_port_begin == -1)
        {
            kal_prompt_trace(
                    stack_get_active_module_id(),
                    "[Hdlr] ERROR: havn't start PS, please call tp_ps_start first");
        }

        // buffer the URC
        if (channelId == RMMI_MSG_BASED_URC_CHANNEL)
        {
            kal_prompt_trace(
                    stack_get_active_module_id(),
                    "[Hdlr] Buffer the URC: %s", buf);
            if ( (tp_urc_buffer_len + iDataLen) > MAX_TP_URC_BUFFER_LENGTH)
            {
                kal_prompt_trace(
                    stack_get_active_module_id(),
                    "[Hdlr] URC buffer is full, clean the buffer", buf);

                tp_urc_buffer_len = 0;
            }
            
            if (iDataLen > MAX_TP_URC_BUFFER_LENGTH)
            {
               kal_prompt_trace(
                    stack_get_active_module_id(),
                    "[Hdlr] ERROR: the URC is too large, please increase the URC buffer");
            }
            else
            {
                kal_mem_cpy(tp_urc_buffer+tp_urc_buffer_len, buf, iDataLen);
                tp_urc_buffer_len += iDataLen;
            }
        }
    }
    else
    {

        data = get_ctrl_buffer(iDataLen);
        kal_mem_cpy(data, buf, iDataLen);
        
        tp_callback(channelId, data, iDataLen, 1);
        
        free_ctrl_buffer(data);
    }

}
Esempio n. 6
0
 /*****************************************************************************
 * FUNCTION
 *matv_module_power_on
 * DESCRIPTION
 *	config power on seq
 * PARAMETERS
 * RETURNS
 * NONE
 *****************************************************************************/
void  matv_module_power_on(void)
{
	if(is_factory_boot())
	{
		kal_prompt_trace(MOD_MATV, "Factory Mode\n");	  
	}
	else
	{		
		kal_prompt_trace(MOD_MATV, "Normal Mode\n");	  
	}

	
//	DrvSetChipDep(MTK_TVD_CamIFMode,0);
	DrvSetChipDep(MTK_TVD_CamIFMode,1);//for serial
	DrvSetChipDep(MTK_PAD_DRIVING,0x0f);//for serial 0: Data 0x09 : 9ma F:12ma
	DrvSetChipDep(MTK_PAD_DRIVING,0xAf);//for serial A: clk   0x09

	DrvSetChipDep(MTK_TVD_CamIFRefMCLK,0);
#if CUSTOM_AVC_ON	
	DrvSetChipDep(MTK_AUD_AVC,0x30000);
#else
	DrvSetChipDep(MTK_AUD_AVC,0x0);
#endif	

#if 0
///ifdef CAMERA_IO_DRV_1800
  DrvSetChipDep(MTK_PAD_DRIVING,0x02);
  DrvSetChipDep(MTK_PAD_DRIVING,0x12);
  DrvSetChipDep(MTK_PAD_DRIVING,0x22);
  DrvSetChipDep(MTK_PAD_DRIVING,0x32);
  DrvSetChipDep(MTK_PAD_DRIVING,0x42);
  DrvSetChipDep(MTK_PAD_DRIVING,0x52);
  DrvSetChipDep(MTK_PAD_DRIVING,0x62);
  DrvSetChipDep(MTK_PAD_DRIVING,0x72);
  DrvSetChipDep(MTK_PAD_DRIVING,0x82);
  DrvSetChipDep(MTK_PAD_DRIVING,0x92);
  DrvSetChipDep(MTK_PAD_DRIVING,0xa2);
  DrvSetChipDep(MTK_PAD_DRIVING,0xb2);
#else
    kal_prompt_trace(MOD_MATV, "Factory Mode max\n");
    ///0x08  --> 0xb8
    DrvSetChipDep(MTK_PAD_DRIVING,0x0f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x1f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x2f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x3f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x4f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x5f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x6f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x7f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x8f);
	DrvSetChipDep(MTK_PAD_DRIVING,0x9f);
	DrvSetChipDep(MTK_PAD_DRIVING,0xaf);
	DrvSetChipDep(MTK_PAD_DRIVING,0xbf);

#endif
	
}
uint32 EXT_BGSND_init()
{
   kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_init] Enter");
   DSP_BGSND_INIT();
   memset((void *)&Ext_BGSnd, 0, sizeof(EXT_BGSND_T));      
   // get audio ID
	Ext_BGSnd.aud_id = L1Audio_GetAudioID(); 
	kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_init] Leave");
// L1Audio_SetEventHandler( Ext_BGSnd.aud_id, (L1Audio_EventHandler) EXT_BGSND_EventHandler );  	
}
//from DL Src buffer -> DL ext buffer, multiplied by gain
//from UL Src buffer -> UL ext buffer
void EXT_BGSND_WriteExtBuffer(uint32 id, int gain, BGSND_PROCESS_TYPE type) // ToDo
{
	volatile uint16 *toPtr;
   int32 count, segment, i;
   uint16 *dataPtr;
   uint16 gainFactor;
   kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_WriteExtBuffer] Enter ");   
   kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_WriteExtBuffer] selected_src_id = %d BGSND_PROCESS_TYPE(0->DL, 1->UL)=%d", id, type);   
	ASSERT( type == BGSND_DL_PROCESS || type == BGSND_UL_PROCESS );
   EXT_BGSND_SRC_T *pSrc = &Ext_BGSnd.src[id];
   kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_WriteExtBuffer] fSph=%d gain=%d ", pSrc->fSph[type], pSrc->gain[type]);      

   gainFactor = pSrc->gain[type];
   
   count = EXT_BGSND_GetDataCount(id, type);   
   toPtr = Ext_BGSnd.buffer[type];   
   
   kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_WriteExtBuffer] count=%d ", count);  
   
   if (count > BGSND_BUFFER_LEN_WB)
      count = BGSND_BUFFER_LEN_WB;         
   
   
   if(count > 0) {
	   /* First Segemnt */
		if(pSrc->bufWrite[type] < pSrc->bufRead[type]) {
		   segment = (pSrc->bufSize[type] - pSrc->bufRead[type]);
		} else {
			segment = (pSrc->bufWrite[type] - pSrc->bufRead[type]);
		}

		if(segment&1){ // keep two sample alight
			segment =segment - 1;
		}      

		if (segment > count)
			segment = count;
			   
	   if (segment > 0) {
	      dataPtr = &(pSrc->buffer[type][pSrc->bufRead[type]]);
	      
	      if(pSrc->fSph[type] && MAX_LEVEL_EXT_BGSND_GAIN!=gainFactor){
   	      for (i=0; i<segment; i++) {			
               if( *dataPtr < (0x1111111111111111 - *toPtr)){ //limiter
                  *toPtr += ((*dataPtr)>>gainFactor);     				
               }else{               
                  kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_WriteExtBuffer] overflows1");  
                  ASSERT(0);
               }
               toPtr++;
               dataPtr++;     				
   	      }
   	      pSrc->dspLastSample[type] = *(toPtr-1);
   	   }else{
static void DSP_BGSND_UpdateMixer() // private
{
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_UpdateMixer] Enter");	   
   if ( AM_IsSpeechOn() || AM_IsVoIPOn()) {
   	SAL_Bgsnd_Config(DSP_BGSnd.gain[BGSND_UL_PROCESS], DSP_BGSnd.gain[BGSND_DL_PROCESS], DSP_BGSnd.fSph[BGSND_UL_PROCESS], DSP_BGSnd.fSph[BGSND_DL_PROCESS]);
   } else {
      //When enable BT, spe_setSpeechMode() will do Speech Off and Speech On. This function may run between Off and ON, so do not use ASSERT().
      //ASSERT(false);
      SAL_Bgsnd_Config(DSP_BGSnd.gain[BGSND_UL_PROCESS], DSP_BGSnd.gain[BGSND_DL_PROCESS], 0, 0);
   }
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_UpdateMixer] Leave");	   
}
Esempio n. 10
0
/* 
*   Function 
*      custom_cfg_vbat_level_regulator
*   DESCRIPTION
*      The function is used to convert the vbat value to the end-user level .
*     And it will be call by audio manager.
*   PARAMETERS
*     vbat      IN
*   RETURNS
*      kal_uint8
*   GLOBALS AFFECTED
*/
kal_uint8 custom_cfg_vbat_level_regulator( kal_uint32 measure_voltage, kal_uint8 *last_level, kal_uint8 *disp_level, kal_uint8 *hit_count )
{
   kal_uint8 level=0; 
   kal_uint8 regulated_level=0; 

   for( level=0; level<BATTERY_MAX_LEVEL; level++)
      if( measure_voltage <= Battery_Level_Info[level] )
         break;

   kal_prompt_trace(MOD_UEM, "Begin: [level %d] [last %d] [disp %d] [hit %d]", \
      level, *last_level, *disp_level,  *hit_count );
         
   if( level > *disp_level )
      {
            for( level=0; level<BATTERY_MAX_LEVEL; level++)
               if( measure_voltage <= (Battery_Level_Info[level] + VBAT_GROWUP_PENALTY) )
                  break;
      }

   kal_prompt_trace(MOD_UEM, "Penalty: [level %d] [last %d] [disp %d] [hit %d]", \
      level, *last_level, *disp_level,  *hit_count );

   if( level == *last_level )
      {
           if( *hit_count >= VBAT_HIT_COUNT_BOUND )
            {
                 regulated_level = *disp_level = level;
            }
           else 
           {
                (*hit_count)++;
                regulated_level = *disp_level;
            }
      }
   else
      {
           *hit_count=1;
           regulated_level = *disp_level;

      }
   
   kal_prompt_trace(MOD_UEM, "End: [level %d] [last %d] [disp %d] [hit %d]", \
      level, *last_level, *disp_level,  *hit_count );

  *last_level = level;

   if( level <= BATTERY_LOW_WARNING )
      return ( level );
   else
   return ( *disp_level );
   
}
Esempio n. 11
0
File: AVB.c Progetto: 12019/mtktest
void avb_HisrHandler(void *data)
{
   uint16 ptr_addr;
   int16 *dspPtr;
   uint32 outputNum,i;
   
   if (AVB.enable == false)
      return;

   if( DSP_TONE_CTRL2 != 0 || DSP_TONE_CTRL1 != 0 ){
      AVB.downsampler->GetSamples( AVB.downsampler, NULL, 160, false, true );
      kal_prompt_trace( MOD_L1SPHISR, "KT1=%x,KT2=%x",DSP_TONE_CTRL1,DSP_TONE_CTRL2);
   }
   else
   {
      ptr_addr = *DSP_DM_ADDR(BT_AUDIO_PLAYBACK_SD_PAGE_NUM, BT_AUDIO_PLAYBACK_SD_PTR_ADDR);
      ASSERT( ptr_addr >= BT_AUDIO_PLAYBACK_SD_ADDR && 
         ptr_addr < (BT_AUDIO_PLAYBACK_SD_ADDR + BT_AUDIO_PLAYBACK_SD_BUF_LEN) );

      dspPtr = (int16 *)DSP_DM_ADDR(BT_AUDIO_PLAYBACK_SD_PAGE_NUM, ptr_addr);
      outputNum = AVB.downsampler->GetOutputNum(AVB.downsampler);
      kal_prompt_trace( MOD_L1SPHISR, "AVB outNum =%d,Put2DSPAddr=%x", outputNum, ptr_addr);
      if ( AVB.buffered < 3 && outputNum >= 1024 ){    // avoid initial discontinuity
         AVB.buffered++;
      }
      if( outputNum > 160 && AVB.buffered > 2 )
         AVB.downsampler->GetSamples( AVB.downsampler, dspPtr, 160, false, false );
      else if ( AVB.flushing ){ 
         if (outputNum >= 160){
            AVB.downsampler->GetSamples( AVB.downsampler, dspPtr, 160, false, false );
            kal_prompt_trace( MOD_L1SPHISR, "AVB Flushing");
         }
         else{
            AVB.downsampler->GetSamples( AVB.downsampler, dspPtr, outputNum, false, false );
            dspPtr += outputNum;
            for( i = outputNum ; i < 160 ; i++ )
               *dspPtr++ = 0;
            kal_prompt_trace( MOD_L1SPHISR, "AVB Flushed");
         }
      }
      else {
         for( i = 160 ; i > 0 ; i-- )
            *dspPtr++ = 0;
         kal_prompt_trace( MOD_L1SPHISR, "AVB fill Silence,outBuf=%d",outputNum);
      }
      
      //get other samples to DSP via DSP
      //dspPtr = (int16 *)IDMA_SHORT_ADDR;
      //AVB.downsampler->GetSamples(AVB.downsampler, dspPtr, 159, true, false);
   }
} 
static void DSP_BGSND_ConfigMixer(kal_bool bSPHFlag, kal_int8 SNDGain, BGSND_PROCESS_TYPE type)
{
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_ConfigMixer] Enter");	
   kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_ConfigMixer] BGSND_PROCESS_TYPE(0->DL, 1->UL)=%d flag:%d, gain:%d", type, bSPHFlag, SNDGain);
   
	ASSERT(SNDGain>=0 && SNDGain<=7);
	if( SNDGain == 0)
		DSP_BGSnd.gain[type] = 0;
	else {
		DSP_BGSnd.gain[type] = (kal_int16)(32767 >> (7 - SNDGain));
	}
	DSP_BGSnd.fSph[type] = bSPHFlag;
	kal_prompt_trace(MOD_L1SP, "[DSP_BGSND_ConfigMixer] Leave");
}
uint32 EXT_BGSND_Start(void (*offHdr)(void),
                       void (*DLHisr)(void),       //move data from src -> ext
                       void (*ULHisr)(void),       //move data from src -> ext 
                       kal_int8 DLSNDGain,
                       kal_int8 ULSNDGain /*,                           
                       void (*EventHandler)(void)*/)
{
   int i, j;
   
   kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_Start] Enter");
   
   ASSERT(!(NULL==DLHisr && NULL==ULHisr));
   ASSERT(NULL!=offHdr); //without this, we cannot stop DSP BGSND
     
   for(i=0; i<MAX_SIZE_EXT_BGSND_SRC; i++){
      kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_Start] debug1 i=%d", i);
      if(!Ext_BGSnd.is_used[i]){
         kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_Start] debug2 i=%d", i);
         EXT_BGSND_SRC_T *pSrc = &Ext_BGSnd.src[i];

         pSrc->Hdr[BGSND_DL_PROCESS]   = DLHisr;
         pSrc->Hdr[BGSND_UL_PROCESS]   = ULHisr;        
         pSrc->offHdr = offHdr;
         for(j=0; j<MAX_NUM_BGSND_PROCESS; j++){//TODO temp solution
            
            pSrc->state[j]  = EXT_SRC_STATE_RUN;      
            //pSrc->fSph[j]   = true; //TODO
            //pSrc->gain[j]   = 7;    //TODO     
            
         	// buffer reset
         	memset(pSrc->buffer[j], 0, sizeof(kal_uint16)*EXT_BGSND_SRC_BUF_SIZE);
         	pSrc->bufSize[j]  = EXT_BGSND_SRC_BUF_SIZE;
         	pSrc->bufRead[j]  = 0;
         	pSrc->bufWrite[j] = EXT_BGSND_BUF_PTR_DIFF;
         }   
         if(AM_IsSpeechOn() || AM_IsVoIPOn()){
            EXT_BGSND_ConfigMixer(i, true, DLSNDGain, BGSND_DL_PROCESS); 
            EXT_BGSND_ConfigMixer(i, true, ULSNDGain, BGSND_UL_PROCESS);
         }else{
            EXT_BGSND_ConfigMixer(i, false, DLSNDGain, BGSND_DL_PROCESS); 
            EXT_BGSND_ConfigMixer(i, false, ULSNDGain, BGSND_UL_PROCESS);            
         }         	
      	Ext_BGSnd.is_used[i] = true;     
         if( 0 == Ext_BGSnd.num_src_used++){
            kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_Start] selected_src_id=%d num_src_used=%d", i,  Ext_BGSnd.num_src_used);
      	   // lock DSP for sherif writing.	
      	   L1Audio_SetFlag( Ext_BGSnd.aud_id ); // REIMIND: Before Locking SleepMode, to access DSP sherrif tasks much time. So access DSP must be after SetFlag1       
            DSP_BGSND_Start(EXT_BGSND_DLHisr, EXT_BGSND_ULHisr);
         }      	 	
         kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_Start] debug3 i=%d", i);
      	break;
      }
      kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_Start] debug4 i=%d", i);
   }   
   kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_Start] debug5 i=%d", i);
   ASSERT(i < MAX_SIZE_EXT_BGSND_SRC);  
   kal_prompt_trace(MOD_L1SP, "[EXT_BGSND_Start] Leave");         
   return i;
}
/*
* FUNCTION                                                            
*	acc_sensor_pwr_up
*
* DESCRIPTION                                                           
*   	This function is to power up acceleration module
*
* CALLS  
*
* PARAMETERS
*  None
*	
* RETURNS
*	None
*/    
void acc_sensor_pwr_up(void)
{
   kal_int32 i;
   kal_prompt_trace(MOD_ENG,"----acc_sensor_pwr_up start----");
   motion_sensor_write_data(0x80, MOTION_SENSOR_CTRL_REGC);//ktxf9 reset
   MS_Delay(30000);//delay for ktxf9 reset
   motion_sensor_write_data(0x00, MOTION_SENSOR_CTRL_REGA);
   motion_sensor_write_data(0x50, MOTION_SENSOR_CTRL_REGA);//set to 12 bit 8g
   motion_sensor_write_data(0x00, MOTION_SENSOR_CTRL_REGB);
   motion_sensor_write_data(0xd0, MOTION_SENSOR_CTRL_REGA);//set to work mode
   motion_sensor_write_data(0x00,MOTION_SENSOR_INT_CTRL_REG1);//disable all interrupt funs
   motion_sensor_write_data(0x00,MOTION_SENSOR_INT_CTRL_REG2);
   motion_sensor_write_data(0x00,MOTION_SENSOR_INT_CTRL_REG3);
   kal_prompt_trace(MOD_ENG,"----acc_sensor_pwr_up end----");
}
Esempio n. 15
0
 /*****************************************************************************
  * FUNCTION
  *  mmi_fm_fm_ate_test_cmd_req_hdlr
  * DESCRIPTION
  *  Test cammand req handler, this function will handle test requst send from 
  *  L4 Uart (at+cmd)
  * PARAMETERS
  *  msg_ptr		 [IN]		message data
  * RETURNS
  *  void
  *****************************************************************************/
 void fm_ate_test_cmd_req_hdlr(void *msg_ptr)
 {
	 mmi_fm_ate_test_req_struct *ind_p;
	 kal_uint8 buffer[10];
	 ind_p = (mmi_fm_ate_test_req_struct*)msg_ptr;
 
	 if (ind_p->event == MMI_FM_ATE_EVENT_POWER_ON)
	 {
		 fm_ate_power_on();
		 fm_ate_set_freq(FM_ATE_DEFAULT_FREQ);
	 }
	 else if (ind_p->event == MMI_FM_ATE_EVENT_POWER_OFF)
	 {
		 fm_ate_power_off();
	 }
	 else if (ind_p->event == MMI_FM_ATE_EVENT_SET_FREQ)
	 {
		fm_ate_set_freq((ind_p->cmd_buf[0]<<8)+ind_p->cmd_buf[1]);
	 }
	 else if (ind_p->event == MMI_FM_ATE_EVENT_COMMAND)
	 {
		 fm_ate_other_command(ind_p->cmd_length, ind_p->cmd_buf);
	 }
	 else 
	 {
		 //MDI_ASSERT(0);
		 kal_prompt_trace(MOD_FMR,"fm_ate_test_cmd_req_hdlr: unknow command!");
		 kal_sprintf((kal_char*) buffer, "FM:FAIL");	// now buffer string is "REG=12"
		 rmmi_write_to_uart(buffer, strlen((char*)buffer),KAL_TRUE);
	 }
 
 }
S32 CALLCC VideoRecordService::gs_video_rec_record_stop()
{
	S32 ret;
	ret = mdi_video_rec_record_stop();
	kal_prompt_trace(MOD_IDLE,"mdi_video_rec_record_stop ret = %d",ret);
	return ret;
}
S32 CALLCC VideoRecordService::gs_video_rec_power_on()
{
	S32 ret =  mdi_video_rec_power_on(ASM_ANONYMOUS_ID);
	kal_prompt_trace(MOD_IDLE,"mdi_video_rec_power_on ret = %d",ret);

	return ret;
}
S32 CALLCC VideoRecordService::gs_video_rec_record_pause(MMI_BOOL stop_preview)
{
	S32 ret;
	ret = mdi_video_rec_record_pause( stop_preview);
	kal_prompt_trace(MOD_IDLE,"mdi_video_rec_record_pause ret = %d",ret);
	return ret;
}
Esempio n. 19
0
kal_bool fm_scan(struct fm_scan_parm *parm){
	kal_bool return_value;
	
	kal_prompt_trace(MOD_MATV, "[FM] fm_scan In");
	if (NULL != matv_sem_id)
			kal_take_sem(matv_sem_id, KAL_INFINITE_WAIT);
	
	return_value=fmdrv_scan(parm);
			
	if (NULL != matv_sem_id)
			kal_give_sem(matv_sem_id);

	kal_prompt_trace(MOD_MATV, "[FM] fm_scan Out");
	
	return return_value;
}
Esempio n. 20
0
void MTPNP_PFAL_Shutdown_Timeout(void)
{
    kal_prompt_trace(MTPNP_PFAL_Get_MTPNP_Task_Mod(), "MTPNP_PFAL_Shutdown_Timeout");

    MTPNP_PFAL_Stop_Timer(MTPNP_RELEASE_SLAVE_PWRKEY_TIMER);
    MTPNP_PFAL_Start_Timer(SYSTEM_SHUTDOWN, POWER_OFF_TIMER_STAGE_2, QuitSystemOperation);
}
S32 CALLCC VideoRecordService::gs_video_set_camera_id(U16 camera_id)
{
	S32 ret =  mdi_video_set_camera_id(camera_id);
	kal_prompt_trace(MOD_IDLE,"mdi_video_set_camera_id ret = %d",ret);
	return ret;

}
void SP_Strm_Enable( ilm_struct *ilm_ptr )
{
   UART_CTRL_OPEN_T data;
   DCL_STATUS status;
   cmux_dlc_connect_ind_struct *local_para;
   
   if (intSStrmControl != NULL )
      return;
   local_para = (cmux_dlc_connect_ind_struct *)ilm_ptr->local_para_ptr;
   
   if( ss_enh_mutex == NULL) // no delete mutex
      ss_enh_mutex = kal_create_enh_mutex( "SP_STRM_ENH_MUTEX" );
   intSStrmControl = (SpStrmControl *)get_ctrl_buffer(sizeof(SpStrmControl));
   intSStrmControl->ul_ready = KAL_FALSE;
   intSStrmControl->ul_sample_count = 0;
   intSStrmControl->port = local_para->port;
   kal_prompt_trace(MOD_L1SP, "SS port %d", intSStrmControl->port);
#if !defined(SS_UNIT_TEST)   
   data.u4OwenrId = MOD_MED;
   intSStrmControl->cmux_handle = DclSerialPort_Open(intSStrmControl->port, 0);
   status = DclSerialPort_Control(intSStrmControl->cmux_handle, SIO_CMD_OPEN, (DCL_CTRL_DATA_T*)&data);
   ASSERT(STATUS_OK == status);
#endif
   L1SP_Register_Strm_Handler( spStrmOnHandler, spStrmOffHandler, spStrmCallback );
}
Esempio n. 23
0
void RDABT_core_Intialization_r10_al(void)
{
    kal_prompt_trace(0,"RDABT_core_Intialization_r10_al");


    RDA_bt_Power_On_Reset();
    RDABT_DELAY(10); //wait for digi running
#ifdef __RDABT_USE_IIC__
    RDABT_rf_Intialization_r10_al();
#else
    RDABT_uart_rf_Intialization_r10_al();
#endif
    Rdabt_Pskey_Write_rf_r10_al();

    RDABT_DELAY(5); //wait for digi running
#ifdef __RDABT_USE_IIC__
    rdabt_DC_write_r10_al();	 
#else
    rdabt_uart_DC_write_r10_al();	 
#endif
    Rdabt_Pskey_Write_r10();
    Rdabt_unsniff_prerxon_write_r10();
    Rdabt_patch_write_r10();    
    Rdabt_setfilter_r10();
    Rdabt_acl_patch_write_r10();

    Rdabt_trap_write_r10();
#ifdef __RDA_USE_LPO_32K__	
    Rdabt_lpo_Setting__write_r10_al();	
    Rdabt_lpo_patch_write_r10_al();
#endif	
	
}
//If controller has the register store these informations
//Read out the informations from controller through I2C
void ctp_cypress_cy8ctma340_get_information()
{
	kal_uint8 value[4];
	kal_bool i2c_ret;

	i2c_ret = CTP_I2C_read(CID_0, value, 3);
	kal_prompt_trace(MOD_TP_TASK, "ctp_cypress_cy8ctma340_get_information i2c_ret=%d CID_0=%x CID_1=%x CID_2=%x", i2c_ret,  value[0], value[1], value[2]);
	i2c_ret = CTP_I2C_read(UID_0, value, 4);
	kal_prompt_trace(MOD_TP_TASK, "ctp_cypress_cy8ctma340_get_information i2c_ret=%d UID_0=%x UID_1=%x UID_2=%x UID_3=%x", i2c_ret,  value[0], value[1], value[2], value[3]);
	i2c_ret = CTP_I2C_read(UID_4, value, 4);
	kal_prompt_trace(MOD_TP_TASK, "ctp_cypress_cy8ctma340_get_information i2c_ret=%d UID_4=%x UID_5=%x UID_6=%x UID_7=%x", i2c_ret,  value[0], value[1], value[2], value[3]);
	i2c_ret = CTP_I2C_read(BL_VERH, value, 4);
	kal_prompt_trace(MOD_TP_TASK, "ctp_cypress_cy8ctma340_get_information i2c_ret=%d BL_VERH=%x BL_VERL=%x TTS_VERH=%x TTS_VERL=%x", i2c_ret,  value[0], value[1], value[2], value[3]);
	i2c_ret = CTP_I2C_read(APP_IDH, value, 4);
	kal_prompt_trace(MOD_TP_TASK, "ctp_cypress_cy8ctma340_get_information i2c_ret=%d APP_IDH=%x APP_IDL=%x APP_VERH=%x APP_VERL=%x", i2c_ret,  value[0], value[1], value[2], value[3]);
}
Esempio n. 25
0
void bt_discovery_result_ind_cb(t_MGR_DeviceEntry *newDevice, int status)
{

  kal_prompt_trace(1,"bt_discovery_result_ind_cb find device ? newDevice =%x,status =%d ", newDevice,status);
	if(!newDevice)
	{
	    LINK_DISCOVERY_CNF_ST mv;
	    mv.type = LINK_DISCOVERY_CNF;
	    mv.result = status;
	    mv.total_number = MGR_GetDeviceNumFound();
	    rdabt_put_message(EXTERNAL_TASK_MASK,LINK_Q,&mv);

	}
	else
	{
		if(status == 0)
		{
			    LINK_DISCOVERY_RESULT_ST mv;
			    mv.type = LINK_DISCOVERY_RESULT_IND;
			    mv.result = status;
			    //pMemcpy(mv.device.address.bytes, (u_int8 *)&newDevice, sizeof(t_MGR_DeviceEntry));

			    mv.device = (t_MGR_DeviceEntry *)newDevice;

			    rdabt_put_message(EXTERNAL_TASK_MASK,LINK_Q,&mv);
		}
	}

} 
Esempio n. 26
0
static int is_factory_boot(void)
{
	int fd;
	size_t s;
	char boot_mode;
	fd = open("/sys/class/BOOT/BOOT/boot/boot_mode", O_RDWR);
	if (fd < 0) {		  
		kal_prompt_trace(MOD_MATV, "fail to open: %s\n", "/sys/class/BOOT/BOOT/boot/boot_mode");		 
	 	return 0;	  
	}	  
	s = read(fd, (void *)&boot_mode, sizeof(boot_mode)); 
	close(fd);    
	if (s <= 0 || boot_mode != '4')		   
		return 0;	  
	kal_prompt_trace(MOD_MATV, "Factory Mode Booting.....\n");    
	return 1;
}
Esempio n. 27
0
  /*****************************************************************************
 * FUNCTION
 *matv_fm_module_power_on
 * DESCRIPTION
 *	config power on seq
 * PARAMETERS
 * RETURNS
 * NONE
 *****************************************************************************/
void  matv_fm_module_power_on(void)
{
	if(is_factory_boot())
	{
		kal_prompt_trace(MOD_MATV, "Factory Mode\n");	  
	}
	else
	{		
		kal_prompt_trace(MOD_MATV, "Normal Mode\n");	  
	}

#if CUSTOM_AVC_ON	
	DrvSetChipDep(MTK_AUD_AVC,0x30000);
#else
	DrvSetChipDep(MTK_AUD_AVC,0x0);
#endif
}
Esempio n. 28
0
 /*****************************************************************************
  * FUNCTION
  *  mmi_fm_fm_ate_power_on
  * DESCRIPTION
  *  Power on FM module
  * PARAMETERS
  *  void
  * RETURNS
  *  void
  *****************************************************************************/
 void fm_ate_power_on(void)
 {	 
	 if (FMR_IsActive() == KAL_FALSE)
	 {
		 mdi_fmr_power_on_with_path(MDI_DEVICE_SPEAKER2, (mdi_ext_callback) NULL,NULL);
		 kal_prompt_trace(MOD_FMR,"fm_atcommand_power_on: DONE!");
	 }
 }
Esempio n. 29
0
static void mmi_em_misc_rf_desense_mode_min_emi_current(void) {
  rf_desense_set_curr_mode(RF_DESENSE_MODE_MIN_EMI_CURRENT);
//#if defined(MT6256)
      EMI_SetMinDrivingCurrent();
      kal_prompt_trace(MOD_MED, "[RF Desense] [Minimum EMI driving current] Pass!\n");
	//custom_DynamicClockSwitch(SSC_IDLE);
//#endif 
}
Esempio n. 30
0
 /*****************************************************************************
  * FUNCTION
  *  mmi_fm_fm_ate_power_off
  * DESCRIPTION
  *  Power off FM module
  * PARAMETERS
  *  void
  * RETURNS
  *  void
  *****************************************************************************/
 void fm_ate_power_off(void)
 {
	 if (FMR_IsActive() == KAL_TRUE)
	 {
		 mdi_fmr_power_off();
		 kal_prompt_trace(MOD_FMR,"fm_atcommand_power_off: DONE!");
	 }
 }