Programming the FDC?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Programming the FDC?
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?
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.
Daryl.
Re:Programming the FDC?
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?
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...)
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?
..
Last edited by Perica on Sun Dec 03, 2006 8:37 pm, edited 1 time in total.
Re:Programming the FDC?
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?
..
Last edited by Perica on Sun Dec 03, 2006 8:37 pm, edited 1 time in total.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Programming the FDC?
i think it will not be feasible, as floppy will sends an IRq to notify the request completion.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
try to read a sector.Is there a way to detect if a disk is inserted in the Drive?
Re:Programming the FDC?
..
Last edited by Perica on Sun Dec 03, 2006 8:38 pm, edited 1 time in total.
Re:Programming the FDC?
..
Last edited by Perica on Sun Dec 03, 2006 8:38 pm, edited 1 time in total.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Programming the FDC?
oh, and, btw ... it seems silly to make a "GetByte" for a BLOCK device ...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
Re:Programming the FDC?
..
Last edited by Perica on Sun Dec 03, 2006 8:40 pm, edited 1 time in total.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Programming the FDC?
The kind of stuff you'll find in any OS book :-pPerica Senjak wrote: What do you mean by "A BLOCK Device" ??, What is "A BLOCK Device" ??
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?
..
Last edited by Perica on Sun Dec 03, 2006 8:38 pm, edited 1 time in total.