root/opal/include/opal/sys/arm64/timer.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. opal_sys_timer_get_cycles
  2. opal_sys_timer_get_freq

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2008      The University of Tennessee and The University
   4  *                         of Tennessee Research Foundation.  All rights
   5  *                         reserved.
   6  * Copyright (c) 2016      Broadcom Limited. All rights reserved.
   7  * Copyright (c) 2016      Los Alamos National Security, LLC. All rights
   8  *                         reserved.
   9  * $COPYRIGHT$
  10  *
  11  * Additional copyrights may follow
  12  *
  13  * $HEADER$
  14  */
  15 
  16 #ifndef OPAL_SYS_ARCH_TIMER_H
  17 #define OPAL_SYS_ARCH_TIMER_H 1
  18 
  19 typedef uint64_t opal_timer_t;
  20 
  21 static inline opal_timer_t
  22 opal_sys_timer_get_cycles(void)
  23 {
  24     opal_timer_t ret;
  25 
  26     __asm__ __volatile__ ("isb" ::: "memory");
  27     __asm__ __volatile__ ("mrs %0,  CNTVCT_EL0" : "=r" (ret));
  28 
  29     return ret;
  30 }
  31 
  32 
  33 static inline opal_timer_t
  34 opal_sys_timer_get_freq(void)
  35 {
  36     opal_timer_t freq;
  37     __asm__ __volatile__ ("mrs %0,  CNTFRQ_EL0" : "=r" (freq));
  38     return (opal_timer_t)(freq);
  39 }
  40 
  41 #define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1
  42 #define OPAL_HAVE_SYS_TIMER_GET_FREQ 1
  43 
  44 #endif /* ! OPAL_SYS_ARCH_TIMER_H */

/* [<][>][^][v][top][bottom][index][help] */