PCI IDE Controller: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Line 555:
DMA: After sending the command, you should wait for an IRQ, while you are waiting, Buffer is written directly to memory automatically.
 
We are going to use PIO as it isn't going to be complixcomplex, and i want to be far from IRQs as they are very slower than Polling after PIO.
 
We can conclude also this table:
Line 635:
unsigned int slavebit = ide_devices[drive].drive; // Read the Drive [Master/Slave]
unsigned int bus = channels[channel].base; // Bus Base, like 0x1F0 which is also data port.
unsigned int words = 256; // ApproximatlyApproximately all ATA-Drives has sector-size of 512-byte.
unsigned short cyl, i; unsigned char head, sect, err;
</source>
Line 703:
* Bits 0-3: Head Number for CHS.
* Bit 4: Slave Bit. (0: Selecting Master Drive, 1: Selecting Slave Drive).
* Bit 5: ObseleteObsolete and isn't used, but should be set.
* Bit 6: LBA (0: CHS, 1: LBA).
* Bit 7: ObseleteObsolete and isn't used, but should be set.
 
Lets write all these information to the register, while the obseleteobsolete bits are set (0xA0):
 
<source lang="c">
Line 764:
</source>
 
This Command "ATA_CMD_READ_PIO" is right for radingreading in LBA28 or CHS, and controller refers to bit 6 of HDDEVSEL Register to know the mode of reading (LBA or CHS).
 
After sending the command, we should poll, then we read/write a sector then we should poll, then we read/write a sector, until we read/write all sectors needed, if an error is happened, we the function will return a specific error code.