1 /*
2  * Copyright (c) 2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: qdf_hrtimer
22  * QCA driver framework (QDF) high resolution timers timer APIs
23  */
24 
25 #include "i_qdf_hrtimer.h"
26 #include "qdf_hrtimer.h"
27 #include <qdf_module.h>
28 
qdf_hrtimer_start(qdf_hrtimer_data_t * timer,qdf_ktime_t interval,enum qdf_hrtimer_mode mode)29 void qdf_hrtimer_start(qdf_hrtimer_data_t *timer, qdf_ktime_t interval,
30 		       enum qdf_hrtimer_mode mode)
31 {
32 	__qdf_hrtimer_start(timer, interval, mode);
33 }
34 
35 qdf_export_symbol(qdf_hrtimer_start);
36 
qdf_hrtimer_cancel(qdf_hrtimer_data_t * timer)37 int qdf_hrtimer_cancel(qdf_hrtimer_data_t *timer)
38 {
39 	return __qdf_hrtimer_cancel(timer);
40 }
41 
42 qdf_export_symbol(qdf_hrtimer_cancel);
43 
qdf_hrtimer_init(qdf_hrtimer_data_t * timer,qdf_hrtimer_func_t callback,enum qdf_clock_id clock,enum qdf_hrtimer_mode mode,enum qdf_context_mode ctx)44 void qdf_hrtimer_init(qdf_hrtimer_data_t *timer,
45 		      qdf_hrtimer_func_t callback,
46 		      enum qdf_clock_id clock,
47 		      enum qdf_hrtimer_mode mode,
48 		      enum qdf_context_mode ctx)
49 {
50 	__qdf_hrtimer_init(timer, callback, clock, mode, ctx);
51 }
52 
53 qdf_export_symbol(qdf_hrtimer_init);
54 
qdf_time_ms_to_ktime(uint64_t ms)55 qdf_ktime_t qdf_time_ms_to_ktime(uint64_t ms)
56 {
57 	return __qdf_time_ms_to_ktime(ms);
58 }
59 
60 qdf_export_symbol(qdf_time_ms_to_ktime);
61 
qdf_hrtimer_kill(qdf_hrtimer_data_t * timer)62 void qdf_hrtimer_kill(qdf_hrtimer_data_t *timer)
63 {
64 	__qdf_hrtimer_kill(timer);
65 }
66 
67 qdf_export_symbol(qdf_hrtimer_kill);
68 
qdf_hrtimer_get_remaining(qdf_hrtimer_data_t * timer)69 qdf_ktime_t qdf_hrtimer_get_remaining(qdf_hrtimer_data_t *timer)
70 {
71 	return __qdf_hrtimer_get_remaining(timer);
72 }
73 
74 qdf_export_symbol(qdf_hrtimer_get_remaining);
75 
qdf_hrtimer_is_queued(qdf_hrtimer_data_t * timer)76 bool qdf_hrtimer_is_queued(qdf_hrtimer_data_t *timer)
77 {
78 	return __qdf_hrtimer_is_queued(timer);
79 }
80 
81 qdf_export_symbol(qdf_hrtimer_is_queued);
82 
qdf_hrtimer_callback_running(qdf_hrtimer_data_t * timer)83 bool qdf_hrtimer_callback_running(qdf_hrtimer_data_t *timer)
84 {
85 	return __qdf_hrtimer_callback_running(timer);
86 }
87 
88 qdf_export_symbol(qdf_hrtimer_callback_running);
89 
qdf_hrtimer_active(qdf_hrtimer_data_t * timer)90 bool qdf_hrtimer_active(qdf_hrtimer_data_t *timer)
91 {
92 	return __qdf_hrtimer_active(timer);
93 }
94 
95 qdf_export_symbol(qdf_hrtimer_active);
96 
qdf_hrtimer_cb_get_time(qdf_hrtimer_data_t * timer)97 qdf_ktime_t qdf_hrtimer_cb_get_time(qdf_hrtimer_data_t *timer)
98 {
99 	return __qdf_hrtimer_cb_get_time(timer);
100 }
101 
102 qdf_export_symbol(qdf_hrtimer_cb_get_time);
103 
qdf_hrtimer_forward(qdf_hrtimer_data_t * timer,qdf_ktime_t now,qdf_ktime_t interval)104 uint64_t qdf_hrtimer_forward(qdf_hrtimer_data_t *timer,
105 			     qdf_ktime_t now,
106 			     qdf_ktime_t interval)
107 {
108 	return __qdf_hrtimer_forward(timer, now, interval);
109 }
110 
111 qdf_export_symbol(qdf_hrtimer_forward);
112 
qdf_hrtimer_add_expires(qdf_hrtimer_data_t * timer,qdf_ktime_t interval)113 void qdf_hrtimer_add_expires(qdf_hrtimer_data_t *timer, qdf_ktime_t interval)
114 {
115 	return __qdf_hrtimer_add_expires(timer, interval);
116 }
117 
118 qdf_export_symbol(qdf_hrtimer_add_expires);
119