Changeset 13e4ab64 in rtems


Ignore:
Timestamp:
Mar 4, 2011, 9:56:45 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
6311805
Parents:
bd0ebc3
Message:

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

  • timer/timer.c: Retry up to 5 times when the calibration loop fails.
Location:
c/src/lib/libbsp/i386/pc386
Files:
2 edited

Legend:

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

    rbd0ebc3 r13e4ab64  
     12011-03-04      Joel Sherrill <joel.sherrilL@OARcorp.com>
     2
     3        * timer/timer.c: Retry up to 5 times when the calibration loop fails.
     4
    152011-02-11      Ralf Corsépius <ralf.corsepius@rtems.org>
    26
  • c/src/lib/libbsp/i386/pc386/timer/timer.c

    rbd0ebc3 r13e4ab64  
    335335  unsigned int slowLoopGranularity, fastLoopGranularity;
    336336  rtems_interrupt_level  level;
    337 
     337  int retries = 0;
     338
     339  rtems_interrupt_disable(level);
     340
     341retry:
     342  if ( ++retries >= 5 ) {
     343    printk( "Calibrate_loop_1ms: too many attempts. giving up!!\n" );
     344    while (1);
     345  }
    338346#ifdef DEBUG_CALIBRATE
    339347  printk("Calibrate_loop_1ms is starting,  please wait (but not too long.)\n");
    340348#endif
    341349  targetClockBits = US_TO_TICK(1000);
    342 
    343   rtems_interrupt_disable(level);
    344350  /*
    345351   * Fill up the cache to get a correct offset
     
    385391  res = readTimer0() - offset;
    386392  if (res < emptyCall) {
    387      printk("Problem #1 in offset computation in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    388     while (1);
     393    printk(
     394      "Problem #1 in offset computation in Calibrate_loop_1ms "
     395        " in file libbsp/i386/pc386/timer/timer.c\n"
     396    );
     397    goto retry;
    389398  }
    390399  fastLoopGranularity = (res - emptyCall) / 10000;
     
    396405  res = readTimer0();
    397406  if (res < offset + emptyCall) {
    398      printk("Problem #2 in offset computation in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    399     while (1);
     407    printk(
     408      "Problem #2 in offset computation in Calibrate_loop_1ms "
     409        " in file libbsp/i386/pc386/timer/timer.c\n"
     410    );
     411    goto retry;
    400412  }
    401413  slowLoopGranularity = (res - offset - emptyCall)/ 10;
    402414
    403415  if (slowLoopGranularity == 0) {
    404     printk("Problem #3 in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    405     while (1);
     416    printk(
     417      "Problem #3 in offset computation in Calibrate_loop_1ms "
     418        " in file libbsp/i386/pc386/timer/timer.c\n"
     419    );
     420    goto retry;
    406421  }
    407422
Note: See TracChangeset for help on using the changeset viewer.