Changeset 65f868c in rtems


Ignore:
Timestamp:
May 23, 2018, 12:17:25 PM (14 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
762fa62
Parents:
4c7b18e3
git-author:
Sebastian Huber <sebastian.huber@…> (05/23/18 12:17:25)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/15/18 11:02:44)
Message:

Add _CPU_Counter_frequency()

Add rtems_counter_frequency() API function. Use it to initialize the
counter value converter via the new system initialization step
(RTEMS_SYSINIT_CPU_COUNTER). This decouples the counter implementation
and the counter converter. It avoids an unnecessary pull in of the
64-bit integer division from libgcc.

Update #3456.

Files:
2 added
78 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/altera-cyclone-v/start/bspstart.c

    r4c7b18e3 r65f868c  
    1414
    1515#include <bsp/bootcard.h>
    16 #include <bsp/arm-a9mpcore-clock.h>
    1716#include <bsp/fdt.h>
    1817#include <bsp/irq-generic.h>
     
    9695{
    9796  update_clocks();
    98   a9mpcore_clock_initialize_early();
    9997  bsp_interrupt_initialize();
    10098  rtems_cache_coherent_add_area(
  • bsps/arm/include/bsp/arm-a9mpcore-clock.h

    r4c7b18e3 r65f868c  
    2323uint32_t a9mpcore_clock_periphclk(void);
    2424
    25 /**
    26  * @brief Do early clock initialization so that the CPU counter conversion
    27  * works.
    28  */
    29 static inline void a9mpcore_clock_initialize_early(void)
    30 {
    31   rtems_counter_initialize_converter(a9mpcore_clock_periphclk());
    32 }
    33 
    3425#ifdef __cplusplus
    3526}
  • bsps/arm/lpc176x/start/system-clocks.c

    r4c7b18e3 r65f868c  
    110110}
    111111
     112uint32_t _CPU_Counter_frequency(void)
     113{
     114  return LPC176X_PCLK;
     115}
     116
    112117CPU_Counter_ticks _CPU_Counter_read( void )
    113118{
  • bsps/arm/lpc24xx/start/system-clocks.c

    r4c7b18e3 r65f868c  
    6262  /* Start timer */
    6363  T1TCR = TCR_EN;
     64}
    6465
    65   rtems_counter_initialize_converter(LPC24XX_PCLK);
     66uint32_t _CPU_Counter_frequency(void)
     67{
     68  return LPC24XX_PCLK;
    6669}
    6770
  • bsps/arm/lpc32xx/start/bspstart.c

    r4c7b18e3 r65f868c  
    2727#include <bsp/irq-generic.h>
    2828
     29uint32_t _CPU_Counter_frequency(void)
     30{
     31  return LPC32XX_PERIPH_CLK;
     32}
     33
    2934CPU_Counter_ticks _CPU_Counter_read(void)
    3035{
     
    3439void bsp_start(void)
    3540{
    36   rtems_counter_initialize_converter(LPC32XX_PERIPH_CLK);
    3741  bsp_interrupt_initialize();
    3842}
  • bsps/arm/realview-pbx-a9/start/bspstart.c

    r4c7b18e3 r65f868c  
    1515#include <bsp.h>
    1616#include <bsp/bootcard.h>
    17 #include <bsp/arm-a9mpcore-clock.h>
    1817#include <bsp/irq-generic.h>
    1918
    2019void bsp_start(void)
    2120{
    22   a9mpcore_clock_initialize_early();
    2321  bsp_interrupt_initialize();
    2422}
  • bsps/arm/shared/clock/clock-a9mpcore.c

    r4c7b18e3 r65f868c  
    156156  a9mpcore_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
    157157  rtems_timecounter_install(&a9mpcore_tc);
     158}
     159
     160uint32_t _CPU_Counter_frequency(void)
     161{
     162  return a9mpcore_clock_periphclk();
    158163}
    159164
  • bsps/arm/shared/clock/clock-generic-timer.c

    r4c7b18e3 r65f868c  
    167167}
    168168
     169uint32_t _CPU_Counter_frequency(void)
     170{
     171  return arm_gt_clock_instance.interval;
     172}
     173
    169174CPU_Counter_ticks _CPU_Counter_read(void)
    170175{
     
    180185    &arm_gt_clock_instance.irq
    181186  );
    182 
    183   rtems_counter_initialize_converter(arm_gt_clock_instance.interval);
    184187}
    185188
    186189RTEMS_SYSINIT_ITEM(
    187190  arm_gt_clock_early_init,
    188   RTEMS_SYSINIT_BSP_START,
    189   RTEMS_SYSINIT_ORDER_LAST
     191  RTEMS_SYSINIT_CPU_COUNTER,
     192  RTEMS_SYSINIT_ORDER_FIRST
    190193);
    191194
  • bsps/arm/shared/cpucounter/cpucounter-armv7m.c

    r4c7b18e3 r65f868c  
    2020#include <bsp/fatal.h>
    2121
     22uint32_t _CPU_Counter_frequency(void)
     23{
     24#ifdef BSP_ARMV7M_SYSTICK_FREQUENCY
     25  return = BSP_ARMV7M_SYSTICK_FREQUENCY;
     26#else
     27  volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
     28  return ARMV7M_SYSTICK_CALIB_TENMS_GET(systick->calib) * 100;
     29#endif
     30}
     31
    2232CPU_Counter_ticks _CPU_Counter_read(void)
    2333{
     
    3343  cyccnt_enabled = _ARMV7M_DWT_Enable_CYCCNT();
    3444
    35   if (cyccnt_enabled) {
    36     #ifdef BSP_ARMV7M_SYSTICK_FREQUENCY
    37       uint64_t freq = BSP_ARMV7M_SYSTICK_FREQUENCY;
    38     #else
    39       volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
    40       uint64_t freq = ARMV7M_SYSTICK_CALIB_TENMS_GET(systick->calib) * 100ULL;
    41     #endif
    42 
    43     rtems_counter_initialize_converter(freq);
    44   } else {
     45  if (!cyccnt_enabled) {
    4546    bsp_fatal(BSP_ARM_ARMV7M_CPU_COUNTER_INIT);
    4647  }
     
    4950RTEMS_SYSINIT_ITEM(
    5051  armv7m_cpu_counter_initialize,
    51   RTEMS_SYSINIT_BSP_START,
     52  RTEMS_SYSINIT_CPU_COUNTER,
    5253  RTEMS_SYSINIT_ORDER_FIRST
    5354);
  • bsps/arm/tms570/cpucounter/cpucounterread.c

    r4c7b18e3 r65f868c  
    4747  pmcr |= ARM_CP15_PMCR_E;
    4848  arm_cp15_set_performance_monitors_control(pmcr);
     49}
    4950
    50   rtems_counter_initialize_converter(2 * BSP_PLL_OUT_CLOCK);
     51uint32_t _CPU_Counter_frequency(void)
     52{
     53  return 2 * BSP_PLL_OUT_CLOCK;
    5154}
    5255
     
    5861RTEMS_SYSINIT_ITEM(
    5962  tms570_cpu_counter_initialize,
    60   RTEMS_SYSINIT_BSP_START,
     63  RTEMS_SYSINIT_CPU_COUNTER,
    6164  RTEMS_SYSINIT_ORDER_FIRST
    6265);
  • bsps/arm/xilinx-zynq/start/bspstart.c

    r4c7b18e3 r65f868c  
    1515#include <bsp.h>
    1616#include <bsp/bootcard.h>
    17 #include <bsp/arm-a9mpcore-clock.h>
    1817#include <bsp/irq-generic.h>
    1918#include <bsp/linker-symbols.h>
     
    2625void bsp_start(void)
    2726{
    28   a9mpcore_clock_initialize_early();
    2927  bsp_interrupt_initialize();
    3028  rtems_cache_coherent_add_area(
  • bsps/powerpc/beatnik/start/bspstart.c

    r4c7b18e3 r65f868c  
    163163}
    164164
     165uint32_t _CPU_Counter_frequency(void)
     166{
     167  return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
     168}
     169
    165170/*
    166171 *  bsp_start
     
    331336
    332337  bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
    333   rtems_counter_initialize_converter(
    334     BSP_bus_frequency / (BSP_time_base_divisor / 1000)
    335   );
    336338
    337339#ifdef SHOW_MORE_INIT_SETTINGS
  • bsps/powerpc/gen5200/start/bspstart.c

    r4c7b18e3 r65f868c  
    113113uint32_t bsp_clicks_per_usec;
    114114
     115uint32_t _CPU_Counter_frequency(void)
     116{
     117  return bsp_time_base_frequency;
     118}
     119
    115120void bsp_start(void)
    116121{
     
    146151  bsp_time_base_frequency = XLB_CLOCK / 4;
    147152  bsp_clicks_per_usec    = (XLB_CLOCK/4000000);
    148   rtems_counter_initialize_converter(bsp_time_base_frequency);
    149153
    150154  /* Initialize exception handler */
  • bsps/powerpc/gen83xx/start/bspstart.c

    r4c7b18e3 r65f868c  
    5252}
    5353
     54uint32_t _CPU_Counter_frequency(void)
     55{
     56  return bsp_time_base_frequency;
     57}
     58
    5459void bsp_start( void)
    5560{
     
    9398  bsp_time_base_frequency = BSP_bus_frequency / 4;
    9499  bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
    95   rtems_counter_initialize_converter(bsp_time_base_frequency);
    96100
    97101  /* Initialize some console parameters */
  • bsps/powerpc/haleakala/start/bspstart.c

    r4c7b18e3 r65f868c  
    154154BSP_polling_getchar_function_type BSP_poll_char = NULL;
    155155
     156uint32_t _CPU_Counter_frequency(void)
     157{
     158  return bsp_clicks_per_usec * 1000000;
     159}
     160
    156161/*===================================================================*/
    157162
     
    179184  /* timebase register ticks/microsecond = CPU Clk in MHz */
    180185  bsp_clicks_per_usec = 400;
    181   rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
    182186
    183187  /*
  • bsps/powerpc/motorola_powerpc/start/bspstart.c

    r4c7b18e3 r65f868c  
    120120#endif
    121121
     122uint32_t _CPU_Counter_frequency(void)
     123{
     124  return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
     125}
     126
    122127/*
    123128 *  bsp_start
     
    347352   */
    348353  bsp_clicks_per_usec    = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
    349   rtems_counter_initialize_converter(
    350     BSP_bus_frequency / (BSP_time_base_divisor / 1000)
    351   );
    352354
    353355  /*
  • bsps/powerpc/mpc55xxevb/start/bspstart.c

    r4c7b18e3 r65f868c  
    6464}
    6565
     66uint32_t _CPU_Counter_frequency(void)
     67{
     68        return bsp_clock_speed;
     69}
     70
    6671void bsp_start(void)
    6772{
     
    8388        /* Time reference value */
    8489        bsp_clicks_per_usec = bsp_clock_speed / 1000000;
    85         rtems_counter_initialize_converter(bsp_clock_speed);
    8690
    8791        /* Initialize exceptions */
  • bsps/powerpc/mpc8260ads/start/bspstart.c

    r4c7b18e3 r65f868c  
    115115}
    116116
     117uint32_t _CPU_Counter_frequency(void)
     118{
     119  return bsp_clock_speed;
     120}
     121
    117122void bsp_start(void)
    118123{
     
    172177  bsp_serial_rate            = 9600;
    173178  bsp_clock_speed          = 40000000;
    174   rtems_counter_initialize_converter(bsp_clock_speed);
    175179
    176180#ifdef REV_0_2
  • bsps/powerpc/mvme3100/start/bspstart.c

    r4c7b18e3 r65f868c  
    193193}
    194194
     195uint32_t _CPU_Counter_frequency(void)
     196{
     197  return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
     198}
     199
    195200/*
    196201 *  bsp_start
     
    368373
    369374  bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
    370   rtems_counter_initialize_converter(
    371     BSP_bus_frequency / (BSP_time_base_divisor / 1000)
    372   );
    373375
    374376  /*
  • bsps/powerpc/mvme5500/start/bspstart.c

    r4c7b18e3 r65f868c  
    170170}
    171171
     172uint32_t _CPU_Counter_frequency(void)
     173{
     174  return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
     175}
     176
    172177void bsp_start( void )
    173178{
     
    266271
    267272  bsp_clicks_per_usec    = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
    268   rtems_counter_initialize_converter(
    269     BSP_bus_frequency / (BSP_time_base_divisor / 1000)
    270   );
    271273
    272274  /*
  • bsps/powerpc/psim/start/bspstart.c

    r4c7b18e3 r65f868c  
    6161extern unsigned long __rtems_end[];
    6262
     63uint32_t _CPU_Counter_frequency(void)
     64{
     65  return bsp_clicks_per_usec * 1000000;
     66}
     67
    6368/*
    6469 *  bsp_start
     
    8287  bsp_clicks_per_usec      = BSP_bus_frequency;
    8388  BSP_time_base_divisor    = 1;
    84   rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
    8589
    8690  /*
  • bsps/powerpc/qemuppc/start/bspstart.c

    r4c7b18e3 r65f868c  
    5555}
    5656
     57uint32_t _CPU_Counter_frequency(void)
     58{
     59  return bsp_time_base_frequency;
     60}
     61
    5762/*
    5863 *  bsp_start
     
    8186  bsp_time_base_frequency  = 20000000;
    8287  bsp_clicks_per_usec      = BSP_bus_frequency;
    83   rtems_counter_initialize_converter(bsp_time_base_frequency);
    8488
    8589  /*
  • bsps/powerpc/qoriq/start/bspstart.c

    r4c7b18e3 r65f868c  
    5555uint32_t qoriq_clock_frequency;
    5656
     57uint32_t _CPU_Counter_frequency(void)
     58{
     59#ifdef __PPC_CPU_E6500__
     60  return qoriq_clock_frequency;
     61#else
     62  return bsp_time_base_frequency;
     63#endif
     64}
     65
    5766static void initialize_frequency_parameters(void)
    5867{
     
    8392    qoriq_clock_frequency = fdt32_to_cpu(*val_fdt);
    8493  #endif
    85   rtems_counter_initialize_converter(fdt32_to_cpu(*val_fdt));
    8694}
    8795
  • bsps/powerpc/ss555/start/bspstart.c

    r4c7b18e3 r65f868c  
    4040uint32_t   bsp_clicks_per_usec;
    4141uint32_t   bsp_clock_speed;            /* Serial clocks per second */
     42
     43uint32_t _CPU_Counter_frequency(void)
     44{
     45  return BSP_CRYSTAL_HZ / 4;
     46}
    4247
    4348/*
     
    8994  bsp_clicks_per_usec = BSP_CRYSTAL_HZ / 4 / 1000000;
    9095  bsp_clock_speed     = BSP_CLOCK_HZ;   /* for SCI baud rate generator */
    91   rtems_counter_initialize_converter(BSP_CRYSTAL_HZ / 4);
    9296
    9397  /*
  • bsps/powerpc/t32mppc/start/bspstart.c

    r4c7b18e3 r65f868c  
    7878}
    7979
     80uint32_t _CPU_Counter_frequency(void)
     81{
     82  return bsp_time_base_frequency;
     83}
     84
    8085void bsp_start(void)
    8186{
    8287  get_ppc_cpu_type();
    8388  get_ppc_cpu_revision();
    84 
    85   rtems_counter_initialize_converter(bsp_time_base_frequency);
    86 
    8789  t32mppc_initialize_exceptions(bsp_section_work_begin);
    8890  bsp_interrupt_initialize();
  • bsps/powerpc/tqm8xx/start/bspstart.c

    r4c7b18e3 r65f868c  
    9393}
    9494
     95uint32_t _CPU_Counter_frequency(void)
     96{
     97  return bsp_time_base_frequency;
     98}
     99
    95100void bsp_start( void)
    96101{
     
    143148  bsp_time_base_frequency = BSP_bus_frequency / 16;
    144149  bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
    145   rtems_counter_initialize_converter(bsp_time_base_frequency);
    146150
    147151  /* Initialize exception handler */
  • bsps/powerpc/virtex/start/bspstart.c

    r4c7b18e3 r65f868c  
    7575uint32_t bsp_time_base_frequency = XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ;
    7676
     77uint32_t _CPU_Counter_frequency(void)
     78{
     79  return bsp_time_base_frequency;
     80}
     81
    7782/*
    7883 *  bsp_start
     
    9095  get_ppc_cpu_revision();
    9196
    92   rtems_counter_initialize_converter(bsp_time_base_frequency);
    93 
    9497  /*
    9598   * Initialize default raw exception handlers.
  • bsps/powerpc/virtex4/start/bspstart.c

    r4c7b18e3 r65f868c  
    131131}
    132132
     133uint32_t _CPU_Counter_frequency(void)
     134{
     135  return bsp_clicks_per_usec * 1000000;
     136}
    133137
    134138/*===================================================================*/
     
    167171  /* Timebase register ticks/microsecond;  The application may override these */
    168172  bsp_clicks_per_usec        = 350;
    169   rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
    170173
    171174  /*
  • bsps/powerpc/virtex5/start/bspstart.c

    r4c7b18e3 r65f868c  
    145145}
    146146
     147uint32_t _CPU_Counter_frequency(void)
     148{
     149  return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
     150}
    147151
    148152/*===================================================================*/
     
    186190  /* Timebase register ticks/microsecond;  The application may override these */
    187191  bsp_clicks_per_usec        = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
    188   rtems_counter_initialize_converter(
    189     BSP_bus_frequency / (BSP_time_base_divisor / 1000)
    190   );
    191192
    192193  /*
  • bsps/sparc/erc32/clock/ckinit.c

    r4c7b18e3 r65f868c  
    2828#include <rtems/timecounter.h>
    2929#include <rtems/score/sparcimpl.h>
     30
     31#define ERC32_REAL_TIME_CLOCK_FREQUENCY 1000000
    3032
    3133/*
     
    7981}
    8082
    81 static void erc32_counter_initialize( uint32_t frequency )
     83static void erc32_counter_initialize( void )
    8284{
    8385  _SPARC_Counter_initialize(
     
    8688    &ERC32_MEC.Real_Time_Clock_Counter
    8789  );
    88   rtems_counter_initialize_converter( frequency );
     90}
     91
     92uint32_t _CPU_Counter_frequency(void)
     93{
     94  return ERC32_REAL_TIME_CLOCK_FREQUENCY;
    8995}
    9096
    9197#define Clock_driver_support_initialize_hardware() \
    9298  do { \
    93     uint32_t frequency = 1000000; \
    9499    /* approximately 1 us per countdown */ \
    95100    ERC32_MEC.Real_Time_Clock_Scalar  = CLOCK_SPEED - 1; \
     
    109114    rtems_timecounter_simple_install( \
    110115        &erc32_tc, \
    111         frequency, \
     116        ERC32_REAL_TIME_CLOCK_FREQUENCY, \
    112117        rtems_configuration_get_microseconds_per_tick(), \
    113118        erc32_tc_get_timecount \
    114119    ); \
    115     erc32_counter_initialize( frequency ); \
     120    erc32_counter_initialize(); \
    116121  } while (0)
    117122
  • bsps/sparc/leon3/start/cpucounter.c

    r4c7b18e3 r65f868c  
    1919#include <rtems/score/sparcimpl.h>
    2020
     21static uint32_t leon3_counter_frequency = 1000000000;
     22
     23uint32_t _CPU_Counter_frequency(void)
     24{
     25  return leon3_up_counter_frequency;
     26}
     27
    2128static void leon3_counter_initialize(void)
    2229{
    2330  volatile struct irqmp_timestamp_regs *irqmp_ts;
    2431  volatile struct gptimer_regs *gpt;
    25   unsigned int freq;
    2632
    2733  irqmp_ts = &LEON3_IrqCtrl_Regs->timestamp[0];
     
    3945    );
    4046
    41     freq = leon3_up_counter_frequency();
    42     rtems_counter_initialize_converter(freq);
     47    leon3_counter_frequency = leon3_up_counter_frequency();
    4348  } else if (leon3_irqmp_has_timestamp(irqmp_ts)) {
    4449    /* Use the interrupt controller timestamp counter if available */
     
    5358    );
    5459
    55     freq = ambapp_freq_get(&ambapp_plb, LEON3_IrqCtrl_Adev);
    56     rtems_counter_initialize_converter(freq);
     60    leon3_counter_frequency = ambapp_freq_get(&ambapp_plb, LEON3_IrqCtrl_Adev);
    5761  } else if (gpt != NULL) {
    5862    /* Fall back to the first GPTIMER if available */
     
    6771    );
    6872
    69     freq = ambapp_freq_get(&ambapp_plb, LEON3_Timer_Adev);
    70     rtems_counter_initialize_converter(freq / (gpt->scaler_reload - 1));
     73    leon3_counter_frequency = ambapp_freq_get(&ambapp_plb, LEON3_Timer_Adev) /
     74      (gpt->scaler_reload - 1);
    7175  }
    7276}
     
    7478RTEMS_SYSINIT_ITEM(
    7579  leon3_counter_initialize,
    76   RTEMS_SYSINIT_BSP_START,
    77   RTEMS_SYSINIT_ORDER_THIRD
     80  RTEMS_SYSINIT_CPU_COUNTER,
     81  RTEMS_SYSINIT_ORDER_FIRST
    7882);
    7983
  • c/src/lib/libbsp/arm/beagle/Makefile.am

    r4c7b18e3 r65f868c  
    4747librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
    4848librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
     49librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    4950librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    5051librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/start/bsp-start-memcpy.S
  • c/src/lib/libbsp/arm/csb336/Makefile.am

    r4c7b18e3 r65f868c  
    2626librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
    2727librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
     28librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    2829librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    2930librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/csb337/Makefile.am

    r4c7b18e3 r65f868c  
    3535librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
    3636librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
     37librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    3738librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    3839librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/edb7312/Makefile.am

    r4c7b18e3 r65f868c  
    2424librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
    2525librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/edb7312/start/bspreset.c
     26librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    2627librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    2728librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/gdbarmsim/Makefile.am

    r4c7b18e3 r65f868c  
    2626librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
    2727librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/start/syscalls.c
     28librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    2829librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    2930librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/gumstix/Makefile.am

    r4c7b18e3 r65f868c  
    2525librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gumstix/start/bspreset.c
    2626librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gumstix/start/memmap.c
     27librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    2728librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    2829librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/lm3s69xx/Makefile.am

    r4c7b18e3 r65f868c  
    3535librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
    3636librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
     37librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    3738librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    3839librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/raspberrypi/Makefile.am

    r4c7b18e3 r65f868c  
    4040librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
    4141librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
     42librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    4243librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    4344librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/rtl22xx/Makefile.am

    r4c7b18e3 r65f868c  
    2626librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
    2727librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
     28librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    2829librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    2930librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/smdk2410/Makefile.am

    r4c7b18e3 r65f868c  
    2626
    2727librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
     28librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    2829librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    2930librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/arm/stm32f4/Makefile.am

    r4c7b18e3 r65f868c  
    3434librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
    3535librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
     36librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    3637librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
    3738librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
  • c/src/lib/libbsp/sparc/leon2/Makefile.am

    r4c7b18e3 r65f868c  
    2727librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/start/bspstart.c
    2828librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/start/bspgetworkarea.c
     29librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
    2930librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
    3031librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
  • cpukit/include/rtems/counter.h

    r4c7b18e3 r65f868c  
    88
    99/*
    10  * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2014, 2018 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    6161 */
    6262typedef CPU_Counter_ticks rtems_counter_ticks;
     63
     64/**
     65 * @brief Returns the current counter frequency in Hz.
     66 *
     67 * @return The current counter frequency in Hz.
     68 */
     69static inline uint32_t rtems_counter_frequency( void )
     70{
     71  return _CPU_Counter_frequency();
     72}
    6373
    6474/**
  • cpukit/sapi/src/cpucounterconverter.c

    r4c7b18e3 r65f868c  
    11/*
    2  * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2014, 2018 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
     
    1414
    1515#include <rtems/counter.h>
     16#include <rtems/sysinit.h>
    1617
    1718RTEMS_STATIC_ASSERT(sizeof(rtems_counter_ticks) <= sizeof(uint32_t), type);
    1819
    19 static uint64_t to_ns_scaler = UINT64_C(1) << 32;
     20static uint64_t to_ns_scaler;
    2021
    21 static uint64_t from_ns_scaler = UINT64_C(1) << 32;
     22static uint64_t from_ns_scaler;
    2223
    2324uint64_t rtems_counter_ticks_to_nanoseconds( rtems_counter_ticks counter )
     
    3839  from_ns_scaler = ((UINT64_C(1) << 32) * frequency + ns_per_s - 1) / ns_per_s;
    3940}
     41
     42static void rtems_counter_sysinit( void )
     43{
     44  rtems_counter_initialize_converter( rtems_counter_frequency() );
     45}
     46
     47RTEMS_SYSINIT_ITEM(
     48  rtems_counter_sysinit,
     49  RTEMS_SYSINIT_CPU_COUNTER,
     50  RTEMS_SYSINIT_ORDER_LAST
     51);
  • cpukit/score/cpu/arm/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    596596
    597597typedef uint32_t CPU_Counter_ticks;
     598
     599uint32_t _CPU_Counter_frequency( void );
    598600
    599601CPU_Counter_ticks _CPU_Counter_read( void );
  • cpukit/score/cpu/bfin/Makefile.am

    r4c7b18e3 r65f868c  
    33noinst_LIBRARIES = libscorecpu.a
    44libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     5libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    56libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    67libscorecpu_a_SOURCES += bfin-exception-frame-print.c
  • cpukit/score/cpu/bfin/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    983983typedef uint32_t CPU_Counter_ticks;
    984984
     985uint32_t _CPU_Counter_frequency( void );
     986
    985987CPU_Counter_ticks _CPU_Counter_read( void );
    986988
  • cpukit/score/cpu/epiphany/Makefile.am

    r4c7b18e3 r65f868c  
    99libscorecpu_a_SOURCES += epiphany-context-switch.S
    1010libscorecpu_a_SOURCES += epiphany-context-initialize.c
     11libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    1112libscorecpu_a_SOURCES += setjmp.S
    1213
  • cpukit/score/cpu/epiphany/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    855855typedef uint32_t CPU_Counter_ticks;
    856856
     857uint32_t _CPU_Counter_frequency( void );
     858
    857859CPU_Counter_ticks _CPU_Counter_read( void );
    858860
  • cpukit/score/cpu/i386/Makefile.am

    r4c7b18e3 r65f868c  
    33noinst_LIBRARIES = libscorecpu.a
    44libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     5libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    56libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    67libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/i386/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    698698typedef uint32_t CPU_Counter_ticks;
    699699
     700uint32_t _CPU_Counter_frequency( void );
     701
    700702CPU_Counter_ticks _CPU_Counter_read( void );
    701703
  • cpukit/score/cpu/lm32/Makefile.am

    r4c7b18e3 r65f868c  
    33noinst_LIBRARIES = libscorecpu.a
    44libscorecpu_a_SOURCES = cpu.c cpu_asm.S irq.c
     5libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    56libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    67libscorecpu_a_SOURCES += lm32-exception-frame-print.c
  • cpukit/score/cpu/lm32/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    10191019typedef uint32_t CPU_Counter_ticks;
    10201020
     1021uint32_t _CPU_Counter_frequency( void );
     1022
    10211023CPU_Counter_ticks _CPU_Counter_read( void );
    10221024
  • cpukit/score/cpu/m32c/Makefile.am

    r4c7b18e3 r65f868c  
    44libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c \
    55    varvects.S
     6libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    67libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    78libscorecpu_a_SOURCES += m32c-exception-frame-print.c
  • cpukit/score/cpu/m32c/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    969969typedef uint32_t CPU_Counter_ticks;
    970970
     971uint32_t _CPU_Counter_frequency( void );
     972
    971973CPU_Counter_ticks _CPU_Counter_read( void );
    972974
  • cpukit/score/cpu/m68k/Makefile.am

    r4c7b18e3 r65f868c  
    55
    66libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     7libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    78libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    89libscorecpu_a_SOURCES += m68k-exception-frame-print.c
  • cpukit/score/cpu/m68k/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    680680typedef uint32_t CPU_Counter_ticks;
    681681
     682uint32_t _CPU_Counter_frequency( void );
     683
    682684CPU_Counter_ticks _CPU_Counter_read( void );
    683685
  • cpukit/score/cpu/mips/Makefile.am

    r4c7b18e3 r65f868c  
    33noinst_LIBRARIES = libscorecpu.a
    44libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     5libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    56libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    67libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/mips/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    989989typedef uint32_t CPU_Counter_ticks;
    990990
     991uint32_t _CPU_Counter_frequency( void );
     992
    991993CPU_Counter_ticks _CPU_Counter_read( void );
    992994
  • cpukit/score/cpu/moxie/Makefile.am

    r4c7b18e3 r65f868c  
    77noinst_LIBRARIES = libscorecpu.a
    88libscorecpu_a_SOURCES = cpu.c moxie-exception-frame-print.c cpu_asm.S
     9libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    910libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1011libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/moxie/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    836836typedef uint32_t CPU_Counter_ticks;
    837837
     838uint32_t _CPU_Counter_frequency( void );
     839
    838840CPU_Counter_ticks _CPU_Counter_read( void );
    839841
  • cpukit/score/cpu/nios2/Makefile.am

    r4c7b18e3 r65f868c  
    66
    77libscorecpu_a_SOURCES =
     8libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    89libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    910libscorecpu_a_SOURCES += nios2-context-initialize.c
  • cpukit/score/cpu/nios2/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    354354typedef uint32_t CPU_Counter_ticks;
    355355
     356uint32_t _CPU_Counter_frequency( void );
     357
    356358CPU_Counter_ticks _CPU_Counter_read( void );
    357359
  • cpukit/score/cpu/no_cpu/Makefile.am

    r4c7b18e3 r65f868c  
    33noinst_LIBRARIES = libscorecpu.a
    44libscorecpu_a_SOURCES = cpu.c cpu_asm.c
     5libscorecpu_a_SOURCES += cpucounterfrequency.c
    56libscorecpu_a_SOURCES += cpucounterread.c
    67libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    13301330
    13311331/**
     1332 * @brief Returns the current CPU counter frequency in Hz.
     1333 *
     1334 * @return The current CPU counter frequency in Hz.
     1335 */
     1336uint32_t _CPU_Counter_frequency( void );
     1337
     1338/**
    13321339 * @brief Returns the current CPU counter value.
    13331340 *
  • cpukit/score/cpu/or1k/Makefile.am

    r4c7b18e3 r65f868c  
    77libscorecpu_a_SOURCES =
    88libscorecpu_a_SOURCES += cpu.c
     9libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
     10libscorecpu_a_SOURCES += or1k-context-initialize.c
    911libscorecpu_a_SOURCES += or1k-context-switch.S
    10 libscorecpu_a_SOURCES += or1k-context-initialize.c
    1112libscorecpu_a_SOURCES += or1k-context-validate.S
    1213libscorecpu_a_SOURCES += or1k-context-volatile-clobber.S
  • cpukit/score/cpu/or1k/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    666666
    667667#ifndef ASM
    668 typedef uint32_t CPU_Counter_ticks;
    669 
    670668typedef struct {
    671669  uint32_t r[32];
     
    857855typedef uint32_t CPU_Counter_ticks;
    858856
     857uint32_t _CPU_Counter_frequency( void );
     858
    859859CPU_Counter_ticks _CPU_Counter_read( void );
    860860
  • cpukit/score/cpu/powerpc/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    804804typedef uint32_t CPU_Counter_ticks;
    805805
     806uint32_t _CPU_Counter_frequency( void );
     807
    806808static inline CPU_Counter_ticks _CPU_Counter_read( void )
    807809{
  • cpukit/score/cpu/riscv/Makefile.am

    r4c7b18e3 r65f868c  
    33libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
    44libscorecpu_a_SOURCES  = cpu.c
     5libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    56libscorecpu_a_SOURCES += riscv-exception-handler.S
    67libscorecpu_a_SOURCES += riscv-exception-default.c
  • cpukit/score/cpu/riscv/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    475475typedef uint32_t CPU_Counter_ticks;
    476476
     477uint32_t _CPU_Counter_frequency( void );
     478
    477479CPU_Counter_ticks _CPU_Counter_read( void );
    478480
  • cpukit/score/cpu/sh/Makefile.am

    r4c7b18e3 r65f868c  
    33noinst_LIBRARIES = libscorecpu.a
    44libscorecpu_a_SOURCES = cpu.c context.c
     5libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    56libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    67libscorecpu_a_SOURCES += sh-exception-frame-print.c
  • cpukit/score/cpu/sh/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    722722typedef uint32_t CPU_Counter_ticks;
    723723
     724uint32_t _CPU_Counter_frequency( void );
     725
    724726CPU_Counter_ticks _CPU_Counter_read( void );
    725727
  • cpukit/score/cpu/sparc/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    11591159typedef uint32_t CPU_Counter_ticks;
    11601160
     1161uint32_t _CPU_Counter_frequency( void );
     1162
    11611163typedef CPU_Counter_ticks ( *SPARC_Counter_read )( void );
    11621164
  • cpukit/score/cpu/sparc64/Makefile.am

    r4c7b18e3 r65f868c  
    66libscorecpu_a_SOURCES += cpu.c
    77libscorecpu_a_SOURCES += interrupt.S
     8libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    89libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    910libscorecpu_a_SOURCES += sparc64-exception-frame-print.c
  • cpukit/score/cpu/sparc64/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    10331033typedef uint32_t CPU_Counter_ticks;
    10341034
     1035uint32_t _CPU_Counter_frequency( void );
     1036
    10351037CPU_Counter_ticks _CPU_Counter_read( void );
    10361038
  • cpukit/score/cpu/v850/Makefile.am

    r4c7b18e3 r65f868c  
    44libscorecpu_a_SOURCES  = cpu.c
    55libscorecpu_a_SOURCES += cpu_asm.S
     6libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    67libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    78libscorecpu_a_SOURCES += v850-exception-frame-print.c
  • cpukit/score/cpu/v850/include/rtems/score/cpu.h

    r4c7b18e3 r65f868c  
    935935typedef uint32_t CPU_Counter_ticks;
    936936
     937uint32_t _CPU_Counter_frequency( void );
     938
    937939CPU_Counter_ticks _CPU_Counter_read( void );
    938940
Note: See TracChangeset for help on using the changeset viewer.