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.
Hi,
I'm trying to implement a floppy driver. For the dma part I read the wiki. As it seems to work in qemu and bochs quite nice I would be satisfied with it for now if there wasn't one thing I can't understand:
In the FAQ is said the mode register of the dma chip is used to set the direction of IO.
SEL0 and SEL1 selects the channel you want to change.
TRA0 and TRA1 selects the transfer type.
00 runs a self test of the controller.
01 DMA Channel is for writing
10 DMA Channel is for reading
11 invalid
Therefore writing is 0x04 and reading 0x08. It's the same in the Intel specification. But if I use it in my implementation in this order it crashes. But the other way round [writing 10 / 0x08 and reading 01 / 0x04] works? ???
What am I getting wrong here?
It can be a little confusing. The notes for transfer direction could be more specific:
[tt] 00 DMA Channel is for verifying to memory
01 DMA Channel is for writing to memory
10 DMA Channel is for reading from memory
11 invalid[/tt]
For example, if you're reading data from a floppy you'd need to tell the DMA controller to write the data to memory.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
thx, your description should replace the old one in the faq as it's clearer or at least a hint in the example for accessing the floppy that one has to consider that for reading from floppy the dma has to write to mem and the other way round.
OZ wrote:thx, your description should replace the old one in the faq as it's clearer or at least a hint in the example for accessing the floppy that one has to consider that for reading from floppy the dma has to write to mem and the other way round.
Done - Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.