Example #1
0
/*
* FUNCTION
*	   bmt_charge_start
*
* DESCRIPTION                                                           
*   	This function is to start charging algorithm.
*
* CALLS  
*
* PARAMETERS
*	   None
*	
* RETURNS
*	   None
*
* GLOBALS AFFECTED
*     None
*/
void bmt_charge_start(void)
{
   kal_uint8 index;
   BMT_Charge(KAL_FALSE);
   BMT.pmictrl_state = PMIC_CHARGEOFF;
   BMT.bat_state = CHR_PRE;
   BMT.VBAT_UEM= VBAT_UEM_CHR_IN_FISRT;
   bmt_charge_time_value = 10;
   low_charger_count = 0;
   low_current_count = 0;
   low_temper_count = 0;
   over_temper_count = 0;
   
   #ifdef MTK_SLEEP_ENABLE
   L1SM_SleepDisable(bmt_sm_handle);
   #endif
   for(index=0;index<BMT_MAX_CHANNEL;index++)
   {
      adc_sche_modify_parameters(bmt_bmtid_adcscheid[index],1,1);
	   adc_sche_add_item(bmt_bmtid_adcscheid[index],bmt_measure_complete1[index], bmt_adc_sche_measure);
	}
	
	adc_sche_set_timer_page_align(KAL_FALSE);

	stack_start_timer(&ChargeTimeout_timer, 0, KAL_TICKS_1_MIN*60*6);
	#ifdef BMT_KAL_DEBUG   
	   kal_trace(TRACE_FUNC, BMT_SAFETY_TIMER_START_TRC);
	#endif   
   SaftyTimer_Flag = BMT_SaftyTimer_On; 
   #if defined(MT6318)
      #if !defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__)
   if(pmic_is_chr_det(AC_CHR))
      pmic_charging_currnet_ctrl(pmic_return_current(AC_CHR));
   #ifdef __USB_MULTI_CHARGE_CURRENT__
      else if (bmt_support_usb_charge()) /* If not support, charging current is not set here. */
         pmic_charging_currnet_ctrl(pmic_return_current(USB_CHR));   
   #else /* __USB_MULTI_CHARGE_CURRENT__ */
   else
      pmic_charging_currnet_ctrl(pmic_return_current(USB_CHR));   
   #endif /* __USB_MULTI_CHARGE_CURRENT__ */
      #else/*defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__)*/
         if(chr_usb_detect.chr_usb_present == CHARGER_PRESENT)                                   
            pmic_charging_currnet_ctrl(pmic_return_current(AC_CHR));   
         else if(chr_usb_detect.chr_usb_present == USB_PRESENT)                                                                                             
         {  
            #ifdef __USB_MULTI_CHARGE_CURRENT__
            if (bmt_support_usb_charge()) /* If not support, charging current is not set here. */
                pmic_charging_currnet_ctrl(pmic_return_current(USB_CHR));   
            #else /* __USB_MULTI_CHARGE_CURRENT__ */             
                pmic_charging_currnet_ctrl(pmic_return_current(USB_CHR));   
             #endif /* __USB_MULTI_CHARGE_CURRENT__ */
         }
      #endif   
   #endif /* defined(MT6318) */
}
Example #2
0
void usb_set_chr_current(kal_uint8 index)
{
	ASSERT(index < (USB_CHARGE_CURRENT_TABLE_SIZE - 1));
	pmic_charging_currnet_ctrl(PMIC6318_USB_CHARGE_CURRENT[index]);
	return;
}