Changeset f466e56 in rtems


Ignore:
Timestamp:
Dec 19, 2013, 3:49:11 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11, master
Children:
db8a89e
Parents:
6c1e530
Message:

arm/a9mpcore: Add support to get the clock via a weak linkage function.

This allows an application to provide a localised clock freq with
needing to go down the BSP opts path. This is important with the
Zynq where the Xilinx tools generate the frequency.

Location:
c/src/lib/libbsp/arm
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c

    r6c1e530 rf466e56  
    1919#define A9MPCORE_PT ((volatile a9mpcore_pt *) BSP_ARM_A9MPCORE_PT_BASE)
    2020
     21static uint64_t a9mpcore_clock_last_tick_k;
     22
    2123/* This is defined in clockdrv_shell.h */
    2224void Clock_isr(rtems_irq_hdl_param arg);
     25
     26uint32_t a9mpcore_clock_periphclk(void) __attribute__ ((weak));
     27
     28uint32_t a9mpcore_clock_periphclk(void)
     29{
     30  /* default to the BSP option. */
     31  return BSP_ARM_A9MPCORE_PERIPHCLK;
     32}
    2333
    2434static void a9mpcore_clock_at_tick(void)
     
    5161{
    5262  volatile a9mpcore_pt *pt = A9MPCORE_PT;
    53   uint64_t interval = ((uint64_t) BSP_ARM_A9MPCORE_PERIPHCLK
     63  uint64_t periphclk = (uint64_t) a9mpcore_clock_periphclk();
     64  uint64_t interval = (periphclk
    5465    * (uint64_t) rtems_configuration_get_microseconds_per_tick()) / 1000000;
     66
     67  a9mpcore_clock_last_tick_k = (1000000000ULL << 32) / periphclk;
    5568
    5669  pt->load = (uint32_t) interval - 1;
     
    8497{
    8598  volatile a9mpcore_pt *pt = A9MPCORE_PT;
    86   uint64_t k = (1000000000ULL << 32) / BSP_ARM_A9MPCORE_PERIPHCLK;
     99  uint64_t k = a9mpcore_clock_last_tick_k;
    87100  uint32_t c = pt->cntr;
    88101  uint32_t p = pt->load + 1;
  • c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am

    r6c1e530 rf466e56  
    3434include_bsp_HEADERS += ../../shared/tod.h
    3535include_bsp_HEADERS += ../shared/include/start.h
     36include_bsp_HEADERS += ../shared/include/arm-a9mpcore-clock.h
    3637include_bsp_HEADERS += ../shared/include/arm-a9mpcore-irq.h
    3738include_bsp_HEADERS += ../shared/include/arm-a9mpcore-regs.h
     
    128129
    129130# Start hooks
    130 libbsp_a_SOURCES += startup/bspstarthooks.c
     131libbsp_a_SOURCES += startup/bspstarthooks.c startup/bspstartmmu.c
    131132
    132133if HAS_SMP
Note: See TracChangeset for help on using the changeset viewer.