Page 1 of 1

Floppy Driver works in qemu, not on real HW

Posted: Tue Dec 20, 2005 8:23 am
by HanzZ
Hi!
My Floppy Driver works correctly in Qemu, but not works on real HW. I find, that driver freeze in fdc_rw(); (line 388), when he call (line 427) seek(); (line 281).... And in seek function, i think, freeze on (line 294) waitfdc(); (line 135)
I have already read http://www.mega-tokyo.com/forum/index.php?board=1;action=display;threadid=8436;start=msg73290#msg73290,
but autor of this driver said, that his seek function was bad, but i don't know, where is any problem...

So here is my driver : http://hanzz.name/floppy.html

Thank you for any solution
HanzZ

Re:Floppy Driver works in qemu, not on real HW

Posted: Tue Dec 20, 2005 9:03 am
by Pype.Clicker

Code: Select all


   33 #define   WAIT   0xFFFFFL
   36 static void wait(void)
   37 {
   38    unsigned long wait;
   39 
   40    for(wait = WAIT; wait != 0; wait--)
   41       /* nothing */;
   42 for(wait = WAIT; wait != 0; wait--)
   43       /* nothing */;
   44 for(wait = WAIT; wait != 0; wait--)
   45       /* nothing */;
   46 }
does it surprise you it doesn't work properly on real hardware ? i mean, what about some decent delay function for those 15ms etc. delays you're supposed to observe when programming the floppy ?

Re:Floppy Driver works in qemu, not on real HW

Posted: Tue Dec 20, 2005 9:31 am
by Candy
Pype.Clicker wrote:

Code: Select all


   33 #define???WAIT???0xFFFFFL
   36 static void wait(void)
   37 {
   38 ???unsigned long wait;
   39 
   40 ???for(wait = WAIT; wait != 0; wait--)
   41 ??????/* nothing */;
   42 for(wait = WAIT; wait != 0; wait--)
   43 ??????/* nothing */;
   44 for(wait = WAIT; wait != 0; wait--)
   45 ??????/* nothing */;
   46 }
does it surprise you it doesn't work properly on real hardware ? i mean, what about some decent delay function for those 15ms etc. delays you're supposed to observe when programming the floppy ?

This'll wait for 3 million cycles, on bochs that'd be around 3 seconds, on a real cpu that could be about a millisecond.

Assuming you compile without optimizations, because GCC will see right through your nothing and optimize away the entire loop. All the way down to around 5 nanoseconds of delay.

And no, 5 nanoseconds for 1980 technology is not long enough.

Re:Floppy Driver works in qemu, not on real HW

Posted: Tue Dec 20, 2005 9:38 am
by HanzZ
OK... :-) Now i have real delay with ticks... but now i have problem with seeking... if I call seek(); i get one of these errors (in emulator sometimes, on real HW everytime (in reset(); too)) :

Code: Select all

291       if (sr0 != 0x20) kprintf("FLOPPY | SEEK | SR0!=0x20\n");
292       if (fdc_track != track) kprintf("FLOPPY | SEEK | FDC_TRACK!=TRACK\n");
293       return FALSE;
I update source code on my site, so number lines aren't good in my first message.... I will read again floppy controler data sheet tonight, but i think, that my seek function is good ;)

Re:Floppy Driver works in qemu, not on real HW

Posted: Tue Dec 20, 2005 9:58 am
by HanzZ
does it surprise you it doesn't work properly on real hardware ? i mean, what about some decent delay function for those 15ms etc. delays you're supposed to observe when programming the floppy ?
I simply thought, that it is not essentially.. only that time don't have to be too small..., but how tell Candy, it was too little... sorry ;) And thank you for your time... but problem with seek(); still be...

Re:Floppy Driver works in qemu, not on real HW

Posted: Tue Dec 20, 2005 11:15 am
by Dex4u
The floppy driver i witten for Dex4u OS, work fine and is well commented to go with the intel floppy pdf. But you need to be able to understand a man's programming language, as it written in ASM ;D .
http://www.dex4u.com/FloppyDriver.zip

Re:Floppy Driver works in qemu, not on real HW

Posted: Tue Dec 20, 2005 12:26 pm
by HanzZ
thanks... it will be usefull

Re:Floppy Driver works in qemu, not on real HW

Posted: Wed Dec 21, 2005 9:10 am
by HanzZ
I'm so happy ;)!!!! My driver runs greatly ;D ... i thanks everyone, who helps me....

Problem was in lot of small bugs... for example on real HW i have to make "sense interrupt status" four times... and I make it only once... Great source code of driver is on (Free dos) http://koders.com/c/fid051291340B94EC7F5D1A38EF6843466C0B07627B.aspx?s=fdc

Thanks for help
HanzZ

Re:Floppy Driver works in qemu, not on real HW

Posted: Wed Dec 21, 2005 3:47 pm
by Dex4u
Nice to hear you got it working :), but it's fat12 next :-[

Re:Floppy Driver works in qemu, not on real HW

Posted: Thu Dec 22, 2005 1:38 am
by HanzZ
I have just had FAT12 driver ;) I have many things, but I first time tested my OS on real HW... And from this test i got this , now solved, error...