cycles = (cycles - 1) & 0x0fff;
if (cycles < 500) {
- elprintf(EL_32X|EL_ANOMALY, "pwm: low cycle value: %d", cycles + 1);
+ elprintf(EL_32X|EL_PWM|EL_ANOMALY, "pwm: low cycle value: %d", cycles + 1);
cycles = 500;
}
pwm_cycles = cycles;
// irq for every sample??
// FIXME: we need to hit more than once per line :(
-void p32x_pwm_irq_check(void)
+void p32x_pwm_irq_check(int new_line)
{
int tm = (Pico32x.regs[0x30 / 2] & 0x0f00) >> 8;
if (tm == 0)
return; // TODO: verify
- Pico32x.pwm_irq_sample_cnt += pwm_line_samples;
+ if (new_line)
+ Pico32x.pwm_irq_sample_cnt += pwm_line_samples;
if (Pico32x.pwm_irq_sample_cnt >= (tm << 16)) {
Pico32x.pwm_irq_sample_cnt -= tm << 16;
Pico32x.sh2irqs |= P32XI_PWM;
case 6: // R ch
case 8: // MONO
predict = (pwm_line_samples * Pico.m.scanline) >> 16;
- elprintf(EL_32X, "pwm: read status: ptr %d/%d, predict %d",
+ elprintf(EL_PWM, "pwm: read status: ptr %d/%d, predict %d",
pwm_frame_smp_cnt, (pwm_line_samples * scanlines_total) >> 16, predict);
if (pwm_frame_smp_cnt > predict + 3)
d |= P32XP_FULL;
if (a >= 6) { // R or MONO
pwm_frame_smp_cnt++;
pwm_ptr = (pwm_ptr + 1) & (PWM_BUFF_LEN - 1);
- elprintf(EL_32X, "pwm: smp_cnt %d, ptr %d, smp %x", pwm_frame_smp_cnt, pwm_ptr, d);
+ elprintf(EL_PWM, "pwm: smp_cnt %d, ptr %d, smp %x", pwm_frame_smp_cnt, pwm_ptr, d);
}
}
}
}
}
- elprintf(EL_STATUS, "pwm_update: pwm_ptr %d, len %d, step %04x, done %d",
+ elprintf(EL_PWM, "pwm_update: pwm_ptr %d, len %d, step %04x, done %d",
pwm_ptr, length, step, (pwmb - Pico32xMem->pwm) / 2);
pwm_ptr = 0;