Line data Source code
1 0 : /*
2 : * Copyright (c) 2019 Intel Corporation
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_TIME_UNITS_H_
8 : #define ZEPHYR_INCLUDE_TIME_UNITS_H_
9 :
10 : #include <zephyr/toolchain.h>
11 : #include <zephyr/sys/util.h>
12 :
13 : #ifdef __cplusplus
14 : extern "C" {
15 : #endif
16 :
17 : /**
18 : * @file
19 : * @defgroup timeutil_unit_apis Time Units Helpers
20 : * @ingroup timeutil_apis
21 : *
22 : * @brief Various helper APIs for converting between time units.
23 : * @{
24 : */
25 :
26 : /** @brief System-wide macro to denote "forever" in milliseconds
27 : *
28 : * Usage of this macro is limited to APIs that want to expose a timeout value
29 : * that can optionally be unlimited, or "forever".
30 : * This macro can not be fed into kernel functions or macros directly. Use
31 : * @ref SYS_TIMEOUT_MS instead.
32 : */
33 1 : #define SYS_FOREVER_MS (-1)
34 :
35 : /** @brief System-wide macro to denote "forever" in microseconds
36 : *
37 : * See @ref SYS_FOREVER_MS.
38 : */
39 1 : #define SYS_FOREVER_US (-1)
40 :
41 : /** @brief System-wide macro to convert milliseconds to kernel timeouts
42 : */
43 1 : #define SYS_TIMEOUT_MS(ms) Z_TIMEOUT_TICKS((ms) == SYS_FOREVER_MS ? \
44 : K_TICKS_FOREVER : Z_TIMEOUT_MS_TICKS(ms))
45 :
46 : /* Exhaustively enumerated, highly optimized time unit conversion API */
47 :
48 : #if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
49 : __syscall int sys_clock_hw_cycles_per_sec_runtime_get(void);
50 :
51 : static inline int z_impl_sys_clock_hw_cycles_per_sec_runtime_get(void)
52 : {
53 : extern int z_clock_hw_cycles_per_sec;
54 :
55 : return z_clock_hw_cycles_per_sec;
56 : }
57 : #endif /* CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME */
58 :
59 : #if defined(__cplusplus) && (__cplusplus >= 201402L)
60 : #if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
61 : #define TIME_CONSTEXPR
62 : #else
63 : #define TIME_CONSTEXPR constexpr
64 : #endif
65 : #else
66 0 : #define TIME_CONSTEXPR
67 : #endif
68 :
69 : /**
70 : * @brief Get the system timer frequency.
71 : * @return system timer frequency in Hz
72 : */
73 : #if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
74 : #define sys_clock_hw_cycles_per_sec() sys_clock_hw_cycles_per_sec_runtime_get()
75 : #else
76 1 : #define sys_clock_hw_cycles_per_sec() CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
77 : #endif
78 :
79 : /** @internal
80 : * Macro determines if fast conversion algorithm can be used. It checks if
81 : * maximum timeout represented in source frequency domain and multiplied by
82 : * target frequency fits in 64 bits.
83 : *
84 : * @param from_hz Source frequency.
85 : * @param to_hz Target frequency.
86 : *
87 : * @retval true Use faster algorithm.
88 : * @retval false Use algorithm preventing overflow of intermediate value.
89 : */
90 : #define z_tmcvt_use_fast_algo(from_hz, to_hz) \
91 : ((DIV_ROUND_UP(CONFIG_SYS_CLOCK_MAX_TIMEOUT_DAYS * 24ULL * 3600ULL * from_hz, \
92 : UINT32_MAX) * to_hz) <= UINT32_MAX)
93 :
94 : /* Time converter generator gadget. Selects from one of three
95 : * conversion algorithms: ones that take advantage when the
96 : * frequencies are an integer ratio (in either direction), or a full
97 : * precision conversion. Clever use of extra arguments causes all the
98 : * selection logic to be optimized out, and the generated code even
99 : * reduces to 32 bit only if a ratio conversion is available and the
100 : * result is 32 bits.
101 : *
102 : * This isn't intended to be used directly, instead being wrapped
103 : * appropriately in a user-facing API. The boolean arguments are:
104 : *
105 : * const_hz - The hz arguments are known to be compile-time
106 : * constants (because otherwise the modulus test would
107 : * have to be done at runtime)
108 : * result32 - The result will be truncated to 32 bits on use
109 : * round_up - Return the ceiling of the resulting fraction
110 : * round_off - Return the nearest value to the resulting fraction
111 : * (pass both round_up/off as false to get "round_down")
112 : *
113 : * All of this must be implemented as expressions so that, when constant,
114 : * the results may be used to initialize global variables.
115 : */
116 :
117 : /* true if the conversion is the identity */
118 : #define z_tmcvt_is_identity(__from_hz, __to_hz) \
119 : ((__to_hz) == (__from_hz))
120 :
121 : /* true if the conversion requires a simple integer multiply */
122 : #define z_tmcvt_is_int_mul(__from_hz, __to_hz) \
123 : ((__to_hz) > (__from_hz) && (__to_hz) % (__from_hz) == 0U)
124 :
125 : /* true if the conversion requires a simple integer division */
126 : #define z_tmcvt_is_int_div(__from_hz, __to_hz) \
127 : ((__from_hz) > (__to_hz) && (__from_hz) % (__to_hz) == 0U)
128 :
129 : /*
130 : * Compute the offset needed to round the result correctly when
131 : * the conversion requires a simple integer division
132 : */
133 : #define z_tmcvt_off_div(__from_hz, __to_hz, __round_up, __round_off) \
134 : ((__round_off) ? ((__from_hz) / (__to_hz)) / 2 : \
135 : (__round_up) ? ((__from_hz) / (__to_hz)) - 1 : \
136 : 0)
137 :
138 : /*
139 : * All users of this macro MUST ensure its output is never used when a/b
140 : * is zero because it incorrectly but by design never returns zero.
141 : *
142 : * Some compiler versions emit a divide-by-zero warning for this code:
143 : * "false ? 42/0 : 43". Dealing with (generated) dead code is hard:
144 : * https://github.com/zephyrproject-rtos/zephyr/issues/63564
145 : * https://blog.llvm.org/2011/05/what-every-c-programmer-should-know_21.html
146 : *
147 : * To silence such divide-by-zero warnings, "cheat" and never return
148 : * zero. Return 1 instead. Use octal "01u" as a breadcrumb to ease a
149 : * little bit the huge pain of "reverse-engineering" pre-processor
150 : * output.
151 : *
152 : * The "Elvis" operator "a/b ?: 1" is tempting because it avoids
153 : * evaluating the same expression twice. However: 1. it's a non-standard
154 : * GNU extension; 2. everything in this file is designed to be computed
155 : * at compile time anyway.
156 : */
157 : #define z_tmcvt_divisor(a, b) ((a)/(b) ? (a)/(b) : 01u)
158 :
159 : /*
160 : * Compute the offset needed to round the result correctly when
161 : * the conversion requires a full mul/div
162 : */
163 : #define z_tmcvt_off_gen(__from_hz, __to_hz, __round_up, __round_off) \
164 : ((__round_off) ? (__from_hz) / 2 : \
165 : (__round_up) ? (__from_hz) - 1 : \
166 : 0)
167 :
168 : /* Integer division 32-bit conversion */
169 : #define z_tmcvt_int_div_32(__t, __from_hz, __to_hz, __round_up, __round_off) \
170 : ((uint64_t) (__t) <= 0xffffffffU - \
171 : z_tmcvt_off_div(__from_hz, __to_hz, __round_up, __round_off) ? \
172 : ((uint32_t)((__t) + \
173 : z_tmcvt_off_div(__from_hz, __to_hz, \
174 : __round_up, __round_off)) / \
175 : z_tmcvt_divisor(__from_hz, __to_hz)) \
176 : : \
177 : (uint32_t) (((uint64_t) (__t) + \
178 : z_tmcvt_off_div(__from_hz, __to_hz, \
179 : __round_up, __round_off)) / \
180 : z_tmcvt_divisor(__from_hz, __to_hz)) \
181 : )
182 :
183 : /* Integer multiplication 32-bit conversion */
184 : #define z_tmcvt_int_mul_32(__t, __from_hz, __to_hz) \
185 : (uint32_t) (__t)*((__to_hz) / (__from_hz))
186 :
187 : /* General 32-bit conversion */
188 : #define z_tmcvt_gen_32(__t, __from_hz, __to_hz, __round_up, __round_off) \
189 : ((uint32_t) (((uint64_t) (__t)*(__to_hz) + \
190 : z_tmcvt_off_gen(__from_hz, __to_hz, __round_up, __round_off)) / (__from_hz)))
191 :
192 : /* Integer division 64-bit conversion */
193 : #define z_tmcvt_int_div_64(__t, __from_hz, __to_hz, __round_up, __round_off) \
194 : (((uint64_t) (__t) + z_tmcvt_off_div(__from_hz, __to_hz, \
195 : __round_up, __round_off)) / \
196 : z_tmcvt_divisor(__from_hz, __to_hz))
197 :
198 : /* Integer multiplication 64-bit conversion */
199 : #define z_tmcvt_int_mul_64(__t, __from_hz, __to_hz) \
200 : (uint64_t) (__t)*((__to_hz) / (__from_hz))
201 :
202 : /* Fast 64-bit conversion. This relies on the multiply not overflowing */
203 : #define z_tmcvt_gen_64_fast(__t, __from_hz, __to_hz, __round_up, __round_off) \
204 : (((uint64_t) (__t)*(__to_hz) + \
205 : z_tmcvt_off_gen(__from_hz, __to_hz, __round_up, __round_off)) / (__from_hz))
206 :
207 : /* Slow 64-bit conversion. This avoids overflowing the multiply */
208 : #define z_tmcvt_gen_64_slow(__t, __from_hz, __to_hz, __round_up, __round_off) \
209 : (((uint64_t) (__t) / (__from_hz))*(__to_hz) + \
210 : (((uint64_t) (__t) % (__from_hz))*(__to_hz) + \
211 : z_tmcvt_off_gen(__from_hz, __to_hz, __round_up, __round_off)) / (__from_hz))
212 :
213 : /* General 64-bit conversion. Uses one of the two above macros */
214 : #define z_tmcvt_gen_64(__t, __from_hz, __to_hz, __round_up, __round_off) \
215 : (z_tmcvt_use_fast_algo(__from_hz, __to_hz) ? \
216 : z_tmcvt_gen_64_fast(__t, __from_hz, __to_hz, __round_up, __round_off) : \
217 : z_tmcvt_gen_64_slow(__t, __from_hz, __to_hz, __round_up, __round_off))
218 :
219 : /* Convert, generating a 32-bit result */
220 : #define z_tmcvt_32(__t, __from_hz, __to_hz, __const_hz, __round_up, __round_off) \
221 : ((__const_hz) ? \
222 : ( \
223 : z_tmcvt_is_identity(__from_hz, __to_hz) ? \
224 : (uint32_t) (__t) \
225 : : \
226 : z_tmcvt_is_int_div(__from_hz, __to_hz) ? \
227 : z_tmcvt_int_div_32(__t, __from_hz, __to_hz, __round_up, __round_off) \
228 : : \
229 : z_tmcvt_is_int_mul(__from_hz, __to_hz) ? \
230 : z_tmcvt_int_mul_32(__t, __from_hz, __to_hz) \
231 : : \
232 : z_tmcvt_gen_32(__t, __from_hz, __to_hz, __round_up, __round_off) \
233 : ) \
234 : : \
235 : z_tmcvt_gen_32(__t, __from_hz, __to_hz, __round_up, __round_off) \
236 : )
237 :
238 : /* Convert, generating a 64-bit result */
239 : #define z_tmcvt_64(__t, __from_hz, __to_hz, __const_hz, __round_up, __round_off) \
240 : ((__const_hz) ? \
241 : ( \
242 : z_tmcvt_is_identity(__from_hz, __to_hz) ? \
243 : (uint64_t) (__t) \
244 : : \
245 : z_tmcvt_is_int_div(__from_hz, __to_hz) ? \
246 : z_tmcvt_int_div_64(__t, __from_hz, __to_hz, __round_up, __round_off) \
247 : : \
248 : z_tmcvt_is_int_mul(__from_hz, __to_hz) ? \
249 : z_tmcvt_int_mul_64(__t, __from_hz, __to_hz) \
250 : : \
251 : z_tmcvt_gen_64(__t, __from_hz, __to_hz, __round_up, __round_off) \
252 : ) \
253 : : \
254 : z_tmcvt_gen_64_slow(__t, __from_hz, __to_hz, __round_up, __round_off) \
255 : )
256 :
257 : #define z_tmcvt(__t, __from_hz, __to_hz, __const_hz, __result32, __round_up, __round_off) \
258 : ((__result32) ? \
259 : z_tmcvt_32(__t, __from_hz, __to_hz, __const_hz, __round_up, __round_off) : \
260 : z_tmcvt_64(__t, __from_hz, __to_hz, __const_hz, __round_up, __round_off))
261 :
262 : /* The following code is programmatically generated using this perl
263 : * code, which enumerates all possible combinations of units, rounding
264 : * modes and precision. Do not edit directly.
265 : *
266 : * Note that nano/microsecond conversions are only defined with 64 bit
267 : * precision. These units conversions were not available in 32 bit
268 : * variants historically, and doing 32 bit math with units that small
269 : * has precision traps that we probably don't want to support in an
270 : * official API.
271 : *
272 : * #!/usr/bin/perl -w
273 : * use strict;
274 : *
275 : * my %human = ("sec" => "seconds",
276 : * "ms" => "milliseconds",
277 : * "us" => "microseconds",
278 : * "ns" => "nanoseconds",
279 : * "cyc" => "hardware cycles",
280 : * "ticks" => "ticks");
281 : * my %human_round = ("ceil" => "Rounds up",
282 : * "near" => "Round nearest",
283 : * "floor" => "Truncates");
284 : *
285 : * sub big { return $_[0] eq "us" || $_[0] eq "ns"; }
286 : * sub prefix { return $_[0] eq "sec" || $_[0] eq "ms" || $_[0] eq "us" || $_[0] eq "ns"; }
287 : *
288 : * for my $from_unit ("sec", "ms", "us", "ns", "cyc", "ticks") {
289 : * for my $to_unit ("sec", "ms", "us", "ns", "cyc", "ticks") {
290 : * next if $from_unit eq $to_unit;
291 : * next if prefix($from_unit) && prefix($to_unit);
292 : * for my $round ("floor", "near", "ceil") {
293 : * for(my $big=0; $big <= 1; $big++) {
294 : * my $sz = $big ? 64 : 32;
295 : * my $sym = "k_${from_unit}_to_${to_unit}_$round$sz";
296 : * my $type = "uint${sz}_t";
297 : * my $const_hz = ($from_unit eq "cyc" || $to_unit eq "cyc")
298 : * ? "Z_CCYC" : "true";
299 : * my $ret32 = $big ? "64" : "32";
300 : * my $rup = $round eq "ceil" ? "true" : "false";
301 : * my $roff = $round eq "near" ? "true" : "false";
302 : *
303 : * my $hfrom = $human{$from_unit};
304 : * my $hto = $human{$to_unit};
305 : * my $hround = $human_round{$round};
306 : * print "/", "** \@brief Convert $hfrom to $hto. $ret32 bits. $hround.\n";
307 : * print " *\n";
308 : * print " * Converts time values in $hfrom to $hto.\n";
309 : * print " * Computes result in $sz bit precision.\n";
310 : * if ($round eq "ceil") {
311 : * print " * Rounds up to the next highest output unit.\n";
312 : * } elsif ($round eq "near") {
313 : * print " * Rounds to the nearest output unit.\n";
314 : * } else {
315 : * print " * Truncates to the next lowest output unit.\n";
316 : * }
317 : * print " *\n";
318 : * print " * \@warning Generated. Do not edit. See above.\n";
319 : * print " *\n";
320 : * print " * \@param t Source time in $hfrom. uint64_t\n";
321 : * print " *\n";
322 : * print " * \@return The converted time value in $hto. $type\n";
323 : * print " *", "/\n";
324 : * print "#define $sym(t) \\\n";
325 : * print "\tz_tmcvt_$ret32(t, Z_HZ_$from_unit, Z_HZ_$to_unit,";
326 : * print " $const_hz, $rup, $roff)\n";
327 : * print "\n\n";
328 : * }
329 : * }
330 : * }
331 : * }
332 : */
333 :
334 : /* Some more concise declarations to simplify the generator script and
335 : * save bytes below
336 : */
337 : #define Z_HZ_sec 1
338 : #define Z_HZ_ms 1000
339 : #define Z_HZ_us 1000000
340 : #define Z_HZ_ns 1000000000
341 : #define Z_HZ_cyc sys_clock_hw_cycles_per_sec()
342 : #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
343 : #define Z_CCYC (!IS_ENABLED(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME))
344 :
345 : /** @brief Convert seconds to hardware cycles. 32 bits. Truncates.
346 : *
347 : * Converts time values in seconds to hardware cycles.
348 : * Computes result in 32 bit precision.
349 : * Truncates to the next lowest output unit.
350 : *
351 : * @warning Generated. Do not edit. See above.
352 : *
353 : * @param t Source time in seconds. uint64_t
354 : *
355 : * @return The converted time value in hardware cycles. uint32_t
356 : */
357 1 : #define k_sec_to_cyc_floor32(t) \
358 : z_tmcvt_32(t, Z_HZ_sec, Z_HZ_cyc, Z_CCYC, false, false)
359 :
360 :
361 : /** @brief Convert seconds to hardware cycles. 64 bits. Truncates.
362 : *
363 : * Converts time values in seconds to hardware cycles.
364 : * Computes result in 64 bit precision.
365 : * Truncates to the next lowest output unit.
366 : *
367 : * @warning Generated. Do not edit. See above.
368 : *
369 : * @param t Source time in seconds. uint64_t
370 : *
371 : * @return The converted time value in hardware cycles. uint64_t
372 : */
373 1 : #define k_sec_to_cyc_floor64(t) \
374 : z_tmcvt_64(t, Z_HZ_sec, Z_HZ_cyc, Z_CCYC, false, false)
375 :
376 :
377 : /** @brief Convert seconds to hardware cycles. 32 bits. Round nearest.
378 : *
379 : * Converts time values in seconds to hardware cycles.
380 : * Computes result in 32 bit precision.
381 : * Rounds to the nearest output unit.
382 : *
383 : * @warning Generated. Do not edit. See above.
384 : *
385 : * @param t Source time in seconds. uint64_t
386 : *
387 : * @return The converted time value in hardware cycles. uint32_t
388 : */
389 1 : #define k_sec_to_cyc_near32(t) \
390 : z_tmcvt_32(t, Z_HZ_sec, Z_HZ_cyc, Z_CCYC, false, true)
391 :
392 :
393 : /** @brief Convert seconds to hardware cycles. 64 bits. Round nearest.
394 : *
395 : * Converts time values in seconds to hardware cycles.
396 : * Computes result in 64 bit precision.
397 : * Rounds to the nearest output unit.
398 : *
399 : * @warning Generated. Do not edit. See above.
400 : *
401 : * @param t Source time in seconds. uint64_t
402 : *
403 : * @return The converted time value in hardware cycles. uint64_t
404 : */
405 1 : #define k_sec_to_cyc_near64(t) \
406 : z_tmcvt_64(t, Z_HZ_sec, Z_HZ_cyc, Z_CCYC, false, true)
407 :
408 :
409 : /** @brief Convert seconds to hardware cycles. 32 bits. Rounds up.
410 : *
411 : * Converts time values in seconds to hardware cycles.
412 : * Computes result in 32 bit precision.
413 : * Rounds up to the next highest output unit.
414 : *
415 : * @warning Generated. Do not edit. See above.
416 : *
417 : * @param t Source time in seconds. uint64_t
418 : *
419 : * @return The converted time value in hardware cycles. uint32_t
420 : */
421 1 : #define k_sec_to_cyc_ceil32(t) \
422 : z_tmcvt_32(t, Z_HZ_sec, Z_HZ_cyc, Z_CCYC, true, false)
423 :
424 :
425 : /** @brief Convert seconds to hardware cycles. 64 bits. Rounds up.
426 : *
427 : * Converts time values in seconds to hardware cycles.
428 : * Computes result in 64 bit precision.
429 : * Rounds up to the next highest output unit.
430 : *
431 : * @warning Generated. Do not edit. See above.
432 : *
433 : * @param t Source time in seconds. uint64_t
434 : *
435 : * @return The converted time value in hardware cycles. uint64_t
436 : */
437 1 : #define k_sec_to_cyc_ceil64(t) \
438 : z_tmcvt_64(t, Z_HZ_sec, Z_HZ_cyc, Z_CCYC, true, false)
439 :
440 :
441 : /** @brief Convert seconds to ticks. 32 bits. Truncates.
442 : *
443 : * Converts time values in seconds to ticks.
444 : * Computes result in 32 bit precision.
445 : * Truncates to the next lowest output unit.
446 : *
447 : * @warning Generated. Do not edit. See above.
448 : *
449 : * @param t Source time in seconds. uint64_t
450 : *
451 : * @return The converted time value in ticks. uint32_t
452 : */
453 1 : #define k_sec_to_ticks_floor32(t) \
454 : z_tmcvt_32(t, Z_HZ_sec, Z_HZ_ticks, true, false, false)
455 :
456 :
457 : /** @brief Convert seconds to ticks. 64 bits. Truncates.
458 : *
459 : * Converts time values in seconds to ticks.
460 : * Computes result in 64 bit precision.
461 : * Truncates to the next lowest output unit.
462 : *
463 : * @warning Generated. Do not edit. See above.
464 : *
465 : * @param t Source time in seconds. uint64_t
466 : *
467 : * @return The converted time value in ticks. uint64_t
468 : */
469 1 : #define k_sec_to_ticks_floor64(t) \
470 : z_tmcvt_64(t, Z_HZ_sec, Z_HZ_ticks, true, false, false)
471 :
472 :
473 : /** @brief Convert seconds to ticks. 32 bits. Round nearest.
474 : *
475 : * Converts time values in seconds to ticks.
476 : * Computes result in 32 bit precision.
477 : * Rounds to the nearest output unit.
478 : *
479 : * @warning Generated. Do not edit. See above.
480 : *
481 : * @param t Source time in seconds. uint64_t
482 : *
483 : * @return The converted time value in ticks. uint32_t
484 : */
485 1 : #define k_sec_to_ticks_near32(t) \
486 : z_tmcvt_32(t, Z_HZ_sec, Z_HZ_ticks, true, false, true)
487 :
488 :
489 : /** @brief Convert seconds to ticks. 64 bits. Round nearest.
490 : *
491 : * Converts time values in seconds to ticks.
492 : * Computes result in 64 bit precision.
493 : * Rounds to the nearest output unit.
494 : *
495 : * @warning Generated. Do not edit. See above.
496 : *
497 : * @param t Source time in seconds. uint64_t
498 : *
499 : * @return The converted time value in ticks. uint64_t
500 : */
501 1 : #define k_sec_to_ticks_near64(t) \
502 : z_tmcvt_64(t, Z_HZ_sec, Z_HZ_ticks, true, false, true)
503 :
504 :
505 : /** @brief Convert seconds to ticks. 32 bits. Rounds up.
506 : *
507 : * Converts time values in seconds to ticks.
508 : * Computes result in 32 bit precision.
509 : * Rounds up to the next highest output unit.
510 : *
511 : * @warning Generated. Do not edit. See above.
512 : *
513 : * @param t Source time in seconds. uint64_t
514 : *
515 : * @return The converted time value in ticks. uint32_t
516 : */
517 1 : #define k_sec_to_ticks_ceil32(t) \
518 : z_tmcvt_32(t, Z_HZ_sec, Z_HZ_ticks, true, true, false)
519 :
520 :
521 : /** @brief Convert seconds to ticks. 64 bits. Rounds up.
522 : *
523 : * Converts time values in seconds to ticks.
524 : * Computes result in 64 bit precision.
525 : * Rounds up to the next highest output unit.
526 : *
527 : * @warning Generated. Do not edit. See above.
528 : *
529 : * @param t Source time in seconds. uint64_t
530 : *
531 : * @return The converted time value in ticks. uint64_t
532 : */
533 1 : #define k_sec_to_ticks_ceil64(t) \
534 : z_tmcvt_64(t, Z_HZ_sec, Z_HZ_ticks, true, true, false)
535 :
536 :
537 : /** @brief Convert milliseconds to hardware cycles. 32 bits. Truncates.
538 : *
539 : * Converts time values in milliseconds to hardware cycles.
540 : * Computes result in 32 bit precision.
541 : * Truncates to the next lowest output unit.
542 : *
543 : * @warning Generated. Do not edit. See above.
544 : *
545 : * @param t Source time in milliseconds. uint64_t
546 : *
547 : * @return The converted time value in hardware cycles. uint32_t
548 : */
549 1 : #define k_ms_to_cyc_floor32(t) \
550 : z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, false)
551 :
552 :
553 : /** @brief Convert milliseconds to hardware cycles. 64 bits. Truncates.
554 : *
555 : * Converts time values in milliseconds to hardware cycles.
556 : * Computes result in 64 bit precision.
557 : * Truncates to the next lowest output unit.
558 : *
559 : * @warning Generated. Do not edit. See above.
560 : *
561 : * @param t Source time in milliseconds. uint64_t
562 : *
563 : * @return The converted time value in hardware cycles. uint64_t
564 : */
565 1 : #define k_ms_to_cyc_floor64(t) \
566 : z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, false)
567 :
568 :
569 : /** @brief Convert milliseconds to hardware cycles. 32 bits. Round nearest.
570 : *
571 : * Converts time values in milliseconds to hardware cycles.
572 : * Computes result in 32 bit precision.
573 : * Rounds to the nearest output unit.
574 : *
575 : * @warning Generated. Do not edit. See above.
576 : *
577 : * @param t Source time in milliseconds. uint64_t
578 : *
579 : * @return The converted time value in hardware cycles. uint32_t
580 : */
581 1 : #define k_ms_to_cyc_near32(t) \
582 : z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, true)
583 :
584 :
585 : /** @brief Convert milliseconds to hardware cycles. 64 bits. Round nearest.
586 : *
587 : * Converts time values in milliseconds to hardware cycles.
588 : * Computes result in 64 bit precision.
589 : * Rounds to the nearest output unit.
590 : *
591 : * @warning Generated. Do not edit. See above.
592 : *
593 : * @param t Source time in milliseconds. uint64_t
594 : *
595 : * @return The converted time value in hardware cycles. uint64_t
596 : */
597 1 : #define k_ms_to_cyc_near64(t) \
598 : z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, true)
599 :
600 :
601 : /** @brief Convert milliseconds to hardware cycles. 32 bits. Rounds up.
602 : *
603 : * Converts time values in milliseconds to hardware cycles.
604 : * Computes result in 32 bit precision.
605 : * Rounds up to the next highest output unit.
606 : *
607 : * @warning Generated. Do not edit. See above.
608 : *
609 : * @param t Source time in milliseconds. uint64_t
610 : *
611 : * @return The converted time value in hardware cycles. uint32_t
612 : */
613 1 : #define k_ms_to_cyc_ceil32(t) \
614 : z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, true, false)
615 :
616 :
617 : /** @brief Convert milliseconds to hardware cycles. 64 bits. Rounds up.
618 : *
619 : * Converts time values in milliseconds to hardware cycles.
620 : * Computes result in 64 bit precision.
621 : * Rounds up to the next highest output unit.
622 : *
623 : * @warning Generated. Do not edit. See above.
624 : *
625 : * @param t Source time in milliseconds. uint64_t
626 : *
627 : * @return The converted time value in hardware cycles. uint64_t
628 : */
629 1 : #define k_ms_to_cyc_ceil64(t) \
630 : z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, true, false)
631 :
632 :
633 : /** @brief Convert milliseconds to ticks. 32 bits. Truncates.
634 : *
635 : * Converts time values in milliseconds to ticks.
636 : * Computes result in 32 bit precision.
637 : * Truncates to the next lowest output unit.
638 : *
639 : * @warning Generated. Do not edit. See above.
640 : *
641 : * @param t Source time in milliseconds. uint64_t
642 : *
643 : * @return The converted time value in ticks. uint32_t
644 : */
645 1 : #define k_ms_to_ticks_floor32(t) \
646 : z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, false, false)
647 :
648 :
649 : /** @brief Convert milliseconds to ticks. 64 bits. Truncates.
650 : *
651 : * Converts time values in milliseconds to ticks.
652 : * Computes result in 64 bit precision.
653 : * Truncates to the next lowest output unit.
654 : *
655 : * @warning Generated. Do not edit. See above.
656 : *
657 : * @param t Source time in milliseconds. uint64_t
658 : *
659 : * @return The converted time value in ticks. uint64_t
660 : */
661 1 : #define k_ms_to_ticks_floor64(t) \
662 : z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, false, false)
663 :
664 :
665 : /** @brief Convert milliseconds to ticks. 32 bits. Round nearest.
666 : *
667 : * Converts time values in milliseconds to ticks.
668 : * Computes result in 32 bit precision.
669 : * Rounds to the nearest output unit.
670 : *
671 : * @warning Generated. Do not edit. See above.
672 : *
673 : * @param t Source time in milliseconds. uint64_t
674 : *
675 : * @return The converted time value in ticks. uint32_t
676 : */
677 1 : #define k_ms_to_ticks_near32(t) \
678 : z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, false, true)
679 :
680 :
681 : /** @brief Convert milliseconds to ticks. 64 bits. Round nearest.
682 : *
683 : * Converts time values in milliseconds to ticks.
684 : * Computes result in 64 bit precision.
685 : * Rounds to the nearest output unit.
686 : *
687 : * @warning Generated. Do not edit. See above.
688 : *
689 : * @param t Source time in milliseconds. uint64_t
690 : *
691 : * @return The converted time value in ticks. uint64_t
692 : */
693 1 : #define k_ms_to_ticks_near64(t) \
694 : z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, false, true)
695 :
696 :
697 : /** @brief Convert milliseconds to ticks. 32 bits. Rounds up.
698 : *
699 : * Converts time values in milliseconds to ticks.
700 : * Computes result in 32 bit precision.
701 : * Rounds up to the next highest output unit.
702 : *
703 : * @warning Generated. Do not edit. See above.
704 : *
705 : * @param t Source time in milliseconds. uint64_t
706 : *
707 : * @return The converted time value in ticks. uint32_t
708 : */
709 1 : #define k_ms_to_ticks_ceil32(t) \
710 : z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, true, false)
711 :
712 :
713 : /** @brief Convert milliseconds to ticks. 64 bits. Rounds up.
714 : *
715 : * Converts time values in milliseconds to ticks.
716 : * Computes result in 64 bit precision.
717 : * Rounds up to the next highest output unit.
718 : *
719 : * @warning Generated. Do not edit. See above.
720 : *
721 : * @param t Source time in milliseconds. uint64_t
722 : *
723 : * @return The converted time value in ticks. uint64_t
724 : */
725 1 : #define k_ms_to_ticks_ceil64(t) \
726 : z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, true, false)
727 :
728 :
729 : /** @brief Convert microseconds to hardware cycles. 32 bits. Truncates.
730 : *
731 : * Converts time values in microseconds to hardware cycles.
732 : * Computes result in 32 bit precision.
733 : * Truncates to the next lowest output unit.
734 : *
735 : * @warning Generated. Do not edit. See above.
736 : *
737 : * @param t Source time in microseconds. uint64_t
738 : *
739 : * @return The converted time value in hardware cycles. uint32_t
740 : */
741 1 : #define k_us_to_cyc_floor32(t) \
742 : z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, false)
743 :
744 :
745 : /** @brief Convert microseconds to hardware cycles. 64 bits. Truncates.
746 : *
747 : * Converts time values in microseconds to hardware cycles.
748 : * Computes result in 64 bit precision.
749 : * Truncates to the next lowest output unit.
750 : *
751 : * @warning Generated. Do not edit. See above.
752 : *
753 : * @param t Source time in microseconds. uint64_t
754 : *
755 : * @return The converted time value in hardware cycles. uint64_t
756 : */
757 1 : #define k_us_to_cyc_floor64(t) \
758 : z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, false)
759 :
760 :
761 : /** @brief Convert microseconds to hardware cycles. 32 bits. Round nearest.
762 : *
763 : * Converts time values in microseconds to hardware cycles.
764 : * Computes result in 32 bit precision.
765 : * Rounds to the nearest output unit.
766 : *
767 : * @warning Generated. Do not edit. See above.
768 : *
769 : * @param t Source time in microseconds. uint64_t
770 : *
771 : * @return The converted time value in hardware cycles. uint32_t
772 : */
773 1 : #define k_us_to_cyc_near32(t) \
774 : z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, true)
775 :
776 :
777 : /** @brief Convert microseconds to hardware cycles. 64 bits. Round nearest.
778 : *
779 : * Converts time values in microseconds to hardware cycles.
780 : * Computes result in 64 bit precision.
781 : * Rounds to the nearest output unit.
782 : *
783 : * @warning Generated. Do not edit. See above.
784 : *
785 : * @param t Source time in microseconds. uint64_t
786 : *
787 : * @return The converted time value in hardware cycles. uint64_t
788 : */
789 1 : #define k_us_to_cyc_near64(t) \
790 : z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, true)
791 :
792 :
793 : /** @brief Convert microseconds to hardware cycles. 32 bits. Rounds up.
794 : *
795 : * Converts time values in microseconds to hardware cycles.
796 : * Computes result in 32 bit precision.
797 : * Rounds up to the next highest output unit.
798 : *
799 : * @warning Generated. Do not edit. See above.
800 : *
801 : * @param t Source time in microseconds. uint64_t
802 : *
803 : * @return The converted time value in hardware cycles. uint32_t
804 : */
805 1 : #define k_us_to_cyc_ceil32(t) \
806 : z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, true, false)
807 :
808 :
809 : /** @brief Convert microseconds to hardware cycles. 64 bits. Rounds up.
810 : *
811 : * Converts time values in microseconds to hardware cycles.
812 : * Computes result in 64 bit precision.
813 : * Rounds up to the next highest output unit.
814 : *
815 : * @warning Generated. Do not edit. See above.
816 : *
817 : * @param t Source time in microseconds. uint64_t
818 : *
819 : * @return The converted time value in hardware cycles. uint64_t
820 : */
821 1 : #define k_us_to_cyc_ceil64(t) \
822 : z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, true, false)
823 :
824 :
825 : /** @brief Convert microseconds to ticks. 32 bits. Truncates.
826 : *
827 : * Converts time values in microseconds to ticks.
828 : * Computes result in 32 bit precision.
829 : * Truncates to the next lowest output unit.
830 : *
831 : * @warning Generated. Do not edit. See above.
832 : *
833 : * @param t Source time in microseconds. uint64_t
834 : *
835 : * @return The converted time value in ticks. uint32_t
836 : */
837 1 : #define k_us_to_ticks_floor32(t) \
838 : z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, false, false)
839 :
840 :
841 : /** @brief Convert microseconds to ticks. 64 bits. Truncates.
842 : *
843 : * Converts time values in microseconds to ticks.
844 : * Computes result in 64 bit precision.
845 : * Truncates to the next lowest output unit.
846 : *
847 : * @warning Generated. Do not edit. See above.
848 : *
849 : * @param t Source time in microseconds. uint64_t
850 : *
851 : * @return The converted time value in ticks. uint64_t
852 : */
853 1 : #define k_us_to_ticks_floor64(t) \
854 : z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, false, false)
855 :
856 :
857 : /** @brief Convert microseconds to ticks. 32 bits. Round nearest.
858 : *
859 : * Converts time values in microseconds to ticks.
860 : * Computes result in 32 bit precision.
861 : * Rounds to the nearest output unit.
862 : *
863 : * @warning Generated. Do not edit. See above.
864 : *
865 : * @param t Source time in microseconds. uint64_t
866 : *
867 : * @return The converted time value in ticks. uint32_t
868 : */
869 1 : #define k_us_to_ticks_near32(t) \
870 : z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, false, true)
871 :
872 :
873 : /** @brief Convert microseconds to ticks. 64 bits. Round nearest.
874 : *
875 : * Converts time values in microseconds to ticks.
876 : * Computes result in 64 bit precision.
877 : * Rounds to the nearest output unit.
878 : *
879 : * @warning Generated. Do not edit. See above.
880 : *
881 : * @param t Source time in microseconds. uint64_t
882 : *
883 : * @return The converted time value in ticks. uint64_t
884 : */
885 1 : #define k_us_to_ticks_near64(t) \
886 : z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, false, true)
887 :
888 :
889 : /** @brief Convert microseconds to ticks. 32 bits. Rounds up.
890 : *
891 : * Converts time values in microseconds to ticks.
892 : * Computes result in 32 bit precision.
893 : * Rounds up to the next highest output unit.
894 : *
895 : * @warning Generated. Do not edit. See above.
896 : *
897 : * @param t Source time in microseconds. uint64_t
898 : *
899 : * @return The converted time value in ticks. uint32_t
900 : */
901 1 : #define k_us_to_ticks_ceil32(t) \
902 : z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, true, false)
903 :
904 :
905 : /** @brief Convert microseconds to ticks. 64 bits. Rounds up.
906 : *
907 : * Converts time values in microseconds to ticks.
908 : * Computes result in 64 bit precision.
909 : * Rounds up to the next highest output unit.
910 : *
911 : * @warning Generated. Do not edit. See above.
912 : *
913 : * @param t Source time in microseconds. uint64_t
914 : *
915 : * @return The converted time value in ticks. uint64_t
916 : */
917 1 : #define k_us_to_ticks_ceil64(t) \
918 : z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, true, false)
919 :
920 :
921 : /** @brief Convert nanoseconds to hardware cycles. 32 bits. Truncates.
922 : *
923 : * Converts time values in nanoseconds to hardware cycles.
924 : * Computes result in 32 bit precision.
925 : * Truncates to the next lowest output unit.
926 : *
927 : * @warning Generated. Do not edit. See above.
928 : *
929 : * @param t Source time in nanoseconds. uint64_t
930 : *
931 : * @return The converted time value in hardware cycles. uint32_t
932 : */
933 1 : #define k_ns_to_cyc_floor32(t) \
934 : z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, false)
935 :
936 :
937 : /** @brief Convert nanoseconds to hardware cycles. 64 bits. Truncates.
938 : *
939 : * Converts time values in nanoseconds to hardware cycles.
940 : * Computes result in 64 bit precision.
941 : * Truncates to the next lowest output unit.
942 : *
943 : * @warning Generated. Do not edit. See above.
944 : *
945 : * @param t Source time in nanoseconds. uint64_t
946 : *
947 : * @return The converted time value in hardware cycles. uint64_t
948 : */
949 1 : #define k_ns_to_cyc_floor64(t) \
950 : z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, false)
951 :
952 :
953 : /** @brief Convert nanoseconds to hardware cycles. 32 bits. Round nearest.
954 : *
955 : * Converts time values in nanoseconds to hardware cycles.
956 : * Computes result in 32 bit precision.
957 : * Rounds to the nearest output unit.
958 : *
959 : * @warning Generated. Do not edit. See above.
960 : *
961 : * @param t Source time in nanoseconds. uint64_t
962 : *
963 : * @return The converted time value in hardware cycles. uint32_t
964 : */
965 1 : #define k_ns_to_cyc_near32(t) \
966 : z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, true)
967 :
968 :
969 : /** @brief Convert nanoseconds to hardware cycles. 64 bits. Round nearest.
970 : *
971 : * Converts time values in nanoseconds to hardware cycles.
972 : * Computes result in 64 bit precision.
973 : * Rounds to the nearest output unit.
974 : *
975 : * @warning Generated. Do not edit. See above.
976 : *
977 : * @param t Source time in nanoseconds. uint64_t
978 : *
979 : * @return The converted time value in hardware cycles. uint64_t
980 : */
981 1 : #define k_ns_to_cyc_near64(t) \
982 : z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, true)
983 :
984 :
985 : /** @brief Convert nanoseconds to hardware cycles. 32 bits. Rounds up.
986 : *
987 : * Converts time values in nanoseconds to hardware cycles.
988 : * Computes result in 32 bit precision.
989 : * Rounds up to the next highest output unit.
990 : *
991 : * @warning Generated. Do not edit. See above.
992 : *
993 : * @param t Source time in nanoseconds. uint64_t
994 : *
995 : * @return The converted time value in hardware cycles. uint32_t
996 : */
997 1 : #define k_ns_to_cyc_ceil32(t) \
998 : z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, true, false)
999 :
1000 :
1001 : /** @brief Convert nanoseconds to hardware cycles. 64 bits. Rounds up.
1002 : *
1003 : * Converts time values in nanoseconds to hardware cycles.
1004 : * Computes result in 64 bit precision.
1005 : * Rounds up to the next highest output unit.
1006 : *
1007 : * @warning Generated. Do not edit. See above.
1008 : *
1009 : * @param t Source time in nanoseconds. uint64_t
1010 : *
1011 : * @return The converted time value in hardware cycles. uint64_t
1012 : */
1013 1 : #define k_ns_to_cyc_ceil64(t) \
1014 : z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, true, false)
1015 :
1016 :
1017 : /** @brief Convert nanoseconds to ticks. 32 bits. Truncates.
1018 : *
1019 : * Converts time values in nanoseconds to ticks.
1020 : * Computes result in 32 bit precision.
1021 : * Truncates to the next lowest output unit.
1022 : *
1023 : * @warning Generated. Do not edit. See above.
1024 : *
1025 : * @param t Source time in nanoseconds. uint64_t
1026 : *
1027 : * @return The converted time value in ticks. uint32_t
1028 : */
1029 1 : #define k_ns_to_ticks_floor32(t) \
1030 : z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, false, false)
1031 :
1032 :
1033 : /** @brief Convert nanoseconds to ticks. 64 bits. Truncates.
1034 : *
1035 : * Converts time values in nanoseconds to ticks.
1036 : * Computes result in 64 bit precision.
1037 : * Truncates to the next lowest output unit.
1038 : *
1039 : * @warning Generated. Do not edit. See above.
1040 : *
1041 : * @param t Source time in nanoseconds. uint64_t
1042 : *
1043 : * @return The converted time value in ticks. uint64_t
1044 : */
1045 1 : #define k_ns_to_ticks_floor64(t) \
1046 : z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, false, false)
1047 :
1048 :
1049 : /** @brief Convert nanoseconds to ticks. 32 bits. Round nearest.
1050 : *
1051 : * Converts time values in nanoseconds to ticks.
1052 : * Computes result in 32 bit precision.
1053 : * Rounds to the nearest output unit.
1054 : *
1055 : * @warning Generated. Do not edit. See above.
1056 : *
1057 : * @param t Source time in nanoseconds. uint64_t
1058 : *
1059 : * @return The converted time value in ticks. uint32_t
1060 : */
1061 1 : #define k_ns_to_ticks_near32(t) \
1062 : z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, false, true)
1063 :
1064 :
1065 : /** @brief Convert nanoseconds to ticks. 64 bits. Round nearest.
1066 : *
1067 : * Converts time values in nanoseconds to ticks.
1068 : * Computes result in 64 bit precision.
1069 : * Rounds to the nearest output unit.
1070 : *
1071 : * @warning Generated. Do not edit. See above.
1072 : *
1073 : * @param t Source time in nanoseconds. uint64_t
1074 : *
1075 : * @return The converted time value in ticks. uint64_t
1076 : */
1077 1 : #define k_ns_to_ticks_near64(t) \
1078 : z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, false, true)
1079 :
1080 :
1081 : /** @brief Convert nanoseconds to ticks. 32 bits. Rounds up.
1082 : *
1083 : * Converts time values in nanoseconds to ticks.
1084 : * Computes result in 32 bit precision.
1085 : * Rounds up to the next highest output unit.
1086 : *
1087 : * @warning Generated. Do not edit. See above.
1088 : *
1089 : * @param t Source time in nanoseconds. uint64_t
1090 : *
1091 : * @return The converted time value in ticks. uint32_t
1092 : */
1093 1 : #define k_ns_to_ticks_ceil32(t) \
1094 : z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, true, false)
1095 :
1096 :
1097 : /** @brief Convert nanoseconds to ticks. 64 bits. Rounds up.
1098 : *
1099 : * Converts time values in nanoseconds to ticks.
1100 : * Computes result in 64 bit precision.
1101 : * Rounds up to the next highest output unit.
1102 : *
1103 : * @warning Generated. Do not edit. See above.
1104 : *
1105 : * @param t Source time in nanoseconds. uint64_t
1106 : *
1107 : * @return The converted time value in ticks. uint64_t
1108 : */
1109 1 : #define k_ns_to_ticks_ceil64(t) \
1110 : z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, true, false)
1111 :
1112 :
1113 : /** @brief Convert hardware cycles to seconds. 32 bits. Truncates.
1114 : *
1115 : * Converts time values in hardware cycles to seconds.
1116 : * Computes result in 32 bit precision.
1117 : * Truncates to the next lowest output unit.
1118 : *
1119 : * @warning Generated. Do not edit. See above.
1120 : *
1121 : * @param t Source time in hardware cycles. uint64_t
1122 : *
1123 : * @return The converted time value in seconds. uint32_t
1124 : */
1125 1 : #define k_cyc_to_sec_floor32(t) \
1126 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_sec, Z_CCYC, false, false)
1127 :
1128 :
1129 : /** @brief Convert hardware cycles to seconds. 64 bits. Truncates.
1130 : *
1131 : * Converts time values in hardware cycles to seconds.
1132 : * Computes result in 64 bit precision.
1133 : * Truncates to the next lowest output unit.
1134 : *
1135 : * @warning Generated. Do not edit. See above.
1136 : *
1137 : * @param t Source time in hardware cycles. uint64_t
1138 : *
1139 : * @return The converted time value in seconds. uint64_t
1140 : */
1141 1 : #define k_cyc_to_sec_floor64(t) \
1142 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_sec, Z_CCYC, false, false)
1143 :
1144 :
1145 : /** @brief Convert hardware cycles to seconds. 32 bits. Round nearest.
1146 : *
1147 : * Converts time values in hardware cycles to seconds.
1148 : * Computes result in 32 bit precision.
1149 : * Rounds to the nearest output unit.
1150 : *
1151 : * @warning Generated. Do not edit. See above.
1152 : *
1153 : * @param t Source time in hardware cycles. uint64_t
1154 : *
1155 : * @return The converted time value in seconds. uint32_t
1156 : */
1157 1 : #define k_cyc_to_sec_near32(t) \
1158 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_sec, Z_CCYC, false, true)
1159 :
1160 :
1161 : /** @brief Convert hardware cycles to seconds. 64 bits. Round nearest.
1162 : *
1163 : * Converts time values in hardware cycles to seconds.
1164 : * Computes result in 64 bit precision.
1165 : * Rounds to the nearest output unit.
1166 : *
1167 : * @warning Generated. Do not edit. See above.
1168 : *
1169 : * @param t Source time in hardware cycles. uint64_t
1170 : *
1171 : * @return The converted time value in seconds. uint64_t
1172 : */
1173 1 : #define k_cyc_to_sec_near64(t) \
1174 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_sec, Z_CCYC, false, true)
1175 :
1176 :
1177 : /** @brief Convert hardware cycles to seconds. 32 bits. Rounds up.
1178 : *
1179 : * Converts time values in hardware cycles to seconds.
1180 : * Computes result in 32 bit precision.
1181 : * Rounds up to the next highest output unit.
1182 : *
1183 : * @warning Generated. Do not edit. See above.
1184 : *
1185 : * @param t Source time in hardware cycles. uint64_t
1186 : *
1187 : * @return The converted time value in seconds. uint32_t
1188 : */
1189 1 : #define k_cyc_to_sec_ceil32(t) \
1190 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_sec, Z_CCYC, true, false)
1191 :
1192 :
1193 : /** @brief Convert hardware cycles to seconds. 64 bits. Rounds up.
1194 : *
1195 : * Converts time values in hardware cycles to seconds.
1196 : * Computes result in 64 bit precision.
1197 : * Rounds up to the next highest output unit.
1198 : *
1199 : * @warning Generated. Do not edit. See above.
1200 : *
1201 : * @param t Source time in hardware cycles. uint64_t
1202 : *
1203 : * @return The converted time value in seconds. uint64_t
1204 : */
1205 1 : #define k_cyc_to_sec_ceil64(t) \
1206 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_sec, Z_CCYC, true, false)
1207 :
1208 :
1209 : /** @brief Convert hardware cycles to milliseconds. 32 bits. Truncates.
1210 : *
1211 : * Converts time values in hardware cycles to milliseconds.
1212 : * Computes result in 32 bit precision.
1213 : * Truncates to the next lowest output unit.
1214 : *
1215 : * @warning Generated. Do not edit. See above.
1216 : *
1217 : * @param t Source time in hardware cycles. uint64_t
1218 : *
1219 : * @return The converted time value in milliseconds. uint32_t
1220 : */
1221 1 : #define k_cyc_to_ms_floor32(t) \
1222 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, false)
1223 :
1224 :
1225 : /** @brief Convert hardware cycles to milliseconds. 64 bits. Truncates.
1226 : *
1227 : * Converts time values in hardware cycles to milliseconds.
1228 : * Computes result in 64 bit precision.
1229 : * Truncates to the next lowest output unit.
1230 : *
1231 : * @warning Generated. Do not edit. See above.
1232 : *
1233 : * @param t Source time in hardware cycles. uint64_t
1234 : *
1235 : * @return The converted time value in milliseconds. uint64_t
1236 : */
1237 1 : #define k_cyc_to_ms_floor64(t) \
1238 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, false)
1239 :
1240 :
1241 : /** @brief Convert hardware cycles to milliseconds. 32 bits. Round nearest.
1242 : *
1243 : * Converts time values in hardware cycles to milliseconds.
1244 : * Computes result in 32 bit precision.
1245 : * Rounds to the nearest output unit.
1246 : *
1247 : * @warning Generated. Do not edit. See above.
1248 : *
1249 : * @param t Source time in hardware cycles. uint64_t
1250 : *
1251 : * @return The converted time value in milliseconds. uint32_t
1252 : */
1253 1 : #define k_cyc_to_ms_near32(t) \
1254 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, true)
1255 :
1256 :
1257 : /** @brief Convert hardware cycles to milliseconds. 64 bits. Round nearest.
1258 : *
1259 : * Converts time values in hardware cycles to milliseconds.
1260 : * Computes result in 64 bit precision.
1261 : * Rounds to the nearest output unit.
1262 : *
1263 : * @warning Generated. Do not edit. See above.
1264 : *
1265 : * @param t Source time in hardware cycles. uint64_t
1266 : *
1267 : * @return The converted time value in milliseconds. uint64_t
1268 : */
1269 1 : #define k_cyc_to_ms_near64(t) \
1270 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, true)
1271 :
1272 :
1273 : /** @brief Convert hardware cycles to milliseconds. 32 bits. Rounds up.
1274 : *
1275 : * Converts time values in hardware cycles to milliseconds.
1276 : * Computes result in 32 bit precision.
1277 : * Rounds up to the next highest output unit.
1278 : *
1279 : * @warning Generated. Do not edit. See above.
1280 : *
1281 : * @param t Source time in hardware cycles. uint64_t
1282 : *
1283 : * @return The converted time value in milliseconds. uint32_t
1284 : */
1285 1 : #define k_cyc_to_ms_ceil32(t) \
1286 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, true, false)
1287 :
1288 :
1289 : /** @brief Convert hardware cycles to milliseconds. 64 bits. Rounds up.
1290 : *
1291 : * Converts time values in hardware cycles to milliseconds.
1292 : * Computes result in 64 bit precision.
1293 : * Rounds up to the next highest output unit.
1294 : *
1295 : * @warning Generated. Do not edit. See above.
1296 : *
1297 : * @param t Source time in hardware cycles. uint64_t
1298 : *
1299 : * @return The converted time value in milliseconds. uint64_t
1300 : */
1301 1 : #define k_cyc_to_ms_ceil64(t) \
1302 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, true, false)
1303 :
1304 :
1305 : /** @brief Convert hardware cycles to microseconds. 32 bits. Truncates.
1306 : *
1307 : * Converts time values in hardware cycles to microseconds.
1308 : * Computes result in 32 bit precision.
1309 : * Truncates to the next lowest output unit.
1310 : *
1311 : * @warning Generated. Do not edit. See above.
1312 : *
1313 : * @param t Source time in hardware cycles. uint64_t
1314 : *
1315 : * @return The converted time value in microseconds. uint32_t
1316 : */
1317 1 : #define k_cyc_to_us_floor32(t) \
1318 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, false)
1319 :
1320 :
1321 : /** @brief Convert hardware cycles to microseconds. 64 bits. Truncates.
1322 : *
1323 : * Converts time values in hardware cycles to microseconds.
1324 : * Computes result in 64 bit precision.
1325 : * Truncates to the next lowest output unit.
1326 : *
1327 : * @warning Generated. Do not edit. See above.
1328 : *
1329 : * @param t Source time in hardware cycles. uint64_t
1330 : *
1331 : * @return The converted time value in microseconds. uint64_t
1332 : */
1333 1 : #define k_cyc_to_us_floor64(t) \
1334 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, false)
1335 :
1336 :
1337 : /** @brief Convert hardware cycles to microseconds. 32 bits. Round nearest.
1338 : *
1339 : * Converts time values in hardware cycles to microseconds.
1340 : * Computes result in 32 bit precision.
1341 : * Rounds to the nearest output unit.
1342 : *
1343 : * @warning Generated. Do not edit. See above.
1344 : *
1345 : * @param t Source time in hardware cycles. uint64_t
1346 : *
1347 : * @return The converted time value in microseconds. uint32_t
1348 : */
1349 1 : #define k_cyc_to_us_near32(t) \
1350 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, true)
1351 :
1352 :
1353 : /** @brief Convert hardware cycles to microseconds. 64 bits. Round nearest.
1354 : *
1355 : * Converts time values in hardware cycles to microseconds.
1356 : * Computes result in 64 bit precision.
1357 : * Rounds to the nearest output unit.
1358 : *
1359 : * @warning Generated. Do not edit. See above.
1360 : *
1361 : * @param t Source time in hardware cycles. uint64_t
1362 : *
1363 : * @return The converted time value in microseconds. uint64_t
1364 : */
1365 1 : #define k_cyc_to_us_near64(t) \
1366 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, true)
1367 :
1368 :
1369 : /** @brief Convert hardware cycles to microseconds. 32 bits. Rounds up.
1370 : *
1371 : * Converts time values in hardware cycles to microseconds.
1372 : * Computes result in 32 bit precision.
1373 : * Rounds up to the next highest output unit.
1374 : *
1375 : * @warning Generated. Do not edit. See above.
1376 : *
1377 : * @param t Source time in hardware cycles. uint64_t
1378 : *
1379 : * @return The converted time value in microseconds. uint32_t
1380 : */
1381 1 : #define k_cyc_to_us_ceil32(t) \
1382 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, true, false)
1383 :
1384 :
1385 : /** @brief Convert hardware cycles to microseconds. 64 bits. Rounds up.
1386 : *
1387 : * Converts time values in hardware cycles to microseconds.
1388 : * Computes result in 64 bit precision.
1389 : * Rounds up to the next highest output unit.
1390 : *
1391 : * @warning Generated. Do not edit. See above.
1392 : *
1393 : * @param t Source time in hardware cycles. uint64_t
1394 : *
1395 : * @return The converted time value in microseconds. uint64_t
1396 : */
1397 1 : #define k_cyc_to_us_ceil64(t) \
1398 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, true, false)
1399 :
1400 :
1401 : /** @brief Convert hardware cycles to nanoseconds. 32 bits. Truncates.
1402 : *
1403 : * Converts time values in hardware cycles to nanoseconds.
1404 : * Computes result in 32 bit precision.
1405 : * Truncates to the next lowest output unit.
1406 : *
1407 : * @warning Generated. Do not edit. See above.
1408 : *
1409 : * @param t Source time in hardware cycles. uint64_t
1410 : *
1411 : * @return The converted time value in nanoseconds. uint32_t
1412 : */
1413 1 : #define k_cyc_to_ns_floor32(t) \
1414 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, false)
1415 :
1416 :
1417 : /** @brief Convert hardware cycles to nanoseconds. 64 bits. Truncates.
1418 : *
1419 : * Converts time values in hardware cycles to nanoseconds.
1420 : * Computes result in 64 bit precision.
1421 : * Truncates to the next lowest output unit.
1422 : *
1423 : * @warning Generated. Do not edit. See above.
1424 : *
1425 : * @param t Source time in hardware cycles. uint64_t
1426 : *
1427 : * @return The converted time value in nanoseconds. uint64_t
1428 : */
1429 1 : #define k_cyc_to_ns_floor64(t) \
1430 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, false)
1431 :
1432 :
1433 : /** @brief Convert hardware cycles to nanoseconds. 32 bits. Round nearest.
1434 : *
1435 : * Converts time values in hardware cycles to nanoseconds.
1436 : * Computes result in 32 bit precision.
1437 : * Rounds to the nearest output unit.
1438 : *
1439 : * @warning Generated. Do not edit. See above.
1440 : *
1441 : * @param t Source time in hardware cycles. uint64_t
1442 : *
1443 : * @return The converted time value in nanoseconds. uint32_t
1444 : */
1445 1 : #define k_cyc_to_ns_near32(t) \
1446 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, true)
1447 :
1448 :
1449 : /** @brief Convert hardware cycles to nanoseconds. 64 bits. Round nearest.
1450 : *
1451 : * Converts time values in hardware cycles to nanoseconds.
1452 : * Computes result in 64 bit precision.
1453 : * Rounds to the nearest output unit.
1454 : *
1455 : * @warning Generated. Do not edit. See above.
1456 : *
1457 : * @param t Source time in hardware cycles. uint64_t
1458 : *
1459 : * @return The converted time value in nanoseconds. uint64_t
1460 : */
1461 1 : #define k_cyc_to_ns_near64(t) \
1462 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, true)
1463 :
1464 :
1465 : /** @brief Convert hardware cycles to nanoseconds. 32 bits. Rounds up.
1466 : *
1467 : * Converts time values in hardware cycles to nanoseconds.
1468 : * Computes result in 32 bit precision.
1469 : * Rounds up to the next highest output unit.
1470 : *
1471 : * @warning Generated. Do not edit. See above.
1472 : *
1473 : * @param t Source time in hardware cycles. uint64_t
1474 : *
1475 : * @return The converted time value in nanoseconds. uint32_t
1476 : */
1477 1 : #define k_cyc_to_ns_ceil32(t) \
1478 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, true, false)
1479 :
1480 :
1481 : /** @brief Convert hardware cycles to nanoseconds. 64 bits. Rounds up.
1482 : *
1483 : * Converts time values in hardware cycles to nanoseconds.
1484 : * Computes result in 64 bit precision.
1485 : * Rounds up to the next highest output unit.
1486 : *
1487 : * @warning Generated. Do not edit. See above.
1488 : *
1489 : * @param t Source time in hardware cycles. uint64_t
1490 : *
1491 : * @return The converted time value in nanoseconds. uint64_t
1492 : */
1493 1 : #define k_cyc_to_ns_ceil64(t) \
1494 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, true, false)
1495 :
1496 :
1497 : /** @brief Convert hardware cycles to ticks. 32 bits. Truncates.
1498 : *
1499 : * Converts time values in hardware cycles to ticks.
1500 : * Computes result in 32 bit precision.
1501 : * Truncates to the next lowest output unit.
1502 : *
1503 : * @warning Generated. Do not edit. See above.
1504 : *
1505 : * @param t Source time in hardware cycles. uint64_t
1506 : *
1507 : * @return The converted time value in ticks. uint32_t
1508 : */
1509 1 : #define k_cyc_to_ticks_floor32(t) \
1510 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, false)
1511 :
1512 :
1513 : /** @brief Convert hardware cycles to ticks. 64 bits. Truncates.
1514 : *
1515 : * Converts time values in hardware cycles to ticks.
1516 : * Computes result in 64 bit precision.
1517 : * Truncates to the next lowest output unit.
1518 : *
1519 : * @warning Generated. Do not edit. See above.
1520 : *
1521 : * @param t Source time in hardware cycles. uint64_t
1522 : *
1523 : * @return The converted time value in ticks. uint64_t
1524 : */
1525 1 : #define k_cyc_to_ticks_floor64(t) \
1526 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, false)
1527 :
1528 :
1529 : /** @brief Convert hardware cycles to ticks. 32 bits. Round nearest.
1530 : *
1531 : * Converts time values in hardware cycles to ticks.
1532 : * Computes result in 32 bit precision.
1533 : * Rounds to the nearest output unit.
1534 : *
1535 : * @warning Generated. Do not edit. See above.
1536 : *
1537 : * @param t Source time in hardware cycles. uint64_t
1538 : *
1539 : * @return The converted time value in ticks. uint32_t
1540 : */
1541 1 : #define k_cyc_to_ticks_near32(t) \
1542 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, true)
1543 :
1544 :
1545 : /** @brief Convert hardware cycles to ticks. 64 bits. Round nearest.
1546 : *
1547 : * Converts time values in hardware cycles to ticks.
1548 : * Computes result in 64 bit precision.
1549 : * Rounds to the nearest output unit.
1550 : *
1551 : * @warning Generated. Do not edit. See above.
1552 : *
1553 : * @param t Source time in hardware cycles. uint64_t
1554 : *
1555 : * @return The converted time value in ticks. uint64_t
1556 : */
1557 1 : #define k_cyc_to_ticks_near64(t) \
1558 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, true)
1559 :
1560 :
1561 : /** @brief Convert hardware cycles to ticks. 32 bits. Rounds up.
1562 : *
1563 : * Converts time values in hardware cycles to ticks.
1564 : * Computes result in 32 bit precision.
1565 : * Rounds up to the next highest output unit.
1566 : *
1567 : * @warning Generated. Do not edit. See above.
1568 : *
1569 : * @param t Source time in hardware cycles. uint64_t
1570 : *
1571 : * @return The converted time value in ticks. uint32_t
1572 : */
1573 1 : #define k_cyc_to_ticks_ceil32(t) \
1574 : z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, false)
1575 :
1576 :
1577 : /** @brief Convert hardware cycles to ticks. 64 bits. Rounds up.
1578 : *
1579 : * Converts time values in hardware cycles to ticks.
1580 : * Computes result in 64 bit precision.
1581 : * Rounds up to the next highest output unit.
1582 : *
1583 : * @warning Generated. Do not edit. See above.
1584 : *
1585 : * @param t Source time in hardware cycles. uint64_t
1586 : *
1587 : * @return The converted time value in ticks. uint64_t
1588 : */
1589 1 : #define k_cyc_to_ticks_ceil64(t) \
1590 : z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, false)
1591 :
1592 :
1593 : /** @brief Convert ticks to seconds. 32 bits. Truncates.
1594 : *
1595 : * Converts time values in ticks to seconds.
1596 : * Computes result in 32 bit precision.
1597 : * Truncates to the next lowest output unit.
1598 : *
1599 : * @warning Generated. Do not edit. See above.
1600 : *
1601 : * @param t Source time in ticks. uint64_t
1602 : *
1603 : * @return The converted time value in seconds. uint32_t
1604 : */
1605 1 : #define k_ticks_to_sec_floor32(t) \
1606 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_sec, true, false, false)
1607 :
1608 :
1609 : /** @brief Convert ticks to seconds. 64 bits. Truncates.
1610 : *
1611 : * Converts time values in ticks to seconds.
1612 : * Computes result in 64 bit precision.
1613 : * Truncates to the next lowest output unit.
1614 : *
1615 : * @warning Generated. Do not edit. See above.
1616 : *
1617 : * @param t Source time in ticks. uint64_t
1618 : *
1619 : * @return The converted time value in seconds. uint64_t
1620 : */
1621 1 : #define k_ticks_to_sec_floor64(t) \
1622 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_sec, true, false, false)
1623 :
1624 :
1625 : /** @brief Convert ticks to seconds. 32 bits. Round nearest.
1626 : *
1627 : * Converts time values in ticks to seconds.
1628 : * Computes result in 32 bit precision.
1629 : * Rounds to the nearest output unit.
1630 : *
1631 : * @warning Generated. Do not edit. See above.
1632 : *
1633 : * @param t Source time in ticks. uint64_t
1634 : *
1635 : * @return The converted time value in seconds. uint32_t
1636 : */
1637 1 : #define k_ticks_to_sec_near32(t) \
1638 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_sec, true, false, true)
1639 :
1640 :
1641 : /** @brief Convert ticks to seconds. 64 bits. Round nearest.
1642 : *
1643 : * Converts time values in ticks to seconds.
1644 : * Computes result in 64 bit precision.
1645 : * Rounds to the nearest output unit.
1646 : *
1647 : * @warning Generated. Do not edit. See above.
1648 : *
1649 : * @param t Source time in ticks. uint64_t
1650 : *
1651 : * @return The converted time value in seconds. uint64_t
1652 : */
1653 1 : #define k_ticks_to_sec_near64(t) \
1654 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_sec, true, false, true)
1655 :
1656 :
1657 : /** @brief Convert ticks to seconds. 32 bits. Rounds up.
1658 : *
1659 : * Converts time values in ticks to seconds.
1660 : * Computes result in 32 bit precision.
1661 : * Rounds up to the next highest output unit.
1662 : *
1663 : * @warning Generated. Do not edit. See above.
1664 : *
1665 : * @param t Source time in ticks. uint64_t
1666 : *
1667 : * @return The converted time value in seconds. uint32_t
1668 : */
1669 1 : #define k_ticks_to_sec_ceil32(t) \
1670 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_sec, true, true, false)
1671 :
1672 :
1673 : /** @brief Convert ticks to seconds. 64 bits. Rounds up.
1674 : *
1675 : * Converts time values in ticks to seconds.
1676 : * Computes result in 64 bit precision.
1677 : * Rounds up to the next highest output unit.
1678 : *
1679 : * @warning Generated. Do not edit. See above.
1680 : *
1681 : * @param t Source time in ticks. uint64_t
1682 : *
1683 : * @return The converted time value in seconds. uint64_t
1684 : */
1685 1 : #define k_ticks_to_sec_ceil64(t) \
1686 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_sec, true, true, false)
1687 :
1688 :
1689 : /** @brief Convert ticks to milliseconds. 32 bits. Truncates.
1690 : *
1691 : * Converts time values in ticks to milliseconds.
1692 : * Computes result in 32 bit precision.
1693 : * Truncates to the next lowest output unit.
1694 : *
1695 : * @warning Generated. Do not edit. See above.
1696 : *
1697 : * @param t Source time in ticks. uint64_t
1698 : *
1699 : * @return The converted time value in milliseconds. uint32_t
1700 : */
1701 1 : #define k_ticks_to_ms_floor32(t) \
1702 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, false, false)
1703 :
1704 :
1705 : /** @brief Convert ticks to milliseconds. 64 bits. Truncates.
1706 : *
1707 : * Converts time values in ticks to milliseconds.
1708 : * Computes result in 64 bit precision.
1709 : * Truncates to the next lowest output unit.
1710 : *
1711 : * @warning Generated. Do not edit. See above.
1712 : *
1713 : * @param t Source time in ticks. uint64_t
1714 : *
1715 : * @return The converted time value in milliseconds. uint64_t
1716 : */
1717 1 : #define k_ticks_to_ms_floor64(t) \
1718 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, false, false)
1719 :
1720 :
1721 : /** @brief Convert ticks to milliseconds. 32 bits. Round nearest.
1722 : *
1723 : * Converts time values in ticks to milliseconds.
1724 : * Computes result in 32 bit precision.
1725 : * Rounds to the nearest output unit.
1726 : *
1727 : * @warning Generated. Do not edit. See above.
1728 : *
1729 : * @param t Source time in ticks. uint64_t
1730 : *
1731 : * @return The converted time value in milliseconds. uint32_t
1732 : */
1733 1 : #define k_ticks_to_ms_near32(t) \
1734 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, false, true)
1735 :
1736 :
1737 : /** @brief Convert ticks to milliseconds. 64 bits. Round nearest.
1738 : *
1739 : * Converts time values in ticks to milliseconds.
1740 : * Computes result in 64 bit precision.
1741 : * Rounds to the nearest output unit.
1742 : *
1743 : * @warning Generated. Do not edit. See above.
1744 : *
1745 : * @param t Source time in ticks. uint64_t
1746 : *
1747 : * @return The converted time value in milliseconds. uint64_t
1748 : */
1749 1 : #define k_ticks_to_ms_near64(t) \
1750 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, false, true)
1751 :
1752 :
1753 : /** @brief Convert ticks to milliseconds. 32 bits. Rounds up.
1754 : *
1755 : * Converts time values in ticks to milliseconds.
1756 : * Computes result in 32 bit precision.
1757 : * Rounds up to the next highest output unit.
1758 : *
1759 : * @warning Generated. Do not edit. See above.
1760 : *
1761 : * @param t Source time in ticks. uint64_t
1762 : *
1763 : * @return The converted time value in milliseconds. uint32_t
1764 : */
1765 1 : #define k_ticks_to_ms_ceil32(t) \
1766 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, true, false)
1767 :
1768 :
1769 : /** @brief Convert ticks to milliseconds. 64 bits. Rounds up.
1770 : *
1771 : * Converts time values in ticks to milliseconds.
1772 : * Computes result in 64 bit precision.
1773 : * Rounds up to the next highest output unit.
1774 : *
1775 : * @warning Generated. Do not edit. See above.
1776 : *
1777 : * @param t Source time in ticks. uint64_t
1778 : *
1779 : * @return The converted time value in milliseconds. uint64_t
1780 : */
1781 1 : #define k_ticks_to_ms_ceil64(t) \
1782 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, true, false)
1783 :
1784 :
1785 : /** @brief Convert ticks to microseconds. 32 bits. Truncates.
1786 : *
1787 : * Converts time values in ticks to microseconds.
1788 : * Computes result in 32 bit precision.
1789 : * Truncates to the next lowest output unit.
1790 : *
1791 : * @warning Generated. Do not edit. See above.
1792 : *
1793 : * @param t Source time in ticks. uint64_t
1794 : *
1795 : * @return The converted time value in microseconds. uint32_t
1796 : */
1797 1 : #define k_ticks_to_us_floor32(t) \
1798 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, false, false)
1799 :
1800 :
1801 : /** @brief Convert ticks to microseconds. 64 bits. Truncates.
1802 : *
1803 : * Converts time values in ticks to microseconds.
1804 : * Computes result in 64 bit precision.
1805 : * Truncates to the next lowest output unit.
1806 : *
1807 : * @warning Generated. Do not edit. See above.
1808 : *
1809 : * @param t Source time in ticks. uint64_t
1810 : *
1811 : * @return The converted time value in microseconds. uint64_t
1812 : */
1813 1 : #define k_ticks_to_us_floor64(t) \
1814 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, false, false)
1815 :
1816 :
1817 : /** @brief Convert ticks to microseconds. 32 bits. Round nearest.
1818 : *
1819 : * Converts time values in ticks to microseconds.
1820 : * Computes result in 32 bit precision.
1821 : * Rounds to the nearest output unit.
1822 : *
1823 : * @warning Generated. Do not edit. See above.
1824 : *
1825 : * @param t Source time in ticks. uint64_t
1826 : *
1827 : * @return The converted time value in microseconds. uint32_t
1828 : */
1829 1 : #define k_ticks_to_us_near32(t) \
1830 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, false, true)
1831 :
1832 :
1833 : /** @brief Convert ticks to microseconds. 64 bits. Round nearest.
1834 : *
1835 : * Converts time values in ticks to microseconds.
1836 : * Computes result in 64 bit precision.
1837 : * Rounds to the nearest output unit.
1838 : *
1839 : * @warning Generated. Do not edit. See above.
1840 : *
1841 : * @param t Source time in ticks. uint64_t
1842 : *
1843 : * @return The converted time value in microseconds. uint64_t
1844 : */
1845 1 : #define k_ticks_to_us_near64(t) \
1846 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, false, true)
1847 :
1848 :
1849 : /** @brief Convert ticks to microseconds. 32 bits. Rounds up.
1850 : *
1851 : * Converts time values in ticks to microseconds.
1852 : * Computes result in 32 bit precision.
1853 : * Rounds up to the next highest output unit.
1854 : *
1855 : * @warning Generated. Do not edit. See above.
1856 : *
1857 : * @param t Source time in ticks. uint64_t
1858 : *
1859 : * @return The converted time value in microseconds. uint32_t
1860 : */
1861 1 : #define k_ticks_to_us_ceil32(t) \
1862 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, true, false)
1863 :
1864 :
1865 : /** @brief Convert ticks to microseconds. 64 bits. Rounds up.
1866 : *
1867 : * Converts time values in ticks to microseconds.
1868 : * Computes result in 64 bit precision.
1869 : * Rounds up to the next highest output unit.
1870 : *
1871 : * @warning Generated. Do not edit. See above.
1872 : *
1873 : * @param t Source time in ticks. uint64_t
1874 : *
1875 : * @return The converted time value in microseconds. uint64_t
1876 : */
1877 1 : #define k_ticks_to_us_ceil64(t) \
1878 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, true, false)
1879 :
1880 :
1881 : /** @brief Convert ticks to nanoseconds. 32 bits. Truncates.
1882 : *
1883 : * Converts time values in ticks to nanoseconds.
1884 : * Computes result in 32 bit precision.
1885 : * Truncates to the next lowest output unit.
1886 : *
1887 : * @warning Generated. Do not edit. See above.
1888 : *
1889 : * @param t Source time in ticks. uint64_t
1890 : *
1891 : * @return The converted time value in nanoseconds. uint32_t
1892 : */
1893 1 : #define k_ticks_to_ns_floor32(t) \
1894 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, false, false)
1895 :
1896 :
1897 : /** @brief Convert ticks to nanoseconds. 64 bits. Truncates.
1898 : *
1899 : * Converts time values in ticks to nanoseconds.
1900 : * Computes result in 64 bit precision.
1901 : * Truncates to the next lowest output unit.
1902 : *
1903 : * @warning Generated. Do not edit. See above.
1904 : *
1905 : * @param t Source time in ticks. uint64_t
1906 : *
1907 : * @return The converted time value in nanoseconds. uint64_t
1908 : */
1909 1 : #define k_ticks_to_ns_floor64(t) \
1910 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, false, false)
1911 :
1912 :
1913 : /** @brief Convert ticks to nanoseconds. 32 bits. Round nearest.
1914 : *
1915 : * Converts time values in ticks to nanoseconds.
1916 : * Computes result in 32 bit precision.
1917 : * Rounds to the nearest output unit.
1918 : *
1919 : * @warning Generated. Do not edit. See above.
1920 : *
1921 : * @param t Source time in ticks. uint64_t
1922 : *
1923 : * @return The converted time value in nanoseconds. uint32_t
1924 : */
1925 1 : #define k_ticks_to_ns_near32(t) \
1926 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, false, true)
1927 :
1928 :
1929 : /** @brief Convert ticks to nanoseconds. 64 bits. Round nearest.
1930 : *
1931 : * Converts time values in ticks to nanoseconds.
1932 : * Computes result in 64 bit precision.
1933 : * Rounds to the nearest output unit.
1934 : *
1935 : * @warning Generated. Do not edit. See above.
1936 : *
1937 : * @param t Source time in ticks. uint64_t
1938 : *
1939 : * @return The converted time value in nanoseconds. uint64_t
1940 : */
1941 1 : #define k_ticks_to_ns_near64(t) \
1942 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, false, true)
1943 :
1944 :
1945 : /** @brief Convert ticks to nanoseconds. 32 bits. Rounds up.
1946 : *
1947 : * Converts time values in ticks to nanoseconds.
1948 : * Computes result in 32 bit precision.
1949 : * Rounds up to the next highest output unit.
1950 : *
1951 : * @warning Generated. Do not edit. See above.
1952 : *
1953 : * @param t Source time in ticks. uint64_t
1954 : *
1955 : * @return The converted time value in nanoseconds. uint32_t
1956 : */
1957 1 : #define k_ticks_to_ns_ceil32(t) \
1958 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, true, false)
1959 :
1960 :
1961 : /** @brief Convert ticks to nanoseconds. 64 bits. Rounds up.
1962 : *
1963 : * Converts time values in ticks to nanoseconds.
1964 : * Computes result in 64 bit precision.
1965 : * Rounds up to the next highest output unit.
1966 : *
1967 : * @warning Generated. Do not edit. See above.
1968 : *
1969 : * @param t Source time in ticks. uint64_t
1970 : *
1971 : * @return The converted time value in nanoseconds. uint64_t
1972 : */
1973 1 : #define k_ticks_to_ns_ceil64(t) \
1974 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, true, false)
1975 :
1976 :
1977 : /** @brief Convert ticks to hardware cycles. 32 bits. Truncates.
1978 : *
1979 : * Converts time values in ticks to hardware cycles.
1980 : * Computes result in 32 bit precision.
1981 : * Truncates to the next lowest output unit.
1982 : *
1983 : * @warning Generated. Do not edit. See above.
1984 : *
1985 : * @param t Source time in ticks. uint64_t
1986 : *
1987 : * @return The converted time value in hardware cycles. uint32_t
1988 : */
1989 1 : #define k_ticks_to_cyc_floor32(t) \
1990 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, false)
1991 :
1992 :
1993 : /** @brief Convert ticks to hardware cycles. 64 bits. Truncates.
1994 : *
1995 : * Converts time values in ticks to hardware cycles.
1996 : * Computes result in 64 bit precision.
1997 : * Truncates to the next lowest output unit.
1998 : *
1999 : * @warning Generated. Do not edit. See above.
2000 : *
2001 : * @param t Source time in ticks. uint64_t
2002 : *
2003 : * @return The converted time value in hardware cycles. uint64_t
2004 : */
2005 1 : #define k_ticks_to_cyc_floor64(t) \
2006 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, false)
2007 :
2008 :
2009 : /** @brief Convert ticks to hardware cycles. 32 bits. Round nearest.
2010 : *
2011 : * Converts time values in ticks to hardware cycles.
2012 : * Computes result in 32 bit precision.
2013 : * Rounds to the nearest output unit.
2014 : *
2015 : * @warning Generated. Do not edit. See above.
2016 : *
2017 : * @param t Source time in ticks. uint64_t
2018 : *
2019 : * @return The converted time value in hardware cycles. uint32_t
2020 : */
2021 1 : #define k_ticks_to_cyc_near32(t) \
2022 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, true)
2023 :
2024 :
2025 : /** @brief Convert ticks to hardware cycles. 64 bits. Round nearest.
2026 : *
2027 : * Converts time values in ticks to hardware cycles.
2028 : * Computes result in 64 bit precision.
2029 : * Rounds to the nearest output unit.
2030 : *
2031 : * @warning Generated. Do not edit. See above.
2032 : *
2033 : * @param t Source time in ticks. uint64_t
2034 : *
2035 : * @return The converted time value in hardware cycles. uint64_t
2036 : */
2037 1 : #define k_ticks_to_cyc_near64(t) \
2038 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, true)
2039 :
2040 :
2041 : /** @brief Convert ticks to hardware cycles. 32 bits. Rounds up.
2042 : *
2043 : * Converts time values in ticks to hardware cycles.
2044 : * Computes result in 32 bit precision.
2045 : * Rounds up to the next highest output unit.
2046 : *
2047 : * @warning Generated. Do not edit. See above.
2048 : *
2049 : * @param t Source time in ticks. uint64_t
2050 : *
2051 : * @return The converted time value in hardware cycles. uint32_t
2052 : */
2053 1 : #define k_ticks_to_cyc_ceil32(t) \
2054 : z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, true, false)
2055 :
2056 :
2057 : /** @brief Convert ticks to hardware cycles. 64 bits. Rounds up.
2058 : *
2059 : * Converts time values in ticks to hardware cycles.
2060 : * Computes result in 64 bit precision.
2061 : * Rounds up to the next highest output unit.
2062 : *
2063 : * @warning Generated. Do not edit. See above.
2064 : *
2065 : * @param t Source time in ticks. uint64_t
2066 : *
2067 : * @return The converted time value in hardware cycles. uint64_t
2068 : */
2069 1 : #define k_ticks_to_cyc_ceil64(t) \
2070 : z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, true, false)
2071 :
2072 : #if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
2073 : #include <zephyr/syscalls/time_units.h>
2074 : #endif
2075 :
2076 : #undef TIME_CONSTEXPR
2077 :
2078 : /**
2079 : * @}
2080 : */
2081 :
2082 : #ifdef __cplusplus
2083 : } /* extern "C" */
2084 : #endif
2085 :
2086 : #endif /* ZEPHYR_INCLUDE_TIME_UNITS_H_ */
|