Changeset 31fe820 in rtems


Ignore:
Timestamp:
Jun 21, 2007, 10:45:05 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
3aa0564
Parents:
d3b05790
Message:

2007-06-21 Joel Sherrill <joel.sherrill@…>

  • clock/clock.c: Add nanoseconds since last tick support.
Location:
c/src/lib/libbsp/powerpc/gen5200
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/gen5200/ChangeLog

    rd3b05790 r31fe820  
     12007-06-21      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * clock/clock.c: Add nanoseconds since last tick support.
     4
    152007-06-20      Joel Sherrill <joel.sherrill@oarcorp.com>
    26
  • c/src/lib/libbsp/powerpc/gen5200/clock/clock.c

    rd3b05790 r31fe820  
    127127
    128128
     129uint64_t Clock_last_TBR;
     130
    129131/*
    130132 *  ISR Handlers
     
    142144
    143145    gpt->status |= GPT_STATUS_TEXP;
     146    Clock_last_TBR = PPC_Get_timebase_register();
    144147
    145148
     
    187190  }
    188191
     192uint32_t bsp_clock_nanoseconds_since_last_tick(void)
     193{
     194  uint64_t new_tbr;
     195  uint64_t bus_cycles;
     196  uint32_t nsecs;
     197
     198  new_tbr = PPC_Get_timebase_register();
     199  bus_cycles = (new_tbr - Clock_last_TBR) * 4;
     200  nsecs =  (uint32_t) (bus_cycles / (XLB_CLOCK / 1000000)) * 1000;
     201
     202  return nsecs;
     203}
    189204
    190205/*
     
    196211
    197212  gpt->emsel |= GPT_EMSEL_CE | GPT_EMSEL_INTEN;
     213  Clock_last_TBR = PPC_Get_timebase_register();
    198214
    199215  }
     
    227243  {
    228244  uint32_t gpt_no;
    229 
    230245
    231246  gpt_no = BSP_SIU_IRQ_TMR0 - (irq->name);
     
    376391  ClockInitialized = 1;
    377392
     393    rtems_clock_set_nanoseconds_extension(
     394      bsp_clock_nanoseconds_since_last_tick
     395    );
    378396  atexit(Clock_exit);
    379397
Note: See TracChangeset for help on using the changeset viewer.