i am trying to use some codes from other OSes to get ATA working in my code.
i am using below code to send IDENTIFY command
Code: Select all
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, _IRQ
some times it writes on screen "Sen" without completing the word and hang up.
there is no panic catched ..
any isea why it is hanging up?