flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > FDC programming with DMA |
Author |
|
bogdanontanu 02 Feb 2005, 13:04
You have example of a functional FDC driver in SolarOS.
I has become a little more advanced/cmplicated lately (state machine by IRQ) to speed up things but I can explain FDC operation to you bit by bit -- and in this regard to anybody eles that need to understand it Bassically you have to read the documentation and assume nothing, since people have a strange tendency to assume that things work much simpler or easyer than they really are in hardware devices. First you should do a Recalibrate command since you do not know where the Floppy drive read head is located at OS startup do you? And then after the SEEK command you should LAways do a SENSEI comand on the IRQ-6 that signals the end of SEEK/RECALIBRATE. If you read and interpret the status register corectly then you should have dedeucted that also. The floppy expects some oredr in the commands you are sending and receiving from it and failing to folow that strict order result in no fucntion or stall of the controller. I did played with it a lot without the DMA just to have a single unknown variable in the equation. I have enabled DMA only after i have understood it method of operation . Today CPUs are fast enough to read the data from the floppy controler without any DMA whatsoever but since that DMA is linked to floppy anyway i finnaly used it. Also using Bochs or other emulators to test real hardware device is not the best solution because emulatore act most of the time slightly diffrent that real devices and you can have surprises later on either ways: either it runs on the emulator but it doesent run on real hardware or it runs on real hardware and is not running in emulators. For example lately Eugen has some problems with QEMU generating an IRQ from its network board in the middle of CLI ... STI instructions imagine THAT ... |
|||
02 Feb 2005, 13:04 |
|
ASHLEY4 02 Feb 2005, 19:19
bogdanontanu, I agree with you about it work on a real hardware or it works on a emulator, but not on both, my floppy driver work on real PC's, but not on most emulators , same with my atapi driver.
But do you know how to test for floppy change, with out reading floppy, as windows can. I can not find any command, for doing this . _________________ \\\\||//// (@@) ASHLEY4. Batteries not included, Some assembly required. |
|||
02 Feb 2005, 19:19 |
|
Octavio 02 Feb 2005, 19:43
bogdanontanu: you have a floppy driver ,but your os is loaded using bios
and you must provide some application to test this driver. Also the only computer where my floppy driver doesn't work is too old for your os. ManOfSteel: autoinitialize dma mode is not for floppies ,it can work on read operation but you will get dma errors on write operations. ASHLEY4: to detect disk change just after set motor on read port 3f7h if bit 7 is set the disk is changed. i don´t know how windows does, but in linux you have to manually mount and umount the floppy, on my os i will do the same than in linux, since the cache design is very similar. i have seen in some sources that after a seek operation the driver must wait 15 ms before read/write operations. and why nobody uses implicit seeks ? this is simpler and more efficient. Last edited by Octavio on 02 Feb 2005, 19:56; edited 1 time in total |
|||
02 Feb 2005, 19:43 |
|
ManOfSteel 02 Feb 2005, 19:50
Hello,
Quote:
Recalibrating consists of adjusting the drive and seeking is about adjusting the head, right? I'm currently sending these commands with zeros as parameters since I'm only using drive A for now. I don't really understand the 'sensei' thing. What steps should I follow to do it? Quote: If you read and interpret the status register corectly then you should have dedeucted that also. The floppy expects some oredr in the commands you are sending and receiving from it and failing to folow that strict order result in no fucntion or stall of the controller. I already read the MSR (0x3f4) before sending commands as you've probably seen in my original post. Should I read other ports? Which ones? And when? Also, I've heard about some ports ST1/2/3/4. They are status ports, right? What are their addresses? Should they be read and interpreted? If yes, when? Quote: I did played with it a lot without the DMA just to have a single unknown variable in the equation. I have enabled DMA only after i have understood it method of operation. Very interesting. I would like to know how to do it, because I already tried it and so far I was unable to achieve anything even under Bochs . That's why I actually switched to the DMA technique thinking it will work better but I finally realized I was mistaken. To read a sector, for example, I used to send the read command to the command port then the parameters (head, sector, track, gap, ...) but then I don't know what to do next. I tried to read from the command port but it didn't give me any result. How do you do it? Quote: For example lately Eugen has some problems with QEMU generating an IRQ from its network board in the middle of CLI ... STI instructions imagine THAT ... Wow! I've already noticed that emulators are not always so accurate, but that is too much! Thanks for your replies. |
|||
02 Feb 2005, 19:50 |
|
ManOfSteel 02 Feb 2005, 20:22
Hello again,
Octavio, Quote: autoinitialize dma mode is not for floppies ,it can work on read operation but you will get dma errors on write operations. So, I will disable autoinitialization (bit 4 on mode register cleared). Where do I have to enable it? For sound transfers? Quote:
"Implicit seeks"? What do you mean by that? And how are they any different from "standard seeks"? |
|||
02 Feb 2005, 20:22 |
|
ASHLEY4 02 Feb 2005, 20:59
ManOfSteel wrote:
The reason people do not use Implicit seeks much, is it is not available on all controllers. PS: Thanks Octavio, i will give it a try. _________________ \\\\||//// (@@) ASHLEY4. Batteries not included, Some assembly required. |
|||
02 Feb 2005, 20:59 |
|
Octavio 02 Feb 2005, 22:04
Yes, sound cards suports autoinitialize mode.
the implicit seek is enabled with the configure command with this byte secuence: db 13h,0,6fh,0 ;this also enables fifo then you don´t need to issue a seek +sensei commands before read or write operations. here you will finds more info: http://www.osdever.net/cottontail/ Ashley: do you mean that there are still computers with type 1 controller? do you know how to detect them? also i have read that this controllers don´t support relative seek, but relative seek is needed for formating,so it must be some errors on my docs or what ? |
|||
02 Feb 2005, 22:04 |
|
ASHLEY4 03 Feb 2005, 03:12
@Octavio, when i wrtten my floppy driver, i used implicit seek, i have lots of test PC's, half them it work on, on others it give a error to do with not moving the head to the right track, so i used seeks and it works on all test PC's.
PS: I have implemented only reading from the floppy, not write, but the read/write command are basically the same, most people use bacically the same function. _________________ \\\\||//// (@@) ASHLEY4. Batteries not included, Some assembly required. |
|||
03 Feb 2005, 03:12 |
|
Octavio 07 Feb 2005, 17:12
ASHLEY4 wrote: @Octavio, when i wrtten my floppy driver, i used implicit seek, i have lots of test PC's, half them it work on, on others it give a error to do with not moving the head to the right track, so i used seeks and it works on all test PC's. Yes, this was the problem one of my computers has type 1 controller, so i rewrote the driver using explicits seeks and now my OS works on all my computers and also in microsoft virtual pc2004 ,but not in bochs. about the 15 ms off delay time affter the seek it seems to be unneded or done automatically with the head load time parameter. seek and relative seek(type 2 only) both can be used to format floppies. and write operations works in the same way than reads, but the filesystem implementation is a lot complex. |
|||
07 Feb 2005, 17:12 |
|
ASHLEY4 07 Feb 2005, 17:25
Octavio wrote:
Thats the part i am not looking forward to the "filesystem implementation" of write . _________________ \\\\||//// (@@) ASHLEY4. Batteries not included, Some assembly required. |
|||
07 Feb 2005, 17:25 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.