void cpu_tag(cpu_t *cpu, addr_t pc) { update_timing(cpu, TIMER_TAG, true); tag_start(cpu, pc); update_timing(cpu, TIMER_TAG, false); }
void osd_update_video_and_audio(struct mame_display *display) { cycles_t cps = osd_cycles_per_second(); // if this is the first time through, initialize the previous time value if (warming_up) { last_skipcount0_time = osd_cycles() - (int)((double)FRAMESKIP_LEVELS * (double)cps / video_fps); warming_up = 0; } // if this is the first frame in a sequence, adjust the base time for this frame if (frameskip_counter == 0) this_frame_base = last_skipcount0_time + (int)((double)FRAMESKIP_LEVELS * (double)cps / video_fps); // if we're not skipping this frame, draw it if (display->changed_flags & GAME_BITMAP_CHANGED) update_timing(); //// if the LEDs have changed, update them //if (display->changed_flags & LED_STATE_CHANGED) // osd_set_leds(display->led_state); // increment the frameskip counter frameskip_counter = (frameskip_counter + 1) % FRAMESKIP_LEVELS; // check for inputs check_inputs(); }
/* Update the display. */ void osd_update_display(void) { #if defined(GP2X) || defined(PSP) /* Update Timing */ update_timing(); #endif #ifdef PSP /* Wait VSync */ if (gp2x_vsync==1) gp2x_video_wait_vsync(); #endif /* Manage the palette */ if (dirtypalette) update_palette(); /* Update Display */ p_update_display(); #ifdef GP2X /* Show FPS Counter */ if (gp2x_showfps) frame_counter(); #endif #ifdef GP2X /* Double Buffer Video Flip */ if (gp2x_double_buffer) gp2x_video_flip(); #endif }
static void cpu_translate_function(cpu_t *cpu) { BasicBlock *bb_ret, *bb_trap, *label_entry, *bb_start; /* create function and fill it with std basic blocks */ cpu->cur_func = cpu_create_function(cpu, "jitmain", &bb_ret, &bb_trap, &label_entry); cpu->func[cpu->functions] = cpu->cur_func; /* TRANSLATE! */ update_timing(cpu, TIMER_FE, true); if (cpu->flags_debug & CPU_DEBUG_SINGLESTEP) { bb_start = cpu_translate_singlestep(cpu, bb_ret, bb_trap); } else if (cpu->flags_debug & CPU_DEBUG_SINGLESTEP_BB) { bb_start = cpu_translate_singlestep_bb(cpu, bb_ret, bb_trap); } else { bb_start = cpu_translate_all(cpu, bb_ret, bb_trap); } update_timing(cpu, TIMER_FE, false); /* finish entry basicblock */ BranchInst::Create(bb_start, label_entry); /* make sure everything is OK */ verifyFunction(*cpu->cur_func, PrintMessageAction); if (cpu->flags_debug & CPU_DEBUG_PRINT_IR) cpu->mod->dump(); if (cpu->flags_codegen & CPU_CODEGEN_OPTIMIZE) { LOG("*** Optimizing..."); optimize(cpu); LOG("done.\n"); if (cpu->flags_debug & CPU_DEBUG_PRINT_IR_OPTIMIZED) cpu->mod->dump(); } LOG("*** Translating..."); update_timing(cpu, TIMER_BE, true); cpu->fp[cpu->functions] = cpu->exec_engine->getPointerToFunction(cpu->cur_func); update_timing(cpu, TIMER_BE, false); LOG("done.\n"); cpu->functions++; }
int cpu_run(cpu_t *cpu, debug_function_t debug_function) { addr_t pc = 0, orig_pc = 0; uint32_t i; int ret; bool success; bool do_translate = true; /* try to find the entry in all functions */ while(true) { if (do_translate) { cpu_translate(cpu); pc = cpu->f.get_pc(cpu, cpu->rf.grf); } orig_pc = pc; success = false; for (i = 0; i < cpu->functions; i++) { fp_t FP = (fp_t)cpu->fp[i]; update_timing(cpu, TIMER_RUN, true); breakpoint(); ret = FP(cpu->RAM, cpu->rf.grf, cpu->rf.frf, debug_function); update_timing(cpu, TIMER_RUN, false); pc = cpu->f.get_pc(cpu, cpu->rf.grf); if (ret != JIT_RETURN_FUNCNOTFOUND) return ret; if (!is_inside_code_area(cpu, pc)) return ret; if (pc != orig_pc) { success = true; break; } } if (!success) { LOG("{%" PRIx64 "}", pc); cpu_tag(cpu, pc); do_translate = true; } } }
void honoka::Timing_wheel::run() { for(;;) { { std::lock_guard<std::mutex> g(mutex_); if(is_stop) break; while(!queue_.empty()) { auto tmp_event = queue_.front(); queue_.pop(); switch(tmp_event.type_) { case NEW_TIMING: create_timing(tmp_event.fd_); break; case UPDATE_TIMING: update_timing(tmp_event.fd_); break; case DEL_TIMING: del_timing(tmp_event.fd_); break; default: break; } } } int fd; cur = std::begin(*cur_ms); cur_ed = std::end(*cur_ms); skip_within_time(); while((fd = get_timeout()) != 0) { if(reactor_ == nullptr) { LOG(ERROR)<<"Timing_wheel::Timing_wheel() reactor_ == nullptr"; } if(thread_pool_ == nullptr) { LOG(ERROR)<<"Timing_wheel::Timing_wheel() thread_pool_ == nullptr"; } auto tmp_event = reactor_->create_event(fd, TIMEOUT); thread_pool_->add_event(tmp_event); skip_within_time(); } cur_ms->clear(); advance(); } }
char run() { for(;;) { // Phase 1 set_OCT1_tot(); //set maximum waiting time for zero-crossing before quit if(wait_for_transition(0)) { return -1; // return with error } commutationDelay(); // delay about 15deg between zero-crossing and commutation com1com2(); //perform next commutation update_timing(wt_comp_scan); // Calculate new commutation timing WAIT_OCT1_TOT; // Wait "wt_comp_scan" before next zero-crossing scan set_OCT1_tot(); //set maximum waiting time for zero-crossing before quit // Phase 2 if(wait_for_transition(1)) { return -1; // return with error } commutationDelay(); com2com3(); update_timing(wt_comp_scan); WAIT_OCT1_TOT; set_OCT1_tot(); //set maximum waiting time for zero-crossing before quit // Phase 3 if(wait_for_transition(0)) { return -1; // return with error } commutationDelay(); com3com4(); update_timing(wt_comp_scan); WAIT_OCT1_TOT; set_OCT1_tot(); //set maximum waiting time for zero-crossing before quit // Phase 4 if(wait_for_transition(1)) { return -1; // return with error } commutationDelay(); com4com5(); update_timing(wt_comp_scan); WAIT_OCT1_TOT; set_OCT1_tot(); //set maximum waiting time for zero-crossing before quit // Phase 5 if(wait_for_transition(0)) { return -1; // return with error } commutationDelay(); com5com6(); update_timing(wt_comp_scan); WAIT_OCT1_TOT; set_OCT1_tot(); //set maximum waiting time for zero-crossing before quit // Phase 6 if(wait_for_transition(1)) { return -1; // return with error } commutationDelay(); com6com1(); update_timing(wt_comp_scan); WAIT_OCT1_TOT; if(!FLAG(IS_MAINTENANCE)) //don't check timeouts when in maintenance mode { if(uart_timeout== 0) //if communication time-out { // cut power to the motor SET_FLAG(POWER_OFF); } } if(meas_rpm < (RPM_MIN/2)) { return -1; //if too slow, quit } } }
static void update(HWND hwnd) { update_disasm(hwnd); update_registers(hwnd); update_timing(hwnd); }