ATA Read

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
raz0r
Posts: 19
Joined: Sat Apr 30, 2011 6:02 pm

ATA Read

Post by raz0r »

HI,

Im trying to develop a IDE/ATA Driver in ANSI C / ASM. I read this page: http://wiki.osdev.org/ATA and I developed a test function using that standards driver functions:

Code: Select all

void read_test_ide()
{
  ide_initialize(0x1F0, 0x3F4, 0x170, 0x374, 0x000);
  //ide_initialise_harcoded();

  unsigned char* readbuf = (unsigned char*)pvFnMalloc(512);
  int dispositivo = 0;
  unsigned char numsect = 0x200; //READ PIO
  unsigned int lba = 40001;

  for(dispositivo=0;dispositivo<4;dispositivo++)
  {
    if(ide_devices[dispositivo].Reserved == 1)
    {
      if (!ide_read_sectors(dispositivo, numsect, lba, (unsigned int)readbuf))
      {
        vFnImprimir("No se pudo leer la direccion lba: %d!\n",lba);
        iFnFree(readbuf);
      }
      else
      {
        vFnImprimir("READ Test completed\n\n%s\n\n",readbuf);
        iFnFree(readbuf);
      }
    }
  }
}
The OS detect my ATA and it read one sector good. The problem is, where is the data that I read? I need read byte/word/stream and I need recover the information for print this info in a shell.

Using this functions (http://wiki.osdev.org/ATA) can I recover the data that I read? thanks.
raz0r
Posts: 19
Joined: Sat Apr 30, 2011 6:02 pm

Re: ATA Read

Post by raz0r »

berkus wrote:vFnImprimir()? REALLY?
is a print function. ignore that plz
how can i do that. .go...
Post Reply