/***************************************************************************** * 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_mytimer_start * DESCRIPTION * test mytimer start function * PARAMETERS * void * RETURNS * void *****************************************************************************/ AVK_ASYN_CASE(AVK_PLUTO_TIMER_CASE_TEST_MYTIMER_START, AVK_PLUTO_TIMER) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ kal_get_time(&g_avk_pluto_timer_ctx.start_time); avk_mytimer_start_timer(avk_mytimer_test_proc, AVK_PLUTO_TIMER_TIMEOUT_MS_100, (void *)AVK_MYTIMER_TEST_START); }
void SFSystem_GetCurrentDataTime(SFDateTime*pDataTime) { MYTIME mt; DTGetRTCTime(&mt); pDataTime->nYear=(U16)mt.nYear; pDataTime->nMonth=(U8)mt.nMonth; pDataTime->nDay=(U8)mt.nDay; pDataTime->nHour=(U8)mt.nHour; pDataTime->nMinute=(U8)mt.nMin; pDataTime->nSecond=(U8)mt.nSec; kal_get_time(&pDataTime->nMill); }
/***************************************************************************** * removed! * removed! * removed! * removed! * removed! * removed! * removed! * removed! * removed! * removed! *****************************************************************************/ void imps_custom_get_session_cookie(const char* user_id, char* session_cookie, int session_cookie_len) { kal_uint32 now = 0; int j, i; kal_get_time(&now); j = sprintf(session_cookie, "MTK%d", now); for (i = 0; user_id[i] && j < session_cookie_len - 1; i++, j++) { session_cookie[j] = user_id[i]; } session_cookie[j] = 0; }
static kal_bool usbms_read_nand( void *data, kal_uint32 LBA, kal_uint16 sec_len) { kal_int32 status; kal_int32 start_time, end_time; kal_get_time((kal_uint32 *)&start_time); status = NANDCardDrv->ReadSectors((void *)(&NANDFlashDriveData),LBA,sec_len,data); kal_get_time((kal_uint32 *)&end_time); if(status) ASSERT(0); /* record start sector and sector length for histogram statistics; record total read sectors and read time for throughput test */ read_startsec_array[(LBA%4)]++; if(sec_len < 128) read_length_array[(sec_len-1)]++; else read_length_array[127]++; total_read_sector += sec_len; total_read_time += (end_time - start_time); return KAL_TRUE; }
/***************************************************************************** * 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 * avk_mytimer_test_proc * DESCRIPTION * mytimer proc for expiry * PARAMETERS * param : [IN] user data * RETURNS * void *****************************************************************************/ static void avk_mytimer_test_proc(void *param) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ U32 index; U32 exe_time; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ index = (U32)param; switch (index) { case AVK_MYTIMER_TEST_START: kal_get_time(&exe_time); MMI_ASSERT(exe_time - g_avk_pluto_timer_ctx.start_time >= kal_milli_secs_to_ticks(AVK_PLUTO_TIMER_TIMEOUT_MS_100)); AVK_CASE_RESULT(MMI_TRUE); AVK_ASYN_DONE(); break; case AVK_MYTIMER_TEST_STOP: g_avk_pluto_timer_ctx.excute_count++; g_mytimer_test = avk_mytimer_start_timer(avk_mytimer_test_proc, AVK_PLUTO_TIMER_TIMEOUT_MS_100, (void *)AVK_MYTIMER_TEST_STOP); break; case AVK_MYTIMER_TEST_STOP_DO: g_avk_pluto_timer_ctx.excute_count_backup = g_avk_pluto_timer_ctx.excute_count; avk_mytimer_stop_timer(g_mytimer_test); g_mytimer_test = NULL; avk_mytimer_start_timer(avk_mytimer_test_proc, AVK_PLUTO_TIMER_TIMEOUT_MS_200, (void *)AVK_MYTIMER_TEST_STOP_CHECK); break; case AVK_MYTIMER_TEST_STOP_CHECK: MMI_ASSERT(g_mytimer_test == NULL && g_avk_pluto_timer_ctx.excute_count_backup == g_avk_pluto_timer_ctx.excute_count); AVK_CASE_RESULT(MMI_TRUE); AVK_ASYN_DONE(); break; default: MMI_ASSERT(0); } }
/***************************************************************************** * 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; } }
static kal_bool usbms_write_nand(void *data, kal_uint32 LBA, kal_uint16 sec_len) { kal_int32 status; kal_int32 start_time, end_time; //status = NANDCardDrv->WriteSectors((void *)(&NANDFlashDriveData),LBA,sec_len,data); /* prevent USB to write sector 0 */ if(LBA==0) return KAL_TRUE; else { kal_get_time((kal_uint32 *)&start_time); status = NANDCardDrv->WriteSectors((void *)(&NANDFlashDriveData),LBA,sec_len,data); kal_get_time((kal_uint32 *)&end_time); } /* prevent USB to write sector 0 and sector 1 */ #if 0 /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ #endif if(status) ASSERT(0); /* record start sector and sector length for histogram statistics; record total write sectors and write time for throughput test */ write_startsec_array[(LBA%4)]++; if(sec_len < 128) write_length_array[(sec_len-1)]++; else write_length_array[127]++; total_write_sector += sec_len; total_write_time += (end_time - start_time); return KAL_TRUE; }