Re: [hatari-devel] MIDI IRQ handling bug

[ Thread Index | Date Index | More Archives ]

Le 12/12/2021 à 14:23, Eero Tamminen a écrit :
Hi Nicolas,

Current Hatari IRQ handling is buggy for MIDI. Midi_UnInit() disables MIDI IRQ, but Midi_Init() does not enable it, only calling Midi_Reset() does, which does not happen on MIDI device change.

(Similarly to handling of RS232, SCC & printer devices, MIDI device change at run-time does not trigger reset.)

I tried calling Midi_Reset() directly from Midi_Init(), but that freezes Hatari at startup (to somewhere in interrupt handling code).

Attached patch seems to work, but I assume all the things done by Midi_Reset() should not be done just on device change.

Could you look into what's the correct fix?


I didn't check why it fails when calling Midi_Reset from Midi_Init (but at early startup not everything is ready to handle interrupts), but nevertheless I don't think it matters as it's certainly a better place to call Midi_Reset when checking config's changes as you did.

We already call Cold_Reset if a config change requires it, so it seems ok to me to call Midi_Reset in that case.

As for all the variables reset in Midi_Reset beside just starting the timer, I don't think it's a problem ; it will just be the same as reseting any bytes that was currently transferred (ie we didn't receive all 8 bits yet), which doesn't seem a problem to me and acceptable in the case where the midi device was changed on the fly.

so, good to go :)


Mail converted by MHonArc 2.6.19+