summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/metal/timer.h
blob: 5d5132de5e93faa3f6962a0955644a75a94d6e84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* Copyright 2018 SiFive, Inc */
/* SPDX-License-Identifier: Apache-2.0 */

#ifndef METAL__TIMER_H
#define METAL__TIMER_H

/*!
 * @file timer.h
 * @brief API for reading and manipulating the machine timer
 */

/*!
 * @brief Read the machine cycle count
 * @param hartid The hart ID to read the cycle count of
 * @param cyclecount The variable to hold the value
 * @return 0 upon success
 */
int metal_timer_get_cyclecount(int hartid, unsigned long long *cyclecount);

/*!
 * @brief Get the machine timebase frequency
 * @param hartid The hart ID to read the timebase of
 * @param timebase The variable to hold the value
 * @return 0 upon success
 */
int metal_timer_get_timebase_frequency(int hartid,
                                       unsigned long long *timebase);

/*!
 * @brief Set the machine timer tick interval in seconds
 * @param hartid The hart ID to read the timebase of
 * @param second The number of seconds to set the tick interval to
 * @return 0 upon success
 */
int metal_timer_set_tick(int hartid, int second);

#endif