Changeset 65f868c in rtems for bsps/powerpc


Ignore:
Timestamp:
May 23, 2018, 12:17:25 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, 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/powerpc
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • 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  /*
Note: See TracChangeset for help on using the changeset viewer.