/* * 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__) }
/* * 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) { kal_uint8 index; BMT.pmictrl_state = PMIC_CHARGEOFF; BMT.VBAT_UEM= VBAT_UEM_CHR_OUT_FIRST; BMT_Charge(KAL_FALSE); for(index=0;index<BMT_MAX_CHANNEL;index++) adc_sche_remove_item(bmt_bmtid_adcscheid[index]); adc_sche_set_timer_page_align(KAL_TRUE); bmt_stop_stoptimer(); stack_stop_timer(&ChargeTimeout_timer); #ifdef BMT_KAL_DEBUG kal_trace(TRACE_FUNC, BMT_SAFETY_TIMER_STOP_TRC); #endif SaftyTimer_Flag = BMT_SaftyTimer_Off; #ifdef MTK_SLEEP_ENABLE L1SM_SleepEnable(bmt_sm_handle); #endif }