123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- #ifndef HRTIMER_H_
- #define HRTIMER_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifdef CONFIG_ACTS_HRTIMER
- struct hrtimer;
- typedef void (*hrtimer_expiry_t)(struct hrtimer *ttimer, void *expiry_fn_arg);
- struct hrtimer
- {
- sys_dlist_t node;
- s32_t duration;
- s32_t period;
- u64_t expiry_time;
- hrtimer_expiry_t expiry_fn;
- void *expiry_fn_arg;
- };
- extern void hrtimer_init(struct hrtimer *ttimer, hrtimer_expiry_t expiry_fn,
- void *expiry_fn_arg);
- extern void hrtimer_start(struct hrtimer *ttimer, s32_t duration, s32_t period);
- extern void hrtimer_stop(struct hrtimer* timer);
- static inline void hrtimer_restart(struct hrtimer *ttimer)
- {
- hrtimer_start(ttimer, ttimer->duration, ttimer->period);
- }
- extern bool hrtimer_is_running(struct hrtimer *ttimer);
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|