Ignore:
Timestamp:
Jun 7, 2011, 9:14:06 AM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
95fe2fd
Parents:
1343dfa3
Message:

2011-06-07 Sebastian Huber <sebastian.huber@…>

  • clock/clock-config.c: Fixes to pass psnsext01.
  • startup/bspstart.c: Workaround for GCC 4.6 bug.
  • include/smsc9218i.h, network/smsc9218i.c, Makefile.am: Changes throughout.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/mpc55xxevb/clock/clock-config.c

    r1343dfa3 ra447527  
    4444 } while (0)
    4545
    46 static void mpc55xx_clock_handler_install( rtems_isr_entry isr,
     46static uint64_t mpc55xx_clock_factor;
     47
     48static void mpc55xx_clock_handler_install( rtems_isr_entry isr,
    4749                                           rtems_isr_entry *old_isr)
    4850{
     
    6971  uint64_t interval = ((uint64_t) bsp_clock_speed
    7072    * (uint64_t) rtems_configuration_get_microseconds_per_tick()) / 1000000;
     73
     74  mpc55xx_clock_factor = (1000000000ULL << 32) / bsp_clock_speed;
    7175
    7276  /* Apply prescaler */
     
    132136static uint32_t mpc55xx_clock_nanoseconds_since_last_tick( void)
    133137{
    134   uint64_t clicks = EMIOS.CH [MPC55XX_CLOCK_EMIOS_CHANNEL].CCNTR.R;
    135   uint64_t clock = bsp_clock_speed;
    136   uint64_t ns = (clicks * 1000000000) / clock;
     138  volatile struct EMIOS_CH_tag *regs = &EMIOS.CH [MPC55XX_CLOCK_EMIOS_CHANNEL];
     139  uint64_t c = regs->CCNTR.R;
     140  union EMIOS_CSR_tag csr = { .R = regs->CSR.R };
     141  uint64_t k = mpc55xx_clock_factor;
    137142
    138   return (uint32_t) ns;
     143  if (csr.B.FLAG != 0) {
     144    c = regs->CCNTR.R + regs->CADR.R + 1;
     145  }
     146
     147  return (uint32_t) ((c * k) >> 32);
    139148}
    140149
Note: See TracChangeset for help on using the changeset viewer.