MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / sched_second

Function sched_second

core/schedule.c:393–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393static void sched_second(enum sched_item_id id) {
394 sched_process_pending_dma(0);
395 for (id = SCHED_FIRST_EVENT; id <= SCHED_LAST_DMA; id++) {
396 if (sched_active(id)) {
397 sched.items[id].timestamp -= SCHED_BASE_CLOCK_RATE;
398 assert(sched_active(id));
399 }
400 }
401 uint32_t cpu_clock_rate = sched_get_clock_rate(CLOCK_CPU);
402 assert(cpu.cycles >= cpu_clock_rate);
403 cpu.seconds++;
404 cpu.cycles -= cpu_clock_rate;
405 cpu.eiDelay = cpu.eiDelay < cpu_clock_rate ? 0 : cpu.eiDelay - cpu_clock_rate;
406 cpu.baseCycles += cpu_clock_rate;
407 sched.dma.last_mem_timestamp = timestamp_diff(sched.dma.last_mem_timestamp, SCHED_BASE_CLOCK_RATE);
408 assert(sched.items[SCHED_SECOND].timestamp == SCHED_BASE_CLOCK_RATE);
409 sched_update_events();
410}
411
412void sched_rewind_cpu(uint8_t duration) {
413#if __has_builtin(__builtin_sub_overflow) || (__GNUC__ >= 5)

Callers

nothing calls this directly

Calls 5

sched_activeFunction · 0.85
sched_get_clock_rateFunction · 0.85
timestamp_diffFunction · 0.85
sched_update_eventsFunction · 0.85

Tested by

no test coverage detected