Changeset 46974aa in rtems


Ignore:
Timestamp:
Mar 7, 2011, 5:35:52 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10
Children:
97b6dc0
Parents:
7869594
Message:

2011-03-07 Joel Sherrill <joel.sherrilL@…>

PR 1756/bsps

  • timer/timer.c: Retry on timer calibration loop failure.
Location:
c/src/lib/libbsp/i386/pc386
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/pc386/ChangeLog

    r7869594 r46974aa  
     12011-03-07      Joel Sherrill <joel.sherrilL@OARcorp.com>
     2
     3        PR 1756/bsps
     4        * timer/timer.c: Retry on timer calibration loop failure.
     5
    162011-02-02      Ralf Corsépius <ralf.corsepius@rtems.org>
    27
  • c/src/lib/libbsp/i386/pc386/timer/timer.c

    r7869594 r46974aa  
    334334  unsigned int slowLoopGranularity, fastLoopGranularity;
    335335  rtems_interrupt_level  level;
    336 
     336  int retries = 0;
     337
     338  rtems_interrupt_disable(level);
     339
     340retry:
     341  if ( ++retries >= 5 ) {
     342    printk( "Calibrate_loop_1ms: too many attempts. giving up!!\n" );
     343    while (1);
     344  }
    337345#ifdef DEBUG_CALIBRATE
    338346  printk("Calibrate_loop_1ms is starting,  please wait (but not too long.)\n");
    339347#endif
    340348  targetClockBits = US_TO_TICK(1000);
    341 
    342   rtems_interrupt_disable(level);
    343349  /*
    344350   * Fill up the cache to get a correct offset
     
    384390  res = readTimer0() - offset;
    385391  if (res < emptyCall) {
    386      printk("Problem #1 in offset computation in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    387     while (1);
     392    printk(
     393      "Problem #1 in offset computation in Calibrate_loop_1ms "
     394        " in file libbsp/i386/pc386/timer/timer.c\n"
     395    );
     396    goto retry;
    388397  }
    389398  fastLoopGranularity = (res - emptyCall) / 10000;
     
    395404  res = readTimer0();
    396405  if (res < offset + emptyCall) {
    397      printk("Problem #2 in offset computation in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    398     while (1);
     406    printk(
     407      "Problem #2 in offset computation in Calibrate_loop_1ms "
     408        " in file libbsp/i386/pc386/timer/timer.c\n"
     409    );
     410    goto retry;
    399411  }
    400412  slowLoopGranularity = (res - offset - emptyCall)/ 10;
    401413
    402414  if (slowLoopGranularity == 0) {
    403     printk("Problem #3 in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    404     while (1);
     415    printk(
     416      "Problem #3 in offset computation in Calibrate_loop_1ms "
     417        " in file libbsp/i386/pc386/timer/timer.c\n"
     418    );
     419    goto retry;
    405420  }
    406421
Note: See TracChangeset for help on using the changeset viewer.