I have got problems again, this with IDE controller.
When I try to read something, which was written previously by the same controller, I get nothing in the buffer memory.
The code (that is posted below) is very primitive and it does almost anything: I only can initialize the primary master device
attached, write sectors and read them.
The main code, where I call the IDE-controller funtions, is:
Code: Select all
// ...
if(!IDE_INIT0()){
DEBUG(false, "IDE cant be initialized :( \n");
goto halt;
}
DEBUG(false, "IDE-controller initialized successfuly:)\n");
DEBUG(false, "TESTING IDE-CONTROLLER\n");
DEBUG(false, "Writing \"Hello everyone\" on HD... \n");
u8* sectmp = (u8*) kmalloc (512);
if(!sectmp){
DEBUG(false, "I wasnt able to reserve mem for \'sectmp\'\n");
goto halt;
}
memset(sectmp, 0x00, 512);
strcpy((s8*)sectmp, "Hello everyone");
if(IDE_WriteSecs(0, 1, 0, sectmp) != 0x00){
DEBUG(false, "There was an error while writing\n");
kfree(sectmp);
goto halt;
}
DEBUG(false, "It was written successfuly (?)\n");
DEBUG(false, "Read sector 0 to verify the writing\n");
memset(sectmp, 0x00, 512);
if(IDE_ReadSecs(0, 1, 0, sectmp) != 0x00){
DEBUG(false, "There was an error while reading\n");
kfree(sectmp);
goto halt;
}
DEBUG(false, "It was read successfuly\n");
DEBUG(false, "%s\n", sectmp);
DEBUG(false, "TEST IDE-CONTROLLER ENDS\n");
//...
PD: The code has got comments, which are in the DEBUG funtions, but they are in Spanish (Sorry... )