Changeset c984fb3 in rtems


Ignore:
Timestamp:
05/22/04 15:14:31 (19 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
96e5865
Parents:
138aa38
Message:

2004-05-22 Till Strauman <strauman@…>

PR 619/bsps

  • mpc6xx/clock/c_clock.c: The PPC decrementer must be reloaded on each clock tick. Currently, this is done by just reloading a fixed value. The attached patch takes into account the time that elapsed since the decrementer crossed zero in order to adjust the value to be re-loaded. Without the patch, the effective system clock cycle is increased by the exception handler latency.
Location:
c/src/lib/libcpu/powerpc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/ChangeLog

    r138aa38 rc984fb3  
     12004-05-22      Till Strauman <strauman@slac.stanford.edu>
     2
     3        PR 619/bsps
     4        * mpc6xx/clock/c_clock.c: The PPC decrementer must be reloaded on each
     5        clock tick. Currently, this is done by just reloading a fixed value.
     6        The attached patch takes into account the time that elapsed since the
     7        decrementer crossed zero in order to adjust the value to be
     8        re-loaded. Without the patch, the effective system clock cycle is
     9        increased by the exception handler latency.
     10
    1112004-04-13      Ralf Corsepius <ralf_corsepius@rtems.org>
    212
  • c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c

    r138aa38 rc984fb3  
    7474 *
    7575 */
     76
    7677void clockIsr()
    7778{
     79int decr;
    7880  /*
    7981   *  The driver has seen another tick.
    8082   */
    81 
    82   PPC_Set_decrementer( Clock_Decrementer_value );
    83 
    84   Clock_driver_ticks += 1;
    85 
    86   /*
    87   *  Real Time Clock counter/timer is set to automatically reload.
    88   */
    89 
    90   rtems_clock_tick();
     83  do {
     84        asm volatile ("mfdec %0; add %0, %0, %1; mtdec %0":"=r"(decr):"r"(Clock_Decrementer_value));
     85
     86        Clock_driver_ticks += 1;
     87
     88        /*
     89        *  Real Time Clock counter/timer is set to automatically reload.
     90        */
     91        rtems_clock_tick();
     92  } while ( decr < 0 );
    9193}
    9294
     
    145147            (rtems_configuration_get_microseconds_per_tick()/1000);
    146148
     149  /* set the decrementer now, prior to installing the handler
     150   * so no interrupts will happen in a while.
     151   */
     152  PPC_Set_decrementer( (unsigned)-1 );
     153
     154  /* if a decrementer exception was pending, it is cleared by
     155   * executing the default (nop) handler at this point;
     156   * The next exception will then be taken by our clock handler.
     157   * Clock handler installation initializes the decrementer to
     158   * the correct value.
     159   */
     160
    147161  if (!BSP_connect_clock_handler ()) {
    148162    printk("Unable to initialize system clock\n");
     
    191205    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
    192206    {
    193       if (!BSP_connect_clock_handler ()) {
    194         printk("Error installing clock interrupt handler!\n");
    195         rtems_fatal_error_occurred(1);
    196       }
     207                Clock_initialize(major, minor, 0);
    197208    }
    198209done:
Note: See TracChangeset for help on using the changeset viewer.