Changeset 89d19033 in rtems for c/src/libchip/ide/ata.c


Ignore:
Timestamp:
May 7, 2008, 8:49:05 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.9, master
Children:
109cec1
Parents:
9b949dd
Message:

2008-05-07 Till Straumann <strauman@…>

PR 649/bsps

  • libchip/ide/ata.c: Give up if the interface does not become ready.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/libchip/ide/ata.c

    r9b949dd r89d19033  
    14061406                                 * data block
    14071407                                 */
     1408        unsigned           retries;
    14081409    assert(areq);
    14091410
     
    14171418                                  areq->regs.regs[IDE_REGISTER_DEVICE_HEAD]);
    14181419
     1420        retries = 0;
    14191421    do {
    14201422        ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &byte);
     1423        /* If device (on INIT, i.e. it should be idle) is neither
     1424         * busy nor ready something's fishy, i.e., there is probably
     1425         * no device present.
     1426         * I'd like to do a proper timeout but don't know of a portable
     1427         * timeout routine (w/o using multitasking / rtems_task_wake_after())
     1428         */
     1429        if ( ! (byte & (IDE_REGISTER_STATUS_BSY | IDE_REGISTER_STATUS_DRDY)))
     1430            retries++;
     1431        else
     1432            retries=0;
     1433        if ( 10000 == retries ) {
     1434            /* probably no drive connected */
     1435            areq->breq->status = RTEMS_UNSATISFIED;
     1436            areq->breq->error = RTEMS_IO_ERROR;
     1437            return;
     1438        }
    14211439    } while ((byte & IDE_REGISTER_STATUS_BSY) ||
    14221440             (!(byte & IDE_REGISTER_STATUS_DRDY)));
Note: See TracChangeset for help on using the changeset viewer.