UINT32 mt65xx_disp_get_lcd_time(void) { #if 0 UINT32 time0, time1, lcd_time; mt65xx_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); LCD_CHECK_RET(LCD_WaitForNotBusy()); time0 = gpt4_tick2time_us(gpt4_get_current_tick()); LCD_CHECK_RET(LCD_StartTransfer(FALSE)); if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode==CMD_MODE) { DSI_clk_HS_mode(1); DSI_CHECK_RET(DSI_EnableClk()); } else if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode!=CMD_MODE) { DSI_clk_HS_mode(1); DPI_CHECK_RET(DPI_EnableClk()); DSI_CHECK_RET(DSI_EnableClk()); } LCD_CHECK_RET(LCD_WaitForNotBusy()); time1 = gpt4_tick2time_us(gpt4_get_current_tick()); lcd_time = time1 - time0; printf("lcd one %d \n", lcd_time); if(0 != lcd_time) return (100000000/lcd_time); else #endif return (6000); }
bool gpt4_timeout_tick (U32 start_tick, U32 timeout_tick) { register U32 cur_tick; register U32 elapse_tick; // get current tick cur_tick = gpt4_get_current_tick (); // check elapse time if (start_tick <= cur_tick) { elapse_tick = cur_tick - start_tick; } else { elapse_tick = (GPT4_MAX_TICK_CNT - start_tick) + cur_tick; } // check if timeout if (timeout_tick <= elapse_tick) { // timeout return TRUE; } return FALSE; }
void reset_timer_masked (void) { register U32 cur_tick; // get current tick cur_tick = gpt4_get_current_tick (); lastinc = gpt4_tick2time_ms (cur_tick); timestamp = 0; }
UINT32 mt_disp_get_lcd_time(void) { UINT32 time0, time1, lcd_time; mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); if(lcm_params->type==LCM_TYPE_DPI) DPI_WaitVsync(); else if(lcm_params->type==LCM_TYPE_DBI) LCD_WaitForNotBusy(); else if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode!=CMD_MODE) { DSI_WaitVsync(); DSI_WaitVsync(); } time0 = gpt4_tick2time_us(gpt4_get_current_tick()); if(lcm_params->type==LCM_TYPE_DPI) DPI_WaitVsync(); else if(lcm_params->type==LCM_TYPE_DBI){ mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); LCD_WaitForNotBusy(); } else{//DSI if(lcm_params->dsi.mode!=CMD_MODE) DSI_WaitVsync(); else DSI_StartTransfer(TRUE); // DSI_WaitBtaTE(); } time1 = gpt4_tick2time_us(gpt4_get_current_tick()); lcd_time = time1 - time0; printf("Screen Update Costs %d us\n", lcd_time); mt_disp_adjusting_hardware_addr(); if(0 != lcd_time) return (100000000/lcd_time); else return (6000); }
void gpt_busy_wait_ms (U32 timeout_ms) { U32 start_tick, timeout_tick; // get timeout tick timeout_tick = gpt4_time2tick_ms (timeout_ms); start_tick = gpt4_get_current_tick (); // wait for timeout while (!gpt4_timeout_tick (start_tick, timeout_tick)); }
void reset_timer_masked (void) { #ifdef GPT_SOFTWARE_WORKAROUND register U32 cur_tick; // get current tick cur_tick = gpt4_get_current_tick (); lastinc = gpt4_tick2time_ms (cur_tick); #else lastinc = gpt4_tick2time_ms (*GPT4_DAT); #endif timestamp = 0; }
ulong get_timer_masked (void) { volatile U32 now; register U32 cur_tick; // get current tick cur_tick = gpt4_get_current_tick (); now = gpt4_tick2time_ms (cur_tick); if (now >= lastinc) { timestamp = timestamp + now - lastinc; /* normal */ } else { timestamp = timestamp + MAX_REG_MS - lastinc + now; /* overflow */ } lastinc = now; return timestamp; }
ulong get_timer_masked (void) { volatile U32 now; #ifdef GPT_SOFTWARE_WORKAROUND register U32 cur_tick; // get current tick cur_tick = gpt4_get_current_tick (); now = gpt4_tick2time_ms (cur_tick); #else now = gpt4_tick2time_ms (*GPT4_DAT); #endif if (now >= lastinc) { timestamp = timestamp + now - lastinc; /* normal */ } else { timestamp = timestamp + MAX_REG_MS - lastinc + now; /* overflow */ } lastinc = now; return timestamp; }