Changeset f5a5d57 in rtems


Ignore:
Timestamp:
Mar 7, 2011, 5:36:01 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.9
Children:
843bfe5
Parents:
97207cb
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

    r97207cb rf5a5d57  
     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
    162010-11-23      Joel Sherrill <joel.sherrilL@OARcorp.com>
    27
  • c/src/lib/libbsp/i386/pc386/timer/timer.c

    r97207cb rf5a5d57  
    386386  unsigned int slowLoopGranularity, fastLoopGranularity;
    387387  rtems_interrupt_level  level;
    388 
    389 #ifdef DEBUG_CALIBRATE
    390   printk( "Calibrate_loop_1ms is starting,  please wait ( but not too loooong. )\n" );
    391 #endif
     388  int retries = 0;
     389 
     390  rtems_interrupt_disable(level);
     391
     392retry:
     393  if ( ++retries >= 5 ) {
     394    printk( "Calibrate_loop_1ms: too many attempts. giving up!!\n" );
     395    while (1);
     396  }
     397  #ifdef DEBUG_CALIBRATE
     398   printk("Calibrate_loop_1ms is starting,  please wait (but not too long.)\n");
     399  #endif
    392400  targetClockBits = US_TO_TICK(1000);
    393401
    394   rtems_interrupt_disable(level);
    395402  /*
    396403   * Fill up the cache to get a correct offset
     
    436443  res = readTimer0() - offset;
    437444  if (res < emptyCall) {
    438      printk("Problem #1 in offset computation in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    439     while (1);
     445    printk(
     446      "Problem #1 in offset computation in Calibrate_loop_1ms "
     447        " in file libbsp/i386/pc386/timer/timer.c\n"
     448    );
     449    goto retry;
    440450  }
    441451  fastLoopGranularity = (res - emptyCall) / 10000;
     
    447457  res = readTimer0();
    448458  if (res < offset + emptyCall) {
    449      printk("Problem #2 in offset computation in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    450     while (1);
     459    printk(
     460      "Problem #2 in offset computation in Calibrate_loop_1ms "
     461        " in file libbsp/i386/pc386/timer/timer.c\n"
     462    );
     463    goto retry;
    451464  }
    452465  slowLoopGranularity = (res - offset - emptyCall)/ 10;
    453466
    454467  if (slowLoopGranularity == 0) {
    455     printk("Problem #3 in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
    456     while (1);
     468    printk(
     469      "Problem #3 in offset computation in Calibrate_loop_1ms "
     470        " in file libbsp/i386/pc386/timer/timer.c\n"
     471    );
     472    goto retry;
    457473  }
    458474
Note: See TracChangeset for help on using the changeset viewer.