Loading...
Searching...
No Matches
dpl_cputime.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef DPL_DPL_CPUTIME_H
21#define DPL_DPL_CPUTIME_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include "os/os_cputime.h"
28
34static inline uint32_t dpl_cputime_get32(void)
35{
36 return os_cputime_get32();
37}
38
46static inline uint32_t dpl_cputime_usecs_to_ticks(uint32_t usecs)
47{
48 return os_cputime_usecs_to_ticks(usecs);
49}
50
58static inline uint32_t dpl_cputime_ticks_to_usecs(uint32_t ticks)
59{
60 return os_cputime_ticks_to_usecs(ticks);
61}
62
68static inline void dpl_cputime_delay_ticks(uint32_t ticks)
69{
70 os_cputime_delay_ticks(ticks);
71}
72
78static inline void dpl_cputime_delay_usecs(uint32_t usecs)
79{
80 os_cputime_delay_usecs(usecs);
81}
82
90static inline void dpl_cputime_timer_init(struct hal_timer *timer, hal_timer_cb fp,
91 void *arg)
92{
93 os_cputime_timer_init(timer, fp, arg);
94}
95
109static inline int dpl_cputime_timer_start(struct hal_timer *timer, uint32_t cputime)
110{
111 return os_cputime_timer_start(timer, cputime);
112}
113
126static inline int dpl_cputime_timer_relative(struct hal_timer *timer, uint32_t usecs)
127{
128 return os_cputime_timer_relative(timer, usecs);
129}
130
140static inline void dpl_cputime_timer_stop(struct hal_timer *timer)
141{
142 os_cputime_timer_stop(timer);
143}
144
145#ifdef __cplusplus
146}
147#endif
148
149#endif /* DPL_DPL_CPUTIME_H */
static uint32_t dpl_cputime_ticks_to_usecs(uint32_t ticks)
Convert the given number of ticks into microseconds.
Definition dpl_cputime.h:58
static uint32_t dpl_cputime_get32(void)
Returns the low 32 bits of cputime.
Definition dpl_cputime.h:34
static void dpl_cputime_delay_usecs(uint32_t usecs)
Wait until 'usecs' microseconds has elapsed.
Definition dpl_cputime.h:78
static uint32_t dpl_cputime_usecs_to_ticks(uint32_t usecs)
Converts the given number of microseconds into cputime ticks.
Definition dpl_cputime.h:46
static void dpl_cputime_timer_stop(struct hal_timer *timer)
Stops a cputimer from running.
static int dpl_cputime_timer_start(struct hal_timer *timer, uint32_t cputime)
Start a cputimer that will expire at 'cputime'.
static void dpl_cputime_delay_ticks(uint32_t ticks)
Wait until the number of ticks has elapsed.
Definition dpl_cputime.h:68
static void dpl_cputime_timer_init(struct hal_timer *timer, hal_timer_cb fp, void *arg)
Initialize a CPU timer, using the given HAL timer.
Definition dpl_cputime.h:90
static int dpl_cputime_timer_relative(struct hal_timer *timer, uint32_t usecs)
Sets a cpu timer that will expire 'usecs' microseconds from the current cputime.