Anonymous user
ATAPI: Difference between revisions
Jump to navigation
Jump to search
m
Convert to standard ISO data types
[unchecked revision] | [unchecked revision] |
(Added link to new article "Optical Drive") |
m (Convert to standard ISO data types) |
||
Line 9:
For instance, reading the table of contents is achieved by sending the following byte string to the device, as a "command".
<source lang="c">
</
The ATA PACKET command works in three phases, in PIO mode.
Line 50:
Assume that the command is in words Command1 through Command6. Device is the Primary slave. Select the target device by setting the master/slave bit in the Device Select Register. There are no other bits needed.
<source lang="c">
</source>
If the command is going to use DMA, set the Features Register to 1, otherwise 0 for PIO.
<source lang="c">
</source>
The Sectorcount Register and LBA Low Register are unused currently. Send maxByteCount in LBA Mid and LBA High Registers.
<source lang="c">
outb (0x1F4, (maxByteCount & 0xff))▼
</source>
Send the ATAPI PACKET command to the Command Register
<source lang="c">
</source>
Wait for an IRQ, or poll for BSY to clear and DRQ to set.
Line 69 ⟶ 77:
Then send the ATAPI command as 6 words, to the data port.
<source lang="c">
outw (0x1F0, Command1)▼
</source>
Then wait for another IRQ. You cannot poll.
Line 85 ⟶ 95:
Once you have the transfer size (bytecount = LBA High << 8 | LBA Mid), do the PIO transfer.
<source lang="c">
</source>
loop on inw(0x1F0) or outw(0x1f0) wordcount times.
Line 251 ⟶ 263:
<source lang="c">
}
</source>
|