1 /* 2 * Copyright (c) 2006-2023, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2017-12-23 Bernard first version 9 */ 10 11 #ifndef CPUTIME_H__ 12 #define CPUTIME_H__ 13 14 #include <stdint.h> 15 #include "cputimer.h" 16 17 struct rt_clock_cputime_ops 18 { 19 uint64_t (*cputime_getres)(void); 20 uint64_t (*cputime_gettime)(void); 21 int (*cputime_settimeout)(uint64_t tick, void (*timeout)(void *param), void *param); 22 }; 23 24 uint64_t clock_cpu_getres(void); 25 uint64_t clock_cpu_gettime(void); 26 int clock_cpu_settimeout(uint64_t tick, void (*timeout)(void *param), void *param); 27 int clock_cpu_issettimeout(void); 28 29 uint64_t clock_cpu_microsecond(uint64_t cpu_tick); 30 uint64_t clock_cpu_millisecond(uint64_t cpu_tick); 31 32 int clock_cpu_setops(const struct rt_clock_cputime_ops *ops); 33 34 #ifdef RT_USING_CPUTIME_RISCV 35 int riscv_cputime_init(void); 36 #endif /* RT_USING_CPUTIME_RISCV */ 37 38 #endif 39