Programming the FDC?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Programming the FDC?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:37 pm, edited 2 times in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Programming the FDC?

Post 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.
DarylD

Re:Programming the FDC?

Post 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.
Tim

Re:Programming the FDC?

Post 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.
Ozguxxx

Re:Programming the FDC?

Post 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...)
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Programming the FDC?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:37 pm, edited 1 time in total.
Ozguxxx

Re:Programming the FDC?

Post 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.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Programming the FDC?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:37 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Programming the FDC?

Post 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.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Programming the FDC?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:38 pm, edited 1 time in total.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Programming the FDC?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:38 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Programming the FDC?

Post 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 ...
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Programming the FDC?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:40 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Programming the FDC?

Post 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() ...
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Programming the FDC?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:38 pm, edited 1 time in total.
Post Reply