Why can't I read CD with ATAPI?
Posted: Tue Mar 12, 2013 10:56 pm
I need read CD in Protected Mode,so I use ATAPI.
I read http://wiki.osdev.org/ATAPI ,then I write the code:
After "write_port(0x1F0,cmd,6);",the irq didn't arrive,what's the reson?
Thank you very much!
I read http://wiki.osdev.org/ATAPI ,then I write the code:
Code: Select all
void readCD()
{
u8 cmd[12] = {0xBE,0,0,0,0,0,0,0,0,0,0,0};
u8 status;
out_byte(0x1F6,0);
in_byte(0x1F0 + 0x206);
in_byte(0x1F0 + 0x206);
in_byte(0x1F0 + 0x206);
in_byte(0x1F0 + 0x206);
out_byte(0x1F1,0);
out_byte(0x1F4,2048 & 0xFF);
out_byte(0x1F5,2048 >> 8);
out_byte(0x1F7,0xA0);
while ((status = in_byte (0x1F7)) & 0x80);
while (!((status = in_byte (0x1F7)) & 0x8) && !(status & 0x1));
cmd[5] = 25;//LBA:low 0-8
cmd[9] = 1;//1 sector
//cmd[10] = 16;
write_port(0x1F0,cmd,6);
wait_irq();//stop here,why?
//...
}
Thank you very much!