OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:34 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 37 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re:Floppy driver tutorial
PostPosted: Fri Jan 13, 2006 2:47 pm 
Maybe to make a pause:) usleep() is suppose to be in the unistd.h but I can't get that. I think(I'm not sure), that usleep()(or sleep()) uses PIT.


Top
  
 
 Post subject: Re:Floppy driver tutorial
PostPosted: Fri Jan 13, 2006 3:42 pm 
What makes you think it uses the PIT? What if it's implemented on a computer with no PIT - i.e. not a PC? What if the computer it is implemented on doesn't even have a device like the PIT (some embedded system maybe)?

Ask yourself such questions, they will help you design these things on your own.

And "maybe to make a pause" is hardly a specification. Try along the lines of "sleep() causes the scheduler to place the calling thread at the end of the run queue/other scheduling thingy" or "sleep(x) causes the operating system to suspend execution of the thread until at least x seconds have passed." Think about what the manual page for your version of sleep or usleep would say.


Top
  
 
 Post subject: Re:Floppy driver tutorial
PostPosted: Fri Jan 13, 2006 5:31 pm 
Code Slasher wrote:
If you want, you can declare it as volatile. Doesn't make much difference, as only used in 2 places.

Note: That code is used to show a principle. In my os, the driver actually does to sleep instead of polling.


Sorry don't mean to be knit picking (spelling). But according to my understanding, one of the places you're modifying the variable is at an interrupt handler. Therefore when you're using it in the main body of code, the compiler is unaware that the contents of the variable may change and can optimize it out.

In the line:
Quote:
while(floppy_int_count <= 0);


floppy_int_count maybe loaded to a register once and and changes to the variable will go unnoticed resulting in an infinite loop.


Top
  
 
 Post subject: Re:Floppy driver tutorial
PostPosted: Mon Jan 16, 2006 11:29 am 
There is another function:

motor_control()

I couldn't find the implementation of this function as well? Any ideas?


Top
  
 
 Post subject: Re:Floppy driver tutorial
PostPosted: Mon Jan 16, 2006 11:55 am 
May be turns the motor on or off ?.
I think you are making a lot of work for your self. It's so simple, follow the pedo code in the intel pdf and code each bit untill you have a working driver.


Top
  
 
 Post subject: Re: Floppy driver tutorial
PostPosted: Wed Apr 24, 2013 2:44 pm 
Offline

Joined: Wed Apr 17, 2013 4:47 pm
Posts: 3
Sorry that I'm writing in this dead topic, but my question probably fits this topic.

I read this tutorial and I think it's very good, but I found function

Code:
wait_floppy_ready(base);


so I thought that it should be probably something like waitFloppyData

Code:
static void waitFloppyReady(){
   while(((inb(FLOPPY_PRIMARY_BASE+MAIN_STATUS_REG))&0xd0)!=IDLE);
}

I don't know that my idea is good. I found somewhere (I don't remember where) that IDLE is equals 0x80, but I don't know that it's true. I'm looking for some datasheet saying about this constants.

I have one more problem, with function:
Code:
seek_track(head,cylinder,drive);

I know that I must send command SEEK, but what after that?

I found something like this but it don't using head,cylinder,drive parameters:
Code:
   writeFloppyCommand(SEEK_TRACK);
   writeFloppyCommand(0);
   writeFloppyCommand(track);


Thanks in advance


Top
 Profile  
 
 Post subject: Re: Floppy driver tutorial
PostPosted: Mon Apr 29, 2013 9:08 am 
Offline
Member
Member
User avatar

Joined: Sat Oct 23, 2004 11:00 pm
Posts: 1223
Location: Sweden
have you had a look at my other documents ands snippets on the same server as the tutorial?
full folder listing at http://bos.asmhackers.net/docs/floppy/

_________________
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 37 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 66 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