Re: atapi cdrom read problem
Posted: Sun Jun 12, 2016 5:55 am
oh,sorry,status is 0x58
The Place to Start for Operating System Developers
http://f.osdev.org/
Code: Select all
for(i=0;i<1024;i++){
io_out8 (ATA_COMMAND (bus), 0xA0); /* ATA PACKET command */
cd_buf[i] = io_in16(ATA_DATA (bus));
}
Code: Select all
io_out8 (ATA_DRIVE_SELECT (bus), drive |(1 << 4)|(1<<6));
io_out8 (ATA_COMMAND (bus), 0xEC); /* ATA PACKET command */
while ((status = io_in8 (ATA_COMMAND (bus))) & 0x08){ /* BUSY */
io_nop();
}
Code: Select all
io_out8 (ATA_COMMAND (bus), 0xA1); /* ATA PACKET command */
while (!((status = io_in8 (ATA_COMMAND (bus))) & 0x08)){
io_nop();
}
for(i=0;i<256;i++){
id_buf[i] = io_in16(ATA_DATA (bus));
}
Code: Select all
for(i=0;i<1024;i++){
io_out8 (ATA_COMMAND (bus), 0xA0); /* ATA PACKET command */
cd_buf[i] = io_in16(ATA_DATA (bus));
}
Code: Select all
io_out8 (ATA_COMMAND (bus), 0xA1); /* ATA PACKET command */
while (!((status = io_in8 (ATA_COMMAND (bus))) & 0x08)){
io_nop();
}
for(i=0;i<256;i++){
id_buf[i] = io_in16(ATA_DATA (bus));
}
Code: Select all
while (!((status = io_in8 (ATA_COMMAND (bus))) & 0x08)){
Code: Select all
for(i=0;i<12;i++){
io_out16(ATA_DATA (bus),read_cmd[i]|(read_cmd[i+1]<<8));
}
Code: Select all
for(i=0;i<6;i++){
j=i*2;
io_out16(ATA_DATA (bus),read_cmd[j]|(read_cmd[j+1]<<8));
}
I have never tried to write to a CDROM, though the name states that you shouldn't be able toRaymond wrote:yes, i am successful to read the data from cdrom,and how can i write sectors to the cdrom,does it use the 0xAA as same steps as reading sectors?
And i buy you books of 'media storage device' and 'usb' but what is the book of 'vitual file system' want to tell us,is there any knowledge about the ntfs format?
I am sorry, I don't understand your question. Please describe a little more.Raymond wrote:Could you tell me reading ata hard disk with address in 0x20 of pci,is that device pci ide?
if the 0x20 should be set a memory address or it is a fixed one?
Code: Select all
0x4000-->physcial address ,command register
0x4001-->resv
0x4002-->status register
0x4003-->resv
0x4004-->BM0 address