Changeset 24bf11e in rtems


Ignore:
Timestamp:
Feb 12, 2014, 9:31:38 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
6f90ef7
Parents:
382ea27b
git-author:
Sebastian Huber <sebastian.huber@…> (02/12/14 09:31:38)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/14/14 09:28:29)
Message:

score: Add CPU counter support

Add a CPU counter interface to allow access to a free-running counter.
It is useful to measure short time intervals. This can be used for
example to enable profiling of critical low-level functions.

Add two busy wait functions rtems_counter_delay_ticks() and
rtems_counter_delay_nanoseconds() implemented via the CPU counter.

Files:
12 added
85 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/csb336/Makefile.am

    r382ea27b r24bf11e  
    3434    ../../shared/bspreset.c startup/memmap.c ../../shared/bootcard.c \
    3535    ../../shared/sbrk.c ../../shared/gnatinstallhandler.c
     36libbsp_a_SOURCES += ../../shared/cpucounterread.c
     37libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    3638# console
    3739libbsp_a_SOURCES += console/uart.c
  • c/src/lib/libbsp/arm/csb337/Makefile.am

    r382ea27b r24bf11e  
    5757    startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \
    5858    ../../shared/gnatinstallhandler.c
     59libbsp_a_SOURCES += ../../shared/cpucounterread.c
     60libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    5961# console
    6062libbsp_a_SOURCES += ../../shared/console.c console/uarts.c \
  • c/src/lib/libbsp/arm/edb7312/Makefile.am

    r382ea27b r24bf11e  
    3636    ../../shared/bspclean.c ../../shared/bootcard.c ../../shared/sbrk.c \
    3737    startup/bspreset.c ../../shared/gnatinstallhandler.c
     38libbsp_a_SOURCES += ../../shared/cpucounterread.c
     39libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    3840
    3941# clock
  • c/src/lib/libbsp/arm/gba/Makefile.am

    r382ea27b r24bf11e  
    3939    ../../shared/gnatinstallhandler.c \
    4040    startup/bspstart.c
     41libbsp_a_SOURCES += ../../shared/cpucounterread.c
     42libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    4143# clock
    4244libbsp_a_SOURCES += clock/clockdrv.c
  • c/src/lib/libbsp/arm/gdbarmsim/Makefile.am

    r382ea27b r24bf11e  
    3434    ../../shared/bspclean.c startup/bspreset.c ../../shared/bootcard.c \
    3535    ../../shared/sbrk.c ../../shared/gnatinstallhandler.c startup/syscalls.c
     36libbsp_a_SOURCES += ../../shared/cpucounterread.c
     37libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    3638# console
    3739libbsp_a_SOURCES += ../../shared/console-polled.c console/console-io.c
  • c/src/lib/libbsp/arm/gp32/Makefile.am

    r382ea27b r24bf11e  
    3535    startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \
    3636    ../../shared/gnatinstallhandler.c
     37libbsp_a_SOURCES += ../../shared/cpucounterread.c
     38libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    3739# console
    3840libbsp_a_SOURCES += console/uart.c ../../shared/console.c \
  • c/src/lib/libbsp/arm/gumstix/Makefile.am

    r382ea27b r24bf11e  
    3434  ../../shared/gnatinstallhandler.c ../../shared/bsppretaskinghook.c \
    3535  ../../shared/bspclean.c startup/bspstart.c startup/bspreset.c startup/memmap.c
     36libbsp_a_SOURCES += ../../shared/cpucounterread.c
     37libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    3638
    3739#console
  • c/src/lib/libbsp/arm/lm3s69xx/Makefile.am

    r382ea27b r24bf11e  
    6969libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
    7070libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
     71libbsp_a_SOURCES += ../../shared/cpucounterread.c
     72libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    7173libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
    7274libbsp_a_SOURCES += ../../shared/sbrk.c
  • c/src/lib/libbsp/arm/lpc24xx/Makefile.am

    r382ea27b r24bf11e  
    102102        ../../shared/src/stackalloc.c \
    103103        ../../shared/src/uart-output-char.c
     104libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    104105
    105106# Startup
  • c/src/lib/libbsp/arm/lpc24xx/misc/system-clocks.c

    r382ea27b r24bf11e  
    88
    99/*
    10  * Copyright (c) 2008-2012 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2008-2014 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    2020 * http://www.rtems.com/license/LICENSE.
    2121 */
     22
     23#include <rtems/counter.h>
    2224
    2325#include <bsp.h>
     
    6062  /* Start timer */
    6163  T1TCR = TCR_EN;
     64
     65  rtems_counter_initialize_converter(LPC24XX_PCLK);
     66}
     67
     68CPU_Counter_ticks _CPU_Counter_read(void)
     69{
     70  return lpc24xx_timer();
    6271}
    6372
  • c/src/lib/libbsp/arm/lpc32xx/Makefile.am

    r382ea27b r24bf11e  
    8989libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
    9090libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
     91libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    9192libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
    9293libbsp_a_SOURCES += ../../shared/sbrk.c
  • c/src/lib/libbsp/arm/lpc32xx/startup/bspstart.c

    r382ea27b r24bf11e  
    88
    99/*
    10  * Copyright (c) 2009-2012 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2009-2014 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    2121 */
    2222
     23#include <rtems/counter.h>
     24
    2325#include <bsp.h>
    2426#include <bsp/bootcard.h>
    2527#include <bsp/irq-generic.h>
    26 #include <bsp/irq.h>
    27 #include <bsp/linker-symbols.h>
    28 #include <bsp/lpc32xx.h>
     28
     29CPU_Counter_ticks _CPU_Counter_read(void)
     30{
     31  return lpc32xx_timer();
     32}
    2933
    3034void bsp_start(void)
    3135{
     36  rtems_counter_initialize_converter(LPC32XX_PERIPH_CLK);
    3237  bsp_interrupt_initialize();
    3338}
  • c/src/lib/libbsp/arm/nds/Makefile.am

    r382ea27b r24bf11e  
    3636    ../../shared/bspgetworkarea.c ../../shared/bsppredriverhook.c \
    3737    ../../shared/bsppretaskinghook.c ../../shared/bootcard.c
     38libbsp_a_SOURCES += ../../shared/cpucounterread.c
     39libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    3840startup_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM9 -I$(srcdir)/libnds/include
    3941startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
  • c/src/lib/libbsp/arm/raspberrypi/Makefile.am

    r382ea27b r24bf11e  
    8181libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
    8282libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
     83libbsp_a_SOURCES += ../../shared/cpucounterread.c
     84libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    8385libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
    8486libbsp_a_SOURCES += ../../shared/sbrk.c
  • c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am

    r382ea27b r24bf11e  
    8585libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
    8686libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
     87libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    8788libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
    8889libbsp_a_SOURCES += ../../shared/sbrk.c
  • c/src/lib/libbsp/arm/rtl22xx/Makefile.am

    r382ea27b r24bf11e  
    3737    ../../shared/bootcard.c ../../shared/sbrk.c \
    3838    ../../shared/gnatinstallhandler.c
     39libbsp_a_SOURCES += ../../shared/cpucounterread.c
     40libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    3941# console
    4042libbsp_a_SOURCES += ../../shared/console.c \
  • c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c

    r382ea27b r24bf11e  
    1212 * http://www.rtems.com/license/LICENSE.
    1313 */
     14
     15#include <rtems/counter.h>
    1416
    1517#include <bsp.h>
     
    9597    | A9MPCORE_GT_CTRL_COMP_EN
    9698    | A9MPCORE_GT_CTRL_TMR_EN;
     99
     100  rtems_counter_initialize_converter((uint32_t) periphclk);
     101}
     102
     103CPU_Counter_ticks _CPU_Counter_read(void)
     104{
     105  volatile a9mpcore_gt *gt = A9MPCORE_GT;
     106
     107  return gt->cntrlower;
    97108}
    98109
  • c/src/lib/libbsp/arm/smdk2410/Makefile.am

    r382ea27b r24bf11e  
    3535    ../../shared/bsppredriverhook.c ../../shared/bspgetworkarea.c \
    3636    ../../shared/gnatinstallhandler.c
     37libbsp_a_SOURCES += ../../shared/cpucounterread.c
     38libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    3739# console
    3840libbsp_a_SOURCES += ../gp32/console/uart.c ../../shared/console.c \
  • c/src/lib/libbsp/arm/stm32f4/Makefile.am

    r382ea27b r24bf11e  
    7777libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
    7878libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
     79libbsp_a_SOURCES += ../../shared/cpucounterread.c
     80libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    7981libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
    8082libbsp_a_SOURCES += ../../shared/sbrk.c
  • c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am

    r382ea27b r24bf11e  
    7979libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
    8080libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
     81libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
    8182libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
    8283libbsp_a_SOURCES += ../../shared/sbrk.c
  • c/src/lib/libbsp/powerpc/beatnik/startup/bspstart.c

    r382ea27b r24bf11e  
    3232#include <rtems/libcsupport.h>
    3333#include <rtems/bspIo.h>
     34#include <rtems/counter.h>
    3435#include <rtems/powerpc/powerpc.h>
    3536/*#include <bsp/consoleIo.h>*/
     
    338339
    339340  bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
     341  rtems_counter_initialize_converter(
     342    BSP_bus_frequency / (BSP_time_base_divisor / 1000)
     343  );
    340344
    341345#ifdef SHOW_MORE_INIT_SETTINGS
  • c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c

    r382ea27b r24bf11e  
    2828#include <bsp/vectors.h>
    2929#include <rtems/powerpc/powerpc.h>
     30#include <rtems/counter.h>
    3031
    3132extern unsigned long __bss_start[], __SBSS_START__[], __SBSS_END__[];
     
    301302
    302303  bsp_clicks_per_usec = BSP_processor_frequency/(BSP_time_base_divisor * 1000);
     304  rtems_counter_initialize_converter(
     305    BSP_processor_frequency / (BSP_time_base_divisor / 1000)
     306  );
    303307
    304308ShowBATS();
  • c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c

    r382ea27b r24bf11e  
    9696
    9797#include <rtems.h>
     98#include <rtems/counter.h>
    9899
    99100#include <libcpu/powerpc-utility.h>
     
    165166  bsp_time_base_frequency = XLB_CLOCK / 4;
    166167  bsp_clicks_per_usec    = (XLB_CLOCK/4000000);
     168  rtems_counter_initialize_converter(bsp_time_base_frequency);
    167169
    168170  /* Initialize exception handler */
  • c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c

    r382ea27b r24bf11e  
    1919 * http://www.rtems.com/license/LICENSE.
    2020 */
     21
     22#include <rtems/counter.h>
    2123
    2224#include <libchip/serial.h>
     
    118120  bsp_time_base_frequency = BSP_bus_frequency / 4;
    119121  bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
     122  rtems_counter_initialize_converter(bsp_time_base_frequency);
    120123
    121124  /* Initialize some console parameters */
  • c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c

    r382ea27b r24bf11e  
    5959#include <string.h>
    6060#include <fcntl.h>
     61
     62#include <rtems/counter.h>
    6163
    6264#include <bsp.h>
     
    195197  /* timebase register ticks/microsecond = CPU Clk in MHz */
    196198  bsp_clicks_per_usec = 400;
     199  rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
    197200
    198201  bsp_timer_internal_clock  = TRUE;
  • c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c

    r382ea27b r24bf11e  
    2020#include <bsp/irq.h>
    2121#include <rtems/bspIo.h>
     22#include <rtems/counter.h>
    2223#include <libcpu/cpuIdent.h>
    2324#include <libcpu/spr.h>
     
    143144  bsp_clicks_per_usec = 1;  /* for 4MHz extclk */
    144145#endif
     146  rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
    145147
    146148  bsp_serial_per_sec = 10000000;
  • c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c

    r382ea27b r24bf11e  
    3030#include <rtems.h>
    3131#include <rtems/config.h>
     32#include <rtems/counter.h>
    3233
    3334#include <libcpu/powerpc-utility.h>
     
    104105        /* Time reference value */
    105106        bsp_clicks_per_usec = bsp_clock_speed / 1000000;
     107        rtems_counter_initialize_converter(bsp_clock_speed);
    106108
    107109        /* Initialize exceptions */
  • c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c

    r382ea27b r24bf11e  
    4545
    4646#include <rtems/bspIo.h>
     47#include <rtems/counter.h>
    4748#include <bsp/irq.h>
    4849#include <libcpu/cpuIdent.h>
     
    209210  bsp_timer_least_valid    = 3;
    210211  bsp_clock_speed          = 40000000;
     212  rtems_counter_initialize_converter(bsp_clock_speed);
    211213
    212214#ifdef REV_0_2
  • c/src/lib/libbsp/powerpc/mvme3100/startup/bspstart.c

    r382ea27b r24bf11e  
    2424#include <bsp.h>
    2525#include <rtems/bspIo.h>
     26#include <rtems/counter.h>
    2627#include <libcpu/spr.h>
    2728#include <libcpu/io.h>
     
    385386
    386387        bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
     388        rtems_counter_initialize_converter(
     389                BSP_bus_frequency / (BSP_time_base_divisor / 1000)
     390        );
    387391
    388392        /*
  • c/src/lib/libbsp/powerpc/mvme5500/startup/bspstart.c

    r382ea27b r24bf11e  
    4141
    4242#include <rtems/bspIo.h>
     43#include <rtems/counter.h>
    4344#include <rtems/sptables.h>
    4445
     
    288289
    289290  bsp_clicks_per_usec    = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
     291  rtems_counter_initialize_converter(
     292    BSP_bus_frequency / (BSP_time_base_divisor / 1000)
     293  );
    290294
    291295  /*
  • c/src/lib/libbsp/powerpc/psim/startup/bspstart.c

    r382ea27b r24bf11e  
    2121#include <bsp/linker-symbols.h>
    2222#include <rtems/bspIo.h>
     23#include <rtems/counter.h>
    2324#include <rtems/powerpc/powerpc.h>
    2425
     
    9394  bsp_clicks_per_usec      = BSP_bus_frequency;
    9495  BSP_time_base_divisor    = 1;
     96  rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
    9597
    9698  /*
  • c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c

    r382ea27b r24bf11e  
    1515#include <string.h>
    1616#include <fcntl.h>
     17
     18#include <rtems/counter.h>
    1719
    1820#include <libcpu/bat.h>
     
    8082  bsp_time_base_frequency  = 20000000;
    8183  bsp_clicks_per_usec      = BSP_bus_frequency;
     84  rtems_counter_initialize_converter(bsp_time_base_frequency);
    8285
    8386  /*
  • c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c

    r382ea27b r24bf11e  
    2323#include <rtems.h>
    2424#include <rtems/config.h>
     25#include <rtems/counter.h>
    2526
    2627#include <libchip/serial.h>
     
    9091    bsp_clicks_per_usec = bsp_uboot_board_info.bi_busfreq / 8000000;
    9192  #endif /* HAS_UBOOT */
     93  rtems_counter_initialize_converter(BSP_bus_frequency / 8);
    9294
    9395  /* Initialize some console parameters */
  • c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c

    r382ea27b r24bf11e  
    2020#include <rtems/libcsupport.h>
    2121#include <rtems/bspIo.h>
     22#include <rtems/counter.h>
    2223#include <libcpu/cpuIdent.h>
    2324#include <bsp/irq.h>
     
    211212  #endif
    212213  bsp_clicks_per_usec = 66 / 4;
     214  rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
    213215
    214216  #if BSP_DATA_CACHE_ENABLED
  • c/src/lib/libbsp/powerpc/shared/startup/bspstart.c

    r382ea27b r24bf11e  
    2020#include <bsp.h>
    2121#include <rtems/bspIo.h>
     22#include <rtems/counter.h>
    2223#include <bsp/consoleIo.h>
    2324#include <libcpu/spr.h>
     
    343344   */
    344345  bsp_clicks_per_usec    = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
     346  rtems_counter_initialize_converter(
     347    BSP_bus_frequency / (BSP_time_base_divisor / 1000)
     348  );
    345349
    346350  /*
  • c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c

    r382ea27b r24bf11e  
    2525
    2626#include <rtems/bspIo.h>
     27#include <rtems/counter.h>
    2728#include <rtems/powerpc/powerpc.h>
    2829
     
    109110  bsp_timer_least_valid      = 0;
    110111  bsp_timer_average_overhead = 0;
     112  rtems_counter_initialize_converter(BSP_CRYSTAL_HZ / 4);
    111113
    112114  /*
  • c/src/lib/libbsp/powerpc/t32mppc/startup/bspstart.c

    r382ea27b r24bf11e  
    1414
    1515#include <rtems/config.h>
     16#include <rtems/counter.h>
    1617
    1718#include <bsp.h>
     
    6465  get_ppc_cpu_revision();
    6566
     67  rtems_counter_initialize_converter(bsp_time_base_frequency);
     68
    6669  /* Initialize exception handler */
    6770  ppc_exc_initialize_with_vector_base(
  • c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c

    r382ea27b r24bf11e  
    2323
    2424#include <rtems.h>
     25#include <rtems/counter.h>
    2526
    2627#include <libcpu/powerpc-utility.h>
     
    180181  bsp_timer_least_valid = 3;
    181182  bsp_timer_average_overhead = 3;
     183  rtems_counter_initialize_converter(bsp_time_base_frequency);
    182184
    183185  /* Initialize exception handler */
  • c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c

    r382ea27b r24bf11e  
    5555 */
    5656
     57#include <rtems/counter.h>
     58
    5759#include <bsp.h>
    5860#include <bsp/irq.h>
     
    8890  get_ppc_cpu_revision();
    8991
     92  rtems_counter_initialize_converter(bsp_time_base_frequency);
     93
    9094  /*
    9195   * Initialize default raw exception handlers.
  • c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c

    r382ea27b r24bf11e  
    5858#include <rtems/config.h>
    5959#include <rtems/bspIo.h>
     60#include <rtems/counter.h>
    6061#include <rtems/libio.h>
    6162#include <rtems/libcsupport.h>
     
    200201  bsp_timer_average_overhead = 2;
    201202  bsp_timer_least_valid      = 3;
     203  rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
    202204
    203205  /*
  • c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c

    r382ea27b r24bf11e  
    5858#include <rtems/config.h>
    5959#include <rtems/bspIo.h>
     60#include <rtems/counter.h>
    6061#include <rtems/libio.h>
    6162#include <rtems/libcsupport.h>
     
    215216  /* Timebase register ticks/microsecond;  The application may override these */
    216217  bsp_clicks_per_usec        = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
     218  rtems_counter_initialize_converter(
     219    BSP_bus_frequency / (BSP_time_base_divisor / 1000)
     220  );
    217221  bsp_timer_internal_clock   = true;
    218222  bsp_timer_average_overhead = 2;
  • c/src/lib/libbsp/sparc/erc32/Makefile.am

    r382ea27b r24bf11e  
    3636    startup/erc32mec.c startup/boardinit.S startup/bspidle.c \
    3737    startup/bspdelay.c ../../sparc/shared/startup/early_malloc.c
     38libbsp_a_SOURCES += ../../shared/cpucounterread.c
    3839# ISR Handler
    3940libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
  • c/src/lib/libbsp/sparc/leon2/Makefile.am

    r382ea27b r24bf11e  
    5353    ../../shared/bspinit.c startup/bspdelay.c \
    5454    ../../sparc/shared/startup/early_malloc.c
     55libbsp_a_SOURCES += ../../shared/cpucounterread.c
    5556# ISR Handler
    5657libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
  • c/src/lib/libbsp/sparc/leon3/Makefile.am

    r382ea27b r24bf11e  
    3939    startup/spurious.c startup/bspidle.S startup/bspdelay.c \
    4040    ../../shared/bspinit.c ../../sparc/shared/startup/early_malloc.c
     41libbsp_a_SOURCES += startup/cpucounter.c
    4142
    4243# ISR Handler
  • c/src/lib/libbsp/sparc/leon3/include/bsp.h

    r382ea27b r24bf11e  
    210210extern void BSP_shared_interrupt_mask(int irq);
    211211
     212typedef enum {
     213  LEON3_FATAL_CPU_COUNTER_INIT
     214} leon3_fatal_code;
     215
    212216#ifdef __cplusplus
    213217}
  • c/src/lib/libbsp/sparc/leon3/include/leon.h

    r382ea27b r24bf11e  
    318318void leon3_secondary_cpu_initialize(uint32_t cpu);
    319319
     320void leon3_cpu_counter_initialize(void);
     321
    320322void bsp_debug_uart_init(void);
    321323
  • c/src/lib/libbsp/sparc/leon3/startup/bspstart.c

    r382ea27b r24bf11e  
    8080   */
    8181  amba_initialize();
     82  leon3_cpu_counter_initialize();
    8283
    8384  /* find debug UART for printk() */
  • cpukit/sapi/Makefile.am

    r382ea27b r24bf11e  
    77include_rtems_HEADERS += include/rtems/chain.h
    88include_rtems_HEADERS += include/rtems/config.h
     9include_rtems_HEADERS += include/rtems/counter.h
    910include_rtems_HEADERS += include/rtems/extension.h
    1011include_rtems_HEADERS += include/rtems/extensionimpl.h
     
    3334    src/fatal2.c src/fatalsrctext.c
    3435libsapi_a_SOURCES += src/chainsmp.c
     36libsapi_a_SOURCES += src/cpucounterconverter.c
     37libsapi_a_SOURCES += src/delayticks.c
     38libsapi_a_SOURCES += src/delaynano.c
    3539libsapi_a_CPPFLAGS = $(AM_CPPFLAGS)
    3640
  • cpukit/sapi/preinstall.am

    r382ea27b r24bf11e  
    4040        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/config.h
    4141PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/config.h
     42
     43$(PROJECT_INCLUDE)/rtems/counter.h: include/rtems/counter.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
     44        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/counter.h
     45PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/counter.h
    4246
    4347$(PROJECT_INCLUDE)/rtems/extension.h: include/rtems/extension.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
  • cpukit/score/cpu/arm/rtems/score/cpu.h

    r382ea27b r24bf11e  
    555555#endif
    556556}
     557
     558typedef uint32_t CPU_Counter_ticks;
     559
     560CPU_Counter_ticks _CPU_Counter_read( void );
     561
     562CPU_Counter_ticks _CPU_Counter_difference(
     563  CPU_Counter_ticks second,
     564  CPU_Counter_ticks first
     565);
    557566
    558567#if CPU_PROVIDES_IDLE_THREAD_BODY == TRUE
  • cpukit/score/cpu/avr/Makefile.am

    r382ea27b r24bf11e  
    163163noinst_LIBRARIES = libscorecpu.a
    164164libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     165libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    165166libscorecpu_a_SOURCES += avr-exception-frame-print.c
    166167libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/avr/rtems/score/cpu.h

    r382ea27b r24bf11e  
    11811181  (((value&0xff) << 8) | ((value >> 8)&0xff))
    11821182
     1183typedef uint32_t CPU_Counter_ticks;
     1184
     1185CPU_Counter_ticks _CPU_Counter_read( void );
     1186
     1187static inline CPU_Counter_ticks _CPU_Counter_difference(
     1188  CPU_Counter_ticks second,
     1189  CPU_Counter_ticks first
     1190)
     1191{
     1192  return second - first;
     1193}
     1194
    11831195#endif /* ASM */
    11841196
  • cpukit/score/cpu/bfin/Makefile.am

    r382ea27b r24bf11e  
    1818noinst_LIBRARIES = libscorecpu.a
    1919libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     20libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    2021libscorecpu_a_SOURCES += bfin-exception-frame-print.c
    2122libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/bfin/rtems/score/cpu.h

    r382ea27b r24bf11e  
    12811281  (((value&0xff) << 8) | ((value >> 8)&0xff))
    12821282
     1283typedef uint32_t CPU_Counter_ticks;
     1284
     1285CPU_Counter_ticks _CPU_Counter_read( void );
     1286
     1287static inline CPU_Counter_ticks _CPU_Counter_difference(
     1288  CPU_Counter_ticks second,
     1289  CPU_Counter_ticks first
     1290)
     1291{
     1292  return second - first;
     1293}
     1294
    12831295#endif /* ASM */
    12841296
  • cpukit/score/cpu/h8300/Makefile.am

    r382ea27b r24bf11e  
    1212noinst_LIBRARIES = libscorecpu.a
    1313libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     14libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1415libscorecpu_a_SOURCES += h8300-exception-frame-print.c
    1516libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/h8300/rtems/score/cpu.h

    r382ea27b r24bf11e  
    11631163  (((value&0xff) << 8) | ((value >> 8)&0xff))
    11641164
     1165typedef uint32_t CPU_Counter_ticks;
     1166
     1167CPU_Counter_ticks _CPU_Counter_read( void );
     1168
     1169static inline CPU_Counter_ticks _CPU_Counter_difference(
     1170  CPU_Counter_ticks second,
     1171  CPU_Counter_ticks first
     1172)
     1173{
     1174  return second - first;
     1175}
     1176
    11651177/* to be provided by the BSP */
    11661178extern void H8BD_Install_IRQ(
  • cpukit/score/cpu/i386/Makefile.am

    r382ea27b r24bf11e  
    1616noinst_LIBRARIES = libscorecpu.a
    1717libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     18libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1819libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
    1920
  • cpukit/score/cpu/i386/rtems/score/cpu.h

    r382ea27b r24bf11e  
    695695void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
    696696
     697typedef uint32_t CPU_Counter_ticks;
     698
     699CPU_Counter_ticks _CPU_Counter_read( void );
     700
     701static inline CPU_Counter_ticks _CPU_Counter_difference(
     702  CPU_Counter_ticks second,
     703  CPU_Counter_ticks first
     704)
     705{
     706  return second - first;
     707}
     708
    697709#endif /* ASM */
    698710
  • cpukit/score/cpu/lm32/Makefile.am

    r382ea27b r24bf11e  
    1313noinst_LIBRARIES = libscorecpu.a
    1414libscorecpu_a_SOURCES = cpu.c cpu_asm.S irq.c
     15libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1516libscorecpu_a_SOURCES += lm32-exception-frame-print.c
    1617libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/lm32/rtems/score/cpu.h

    r382ea27b r24bf11e  
    12831283}
    12841284
     1285typedef uint32_t CPU_Counter_ticks;
     1286
     1287CPU_Counter_ticks _CPU_Counter_read( void );
     1288
     1289static inline CPU_Counter_ticks _CPU_Counter_difference(
     1290  CPU_Counter_ticks second,
     1291  CPU_Counter_ticks first
     1292)
     1293{
     1294  return second - first;
     1295}
     1296
    12851297#ifdef __cplusplus
    12861298}
  • cpukit/score/cpu/m32c/Makefile.am

    r382ea27b r24bf11e  
    1616libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c \
    1717    varvects.S
     18libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1819libscorecpu_a_SOURCES += m32c-exception-frame-print.c
    1920libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/m32c/rtems/score/cpu.h

    r382ea27b r24bf11e  
    12341234  (((value&0xff) << 8) | ((value >> 8)&0xff))
    12351235
     1236typedef uint32_t CPU_Counter_ticks;
     1237
     1238CPU_Counter_ticks _CPU_Counter_read( void );
     1239
     1240static inline CPU_Counter_ticks _CPU_Counter_difference(
     1241  CPU_Counter_ticks second,
     1242  CPU_Counter_ticks first
     1243)
     1244{
     1245  return second - first;
     1246}
     1247
    12361248#ifdef __cplusplus
    12371249}
  • cpukit/score/cpu/m32r/Makefile.am

    r382ea27b r24bf11e  
    1515noinst_LIBRARIES = libscorecpu.a
    1616libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c
     17libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1718libscorecpu_a_SOURCES += m32r-exception-frame-print.c
    1819libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/m32r/rtems/score/cpu.h

    r382ea27b r24bf11e  
    12751275  (((value&0xff) << 8) | ((value >> 8)&0xff))
    12761276
     1277typedef uint32_t CPU_Counter_ticks;
     1278
     1279CPU_Counter_ticks _CPU_Counter_read( void );
     1280
     1281static inline CPU_Counter_ticks _CPU_Counter_difference(
     1282  CPU_Counter_ticks second,
     1283  CPU_Counter_ticks first
     1284)
     1285{
     1286  return second - first;
     1287}
     1288
    12771289#ifdef __cplusplus
    12781290}
  • cpukit/score/cpu/m68k/Makefile.am

    r382ea27b r24bf11e  
    2020
    2121libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     22libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    2223libscorecpu_a_SOURCES += m68k-exception-frame-print.c
    2324libscorecpu_a_SOURCES += __m68k_read_tp.c
  • cpukit/score/cpu/m68k/rtems/score/cpu.h

    r382ea27b r24bf11e  
    724724);
    725725
     726typedef uint32_t CPU_Counter_ticks;
     727
     728CPU_Counter_ticks _CPU_Counter_read( void );
     729
     730static inline CPU_Counter_ticks _CPU_Counter_difference(
     731  CPU_Counter_ticks second,
     732  CPU_Counter_ticks first
     733)
     734{
     735  return second - first;
     736}
     737
    726738#if (M68K_HAS_FPSP_PACKAGE == 1)
    727739/*
  • cpukit/score/cpu/mips/Makefile.am

    r382ea27b r24bf11e  
    1616noinst_LIBRARIES = libscorecpu.a
    1717libscorecpu_a_SOURCES = cpu.c cpu_asm.S
     18libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1819libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
    1920
  • cpukit/score/cpu/mips/rtems/score/cpu.h

    r382ea27b r24bf11e  
    11941194  (((value&0xff) << 8) | ((value >> 8)&0xff))
    11951195
     1196typedef uint32_t CPU_Counter_ticks;
     1197
     1198CPU_Counter_ticks _CPU_Counter_read( void );
     1199
     1200static inline CPU_Counter_ticks _CPU_Counter_difference(
     1201  CPU_Counter_ticks second,
     1202  CPU_Counter_ticks first
     1203)
     1204{
     1205  return second - first;
     1206}
    11961207
    11971208#endif
  • cpukit/score/cpu/moxie/Makefile.am

    r382ea27b r24bf11e  
    1515noinst_LIBRARIES = libscorecpu.a
    1616libscorecpu_a_SOURCES = cpu.c moxie-exception-frame-print.c cpu_asm.S
     17libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1718libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
    1819
  • cpukit/score/cpu/moxie/rtems/score/cpu.h

    r382ea27b r24bf11e  
    10501050  (((value&0xff) << 8) | ((value >> 8)&0xff))
    10511051
     1052typedef uint32_t CPU_Counter_ticks;
     1053
     1054CPU_Counter_ticks _CPU_Counter_read( void );
     1055
     1056static inline CPU_Counter_ticks _CPU_Counter_difference(
     1057  CPU_Counter_ticks second,
     1058  CPU_Counter_ticks first
     1059)
     1060{
     1061  return second - first;
     1062}
     1063
    10521064#ifdef __cplusplus
    10531065}
  • cpukit/score/cpu/nios2/Makefile.am

    r382ea27b r24bf11e  
    2222
    2323libscorecpu_a_SOURCES =
     24libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    2425libscorecpu_a_SOURCES += nios2-context-initialize.c
    2526libscorecpu_a_SOURCES += nios2-context-switch.S
  • cpukit/score/cpu/nios2/rtems/score/cpu.h

    r382ea27b r24bf11e  
    365365  (((value&0xff) << 8) | ((value >> 8)&0xff))
    366366
     367typedef uint32_t CPU_Counter_ticks;
     368
     369CPU_Counter_ticks _CPU_Counter_read( void );
     370
     371static inline CPU_Counter_ticks _CPU_Counter_difference(
     372  CPU_Counter_ticks second,
     373  CPU_Counter_ticks first
     374)
     375{
     376  return second - first;
     377}
     378
    367379#endif /* ASM */
    368380
  • cpukit/score/cpu/no_cpu/Makefile.am

    r382ea27b r24bf11e  
    1313noinst_LIBRARIES = libscorecpu.a
    1414libscorecpu_a_SOURCES = cpu.c cpu_asm.c
     15libscorecpu_a_SOURCES += cpucounterread.c
    1516libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
    1617
  • cpukit/score/cpu/no_cpu/rtems/score/cpu.h

    r382ea27b r24bf11e  
    14261426#define CPU_swap_u16( value ) \
    14271427  (((value&0xff) << 8) | ((value >> 8)&0xff))
     1428
     1429/**
     1430 * @brief Unsigned integer type for CPU counter values.
     1431 */
     1432typedef uint32_t CPU_Counter_ticks;
     1433
     1434/**
     1435 * @brief Returns the current CPU counter value.
     1436 *
     1437 * A CPU counter is some free-running counter.  It ticks usually with a
     1438 * frequency close to the CPU or system bus clock.  The board support package
     1439 * must ensure that this function works before the RTEMS initialization.
     1440 * Otherwise invalid profiling statistics will be gathered.
     1441 *
     1442 * @return The current CPU counter value.
     1443 */
     1444CPU_Counter_ticks _CPU_Counter_read( void );
     1445
     1446/**
     1447 * @brief Returns the difference between the second and first CPU counter
     1448 * value.
     1449 *
     1450 * This operation may be carried out as a modulo operation depending on the
     1451 * range of the CPU counter device.
     1452 *
     1453 * @param[in] second The second CPU counter value.
     1454 * @param[in] first The first CPU counter value.
     1455 *
     1456 * @return Returns second minus first modulo counter period.
     1457 */
     1458CPU_Counter_ticks _CPU_Counter_difference(
     1459  CPU_Counter_ticks second,
     1460  CPU_Counter_ticks first
     1461);
    14281462
    14291463#ifdef RTEMS_SMP
  • cpukit/score/cpu/powerpc/rtems/score/cpu.h

    r382ea27b r24bf11e  
    769769#define CPU_swap_u16( value ) \
    770770  (((value&0xff) << 8) | ((value >> 8)&0xff))
     771
     772typedef uint32_t CPU_Counter_ticks;
     773
     774static inline CPU_Counter_ticks _CPU_Counter_read( void )
     775{
     776  CPU_Counter_ticks value;
     777
     778#ifdef ppc8540
     779  /* Book E has no mftb */
     780  __asm__ volatile( "mfspr %0, 268" : "=r" (value) );
     781#else
     782  __asm__ volatile( "mftb %0" : "=r" (value) );
     783#endif
     784
     785  return value;
     786}
     787
     788static inline CPU_Counter_ticks _CPU_Counter_difference(
     789  CPU_Counter_ticks second,
     790  CPU_Counter_ticks first
     791)
     792{
     793  return second - first;
     794}
    771795
    772796#endif /* ASM */
  • cpukit/score/cpu/sh/Makefile.am

    r382ea27b r24bf11e  
    1313noinst_LIBRARIES = libscorecpu.a
    1414libscorecpu_a_SOURCES = cpu.c context.c
     15libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1516libscorecpu_a_SOURCES += sh-exception-frame-print.c
    1617libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/sh/rtems/score/cpu.h

    r382ea27b r24bf11e  
    911911void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
    912912
     913typedef uint32_t CPU_Counter_ticks;
     914
     915CPU_Counter_ticks _CPU_Counter_read( void );
     916
     917static inline CPU_Counter_ticks _CPU_Counter_difference(
     918  CPU_Counter_ticks second,
     919  CPU_Counter_ticks first
     920)
     921{
     922  return second - first;
     923}
     924
    913925#ifdef __cplusplus
    914926}
  • cpukit/score/cpu/sparc/rtems/score/cpu.h

    r382ea27b r24bf11e  
    12701270  (((value&0xff) << 8) | ((value >> 8)&0xff))
    12711271
     1272typedef uint32_t CPU_Counter_ticks;
     1273
     1274CPU_Counter_ticks _CPU_Counter_read( void );
     1275
     1276static inline CPU_Counter_ticks _CPU_Counter_difference(
     1277  CPU_Counter_ticks second,
     1278  CPU_Counter_ticks first
     1279)
     1280{
     1281  return second - first;
     1282}
     1283
    12721284#endif /* ASM */
    12731285
  • cpukit/score/cpu/sparc64/Makefile.am

    r382ea27b r24bf11e  
    1515noinst_LIBRARIES = libscorecpu.a
    1616libscorecpu_a_SOURCES = context.S cpu.c
     17libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1718libscorecpu_a_SOURCES += sparc64-exception-frame-print.c
    1819libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/sparc64/rtems/score/cpu.h

    r382ea27b r24bf11e  
    10901090  (((value&0xff) << 8) | ((value >> 8)&0xff))
    10911091
     1092typedef uint32_t CPU_Counter_ticks;
     1093
     1094CPU_Counter_ticks _CPU_Counter_read( void );
     1095
     1096static inline CPU_Counter_ticks _CPU_Counter_difference(
     1097  CPU_Counter_ticks second,
     1098  CPU_Counter_ticks first
     1099)
     1100{
     1101  return second - first;
     1102}
     1103
    10921104#endif /* ASM */
    10931105
  • cpukit/score/cpu/v850/Makefile.am

    r382ea27b r24bf11e  
    1313libscorecpu_a_SOURCES  = cpu.c
    1414libscorecpu_a_SOURCES += cpu_asm.S
     15libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
    1516libscorecpu_a_SOURCES += v850-exception-frame-print.c
    1617libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
  • cpukit/score/cpu/v850/rtems/score/cpu.h

    r382ea27b r24bf11e  
    12341234}
    12351235
     1236typedef uint32_t CPU_Counter_ticks;
     1237
     1238CPU_Counter_ticks _CPU_Counter_read( void );
     1239
     1240static inline CPU_Counter_ticks _CPU_Counter_difference(
     1241  CPU_Counter_ticks second,
     1242  CPU_Counter_ticks first
     1243)
     1244{
     1245  return second - first;
     1246}
     1247
    12361248#ifdef __cplusplus
    12371249}
  • doc/cpu_supplement/general.t

    r382ea27b r24bf11e  
    342342@end example
    343343
     344@section CPU counter
     345
     346The CPU support must implement the CPU counter interface.  A CPU counter is
     347some free-running counter.  It ticks usually with a frequency close to the CPU
     348or system bus clock.  On some architectures the actual implementation is board
     349support package dependent.  The CPU counter is used for profiling of low-level
     350functions.  It is also used to implement two busy wait functions
     351@code{rtems_counter_delay_ticks()} and @code{rtems_counter_delay_nanoseconds()}
     352which may be used in device drivers.  It may be also used as an entropy source
     353for random number generators.
     354
     355The CPU counter interface uses a CPU port specific unsigned integer type
     356@code{CPU_Counter_ticks} to represent CPU counter values.  The CPU port must
     357provide the following two functions
     358
     359@itemize
     360@item @code{_CPU_Counter_read()} to read the current CPU counter value, and
     361@item @code{_CPU_Counter_difference()} to get the difference between two CPU
     362counter values.
     363@end itemize
     364
    344365@c
    345366@c
  • testsuites/sptests/Makefile.am

    r382ea27b r24bf11e  
    3131    spcbssched01 spcbssched02 spcbssched03 spqreslib sptimespec01 \
    3232    spregion_err01 sppartition_err01
     33SUBDIRS += spcpucounter01
    3334if HAS_CPLUSPLUS
    3435SUBDIRS += sptls02
  • testsuites/sptests/configure.ac

    r382ea27b r24bf11e  
    3737# Explicitly list all Makefiles here
    3838AC_CONFIG_FILES([Makefile
     39spcpucounter01/Makefile
    3940sptls02/Makefile
    4041sptls01/Makefile
Note: See TracChangeset for help on using the changeset viewer.