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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
liubo
Posts: 11
Joined: Mon Jul 14, 2008 8:55 pm

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

Post 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.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

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

Post 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
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

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

Post 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
liubo
Posts: 11
Joined: Mon Jul 14, 2008 8:55 pm

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

Post 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.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

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

Post by Dex »

liubo
Posts: 11
Joined: Mon Jul 14, 2008 8:55 pm

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

Post 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. :)
Post Reply