problem in floppy driver
Posted: Fri Nov 07, 2003 6:10 am
i'm writing a floppy driver.but when i execute reset command and read value in data register
it returns 128 which i think is not correct.
please tell me what's causing problem.
whats the correct value that i should recieve;
here is output of my code
interrupt recieved
controller is ready to accept commands
status1=128
it returns 128 which i think is not correct.
please tell me what's causing problem.
whats the correct value that i should recieve;
here is output of my code
interrupt recieved
controller is ready to accept commands
status1=128
Code: Select all
int main(void)
{
reset_floppy();
if(interrupt)
{
printf("\ninterrupt recieved");
check_controller_status();
}
}
/////////////////////////
reset_floppy()
{
outportb(0x3f2,0x00);
outportb(0x3f2,0x0c);
}
////////////////////////////
check_controller_status()
{
unsigned char status=0,status1=0;
status=inportb(0x03f4);
if(status==0x80)
{
printf("\ncontroller is ready to accept commands");
outportb(0x03f5,0x08);
wait_floppy_data();
status1=inportb(0x3f5);
printf(" \nstatus1=%u ",status1);
}
else
printf("\nnot ready to accept commands");
}
/////////////////////////////////////////
void wait_floppy_data()
{
while(((inportb(0x03f4))&0xd0)!=0xd0);
return;
}