Page 1 of 1

floppy driver problem(interrupt), pls give me some advise

Posted: Tue Jul 15, 2008 12:46 am
by liubo
If I send RESET OR RECALIBRATE command to FDC seperately, the interrupt can be received normally.

But if I first send RESET, and then send RECALIBRATE command to FDC, only one interrupt can be received.
I think 2 interrupts should be received during this proceduce.(one is for RESET command, one is for RECALIBRATE command.)

I set the trap gate type for floppy's interrupt and I also found the behaviors of the following virtual machines are different.
Virtual BOX1.6 : ONLY received the interrupt triggered by RESET command
Qemu manager3.0: ONLY received the interrupt triggered by RESET command
Bochs2.3.6 : ONLY received the interrupt triggered by RECALIBRATE command

Can anybody give me some ideas about this problem? I just only want to reset the FDC.

Re: floppy driver problem(interrupt), pls give me some advise

Posted: Tue Jul 15, 2008 2:46 am
by AJ
Hi,

Are you waiting between commands, or are you hammering the FDC with commands at full speed? The FDC is legacy and I believe you need to wait for the interrupt for the first command before sending the second command (or put in some kind of delay - say 200msec).

Cheers,
Adam

Re: floppy driver problem(interrupt), pls give me some advise

Posted: Tue Jul 15, 2008 5:46 am
by jal
AJ wrote:The FDC is legacy
I think we can safely assume the FDC does not like to get more then one command at a time. Isn't there some busy bit or something one can check to see if sending a command is safe?


JAL

Re: floppy driver problem(interrupt), pls give me some advise

Posted: Tue Jul 15, 2008 7:25 am
by liubo
Hi AJ, jal

I add some delay between two commands. The sequences are as follows:

1. send RESET command to FDC
2. send OK
3. receive interrupt, handle interrupt(namely, send SENSEI command to FDC, get 2 result bytes, send SPECIFY command to FDC)
4. interrupt handle OK
5. wait about 1s

mov ecx, 0xFFFFFF
.loop:
dec ecx
nop
nop
nop
nop
cmp ecx, 0
jne .loop

6. re-send RESET command to FDC
7. NOTHING happen

I'll continue to try to find where the problem is located.

Thanks anyway.

Re: floppy driver problem(interrupt), pls give me some advise

Posted: Tue Jul 15, 2008 1:13 pm
by Dex

Re: floppy driver problem(interrupt), pls give me some advise

Posted: Wed Jul 16, 2008 7:40 am
by liubo
Thanks Dex.

The problem has just been solved.

I forgot send EOI to 8259a and I found floppy controller is very sensitive about time delay which I always ignore.(Here, also thanks Adam
and JAL's reminder.)

BTW, DexOS is cool. :)