void calculate_speed(void* dst, u32 len, u32 *speed) { tb_t start, end; mftb(&start); device_frag_read(dst, len, 0); mftb(&end); *speed = tb_diff_usec(&end, &start); }
void S9xSyncSpeed () { #if 0 unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime; while (!S9xSyncSound()) usleep(10); uint32 skipFrms = Settings.SkipFrames; if (Settings.TurboMode) skipFrms = Settings.TurboSkipFrames; now = gettime(); if (tb_diff_usec(now,prev) > timediffallowed) { /* Timer has already expired */ if (IPPU.SkippedFrames < skipFrms) { IPPU.SkippedFrames++; IPPU.RenderThisFrame = FALSE; } else { IPPU.SkippedFrames = 0; IPPU.RenderThisFrame = TRUE; } } else { /*** Ahead - so hold up ***/ while (tb_diff_usec(now,prev) < timediffallowed) { now = gettime(); usleep(50); } IPPU.RenderThisFrame = TRUE; IPPU.SkippedFrames = 0; } prev = now; #endif return; }
u32 _diff_usec(u64 start,u64 end){ return tb_diff_usec(uint64_t (end), uint64_t (start)); }