예제 #1
0
파일: clock-config.c 프로젝트: rtemss/rtems
static uint32_t qoriq_clock_nanoseconds_since_last_tick(void)
{
  uint32_t current = GTCCR_COUNT_GET(qoriq_clock->ccr);
  uint32_t base = qoriq_clock->bcr;

  return (base - current) * qoriq_clock_nanoseconds_per_timer_tick;
}
예제 #2
0
static uint32_t qoriq_clock_nanoseconds_since_last_tick(void)
{
  uint32_t ccr = qoriq_clock->ccr;
  uint32_t bcr = qoriq_clock->bcr;

  if ((ccr & GTCCR_TOG) != (qoriq_clock_last_ccr & GTCCR_TOG)) {
    bcr += bcr;
  }

  return (bcr - GTCCR_COUNT_GET(ccr)) * qoriq_clock_nanoseconds_per_timer_tick;
}
예제 #3
0
파일: clock-config.c 프로젝트: gedare/rtems
static void qoriq_clock_initialize(void)
{
  uint32_t timer_frequency = BSP_bus_frequency / 8;
  uint32_t interval = (uint32_t) (((uint64_t) timer_frequency
    * (uint64_t) rtems_configuration_get_microseconds_per_tick()) / 1000000);

  qoriq_clock->bcr = GTBCR_COUNT(interval);

  qoriq_timecounter->bcr = GTBCR_COUNT(0xffffffff);

  qoriq_clock_tc.tc_get_timecount = qoriq_clock_get_timecount;
  qoriq_clock_tc.tc_counter_mask = GTCCR_COUNT_GET(0xffffffff);
  qoriq_clock_tc.tc_frequency = timer_frequency;
  qoriq_clock_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
  rtems_timecounter_install(&qoriq_clock_tc);
}
예제 #4
0
파일: clock-config.c 프로젝트: gedare/rtems
static uint32_t qoriq_clock_get_timecount(struct timecounter *tc)
{
  uint32_t ccr = qoriq_timecounter->ccr;

  return GTCCR_COUNT_GET(-ccr);
}