OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_66/] [or1ksim/] [peripheral/] [atadevice_cmdi.c] - Diff between revs 876 and 919

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 876 Rev 919
Line 322... Line 322...
    buf++;
    buf++;
 
 
    /*
    /*
       word 19-10: Serial number (ASCII)
       word 19-10: Serial number (ASCII)
    */
    */
    /*           " or1ksim ata_device "                               */
    /*           " www.opencores.org  "                               */
    *buf++ = (' ' << 8) | 'o';
    *buf++ = (' ' << 8) | 'w';
    *buf++ = ('r' << 8) | '1';
    *buf++ = ('w' << 8) | 'w';
    *buf++ = ('k' << 8) | 's';
    *buf++ = ('.' << 8) | 'o';
    *buf++ = ('i' << 8) | 'm';
    *buf++ = ('p' << 8) | 'e';
    *buf++ = (' ' << 8) | 'a';
    *buf++ = ('n' << 8) | 'c';
    *buf++ = ('t' << 8) | 'a';
    *buf++ = ('o' << 8) | 'r';
    *buf++ = ('_' << 8) | 'd';
    *buf++ = ('e' << 8) | 's';
    *buf++ = ('e' << 8) | 'v';
    *buf++ = ('.' << 8) | 'o';
    *buf++ = ('i' << 8) | 'c';
    *buf++ = ('r' << 8) | 'g';
    *buf++ = ('e' << 8) | ' ';
    *buf++ = (' ' << 8) | ' ';
 
 
    /*
    /*
       word 22   : obsolete
       word 22   : obsolete
       word 21-20: retired
       word 21-20: retired
    */
    */
Line 348... Line 348...
    strncpy(buf, FIRMWARE, 8);
    strncpy(buf, FIRMWARE, 8);
    buf += 4;
    buf += 4;
 
 
    /*
    /*
       word 46-27: Model number
       word 46-27: Model number
       note the shuffled character order again.
 
       Damn Big/Little endian thingie
 
    */
    */
    /*           "(C)2002 Richard Herveille  opencores.org"           */
    /*           " ata device model  (C)Richard Herveille "           */
    *buf++ = ('(' << 8) | 'C';
    *buf++ = (' ' << 8) | 'a';
    *buf++ = (')' << 8) | '2';
    *buf++ = ('t' << 8) | 'a';
    *buf++ = ('0' << 8) | '0';
    *buf++ = (' ' << 8) | 'd';
    *buf++ = ('2' << 8) | ' ';
    *buf++ = ('e' << 8) | 'v';
 
    *buf++ = ('i' << 8) | 'c';
 
    *buf++ = ('e' << 8) | ' ';
 
    *buf++ = ('m' << 8) | 'o';
 
    *buf++ = ('d' << 8) | 'e';
 
    *buf++ = ('l' << 8) | ' ';
 
    *buf++ = (' ' << 8) | '(';
 
    *buf++ = ('C' << 8) | ')';
    *buf++ = ('R' << 8) | 'i';
    *buf++ = ('R' << 8) | 'i';
    *buf++ = ('c' << 8) | 'h';
    *buf++ = ('c' << 8) | 'h';
    *buf++ = ('a' << 8) | 'r';
    *buf++ = ('a' << 8) | 'r';
    *buf++ = ('d' << 8) | ' ';
    *buf++ = ('d' << 8) | ' ';
    *buf++ = ('H' << 8) | 'e';
    *buf++ = ('H' << 8) | 'e';
    *buf++ = ('r' << 8) | 'v';
    *buf++ = ('r' << 8) | 'v';
    *buf++ = ('e' << 8) | 'i';
    *buf++ = ('e' << 8) | 'i';
    *buf++ = ('l' << 8) | 'l';
    *buf++ = ('l' << 8) | 'l';
    *buf++ = ('e' << 8) | ' ';
    *buf++ = ('e' << 8) | ' ';
    *buf++ = ('o' << 8) | 'p';
 
    *buf++ = ('e' << 8) | 'n';
 
    *buf++ = ('c' << 8) | 'o';
 
    *buf++ = ('r' << 8) | 'e';
 
    *buf++ = ('s' << 8) | '.';
 
    *buf++ = ('o' << 8) | 'r';
 
    *buf++ = ('g' << 8) | ' ';
 
 
 
    /*
    /*
       word 47:
       word 47:
           15-8: 0x80
           15-8: 0x80
            7-0: 0x00 reserved
            7-0: 0x00 reserved
Line 470... Line 468...
    *buf++ = 0x0001; // not really a FIXME
    *buf++ = 0x0001; // not really a FIXME
 
 
    /*
    /*
       word 60-61: Total number of user addressable sectors (LBA only)
       word 60-61: Total number of user addressable sectors (LBA only)
    */
    */
    *buf++ = (device->size / BYTES_PER_SECTOR) >> 16;
 
    *buf++ = (device->size / BYTES_PER_SECTOR);
    *buf++ = (device->size / BYTES_PER_SECTOR);
 
    *buf++ = (device->size / BYTES_PER_SECTOR) >> 16;
 
 
    /*
    /*
       word 62: obsolete
       word 62: obsolete
    */
    */
    buf++;
    buf++;
Line 848... Line 846...
/*
/*
  A T A _ R E A D _ S E C T O R S
  A T A _ R E A D _ S E C T O R S
*/
*/
void ata_read_sectors_cmd(ata_device *device)
void ata_read_sectors_cmd(ata_device *device)
{
{
  int sector_count;
  size_t sector_count;
  unsigned long lba;
  unsigned long lba;
 
 
  /* print debug information                                          */
  /* print debug information                                          */
  ata_device_debug(2, "executing command 'read sectors'\n");
  ata_device_debug(2, "executing command 'read sectors'\n");
 
 
 
  /* reset the buffer-counter                                         */
 
  device->settings.dbuf_cnt = 0;
 
 
  /* check if this is a NON-PACKET device                             */
  /* check if this is a NON-PACKET device                             */
  if (device->packet)
  if (device->packet)
  {
  {
    /*
    /*
Line 911... Line 911...
 
 
        /* set the file-positon pointer to the start of the sector    */
        /* set the file-positon pointer to the start of the sector    */
        fseek(device->stream, lba, SEEK_SET);
        fseek(device->stream, lba, SEEK_SET);
 
 
        /* get the bytes from the stream                              */
        /* get the bytes from the stream                              */
        fread(device->settings.dbuf, BYTES_PER_SECTOR, 1, device->stream);
        fread(device->settings.dbuf, BYTES_PER_SECTOR, sector_count, device->stream);
 
 
        /* set status register bits                                   */
        /* set status register bits                                   */
        device->regs.status = ATA_SR_DRDY;
        device->regs.status = ATA_SR_DRDY;
    }
    }
  }
  }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.