1/*
2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#pragma once
8
9#include <config.h>
10#ifdef CONFIG_KERNEL_MCS
11#include <stdint.h>
12#include <util.h>
13
14/* timer function definitions that work for all 64 bit arm platforms */
15static inline CONST ticks_t getMaxTicksToUs(void)
16{
17#if USE_KHZ
18    return UINT64_MAX / TIMER_CLOCK_KHZ;
19#else
20    return UINT64_MAX;
21#endif
22}
23
24static inline CONST time_t ticksToUs(ticks_t ticks)
25{
26#if USE_KHZ
27    return (ticks * TIMER_CLOCK_KHZ) / TIMER_CLOCK_MHZ;
28#else
29    return ticks / TIMER_CLOCK_MHZ;
30#endif
31}
32#endif /* CONFIG_KERNEL_MCS */
33
34