/***************************************************************************** * FUNCTION * avk_pluto_timer_case_test_suspend_resume * DESCRIPTION * Test suspend / resume timer function * PARAMETERS * void * RETURNS * void *****************************************************************************/ AVK_ASYN_CASE(AVK_PLUTO_TIMER_CASE_TEST_SUSPEND_RESUME, AVK_PLUTO_TIMER) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ kal_get_time((kal_uint32 *)&g_avk_pluto_timer_ctx.start_time); StartTimerEx(AVK_PLUTO_TIMER_TEST_BASE, AVK_PLUTO_TIMER_TIMEOUT_MS_1000, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_SUSPEND_RESUME); StartTimerEx(AVK_PLUTO_TIMER_TEST_BASE + 1, AVK_PLUTO_TIMER_TIMEOUT_MS_200, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_SUSPEND_DO); /* * the name of test_suspend_resume_timer is a dummy function name * just use this name to indicate test suspend / resume timer */ AVK_LOG_FUN_ASYN(test_suspend_resume_timer); }
/***************************************************************************** * FUNCTION * avk_pluto_timer_case_test_exist * DESCRIPTION * Test IsMyTimerExist function * PARAMETERS * void * RETURNS * void *****************************************************************************/ AVK_CASE(AVK_PLUTO_TIMER_CASE_TEST_EXIST, AVK_PLUTO_TIMER) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MMI_BOOL ret; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ ret = IsMyTimerExist(AVK_PLUTO_TIMER_TEST_BASE); MMI_ASSERT(ret == MMI_FALSE); StartTimerEx(AVK_PLUTO_TIMER_TEST_BASE, AVK_PLUTO_TIMER_TIMEOUT_MS_2000, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_EXIST); ret = IsMyTimerExist(AVK_PLUTO_TIMER_TEST_BASE); MMI_ASSERT(ret == MMI_TRUE); StopTimer(AVK_PLUTO_TIMER_TEST_BASE); ret = IsMyTimerExist(AVK_PLUTO_TIMER_TEST_BASE); MMI_ASSERT(ret == MMI_FALSE); AVK_LOG_FUN(IsMyTimerExist, AVK_PASS); }
/***************************************************************************** * FUNCTION * avk_pluto_timer_case_test_stop * DESCRIPTION * Test StopTimer Function * PARAMETERS * void * RETURNS * void *****************************************************************************/ AVK_ASYN_CASE(AVK_PLUTO_TIMER_CASE_TEST_STOP, AVK_PLUTO_TIMER) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ StartTimerEx(AVK_PLUTO_TIMER_TEST_BASE, AVK_PLUTO_TIMER_TIMEOUT_MS_100, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_STOP); StartTimerEx(AVK_PLUTO_TIMER_TEST_BASE + 1, AVK_PLUTO_TIMER_TIMEOUT_MS_1000, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_STOP_DO); AVK_LOG_FUN_ASYN(StopTimer); }
/***************************************************************************** * FUNCTION * avk_pluto_timer_case_test_start * DESCRIPTION * Test StartTimer Function * PARAMETERS * void * RETURNS * void *****************************************************************************/ AVK_ASYN_CASE(AVK_PLUTO_TIMER_CASE_TEST_START, AVK_PLUTO_TIMER) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ kal_get_time((kal_uint32 *)&g_avk_pluto_timer_ctx.start_time); StartTimerEx(AVK_PLUTO_TIMER_TEST_BASE, AVK_PLUTO_TIMER_TIMEOUT_MS_100, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_START); AVK_LOG_FUN_ASYN(StartTimerEx); }
/***************************************************************************** * FUNCTION * mmi_da_wps_recv_dl_progress_ind * DESCRIPTION * Handler function: To handle "progress indication". We will save status, sequence number, and total size to oma_context * PARAMETERS * Message * RETURNS * void *****************************************************************************/ static void mmi_da_wps_recv_dl_progress_ind(void *MsgStruct) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ wps_dl_progress_ind_struct *p = (wps_dl_progress_ind_struct *) MsgStruct; mmi_da_wps_session *s; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ DA_WPS_TRACE(MMI_DA_WPS_TRACE_GROUP, MMI_DA_OMA_RECV_DL_PROGRESS_IND, p->seq_num, p->acc_size); ASSERT(DA_WPS_VALID_ID(p->request_id)); s = da_wps_context.session_table[p->request_id - MMI_DA_WPS_REQUEST_ID_BASE]; switch(s->state) { case MMI_DA_WPS_SESSION_STATE_ABORT_ING: return; case MMI_DA_WPS_SESSION_STATE_HTTP_REQUEST: break; default: ASSERT(0); return; } #if defined(MMI_DA_WPS_SLOW_BG_DL_SUPPORT) { ASSERT(MMI_DA_WPS_TIMER_END > s->request_id); /* in Slow mode, we start a timer to send response to WPS */ s->seq_num = p->seq_num; StartTimerEx((U16)(MMI_DA_WPS_TIMER_1 + s->request_id), 10, _mmi_da_wps_timer_handler, (void*)s->request_id); } #else { mmi_da_wps_send_dl_progress_res(s->request_id, p->seq_num); } #endif switch(p->status) { case WPS_DL_STATUS_ABORT: case WPS_DL_STATUS_COMPLETE: s->state = MMI_DA_WPS_SESSION_STATE_READY; break; case WPS_DL_STATUS_DOWNLOADING: break; default: ASSERT(0); break; } s->dl_status = p->status; s->dl_progress_cb(s->arg, p->status, p->acc_size, p->cause); }
/***************************************************************************** * FUNCTION * avk_pluto_timer_test_func * DESCRIPTION * timer callback function * PARAMETERS * data :[IN] user data * RETURNS * void *****************************************************************************/ static void avk_pluto_timer_test_func(void *data) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ U32 index; U32 callback_time; U32 duration; U32 suspend_duration; MMI_RET ret; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ index = (U32)data; MMI_ASSERT(index < AVK_PLUTO_TIMER_TEST_END_OF_ENUM); switch (index) { case AVK_PLUTO_TIMER_TEST_START: /* * compute the duration from StartTimer to call test timer's callback function * the duration must be no less than the test timer's expiry */ kal_get_time((kal_uint32 *)&callback_time); duration = callback_time - g_avk_pluto_timer_ctx.start_time; MMI_ASSERT(duration >= AVK_PLUTO_TIMER_MS_TO_TICK(AVK_PLUTO_TIMER_TIMEOUT_MS_100)); StopTimer(AVK_PLUTO_TIMER_TEST_BASE); AVK_LOG(AVK_PLUTO_TIMER_TEST_START); AVK_CASE_RESULT(AVK_PASS); AVK_ASYN_DONE(); break; case AVK_PLUTO_TIMER_TEST_STOP: /* increase the counter and restart the test timer periodicly */ g_avk_pluto_timer_ctx.excute_count++; StartTimerEx(AVK_PLUTO_TIMER_TEST_BASE, AVK_PLUTO_TIMER_TIMEOUT_MS_100, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_STOP); break; case AVK_PLUTO_TIMER_TEST_STOP_DO: /* * record the counter and do StopTimer * start another timer with expiry 500ms to check whether the test one stop */ g_avk_pluto_timer_ctx.excute_count_backup = g_avk_pluto_timer_ctx.excute_count; StopTimer(AVK_PLUTO_TIMER_TEST_BASE); StartTimerEx(AVK_PLUTO_TIMER_TEST_BASE + 1, AVK_PLUTO_TIMER_TIMEOUT_MS_500, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_STOP_CHECK); AVK_LOG(AVK_PLUTO_TIMER_TEST_STOP_DO); break; case AVK_PLUTO_TIMER_TEST_STOP_CHECK: /* * if the test timer stop, the counter must be the same with the recorded one when stop timer */ MMI_ASSERT(g_avk_pluto_timer_ctx.excute_count == g_avk_pluto_timer_ctx.excute_count_backup); AVK_LOG(AVK_PLUTO_TIMER_TEST_STOP_CHECK); AVK_CASE_RESULT(AVK_PASS); AVK_ASYN_DONE(); break; case AVK_PLUTO_TIMER_TEST_SUSPEND_DO: /* * suspend aligned timers * start a non-aligned timer with expiry 1500ms to resume aligned timers */ mmi_frm_suspend_timers(TIMER_IS_ALIGNMENT); kal_get_time((kal_uint32 *)&g_avk_pluto_timer_ctx.suspend_time); ret = IsMyTimerExist(AVK_PLUTO_TIMER_TEST_BASE); MMI_ASSERT(ret == MMI_TRUE); StartNonAlignTimerEx(AVK_PLUTO_TIMER_TEST_BASE + 1, AVK_PLUTO_TIMER_TIMEOUT_MS_1500, avk_pluto_timer_test_func, (void *)AVK_PLUTO_TIMER_TEST_RESUME_DO); AVK_LOG(AVK_PLUTO_TIMER_TEST_SUSPEND_DO); break; case AVK_PLUTO_TIMER_TEST_RESUME_DO: /* resume aligned timers */ ret = IsMyTimerExist(AVK_PLUTO_TIMER_TEST_BASE); MMI_ASSERT(ret == MMI_TRUE); kal_get_time((kal_uint32 *)&g_avk_pluto_timer_ctx.resume_time); mmi_frm_resume_timers(TIMER_IS_ALIGNMENT); AVK_LOG(AVK_PLUTO_TIMER_TEST_RESUME_DO); break; case AVK_PLUTO_TIMER_TEST_SUSPEND_RESUME: /* * compute the duration from StartTimer to call test timer's callback function * and suspend duration from suspend_timers to resume_timers; * the test timer duration must be no less than test timer's expiry plus the suspended duration */ kal_get_time((kal_uint32 *)&callback_time); duration = callback_time - g_avk_pluto_timer_ctx.start_time; suspend_duration = g_avk_pluto_timer_ctx.resume_time - g_avk_pluto_timer_ctx.suspend_time; MMI_ASSERT((duration - suspend_duration) >= AVK_PLUTO_TIMER_MS_TO_TICK(AVK_PLUTO_TIMER_TIMEOUT_MS_1000)); AVK_LOG(AVK_PLUTO_TIMER_TEST_SUSPEND_RESUME); AVK_CASE_RESULT(AVK_PASS); AVK_ASYN_DONE(); break; default: break; } }