X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2F32x%2Fpwm.c;h=97edb9e71d3c8d2cc372bee6ac0d1d6310bb2146;hb=9e1fa0a6cf997b9e4ad38a532d6a9628253fefa7;hp=6fe7954cece6fe917e4a299e3bf9152ecf5a28ed;hpb=531a8f38839713938a441f9287724e5e72c492c3;p=picodrive.git diff --git a/pico/32x/pwm.c b/pico/32x/pwm.c index 6fe7954..97edb9e 100644 --- a/pico/32x/pwm.c +++ b/pico/32x/pwm.c @@ -31,8 +31,7 @@ void p32x_pwm_ctl_changed(void) static void do_pwm_irq(SH2 *sh2, unsigned int m68k_cycles) { - Pico32x.sh2irqs |= P32XI_PWM; - p32x_update_irls(sh2, m68k_cycles); + p32x_trigger_irq(sh2, m68k_cycles, P32XI_PWM); if (Pico32x.regs[0x30 / 2] & P32XP_RTP) { p32x_event_schedule(m68k_cycles, P32X_EVENT_PWM, pwm_cycles / 3 + 1); @@ -105,8 +104,6 @@ static int p32x_pwm_schedule_(SH2 *sh2, unsigned int m68k_now) if (cycles_diff_sh2 >= pwm_cycles) consume_fifo_do(sh2, m68k_now, cycles_diff_sh2); - if (Pico32x.sh2irqs & P32XI_PWM) - return 0; // previous not acked if (!((Pico32x.sh2irq_mask[0] | Pico32x.sh2irq_mask[1]) & 1)) return 0; // masked by everyone @@ -129,6 +126,12 @@ void p32x_pwm_schedule_sh2(SH2 *sh2) p32x_event_schedule_sh2(sh2, P32X_EVENT_PWM, after); } +void p32x_pwm_sync_to_sh2(SH2 *sh2) +{ + int m68k_cycles = sh2_cycles_done_m68k(sh2); + consume_fifo(sh2, m68k_cycles); +} + void p32x_pwm_irq_event(unsigned int m68k_now) { p32x_pwm_schedule(m68k_now);