Problem with CALIBRATE and SEEK commands
Problem with CALIBRATE and SEEK commands
I'm writing a driver for Floppy Drives, and I'm having a bit of trouble with the CALIBRATE and SEEK commands. Both the wiki and another article I was looking at specified that you should wait for IRQ6 to fire after sending the command, but it never seems to fire. I tried polling the "disk active" bits in the MSR to figure out when the head movement was finished, but it never finished. Any suggestions?
Re: Problem with CALIBRATE and SEEK commands
Try waiting say 50 ms after issuing the command before sensing for any interrupt. It worked at my end, it should not make a difference in bochs
Modular Interface Kernel With a lot of bugs
Re: Problem with CALIBRATE and SEEK commands
I popped a sleep(50) in there, but it didn't help
Re: Problem with CALIBRATE and SEEK commands
I hope that you have enabled IRQ 6, haven't you?oib111 wrote:I popped a sleep(50) in there, but it didn't help
Re: Problem with CALIBRATE and SEEK commands
Hi,
I once had a really odd problem with an emulator and a really basic kernel where I issued the FDD commands and then started listening for an IRQ. I eventally worked out that the IRQ appeared never to happen because it occurred before I started listening for it Is there any chance that this could be happening?
Cheers,
Adam
I once had a really odd problem with an emulator and a really basic kernel where I issued the FDD commands and then started listening for an IRQ. I eventally worked out that the IRQ appeared never to happen because it occurred before I started listening for it Is there any chance that this could be happening?
Cheers,
Adam
Re: Problem with CALIBRATE and SEEK commands
I don't think that's happening. In fdc_wait_irq() I just do a while loop checking if bIRQ is false. If IRQ6 fired, bIRQ would be true, and my loop wouldn't even start, bIRQ would be set back to false and that'd be that.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: Problem with CALIBRATE and SEEK commands
Is bIrq volatile?
Re: Problem with CALIBRATE and SEEK commands
No.
EDIT:
Changed it to volatile and now I catch IRQ6 (only when calibrating, still can't catch it when seeking), but I still can't seem to calibrate correctly. It always stays at cylinder 218.
EDIT:
Changed it to volatile and now I catch IRQ6 (only when calibrating, still can't catch it when seeking), but I still can't seem to calibrate correctly. It always stays at cylinder 218.
Re: Problem with CALIBRATE and SEEK commands
My driver is coded and commented to go along with the per-do code in the intel controller pdf, it may help.
[EDIT]Link to code removed[/EDIT]
[EDIT]Link to code removed[/EDIT]
Last edited by Dex on Thu Dec 10, 2009 9:52 pm, edited 1 time in total.
Re: Problem with CALIBRATE and SEEK commands
You seem to be doing the same thing as me except for at the end where you check ST0.
Re: Problem with CALIBRATE and SEEK commands
Hi oib111! I am also writing floppy drivers.
I may be part of the source of your problems. Sorry!
I just last week rewrote that entire FDC article -- it used to be a stub with no info at all. But I am afraid that I made a few mistakes when I wrote the current article. The article describes fairly well how things work in EMULATORS ONLY.
After doing much more extensive testing on real hardware, I find that ALL the emulators have MULTIPLE problems with their FDC emulation.
So, the very first question is: are you running this on an emulator, or on real hardware? Because they are so very different.
Sadly, I am also having lots of trouble with seek and recalibrate on real hardware. I will be happy to share info with you when I have it working myself. (And, OF COURSE, I will be updating the in-progress wiki article as I figure out each new detail for certain.) I am embarrassed that you happened to read the wiki article at this very moment, before I can get it completely perfect.
I may be part of the source of your problems. Sorry!
I just last week rewrote that entire FDC article -- it used to be a stub with no info at all. But I am afraid that I made a few mistakes when I wrote the current article. The article describes fairly well how things work in EMULATORS ONLY.
After doing much more extensive testing on real hardware, I find that ALL the emulators have MULTIPLE problems with their FDC emulation.
So, the very first question is: are you running this on an emulator, or on real hardware? Because they are so very different.
Sadly, I am also having lots of trouble with seek and recalibrate on real hardware. I will be happy to share info with you when I have it working myself. (And, OF COURSE, I will be updating the in-progress wiki article as I figure out each new detail for certain.) I am embarrassed that you happened to read the wiki article at this very moment, before I can get it completely perfect.
Re: Problem with CALIBRATE and SEEK commands
Oh, well you're doing a great job on the wiki article, and I've been mostly testing this on Bochs and VirtualBox.
Re: Problem with CALIBRATE and SEEK commands
OK, on bochs:
Bochs has an extremely long "wait" after a recalibrate or seek. Try something more like a 3 second timeout when you are waiting for the IRQ6.
Also: did you send a Configure command like I said in the wiki article? Especially, did you turn OFF polling? If you did, then in bochs, that seems like it may turn off the IRQ6 from Recalibrate and Seek. I'm not sure yet, though.
If you would care to send me some of your bare floppy routines, I may be able to hack up a wrapper for them, set some breakpoints in bochs, and see why it's not sending an IRQ6, or what the delay actually is.
Bochs has an extremely long "wait" after a recalibrate or seek. Try something more like a 3 second timeout when you are waiting for the IRQ6.
Also: did you send a Configure command like I said in the wiki article? Especially, did you turn OFF polling? If you did, then in bochs, that seems like it may turn off the IRQ6 from Recalibrate and Seek. I'm not sure yet, though.
If you would care to send me some of your bare floppy routines, I may be able to hack up a wrapper for them, set some breakpoints in bochs, and see why it's not sending an IRQ6, or what the delay actually is.
Re: Problem with CALIBRATE and SEEK commands
Oh no, the IRQ fires when I'm testing on Bochs and VirtualBox, but it doesn't seem to fire when I test it on my laptop. And no, I didn't send the CONFIGURE command. The other article I was reading didn't mention that and I was using your wiki article for explanations on things that the other article didn't explain, so I never really saw the CONFIGURE command. Is it mandatory?
Re: Problem with CALIBRATE and SEEK commands
No, the Configure command is not mandatory. In fact, I am still trying to test each feature, to see if changing any of the Configure settings will disable the floppy controller -- because there may actually be a reason that no sample floppy drivers that I have ever seen use any Configure features.
However, the 16 byte buffer in the floppy controller remains disabled if you never send a Configure command. So your floppy data transfer performance will be extra bad.
As to your specific issue: are you sure that on your laptop that your floppy disk is an internal disk (controlled by a 82077AA chip lookalike) -- or might it be a USB floppy?
Try this: make your test program wait 10 seconds. Then display something to the screen, and try setting all the upper bits of the FDC DOR to ON.
Does the MOTOR for the drive turn on?
I am very interested in cases where bochs does not properly match the functionality of real hardware.
I would like to hear anything you eventualy figure out on this problem.
However, the 16 byte buffer in the floppy controller remains disabled if you never send a Configure command. So your floppy data transfer performance will be extra bad.
As to your specific issue: are you sure that on your laptop that your floppy disk is an internal disk (controlled by a 82077AA chip lookalike) -- or might it be a USB floppy?
Try this: make your test program wait 10 seconds. Then display something to the screen, and try setting all the upper bits of the FDC DOR to ON.
Does the MOTOR for the drive turn on?
I am very interested in cases where bochs does not properly match the functionality of real hardware.
I would like to hear anything you eventualy figure out on this problem.