Ignore:
Timestamp:
Jul 27, 2018, 12:47:17 PM (15 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
44c2d393
Parents:
65f52d0
git-author:
Sebastian Huber <sebastian.huber@…> (07/27/18 12:47:17)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/27/18 13:06:55)
Message:

riscv: Rework CPU counter support

Update #3433.

File:
1 edited

Legend:

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

    r65f52d0 rcfc9573  
    3333 */
    3434
    35 #include <rtems/timecounter.h>
    36 #include <rtems/score/cpuimpl.h>
    37 #include <rtems/score/riscv-utility.h>
    38 
    3935#include <bsp/fatal.h>
    4036#include <bsp/fdt.h>
    4137#include <bsp/irq.h>
    4238#include <bsp/riscv.h>
     39
     40#include <rtems/sysinit.h>
     41#include <rtems/timecounter.h>
     42#include <rtems/score/cpuimpl.h>
     43#include <rtems/score/riscv-utility.h>
    4344
    4445#include <libfdt.h>
     
    145146}
    146147
     148volatile uint32_t _RISCV_Counter_register;
     149
     150static void riscv_counter_initialize(void)
     151{
     152  _RISCV_Counter_mutable = &riscv_clint->mtime.val_32[0];
     153}
     154
    147155uint32_t _CPU_Counter_frequency( void )
    148156{
    149157  return riscv_clock_get_timebase_frequency(bsp_fdt_get());
    150158}
     159
     160RTEMS_SYSINIT_ITEM(
     161  riscv_counter_initialize,
     162  RTEMS_SYSINIT_CPU_COUNTER,
     163  RTEMS_SYSINIT_ORDER_FIRST
     164);
    151165
    152166#define Clock_driver_support_at_tick() riscv_clock_at_tick(&riscv_clock_tc)
Note: See TracChangeset for help on using the changeset viewer.