Page 1 of 2
Programming the FDC?
Posted: Tue Jan 28, 2003 6:17 am
by Perica
..
Re:Programming the FDC?
Posted: Tue Jan 28, 2003 7:07 am
by Pype.Clicker
reading 0x80 just forces the CPU to make an I/O access to a 'trash' I/O location (not affecting the state of any device), and thus make it wait for an I/O completion cycle regardless of its internal frequency.
Re:Programming the FDC?
Posted: Tue Jan 28, 2003 7:11 am
by DarylD
You need delays because the floppy controller electronics is not that fast and also the floppy drive takes a while to actually spin up, upto 500ms I believe. Anyway, if you have interrupts, just sleep for a while and run another task while it spins up, thats what my (non-working) code will do, it will avoid your system locking.
Daryl.
Re:Programming the FDC?
Posted: Tue Jan 28, 2003 1:31 pm
by Tim
I agree with DarylD, although the kind of delay you get from task switching (dependent on the PIC frequency, which shouldn't be too fast) will probably be too long for most devices. Granted you should schedule other tasks as you wait for the floppy drive motor to spin up, but for something like the 400ns ATA wait you should use the real-time clock or RDTSC.
Re:Programming the FDC?
Posted: Tue Jan 28, 2003 1:53 pm
by Ozguxxx
Hi people I want to ask a question about timing I had just made a very very simple wait(dword) which makes use of IRQ0, I want to know if that is enough for future use or are there any ideas to implement a more useful
wait(dword)? I think that would be enough for FDC waits but I do not have absolutely any idea for future use... Thanx. (Dont take me very seriously, just asking to get some ideas...)
Re:Programming the FDC?
Posted: Tue Jan 28, 2003 9:09 pm
by Perica
..
Re:Programming the FDC?
Posted: Tue Jan 28, 2003 11:09 pm
by Ozguxxx
Hi Perica Only time slice that you have to wait for is not motor, you also have to wait for 150 ms somewhere and there are some other waits.(I cant remember where now) But I think some fake waits(for loops) are enough but certainly they are not best solutions because they are mpu dependent. BTW my questıon is still valid. ;D Also currently I saw that if you have a working idt then it is very very easy to write a wait function.
Re:Programming the FDC?
Posted: Wed Jan 29, 2003 12:17 am
by Perica
..
Re:Programming the FDC?
Posted: Wed Jan 29, 2003 5:50 am
by Pype.Clicker
Perica Senjak wrote:
Hey,
Yes - I know it's very easy to implement wait commands, but what i want to do is load some things off a Floppy BEFORE my IDT is loaded -- So this will just be a temporary solution, until i get the whole Driver Working ;D
i think it will not be feasible, as floppy will sends an IRq to notify the request completion.
Is there a way to detect if a disk is inserted in the Drive?
try to read a sector.
Re:Programming the FDC?
Posted: Wed Jan 29, 2003 7:12 am
by Perica
..
Re:Programming the FDC?
Posted: Wed Jan 29, 2003 7:34 pm
by Perica
..
Re:Programming the FDC?
Posted: Thu Jan 30, 2003 2:38 am
by Pype.Clicker
What i want to do is Make a Simple GetByte Function, this will be the Base for all the Reading from a Floppy in my OS. Alot of people have been coding FloppyDisk Drivers on this Forum lately, and i thought you'se could offer me some help
oh, and, btw ... it seems silly to make a "GetByte" for a BLOCK device ...
Re:Programming the FDC?
Posted: Thu Jan 30, 2003 2:50 am
by Perica
..
Re:Programming the FDC?
Posted: Thu Jan 30, 2003 6:04 am
by Pype.Clicker
Perica Senjak wrote:
What do you mean by "A BLOCK Device" ??, What is "A BLOCK Device" ??
The kind of stuff you'll find in any OS book :-p
Well, devices usually classify in 2 groups:
character devices (mouse, keyboard, modem, line printer ...) and
block devices (storage mostly).
A character device is just a bidirectionnal pipe from a programmer's point of view : console.getc() will read the next typed char from the keyboard and console.putc() will display it on screen. The same way, printer.getc() and printer.putc() allow you to talk to HP520 or stuff.
A character device cannot be
seeked: you just get bytes in the order the device sent them. period.
A block device is handled differently. First of all, you can't get individual bytes out of it, but only constant-sized
blocks of bytes through device.read() and device.write(). Moreover, you need to provide a Block Identifier (sector nr) for any request.
So if you want to floppy.getByte(), it's more likely that you want to (FS.open("floppy://file")).getByte() ...
Re:Programming the FDC?
Posted: Thu Jan 30, 2003 6:55 am
by Perica
..