FDD-Problem
FDD-Problem
hi everybody,
i've a problem with FDD. i wrote a driver and i was happy, when i saw my driver running in bochs. but after checkin in real i realized: it doesn't run. i don't know why!!! what's the big difference between bochs and the PC? i'd be happy if you'd spend some time to check my code. the important funktions are "FDDReadSektor" and "FDDWriteSektor". from there are calls made and it'll be easy to follow the code.
(its attached!)
mfg
J!N
i've a problem with FDD. i wrote a driver and i was happy, when i saw my driver running in bochs. but after checkin in real i realized: it doesn't run. i don't know why!!! what's the big difference between bochs and the PC? i'd be happy if you'd spend some time to check my code. the important funktions are "FDDReadSektor" and "FDDWriteSektor". from there are calls made and it'll be easy to follow the code.
(its attached!)
mfg
J!N
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:FDD-Problem
Haven't the possibility nor time to scan throu all your code, so I gonna give you some hints:
1. Ports correct? (I know I know it works in the bochs)
2. Timeouts present? the floppy controller chip is a slow beast. You need to give it some time to act. Bochs (any emulator) doesn't need such timeouts.
Erm ... Have I said already that you 're a lucky lad? Having managed to get a fdc driver working in the bochs is quite some achievement. I've managed to get it running on real hardware PRIOR to bochs & qemu!! And imagine this for the sake of testing file system development .
conclusion: it is my bet that you need to introduce some waits ere writing to fdc registers. Haven't checked for that thou' so pls forgive me if I have sinned.
1. Ports correct? (I know I know it works in the bochs)
2. Timeouts present? the floppy controller chip is a slow beast. You need to give it some time to act. Bochs (any emulator) doesn't need such timeouts.
Erm ... Have I said already that you 're a lucky lad? Having managed to get a fdc driver working in the bochs is quite some achievement. I've managed to get it running on real hardware PRIOR to bochs & qemu!! And imagine this for the sake of testing file system development .
conclusion: it is my bet that you need to introduce some waits ere writing to fdc registers. Haven't checked for that thou' so pls forgive me if I have sinned.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:FDD-Problem
and how long do you think for this operations:
-seek
-read/write
-register use
? thank you.
J!N
-seek
-read/write
-register use
? thank you.
J!N
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:FDD-Problem
The fdc controller tells in its status register, if it is ready or not. Have a search for fdc programming in this forum or look at www.mega-tokyo.com/osfaq2 or at www.osdever.net. I don't know the needed instructions by heart. :p
read write reset seek f. ex. require yu to wait for fdc irq nr 6.
read write reset seek f. ex. require yu to wait for fdc irq nr 6.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:FDD-Problem
one problem is also that the irq is only activated with the seek-command. there i'm waiting for it, but in read and write it doesn't activate an IRQ, i don't know, why...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:FDD-Problem
might you be missing some event acknowledge (sending EOI, or maybe something FDC-specific that you should do in order to tell the floppy "okay, i'm done with the event you report.")
Re:FDD-Problem
Here are some pointers as the code is not commented in a language i understand.
1. Do you do a FddReSet on first using your floppy driver ?
2. Do you let motor get up to speed before a read/write command
3. Do you do call FddRecalibrate
4. Do you read ST0, ST1,ST2 ,etc, at end of your commands like
"FddRecalibrate","FddReadWrite",etc.
1. Do you do a FddReSet on first using your floppy driver ?
2. Do you let motor get up to speed before a read/write command
3. Do you do call FddRecalibrate
4. Do you read ST0, ST1,ST2 ,etc, at end of your commands like
"FddRecalibrate","FddReadWrite",etc.
Re:FDD-Problem
well,
1. i call FDDReboot.
2. the motor gets 512 millisecs to speed up.
3. no, i don't call FDDRecalibrate. is it important?
4. i fetch the returnbytes but i trash them. i think if there's a temporary error it wouldn't occur 3 times, because that's the number i call the functions to load my keymap and my bitmapfont.
J!N
1. i call FDDReboot.
2. the motor gets 512 millisecs to speed up.
3. no, i don't call FDDRecalibrate. is it important?
4. i fetch the returnbytes but i trash them. i think if there's a temporary error it wouldn't occur 3 times, because that's the number i call the functions to load my keymap and my bitmapfont.
J!N
Re:FDD-Problem
Well the HUGE difference between the BOCHS emulation and a real floppy is that the BOCHS drive never gives errors. However on a real floppy it's quite usual to require a few resets even with a perfectly good disk.joachim_neu wrote: 3. no, i don't call FDDRecalibrate. is it important?
Re:FDD-Problem
I have uploaded the fasm code for my asm OS called "Dex4u" in it is the asm code for a full working pmode floppy driver, along with working pmode CLI ,which includes commands like Dir etc.
You can take alook to see were yours differs, also in there is a fully working ATAPI driver (CD/DVD), if you OS does not have a working CD driver, here you chance to get one.
http://board.flatassembler.net/topic.php?p=23904#23904
You can take alook to see were yours differs, also in there is a fully working ATAPI driver (CD/DVD), if you OS does not have a working CD driver, here you chance to get one.
http://board.flatassembler.net/topic.php?p=23904#23904
Re:FDD-Problem
well,
first thank you. fasm-board seems to be offline at the moment. thank you for the code i'll check it. but i won't take your driver f?r ATA i'll only keep it for the next problems that'll come but i'll like to code everything on my one.
J!N
first thank you. fasm-board seems to be offline at the moment. thank you for the code i'll check it. but i won't take your driver f?r ATA i'll only keep it for the next problems that'll come but i'll like to code everything on my one.
J!N