/* * 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); }
/***************************************************************************** * FUNCTION * nvram_stop_timer * DESCRIPTION * Stop schedule event * PARAMETERS * void * RETURNS * void *****************************************************************************/ void nvram_stop_timer(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ stack_stop_timer(&nvram_shadow_timer); }
/* * 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 }
/***************************************************************************** * FUNCTION * jma_audio_recorder_stop_record * DESCRIPTION * This function submit stop request to media task. * PARAMETERS * mma_type [IN] Int recorder * java_recorder [IN] * RETURNS * int - 0 *****************************************************************************/ kal_bool jma_mvm_audio_recorder_pause_record(kal_int32 vm_id, kal_int32 java_recorder) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ mdi_result ret; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ kal_trace(TRACE_GROUP_4, FUNC_J2ME_JMA_MVM_AUDIO_RECORDER_PAUSE_RECORD, vm_id, java_recorder, audio_recorder[vm_id].state); JMA_CS_ENTER(vm_id, KAL_FALSE); if (audio_recorder[vm_id].id != java_recorder) { kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_RESOURCE_ERROR, audio_recorder[vm_id].id); JMA_CS_LEAVE(KAL_FALSE); } if (vm_id != jam_mvm_get_current_vm_id()) { if (audio_recorder[vm_id].state == JAVA_MEDIA_STATE_RECORDING) { kal_trace(TRACE_GROUP_4, J2ME_MMA_STATE_TRANSITION, vm_id, audio_recorder[vm_id].state, JAVA_MEDIA_STATE_PAUSED); audio_recorder[vm_id].state = JAVA_MEDIA_STATE_PAUSED; } JMA_CS_LEAVE(KAL_TRUE); } //#ifdef __MMI_BACKGROUND_CALL__ if (jma_media_player_is_in_background_call()) { if (audio_recorder[vm_id].state == JAVA_MEDIA_STATE_RECORDING) { kal_trace(TRACE_GROUP_4, J2ME_MMA_STATE_TRANSITION, vm_id, audio_recorder[vm_id].state, JAVA_MEDIA_STATE_PAUSED); audio_recorder[vm_id].state = JAVA_MEDIA_STATE_PAUSED; } JMA_CS_LEAVE(KAL_TRUE); } //#endif /* __MMI_BACKGROUND_CALL__ */ if (audio_recorder[vm_id].state == JAVA_MEDIA_STATE_RECORDING) { ret = mdi_audio_pause(jma_audio_recorder_record_result_hdlr, NULL); if (ret == MDI_AUDIO_SUCCESS) { if (audio_recorder[vm_id].record_size_limit != -1) { kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_STACK_STOP_TIMER); stack_stop_timer(&java_media_timer); } kal_trace(TRACE_GROUP_4, J2ME_MMA_STATE_TRANSITION, vm_id, audio_recorder[vm_id].state, JAVA_MEDIA_STATE_PAUSED); audio_recorder[vm_id].state = JAVA_MEDIA_STATE_PAUSED; #ifdef __MTK_TARGET__ audio_recorder[vm_id].current_time = (long)Media_GetRecordedTime(); kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_D, audio_recorder[vm_id].current_time); #endif } else { kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_MARKER_FAIL); kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_D, ret); } JMA_CS_LEAVE(KAL_TRUE); } JMA_CS_LEAVE(KAL_TRUE); }
/***************************************************************************** * FUNCTION * jma_audio_recorder_reset * DESCRIPTION * The function erases recorded content * PARAMETERS * mma_type [IN] * java_recorder [IN] * RETURNS * int - 0 *****************************************************************************/ kal_bool jma_mvm_audio_recorder_reset(kal_int32 vm_id, kal_int32 java_recorder) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ mdi_result ret; kal_int32 file_handle; kal_int32 result; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ kal_trace(TRACE_GROUP_4, FUNC_J2ME_JMA_MVM_AUDIO_RECORDER_RESET, vm_id, java_recorder, audio_recorder[vm_id].state); JMA_CS_ENTER(vm_id, KAL_FALSE); /* find free player */ if (audio_recorder[vm_id].id != java_recorder) { kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_RESOURCE_ERROR, audio_recorder[vm_id].id); JMA_CS_LEAVE(KAL_FALSE); } if (vm_id != jam_mvm_get_current_vm_id()) { if (audio_recorder[vm_id].state == JAVA_MEDIA_STATE_RECORDING || audio_recorder[vm_id].state == JAVA_MEDIA_STATE_PAUSED) { kal_trace(TRACE_GROUP_4, J2ME_MMA_STATE_TRANSITION, vm_id, audio_recorder[vm_id].state, JAVA_MEDIA_STATE_READY); audio_recorder[vm_id].state = JAVA_MEDIA_STATE_READY; } JMA_CS_LEAVE(KAL_TRUE); } //#ifdef __MMI_BACKGROUND_CALL__ if (jma_media_player_is_in_background_call()) { if (audio_recorder[vm_id].state == JAVA_MEDIA_STATE_RECORDING || audio_recorder[vm_id].state == JAVA_MEDIA_STATE_PAUSED) { kal_trace(TRACE_GROUP_4, J2ME_MMA_STATE_TRANSITION, vm_id, audio_recorder[vm_id].state, JAVA_MEDIA_STATE_READY); audio_recorder[vm_id].state = JAVA_MEDIA_STATE_READY; } JMA_CS_LEAVE(KAL_TRUE); } //#endif /* __MMI_BACKGROUND_CALL__ */ if (audio_recorder[vm_id].state == JAVA_MEDIA_STATE_RECORDING) { if (audio_recorder[vm_id].record_size_limit != -1) { kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_STACK_STOP_TIMER); stack_stop_timer(&java_media_timer); } } if (audio_recorder[vm_id].state == JAVA_MEDIA_STATE_RECORDING || audio_recorder[vm_id].state == JAVA_MEDIA_STATE_PAUSED) { #ifdef __MTK_TARGET__ audio_recorder[vm_id].current_time = (long)Media_GetRecordedTime(); kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_D, audio_recorder[vm_id].current_time); #endif ret = mdi_audio_stop_record(); /* Delete the recorded file */ file_handle = FS_Open((kal_wchar *) audio_recorder[vm_id].filename, FS_READ_ONLY); if (file_handle > 0) /* Check if file exist */ { result = FS_Close(file_handle); /* need to close file before delete */ result = FS_Delete((kal_wchar *) audio_recorder[vm_id].filename); if (result != FS_NO_ERROR) { kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_D, result); JMA_CS_LEAVE(KAL_FALSE); } } /* Handle result */ if (ret == MDI_AUDIO_SUCCESS) { kal_trace(TRACE_GROUP_4, J2ME_MMA_STATE_TRANSITION, vm_id, audio_recorder[vm_id].state, JAVA_MEDIA_STATE_READY); audio_recorder[vm_id].state = JAVA_MEDIA_STATE_READY; JMA_CS_LEAVE(KAL_TRUE); } else { kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_MARKER_FAIL); kal_trace(TRACE_GROUP_4, INFO_J2ME_MMA_D, ret); JMA_CS_LEAVE(KAL_FALSE); } } JMA_CS_LEAVE(KAL_TRUE); }
MM_ERROR_CODE_ENUM IspJpegSensorCaptureStart(kal_uint32 JpegBufAddr) { #if (defined(ISP_SUPPORT)) #define CRZ_CTRL_REG (CRZ_base + 0x00) #define REG_CRZ_CTRL *((volatile unsigned int *)(CRZ_CTRL_REG)) volatile kal_uint32 i=0; MM_ERROR_CODE_ENUM ErrorCode = MM_ERROR_NONE; ASSERT(JpegBufAddr != NULL); SET_CAMERA_INPUT_TYPE(INPUT_BAYER); IspDoneFlag=KAL_FALSE; IspIdleDoneFlag=KAL_FALSE; DISABLE_VIEW_FINDER_MODE; ENABLE_CAMERA_ISP_DONE_INT; ENABLE_CAMERA_IDLE_INT; ENABLE_CAMERA_GMC_OVERRUN_INT; mm_enable_power(MMPWRMGR_RESZ_LB); REG_CRZ_CTRL = 0x0000; ENABLE_REZ_DISCONN; ENABLE_REZ_LPF; //ENABLE_CAMERA_JPG_INTERFACE; ENABLE_ISP_USING_RESIZER_LINE_BUFFER; SET_OUTPUT_PATH_TYPE(0); ENABLE_CAMERA_OUTPUT_TO_MEM; REG_ISP_OUTPUT_ADDR = JpegBufAddr; SET_ISP_MEM_BURST_MODE(7); DISABLE_CAMERA_INPUT_FROM_MEM; SET_CAMERA_INPUT_RATE(3); //IspReset(); //start_yuv_isp(ISP_CAPTURE_JPEG_STATE); SET_CAMERA_CAPTURE_MODE; SET_CAMERA_FRAME_RATE(0); //IspJpegCaptureStart = KAL_TRUE; ENABLE_VIEW_FINDER_MODE; /* Wait capture done */ i=0; IspWaitOneVsync(IspVsyncTimeOut250MS); while((IspIdleDoneFlag==KAL_FALSE)||(IspDoneFlag==KAL_FALSE)) { i++; kal_sleep_task(2); if(i>100) break; } //stop_yuv_isp(ISP_CAPTURE_JPEG_STATE,CAM_CAPTURE_TIME_OUT_STOP); DISABLE_VIEW_FINDER_MODE; #if 0 /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ #endif if(i<=100) { stack_stop_timer(&CalTaskStackTimer); IspJpegCaptureStart = KAL_FALSE; SendMsgToCal(MSG_ID_CAL_JPEG_SENSOR_PARSE_REQ, &JpegSensorInfo); //pfCalIspCb(CAL_CBID_AF_RESULT, &JpegSensorInfo, sizeof(CAL_JPEG_SENSOR_PARSE_REQ_MSG_STRUCT)); } else { ErrorCode = MM_ERROR_CAL_STILL_CAPTURE_TIMEOUT; } return ErrorCode; #else return MM_ERROR_SENSOR_FEATURE_NOT_SUPPORT; #endif }
/* * FUNCTION * bmt_stop_estimativetimer * * DESCRIPTION * This function is to stop the bmt_stop timer in bmt task. * * CALLS * * PARAMETERS * None * * RETURNS * None * * GLOBALS AFFECTED * None */ void bmt_stop_estimativetimer(void) { drv_trace0(TRACE_GROUP_10, BMT_STOP_TIMER_STOP_TRC); stack_stop_timer(timer_estimative); }