OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 5:22 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Floppy Driver works in qemu, not on real HW
PostPosted: Tue Dec 20, 2005 8:23 am 
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


Top
  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Tue Dec 20, 2005 9:03 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
Code:

   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 ?

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Tue Dec 20, 2005 9:31 am 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 11:33 pm
Posts: 3882
Location: Eindhoven
Pype.Clicker wrote:
Code:

   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.


Top
 Profile  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Tue Dec 20, 2005 9:38 am 
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:
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 ;)


Top
  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Tue Dec 20, 2005 9:58 am 
Quote:
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...


Top
  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Tue Dec 20, 2005 11:15 am 
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


Top
  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Tue Dec 20, 2005 12:26 pm 
thanks... it will be usefull


Top
  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Wed Dec 21, 2005 9:10 am 
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


Top
  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Wed Dec 21, 2005 3:47 pm 
Nice to hear you got it working :), but it's fat12 next :-[


Top
  
 
 Post subject: Re:Floppy Driver works in qemu, not on real HW
PostPosted: Thu Dec 22, 2005 1:38 am 
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...


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], Majestic-12 [Bot], SemrushBot [Bot] and 122 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group