Floppy driver tutorial
Re:Floppy driver tutorial
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.
Re:Floppy driver tutorial
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.
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.
Re:Floppy driver tutorial
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.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.
In the line:
floppy_int_count maybe loaded to a register once and and changes to the variable will go unnoticed resulting in an infinite loop.while(floppy_int_count <= 0);
Re:Floppy driver tutorial
There is another function:
motor_control()
I couldn't find the implementation of this function as well? Any ideas?
motor_control()
I couldn't find the implementation of this function as well? Any ideas?
Re:Floppy driver tutorial
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.
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.
Re: Floppy driver tutorial
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
so I thought that it should be probably something like waitFloppyData
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:
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:
Thanks in advance
I read this tutorial and I think it's very good, but I found function
Code: Select all
wait_floppy_ready(base);
Code: Select all
static void waitFloppyReady(){
while(((inb(FLOPPY_PRIMARY_BASE+MAIN_STATUS_REG))&0xd0)!=IDLE);
}
I have one more problem, with function:
Code: Select all
seek_track(head,cylinder,drive);
I found something like this but it don't using head,cylinder,drive parameters:
Code: Select all
writeFloppyCommand(SEEK_TRACK);
writeFloppyCommand(0);
writeFloppyCommand(track);
Re: Floppy driver tutorial
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/
full folder listing at http://bos.asmhackers.net/docs/floppy/