Changeset dd32e2b2 in rtems


Ignore:
Timestamp:
Jul 6, 2018, 6:12:40 AM (10 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
bca36d9
Parents:
6418c91d
git-author:
Sebastian Huber <sebastian.huber@…> (07/06/18 06:12:40)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/06/18 11:46:46)
Message:

riscv: Implement CPU counter

Update #3433.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bsps/riscv/riscv/clock/clockdrv.c

    r6418c91d rdd32e2b2  
    8888}
    8989
    90 CPU_Counter_ticks _CPU_Counter_read(void)
    91 {
    92   return riscv_clock_get_timecount(NULL);
    93 }
    94 
    9590static uint32_t riscv_clock_get_timebase_frequency(const void *fdt)
    9691{
     
    132127}
    133128
    134 CPU_Counter_ticks _CPU_Counter_difference(
    135   CPU_Counter_ticks second,
    136   CPU_Counter_ticks first
    137 )
     129uint32_t _CPU_Counter_frequency( void )
    138130{
    139   return second - first;
     131  return riscv_clock_get_timebase_frequency(bsp_fdt_get());
    140132}
    141133
  • cpukit/score/cpu/riscv/Makefile.am

    r6418c91d rdd32e2b2  
    33libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
    44libscorecpu_a_SOURCES  = cpu.c
    5 libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
    65libscorecpu_a_SOURCES += riscv-exception-handler.S
    76libscorecpu_a_SOURCES += riscv-exception-default.c
  • cpukit/score/cpu/riscv/include/rtems/score/cpu.h

    r6418c91d rdd32e2b2  
    371371uint32_t _CPU_Counter_frequency( void );
    372372
    373 CPU_Counter_ticks _CPU_Counter_read( void );
     373static inline CPU_Counter_ticks _CPU_Counter_read( void )
     374{
     375  unsigned long ticks;
     376
     377  __asm__ volatile ( "rdtime %0" : "=&r" ( ticks ) );
     378
     379  return (uint32_t) ticks;
     380}
     381
     382static inline CPU_Counter_ticks _CPU_Counter_difference(
     383  CPU_Counter_ticks second,
     384  CPU_Counter_ticks first
     385)
     386{
     387  return second - first;
     388}
    374389
    375390#ifdef RTEMS_SMP
Note: See TracChangeset for help on using the changeset viewer.