| 391 | } |
| 392 | |
| 393 | static 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 | |
| 412 | void sched_rewind_cpu(uint8_t duration) { |
| 413 | #if __has_builtin(__builtin_sub_overflow) || (__GNUC__ >= 5) |
nothing calls this directly
no test coverage detected