1 /* Copyright 2019 SiFive, Inc. */
2 /* SPDX-License-Identifier: Apache-2.0 */
4 #include <metal/machine.h>
9 extern inline uint64_t metal_rtc_get_rate(const struct metal_rtc *const rtc);
10 extern inline uint64_t metal_rtc_set_rate(const struct metal_rtc *const rtc, const uint64_t rate);
11 extern inline uint64_t metal_rtc_get_compare(const struct metal_rtc *const rtc);
12 extern inline uint64_t metal_rtc_set_compare(const struct metal_rtc *const rtc, const uint64_t compare);
13 extern inline uint64_t metal_rtc_get_count(const struct metal_rtc *const rtc);
14 extern inline uint64_t metal_rtc_set_count(const struct metal_rtc *const rtc, const uint64_t count);
15 extern inline int metal_rtc_run(const struct metal_rtc *const rtc, const enum metal_rtc_run_option option);
16 extern inline struct metal_interrupt *metal_rtc_get_interrupt(const struct metal_rtc *const rtc);
17 extern inline int metal_rtc_get_interrupt_id(const struct metal_rtc *const rtc);
19 struct metal_rtc *metal_rtc_get_device(int index) {
20 #ifdef __METAL_DT_MAX_RTCS
21 if (index < __METAL_DT_MAX_RTCS) {
22 return (struct metal_rtc *) __metal_rtc_table[index];