Exemplo n.º 1
0
void bmt_enable_sleepmode(kal_bool enable)
{

	if (KAL_TRUE==enable)
	{
		bmt_sleepmode=KAL_TRUE;
#ifdef __DRV_BMT_SW_POLLING_CHARGER_OV__
		kal_cancel_timer(bmt_sw_polling_timerId);
#endif //#ifdef __DRV_BMT_SW_POLLING_CHARGER_OV__

#ifdef MTK_SLEEP_ENABLE
		L1SM_SleepEnable(bmt_sm_handle);
#endif

		drv_trace0(TRACE_GROUP_10, BMT_SW_ENABLE_SLEEP_MODE);


	}
	else
	{
		bmt_sleepmode=KAL_FALSE;
#ifdef __DRV_BMT_SW_POLLING_CHARGER_OV__
		kal_set_timer(bmt_sw_polling_timerId, (kal_timer_func_ptr)bmt_sw_polling_ov, NULL,43 ,	0);
#endif //#ifdef __DRV_BMT_SW_POLLING_CHARGER_OV__

#ifdef MTK_SLEEP_ENABLE
		L1SM_SleepDisable(bmt_sm_handle);
#endif
		drv_trace0(TRACE_GROUP_10, BMT_SW_DISABLE_SLEEP_MODE);

	}

}
Exemplo n.º 2
0
void bmt_set_customized_current(CHR_DET_TYPE_ENUM charger_type)
{
   	PMU_CHR_CURRENT_ENUM chr_current = PMU_CHARGE_CURRENT_0_00_MA;

    drv_trace0(TRACE_GROUP_10, BMT_SET_CUSTOMIZED_CURRENT_TRC);
   
    switch (charger_type)
    {
		case PW_AC_CHR:
			chr_current = CHR_AC_CHARGE_CURRENT;
            drv_trace0(TRACE_GROUP_10, BMT_SET_AC_CHARGE_CURRENT_TRC);  
		break;
#if defined(__USB_ENABLE__)
		case PW_USB_CHR:
            		chr_current = bmt_usb_chr_current;
            drv_trace0(TRACE_GROUP_10, BMT_SET_USB_CHARGE_CURRENT_TRC); 
#endif //#if defined(__USB_ENABLE__)              
		break;
		case PW_AC_NON_STD_CHR:
			chr_current = PMU_CHARGE_CURRENT_450_00_MA;
		break;		
		default:
			ASSERT(0);
		break;
	} 
    
    bmt_find_and_set_the_nearest_current(chr_current);
}
Exemplo n.º 3
0
void bmt_high_vchg_adjust_safetytimer(kal_int32 Cur_VCHG)   
{
    kal_int32 i;
	CHR_DET_TYPE_ENUM chr_type;

	chr_type = bmt_get_chr_type();

    
    drv_trace1(TRACE_GROUP_9, BMT_HIGH_VCHG_CURRENT_VCHG_TRC, Cur_VCHG);
    // Cur_VCHG > S/W OVP
    if(Cur_VCHG > bmt_charging_para.HIGH_VCHG_TABLE[VCHG_VOL_LEVEL - 1][0])
    {
        bmt_total_charge_time = 0;
        drv_trace0(TRACE_GROUP_9, BMT_HIGH_VCHG_TOO_HIGH_TRC);
    }
    else if(Cur_VCHG < bmt_charging_para.HIGH_VCHG_TABLE[0][0])
    {
        drv_trace1(TRACE_GROUP_9, BMT_HIGH_VCHG_LOWEST_THRESHOLD_TRC, bmt_charging_para.HIGH_VCHG_TABLE[0][0]);
        bmt_total_charge_time = bmt_charging_para.HIGH_VCHG_TABLE[0][2];
    }
    else
    {
        for(i = (VCHG_VOL_LEVEL - 1); i > 0; i--)
        {

            drv_trace1(TRACE_GROUP_9, BMT_HIGH_VCHG_UPPER_THRESHOLD_TRC, bmt_charging_para.HIGH_VCHG_TABLE[i][0]);
            drv_trace1(TRACE_GROUP_9, BMT_HIGH_VCHG_LOWER_THRESHOLD_TRC, bmt_charging_para.HIGH_VCHG_TABLE[i-1][0]);
            if((Cur_VCHG < bmt_charging_para.HIGH_VCHG_TABLE[i][0]) && (Cur_VCHG >= bmt_charging_para.HIGH_VCHG_TABLE[i-1][0]))
            {
                bmt_total_charge_time = bmt_charging_para.HIGH_VCHG_TABLE[i][2];  
                drv_trace1(TRACE_GROUP_9, BMT_HIGH_VCHG_TABLE_INDEX_TRC, i);
                break;
            }
        }
    }
    drv_trace1(TRACE_GROUP_9, BMT_CURRENT_PMIC_STATE_TRC, BMT.pmictrl_state);
    if((chr_type != PW_USB_CHR) && (chr_type !=PW_USB_CHARGING_HOST_CHR))
    {
        drv_trace0(TRACE_GROUP_9, BMT_AC_IN_TRC);
    }
    else
    {
        drv_trace0(TRACE_GROUP_9, BMT_USB_IN_TRC);
		bmt_total_charge_time = bmt_charging_para.bmt_total_charge_time;
    }
   
    
}
VIDEO_DECODER_CODEC_ERROR_T H264HwDecoderCloseAdapt(void)
{
    kal_bool fgCacheable;
    drv_trace0(TRACE_GROUP_8, H264HWDEC_CLOSE);

    if (rH264HwDecCtrl.fgExtMemReplaceIntMem)
    {
        if (rH264HwDecCtrl.fgExtMemReplaceIntMemSwitch)
        {
            fgCacheable = VideoCommIsExtBufferCacheable((kal_uint32)rH264HwDecCtrl.u4IntMemAddr, rH264HwDecCtrl.u4IntMemAlignSize);
            if (fgCacheable == KAL_FALSE)
            {
                VideoCommExtBufferCacheableSwitch(rH264HwDecCtrl.u4IntMemAddr, rH264HwDecCtrl.u4IntMemAlignSize, VIDEO_CACHEABLE);
            }
            else
            {
                //switched internal memory to cacheable???
                ASSERT(0);
            }
        }
        VideoDecoderFree((void *)rH264HwDecCtrl.u4IntMemOriginalAddr);
    }

    return VIDEO_DECODER_CODEC_ERROR_NONE;
}
Exemplo n.º 5
0
/* clear tx buffer */
static void USB2UART_ClrTxBuffer(UART_PORT port, module_type ownerid)
{
    kal_uint32 savedMask;


#ifndef  __PRODUCTION_RELEASE__
    if(ownerid != USB2UARTPort.ownerid)
    {
        EXT_ASSERT( 0, (kal_uint32) ownerid, USB2UARTPort.ownerid, 0);
    }
#endif

    drv_trace0(TRACE_FUNC, USBACM_CLEAR_TX_BUF);
//	kal_prompt_trace(MOD_USB, "clrTx\n");

    /* stop dma channel if current status is CDC ACM*/
    if ( (gUsbDevice.device_type == USB_CDC_ACM) && (USB2UARTPort.initialized == KAL_TRUE)
            &&(gUsbDevice.nDevState==DEVSTATE_CONFIG))
    {
        USB_Stop_DMA_Channel(g_UsbACM.txpipe->byEP, USB_TX_EP_TYPE);
    }

    savedMask = SaveAndSetIRQMask();
    USB2UARTPort.Tx_Buffer.Write = 0;
    USB2UARTPort.Tx_Buffer.Read = 0;
    g_UsbACM.send_Txilm = KAL_TRUE;
    RestoreIRQMask(savedMask);

    drv_trace1(TRACE_FUNC, USBACM_CLEAR_TX_BUF_READY_TO_READ_FLAG, ownerid);
//	kal_prompt_trace(MOD_USB, "clr RDY W %d", ownerid);

}
void _VideoDecodeCheckStackTCM(void)
{
#if defined(MT6225)||defined(MT6235)||defined(MT6235B)||defined(MT6236)||defined(MT6236B)||defined(MT6253)||defined(MT6253T)
    drv_trace0(TRACE_GROUP_10, VCODEC_STACK_NO_TCM);
    ASSERT(0);
#endif
}
Exemplo n.º 7
0
void bmt_charge_clear_wdt(void *parameter)
{
	
	DCL_STATUS status;
	SGPT_CTRL_START_T start;

   

	// Clear charge WDT
	drv_trace0(TRACE_GROUP_10, BMT_CHARGING_WDT_CLR_TRC);
	DclPMU_Control(bmt_PmuHandler, CHR_SET_WDT_CLEAR, NULL);	
	   

	if (bmt_wdt_handle != 0xFF)
	{
		start.u2Tick=BMT_CHARGE_CLEAR_WDT_PERIOD;
		start.pfCallback=bmt_charge_clear_wdt;
		start.vPara=NULL;
		//this is for handle type transfer between new and old API.
		status = DclSGPT_Control(bmt_wdt_handle, SGPT_CMD_START,(DCL_CTRL_DATA_T*)&start);
        
        if(status != STATUS_OK)
        {
        	ASSERT(0);  		
        }  	        
	}
}
VIDEO_DECODER_CODEC_ERROR_T H264HwDecoderDeInitAdapt(void)
{
    if ( rH264HwDecCtrl.fgIsCodecInit != KAL_TRUE )
    {
        ASSERT(0);
        return VIDEO_DECODER_CODEC_ERROR;
    }
    
    drv_trace0(TRACE_GROUP_8, H264HWDEC_DEINIT);
    
    VideoH264DecClose();    
    
    rH264HwDecCtrl.fgIsCodecInit = KAL_FALSE;
    rH264HwDecCtrl.fgEOF = KAL_FALSE;
    rH264HwDecCtrl.fgFrmBufferSwitch = KAL_FALSE;
    rH264HwDecCtrl.u2FrameHeight = 0;
    rH264HwDecCtrl.u2FrameWidth = 0;  
    rH264HwDecCtrl.u4BufferSize = 0;
    rH264HwDecCtrl.u4BitRate = 0;
    rH264HwDecCtrl.u4FrameRate = 0;
    rH264HwDecCtrl.u4OutRIdx = 0;
    rH264HwDecCtrl.u4OutWIdx = 0;

    if (rH264HwDecCtrl.u4ExtMemAddr)
    {
        VideoDecoderFree((void *)rH264HwDecCtrl.u4ExtMemAddr);    
        rH264HwDecCtrl.u4ExtMemAddr = 0;
    }

    return VIDEO_DECODER_CODEC_ERROR_NONE;
}
Exemplo n.º 9
0
/*
* FUNCTION                                                            
*   e_compass_start_cali
*
* DESCRIPTION                                                           
*       This function is to start calibration
*
* CALLS  
*
* PARAMETERS
*   None
*	
* RETURNS
*   None
*/
void e_compass_sensor_start_cali(void)
{
    drv_trace0(TRACE_GROUP_10, EC_CALIBRATION_START);
    e_compass_enable_driver(KAL_FALSE);
    e_compass_sensor_data.cali_state = E_COMPASS_SENSOR_START_CALI;
    e_compass_enable_driver(KAL_TRUE);
}
Exemplo n.º 10
0
/*
* FUNCTION
*	   bmt_stop_stoptimer
*
* DESCRIPTION                                                           
*   	This function is to stop the bmt_stop timer in bmt task.
*
* CALLS  
*
* PARAMETERS
*	   None
*	
* RETURNS
*	   None
*
* GLOBALS AFFECTED
*     None
*/
void bmt_stop_stoptimer(void)
{
   #ifdef BMT_KAL_DEBUG    
   	kal_trace(TRACE_FUNC, BMT_STOP_TIMER_STOP_TRC);
   #endif 	
	drv_trace0(TRACE_GROUP_10, BMT_STOP_TIMER_STOP_TRC);
	stack_stop_timer(timer_stopcharge);
}
Exemplo n.º 11
0
/*
* FUNCTION
*	   bmt_set_guardtimer
*
* DESCRIPTION                                                           
*   	This function is to initialize the bmt_stop timer in bmt task.
*
* CALLS  
*
* PARAMETERS
*	   tick: timer tick(1 tick=4.615ms)
*	
* RETURNS
*	   None
*
* GLOBALS AFFECTED
*     None
*/
void bmt_set_guardtimer(kal_uint32 tick)
{
   #ifdef BMT_KAL_DEBUG   
	   kal_trace(TRACE_FUNC, BMT_STOP_TIMER_START_TRC);
   #endif	
	drv_trace0(TRACE_GROUP_10, BMT_STOP_TIMER_START_TRC);
	stack_start_timer(timer_guardcharge, 0, tick);
}
Exemplo n.º 12
0
/*************************************************************************
* FUNCTION
*   e_compass_sensor_manual_init
*
* DESCRIPTION
*   This function is to configure sensor middleware manually, end user must keep handset horizontal.
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
void e_compass_sensor_manual_init(void)
{
    drv_trace0(TRACE_GROUP_10, EC_MIDDLEWARE_MANUAL_INIT);
    e_compass_enable_driver(KAL_FALSE);
    /* sensor middleware init */
    e_compass_sensor_custom_fp->ec_middleware_init();
    e_compass_enable_driver(KAL_TRUE);
}
Exemplo n.º 13
0
static void bmt_top_off_timer_callback(void* msg_ptr)
{
	 drv_trace0(TRACE_GROUP_10, BMT_TOP_OFF_TIMER_EXPIRE_TRC);

	 bmt_event_scheduler_id[BMT_TOP_OFF_TIMER] = 0;	
	 
	 bmt_CtrlCharge((kal_uint8)KAL_TRUE);
	 BMT.bat_state = CHR_BATFULL;
	 bmt_stop_timer(BMT_STOP_CHARGE_TIMER);
	 bmt_stop_timer(BMT_CHARGE_TIMEOUT_TIMER);

 	 bmt_set_timer(BMT_STOP_CHARGE_TIMER,STOPTIMER_TIMEOUT_TICK);
	 bmt_sendMes2UEM(BMT_CHARGE_COMPLETE);
	 drv_trace0(TRACE_GROUP_10, BMT_CHR_BATFULL_CHANGE_TRC);

	 bmt_timer_config(bmt_charging_para.TOPOFF_TON*CHARGING_TIME_UNIT);
}
Exemplo n.º 14
0
static void bmt_stop_charge_timer_callback(void* msg_ptr)
{
	 drv_trace0(TRACE_GROUP_10, BMT_STOP_TIMER_EXPIRE_TRC);

	 bmt_event_scheduler_id[BMT_STOP_CHARGE_TIMER] = 0;	
	 
     bmt_ChrStop();

	 bmt_enable_sleepmode(KAL_TRUE);
}
VIDEO_ENCODER_CODEC_ERROR_T MPEG4HWEncDeInit(void)
{
    VIDEO_ENCODER_CODEC_ERROR_T eRet = VIDEO_ENCODER_CODEC_ERROR_NONE;

    _MPEG4HWEncControlDeInit();

    drv_trace0(TRACE_GROUP_10, MPEG4HWENC_DEINIT);

    return eRet;
}
Exemplo n.º 16
0
/*
* FUNCTION                                                            
*   e_compass_sensor_cancel_cali
*
* DESCRIPTION                                                           
*       This function is to cancel calibration
*
* CALLS  
*
* PARAMETERS
*   None
*	
* RETURNS
*   None
*/
void e_compass_sensor_cancel_cali(void)
{
    drv_trace0(TRACE_GROUP_10, EC_CALIBRATION_ABORT);
    e_compass_enable_driver(KAL_FALSE);
    /* end user cancel calibration */
    if (E_COMPASS_SENSOR_START_CALI == e_compass_sensor_data.cali_state)
    {
        /* calibration is on-going, we can cancel */
        e_compass_sensor_data.cali_state = E_COMPASS_SENSOR_CALI_ABORTED;
    }
    /* else we do nothing. Driver might have finished calibration */

    e_compass_enable_driver(KAL_TRUE);
} 
MEDIA_STATUS_CODE VideoH264DecClose(void)
{
    drv_trace0(TRACE_GROUP_10,OPEN_API_ENTERVIDEOH264DECCLOSE);
    VideoH264DecOutputPic((kal_uint32)H264SW_OPENAPI_EOF);

    if ( rH264SwCtrl.fgIsCodecInit == KAL_TRUE )
    {
        drv_trace0(TRACE_GROUP_8, H264DEC_DEINIT);
        H264SwDecRelease(rH264SwCtrl.prH264DecInst);
    }

    drv_trace0(TRACE_GROUP_8, H264DEC_CLOSE);
    if (rH264SwCtrl.pAdmId)
    {
        kal_adm_delete(rH264SwCtrl.pAdmId);
        rH264SwCtrl.pAdmId = NULL;
    }
    rH264SwCtrl.fgBsBufferCacheable = KAL_FALSE;
    rH264SwCtrl.fgFrmBufferCacheable = KAL_FALSE;
    rH264SwCtrl.fgFrmBufferSwitch = KAL_FALSE;
    rH264SwCtrl.fgIsCodecInit = KAL_FALSE;
    rH264SwCtrl.u2FrameHeight = 0;
    rH264SwCtrl.u2FrameWidth = 0;
    rH264SwCtrl.u2RealHeight = 0;
    rH264SwCtrl.u2RealWidth = 0;
    rH264SwCtrl.u4BufferSize = 0;
    rH264SwCtrl.pfnSetFrameUnReference = NULL;
    rH264SwCtrl.pfnOutputOneFrame = NULL;
    rH264SwCtrl.pfnGetYUVBuffer = NULL;

#if defined(__MTK_TARGET__)
#if defined(MT6236) || defined(MT6236B)
    DCM_Unload(DYNAMIC_CODE_264DEC_S);
#endif
#endif
    return MEDIA_STATUS_OK;
}
Exemplo n.º 18
0
/* clear tx isr buffer */
void USB2UART_Clear_Tx_ISR_Buffer(void)
{
    kal_uint32 savedMask;


    drv_trace0(TRACE_FUNC, USBACM_CLEAR_TX_ISR_BUF);
//	kal_prompt_trace(MOD_USB, "clrTxISR");


    savedMask = SaveAndSetIRQMask();
    USB2UARTPort.Tx_Buffer_ISR.Write = 0;
    USB2UARTPort.Tx_Buffer_ISR.Read = 0;
    USB_Stop_DMA_Channel(g_UsbACM.txpipe->byEP, USB_TX_EP_TYPE);
    RestoreIRQMask(savedMask);
}
Exemplo n.º 19
0
/*
* FUNCTION
*	   bmt_charge_end
*
* DESCRIPTION                                                           
*   	This function is to stop charging when charger is plugged out 
*     or serious error in charging stage.
*
* CALLS  
*
* PARAMETERS
*	   None
*	
* RETURNS
*	   None
*
* GLOBALS AFFECTED
*     None
*/
void bmt_charge_end(void)
{
#if defined(__EVB__) && defined(__MTK_INTERNAL__)
/* under construction !*/
#elif defined(__DRV_BMT_NO_CHARGING__)
   return;
#else//#if defined(__EVB__)
    DCL_STATUS adc_status;
//#ifdef __DRV_BMT_SW_POLLING_CHARGER_OV__
//	kal_cancel_timer(bmt_sw_polling_timerId);
//#endif //#ifdef __DRV_BMT_SW_POLLING_CHARGER_OV__

#if defined(__DRV_BMT_ULTRA_LOW_COST_CHARGER__)
	bmt_chr_force_enable(KAL_FALSE);
#endif
	BMT.pmictrl_state = PMIC_CHARGEOFF;
   	BMT.VBAT_UEM= VBAT_UEM_CHR_OUT_FIRST;
	BMT_Charge(KAL_FALSE);
		adc_status = DclSADC_Control(bmt_adc_handle, ADC_CMD_STOP_MEASURE, NULL);
		if(adc_status != STATUS_OK)
		{
			ASSERT(0);
		}

	bmt_stop_stoptimer();
	stack_stop_timer(&ChargeTimeout_timer);
#ifdef __BMT_CHARGE_GUARD_TIME__
	bmt_stop_guardtimer();
#endif
#if defined(__DRV_BMT_ESTIMATIVE_TIMER_ON_TOPOFF__)
	bmt_stop_estimativetimer();
#endif //#if defined(__DRV_BMT_ESTIMATIVE_TIMER_ON_TOPOFF__)
	drv_trace1(TRACE_GROUP_10, BMT_SAFETY_TIMER_STOP_TRC, BMT_TOTAL_CHARGE_TIME);
   SaftyTimer_Flag = BMT_SAFETY_TIMER_OFF; 
//   #ifdef MTK_SLEEP_ENABLE
//   L1SM_SleepEnable(bmt_sm_handle);
//   #endif

	bmt_enable_sleepmode(KAL_TRUE);
   
   #if defined(PMIC_CHARGE_WDT)  // Defined in pmic_features.h
   bmt_charge_enable_wdt(KAL_FALSE);
   #endif // #if defined(PMIC_CHARGE_WDT)
   
   drv_trace0(TRACE_GROUP_10, BMT_CHARGING_END_TRC);
 //  DclSADC_Close(adc_handle);
#endif//#if defined(__EVB__)
}
Exemplo n.º 20
0
/*
* FUNCTION
*		bmt_ChrStop
*
* DESCRIPTION																			  
*		This function is called if charge is complete and run after 30 min
*
* CALLS  
*
* PARAMETERS
*		None
*	
* RETURNS
*		None
*
*/
static void bmt_ChrStop(void)  /*30 min*/
{
	DCL_STATUS adc_status;
	drv_trace0(TRACE_STATE, BMT_MEASURE_STOP_TRC);
	bmt_CtrlCharge((kal_uint8)KAL_FALSE);	//Stop Charge!!
	BMT.highfull = 1;
	
	adc_status = DclSADC_Control(bmt_adc_handle, ADC_CMD_STOP_MEASURE, NULL);
	if(adc_status != STATUS_OK)
	{
		ASSERT(0);
	}
	
	bmt_timer_config(bmt_charging_para.BATFULL_TOFF*CHARGING_TIME_UNIT);

}
VIDEO_ENCODER_CODEC_ERROR_T MPEG4HWEncClose(void)
{
    VIDEO_ENCODER_CODEC_ERROR_T eRet = VIDEO_ENCODER_CODEC_ERROR_NONE;
    MPEG4_ENCORE_MEM_INFO *rMPEG4Mem = &rMPEG4HWEncCtrl.rMPEG4Mem;

    ASSERT(rpMPEG4HWEncDriver);

    rpMPEG4HWEncDriver->close();

    VideoEncoderFreeAligned(rMPEG4Mem->ext_mem_addr);
    VideoEncoderFreeAligned(rMPEG4Mem->res_mem_addr);

    drv_trace0(TRACE_GROUP_10, MPEG4HWENC_CLOSE);

    return eRet;
}
Exemplo n.º 22
0
/*
* FUNCTION
*		bmt_CtrlCharge
*
* DESCRIPTION																			  
*		This function is called to control the SW of charge
*
* CALLS  
*
* PARAMETERS
*		ON: 1, charge on	  0, charge off
*	  VBAT: the measured voltage of battery.
*	
* RETURNS
*		None
*
* GLOBALS AFFECTED
*	  None
*/
void bmt_CtrlCharge(kal_uint8 ON)
{
	kal_bool chr_enable;
	kal_bool ChrCtrl;

    drv_trace1(TRACE_GROUP_1, BMT_CTRL_CHARGE_TRC, ON);

	// If bat_state is HOLD, we do NOT enable chr_en
	if ( (BMT.bat_state == CHR_HOLD) || (BMT.bat_state == CHR_ERROR) )
	{
		BMT.pmictrl_state = PMIC_CHARGEOFF;

		chr_enable = KAL_FALSE;
		bmt_charging_control_handler(BMT_CHARGING_CMD_CHARGING_ENABLE, &chr_enable);

		return;
	}

	if ((kal_bool)ON == KAL_TRUE)
	{
		if (BMT.pmictrl_state == PMIC_CHARGEOFF)
		{      
			BMT.pmictrl_state = PMIC_CHARGEON;

			// Fast plug in/out may cause HW disable current level, but SW do not receive interrupt.
			// Under such scenario the current level will incorrect.
			// Enforce set correct current level every time charge ON.
     		bmt_set_chr_current();
     
			ChrCtrl = KAL_TRUE;
			bmt_charging_control_handler(BMT_CHARGING_CMD_CHARGING_ENABLE, &ChrCtrl);
		}
		else
		{
			bmt_charging_control_handler(BMT_CHARGING_CMD_WDT_CLEAR,NULL);
   	 		drv_trace0(TRACE_GROUP_6, BMT_CHARGING_ALREADY_ON_TRC);
      	}
	}
	else
	{
		BMT.pmictrl_state = PMIC_CHARGEOFF;
		ChrCtrl = KAL_FALSE;

		bmt_charging_control_handler(BMT_CHARGING_CMD_CHARGING_ENABLE, &ChrCtrl);
	}
}
void ctp_cypress_cy8ctma340_power(kal_bool ON)
{
	static kal_bool power_status = KAL_FALSE;
	kal_bool sleep, wakeup;
	
	if(ON == power_status) //do not turn on/off pmu ldo again.
		return;
	power_status = ON;
	
	if(gpio_ctp_power_enable_pin != 0xFF)
	{
		DclGPIO_Control(ctp_gpio_power_handle, GPIO_CMD_SET_MODE_0, NULL);
		DclGPIO_Control(ctp_gpio_power_handle, GPIO_CMD_SET_DIR_OUT, NULL);
	}
	if(gpio_ctp_reset_pin != 0xFF)
	{
		DclGPIO_Control(ctp_gpio_reset_handle, GPIO_CMD_SET_MODE_0, NULL);
		DclGPIO_Control(ctp_gpio_reset_handle, GPIO_CMD_SET_DIR_OUT, NULL);
	}
	if(ON)
	{
		wakeup = CTP_I2C_write_byte(HST_MODE_ADDR, HST_MODE_NORMAL); //toggle the controller.
		if(gpio_ctp_power_enable_pin != 0xFF)
			DclGPIO_Control(ctp_gpio_power_handle, GPIO_CMD_WRITE_HIGH, NULL);
		ctp_i2c_udelay(1000);
		if(gpio_ctp_reset_pin != 0xFF)
			DclGPIO_Control(ctp_gpio_reset_handle, GPIO_CMD_WRITE_LOW, NULL);
		ctp_i2c_udelay(10000);
		if(gpio_ctp_reset_pin != 0xFF)
			DclGPIO_Control(ctp_gpio_reset_handle, GPIO_CMD_WRITE_HIGH, NULL);
		drv_trace2(TRACE_GROUP_10, CTP_CAPACITIVE_POWER, ON, wakeup);
	}
	else
	{
		sleep = CTP_I2C_write_byte(HST_MODE_ADDR, HST_MODE_DEEP_SLEEP); //toggle the controller.
		drv_trace2(TRACE_GROUP_10, CTP_CAPACITIVE_POWER, ON, sleep);
		if(!sleep)
		{
			if(gpio_ctp_power_enable_pin != 0xFF)
				DclGPIO_Control(ctp_gpio_power_handle, GPIO_CMD_WRITE_LOW, NULL);
			drv_trace0(TRACE_GROUP_10, CTP_CAPACITIVE_POWER_DOWN);
		}
	}
	ctp_i2c_power_on(ON, CTP_I2C_LDO, 0);
}
kal_bool ctp_cypress_cy8ctma340_get_data(TouchPanelMultipleEventStruct *tpes)
{
	kal_bool i2c_ret;
	kal_uint8 reg[2];
	kal_uint32 model = 0;

	ASSERT(tpes);
		
	tpes->time_stamp = (kal_uint16)L1I_GetTimeStamp();
	tpes->padding = CTP_PATTERN;
	
	i2c_ret = CTP_I2C_read(TT_MODE_ADDR, reg, 2);
	if(i2c_ret == KAL_FALSE)
	{
		ctp_cypress_cy8ctma340_toggle();
		return KAL_FALSE;
	}	
	if(reg[0] & TT_MODE_BUFFER_INVALID)
	{
		drv_trace0(TRACE_GROUP_10, CTP_CAPACITIVE_GET_DATA_INVALID);
		ctp_cypress_cy8ctma340_toggle();
		return KAL_FALSE;
	}

	model = (kal_uint32)(reg[1] & TT_STAT_NUMBER_TOUCH);
		
	drv_trace1(TRACE_GROUP_10, CTP_CAPACITIVE_MODEL, model);
	if(model > 4) //cypress only support 4 fingers
	{
		ctp_cypress_cy8ctma340_toggle();
		return KAL_FALSE;
	}

	tpes->model = (kal_uint16)model;  //read out all touch points coordinates.
	if(model == 0)
	{
		ctp_cypress_cy8ctma340_toggle();
		return KAL_FALSE;
	}

	ctp_read_all_point(tpes, model);
	ctp_cypress_cy8ctma340_toggle();
	return KAL_TRUE;
}
Exemplo n.º 25
0
/*************************************************************************
* FUNCTION
*   e_compass_sensor_power_on
*
* DESCRIPTION
*   This function is to turn on sensor
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
void e_compass_sensor_power_on(void)
{
    static kal_bool is_middleware_init = KAL_FALSE;

    drv_trace0(TRACE_GROUP_10, EC_CALIBRATION_POWERON);

    if (KAL_FALSE == is_middleware_init)
    {
        /* we just need to initialize middleware once */
        e_compass_sensor_custom_fp->ec_init_calibrated_data(&e_compass_calibrated_data);
        is_middleware_init = KAL_TRUE;
    }

    e_compass_sensor_custom_fp->ec_turn_on(1);
    /* we start timer, after timer expired, it will invoke e_compass_sensor_power_on_callback
       because sensor need some time to be ready after power on */
    kal_set_timer(e_compass_power_on_timer_id,(kal_timer_func_ptr)e_compass_sensor_power_on_callback,NULL,
                  e_compass_sensor_custom_dp->poweron_delay,0);
}
Exemplo n.º 26
0
void bmt_sw_polling_ov(void *timer_param)
{

	PMU_CTRL_CHR_GET_VCDT_HV_DET chr_hv_det;
		
	DclPMU_Control(bmt_PmuHandler, CHR_GET_VCDT_HV_DET, (DCL_CTRL_DATA_T *)&chr_hv_det);

	if (chr_hv_det.HV_deteted)
	{
		drv_trace0(TRACE_GROUP_10, BMT_SW_POLLING_CHARGER_OV_TRC);
		BMT_Charge(KAL_FALSE);
	}
	else
	{	
		DclPMU_Control(bmt_PmuHandler, CHR_SET_WDT_CLEAR, NULL);
	}	

	kal_set_timer(bmt_sw_polling_timerId, (kal_timer_func_ptr)bmt_sw_polling_ov, NULL,43 ,	0); //200ms
}
Exemplo n.º 27
0
static void bmt_sw_polling_charger_ov(void *timer_param)
{
	DCL_BOOL  charge_en = KAL_FALSE;
	DCL_BOOL  hv_status;

	bmt_charging_control_handler(BMT_CHARGING_CMD_GET_HV_STATUS, &hv_status);		
	
	if (DCL_TRUE == hv_status)
	{
		bmt_charging_control_handler(BMT_CHARGING_CMD_CHARGING_ENABLE, &charge_en);
		drv_trace0(TRACE_GROUP_10, BMT_SW_POLLING_CHARGER_OV_TRC);
	}
	else
	{	
		bmt_charging_control_handler(BMT_CHARGING_CMD_WDT_CLEAR,NULL);
	}	

	kal_set_timer(bmt_sw_polling_timerId, (kal_timer_func_ptr)bmt_sw_polling_charger_ov, NULL, KAL_TICKS_200_MSEC ,	0);
}
VIDEO_DECODER_CODEC_ERROR_T H264HwDecoderOpenAdapt(void)
{        
    OPEN_API_MEM_INFO_T rMem;
    
    drv_trace0(TRACE_GROUP_8, H264HWDEC_OPEN);

    VideoH264DecGetParam(OPEN_API_PARAM_MEM_INFO, &rMem, sizeof(OPEN_API_MEM_INFO_T));

    rH264HwDecCtrl.fgBsBufferCacheable = (rMem.isBsCacheable == 1) ? KAL_TRUE : KAL_FALSE;
    rH264HwDecCtrl.fgFrmBufferCacheable = (rMem.isFrameCacheable == 1) ? KAL_TRUE : KAL_FALSE;        
    if (VideoDecoderCheckIntBuffer() != KAL_TRUE)
    {
        rH264HwDecCtrl.u4IntMemOriginalAddr = (kal_uint32)VideoDecoderMalloc(rMem.u4IntMemSize + CPU_CACHE_LINE_SIZE*2);
        if (rH264HwDecCtrl.u4IntMemOriginalAddr == 0)
        {
            ASSERT(0);
        }
        rH264HwDecCtrl.fgExtMemReplaceIntMem = KAL_TRUE;
        rH264HwDecCtrl.u4IntMemAlignSize = H264_HW_ROUND_UP_TO_POWER_OF_TWO(rMem.u4IntMemSize, CPU_CACHE_LINE_SIZE);
        rH264HwDecCtrl.u4IntMemAddr = H264_HW_ROUND_UP_TO_POWER_OF_TWO(rH264HwDecCtrl.u4IntMemOriginalAddr, CPU_CACHE_LINE_SIZE);
        
        /* Should switch to non-cache */
        if (VideoCommIsExtBufferCacheable((kal_uint32)rH264HwDecCtrl.u4IntMemAddr, rH264HwDecCtrl.u4IntMemAlignSize) == KAL_FALSE)
        {
            /* External memory allocated from common part is NON-CACHEABLE */
            rH264HwDecCtrl.fgExtMemReplaceIntMemSwitch = KAL_FALSE;
        }
        else
        {
            rH264HwDecCtrl.fgExtMemReplaceIntMemSwitch = KAL_TRUE;
            rH264HwDecCtrl.u4IntMemAddr = VideoCommExtBufferCacheableSwitch(rH264HwDecCtrl.u4IntMemAddr, 
                                                                                                                                rH264HwDecCtrl.u4IntMemAlignSize, VIDEO_NON_CACHEABLE);
        }
    }
    else
    {
        rH264HwDecCtrl.u4IntMemAddr = VideoDecoderIntBuffer(rMem.u4IntMemSize);
        rH264HwDecCtrl.fgExtMemReplaceIntMem = KAL_FALSE;
    }

    return VIDEO_DECODER_CODEC_ERROR_NONE;
}
VIDEO_ENCODER_CODEC_ERROR_T MPEG4HWEncInit(void)
{
    CUSTOM_VENC_ERROR_T ret;
    kal_uint32 u4val;

    _MPEG4HWEncControlInit();

    ASSERT(rpMPEG4HWEncDriver);
    ASSERT(rMPEG4HWEncCtrl.u4FrameRate);

    ret = CustomVenc_Ctrl(CUSTOM_VENC_OP_GET_BIT_RATE, NULL, 0, &u4val, sizeof(kal_uint32));
    ASSERT(ret == CUSTOM_VENC_ERROR_NONE);
    MPEG4HWEncSetParameter(VENC_PARAM_BITRATE, &u4val);

    rpMPEG4HWEncDriver->init();

    drv_trace0(TRACE_GROUP_10, MPEG4HWENC_INIT);

    return VIDEO_ENCODER_CODEC_ERROR_NONE;
}
/* Note that this is called periodically when ms is active */
void USB_Host_Ms_State_Main(kal_uint8 ms_index)
{
	kal_bool result;
//	SGPT_CTRL_START_T start;

	if(g_UsbHostMs[ms_index].dev_attatch == KAL_TRUE)
	{
		result = USB_Host_Ms_Check_All_Media(ms_index);	
	}
	else
	{
		result = KAL_FALSE;
		USB_Dbg_Trace(USB_HOST_MS_STATE_MAIN_FALSE, 0, 0);
	}

	drv_trace1(TRACE_FUNC, (kal_uint32)USB_HOST_MS_CHECK_MEDIA_STATE, g_UsbHostMs[ms_index].media_state_change);
	USB_Dbg_Trace(USB_HOST_MS_REPORT_MEDIA_STATE,  g_UsbHostMs[ms_index].media_state_change, (kal_uint32)g_UsbHostMs[ms_index].b_sending_change_ilm);

	if(result == KAL_TRUE)
	{
		if((g_UsbHostMs[ms_index].media_state_change != 0)&&(g_UsbHostMs[ms_index].b_sending_change_ilm == KAL_FALSE))
		{
			/* Send message to FMT task about card state change */
			USB_Host_Ms_Check_Media_State(ms_index);
		}

		/* start timer to start query device state */
		USB_GPTI_StartItem(g_UsbHostMs[ms_index].gpt_handle, USB_HOST_MS_QUERY_PERIOD,USB_Host_Ms_State_Timeout, &g_UsbHostMs[ms_index]);
//		start.u2Tick =USB_HOST_MS_QUERY_PERIOD;
//		start.pfCallback = USB_Host_Ms_State_Timeout;
//		start.vPara = &g_UsbHostMs[ms_index];
//		DclSGPT_Control((DCL_HANDLE)(g_UsbHostMs[ms_index].gpt_handle), SGPT_CMD_START, (DCL_CTRL_DATA_T*)&start);			
	}
	else
	{
		drv_trace0(TRACE_FUNC, (kal_uint32)USB_HOST_MS_STATE_MAIN_FAIL);
	}
}