ATA IDE IDENTIFY

时间:2016-03-30 07:49:18

标签: c operating-system systems-programming ata

我正在尝试为我的os学习开发ide ata驱动程序..我遇到一个问题,在发送IDENTIFY CMD之后系统挂起而没有恐慌..! 我使用以下代码

/* ATA specs say these values must be zero before sending IDENTIFY */
outportb(io + ATA_REG_SECCOUNT0, 0);
outportb(io + ATA_REG_LBA0, 0);
outportb(io + ATA_REG_LBA1, 0);
outportb(io + ATA_REG_LBA2, 0);
/* Now, send IDENTIFY */
Printf("Sending IDENTIFY to port 0x%X\n",io);
outportb(io + ATA_REG_COMMAND, ATA_CMD_IDENTIFY);
Printf("Sent IDENTIFY\n");
/* Now, read status port */
uint8_t status = inportb(io + ATA_REG_STATUS);
Printf("\nThe status right now is %d", status);
if (status)
{
    Printf("\nNow Polling... _IRQP = %d , _IRQS= %d",_IRQP,_IRQS);
    /* Now, poll untill BSY is clear. */
    //while (inportb(io + ATA_REG_STATUS) & ATA_SR_BSY != 0);
    while (!_IRQP || !_IRQS){}
    Printf("\nFinished Polling... _IRQP = %d , _IRQS= %d", _IRQP, _IRQS);

它从未到达"已发送识别" ..还有一些时间,它写了森并挂起。

我已经在Virtualbox和VMWare上测试了相同的结果。 知道为什么要挂断电话吗?

0 个答案:

没有答案