Changeset 65f868c in rtems for bsps/arm


Ignore:
Timestamp:
May 23, 2018, 12:17:25 PM (18 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.

Location:
bsps/arm
Files:
11 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(
Note: See TracChangeset for help on using the changeset viewer.