Branch data Line data Source code
1 : : /*
2 : : * Copyright (c) 2015 Wind River Systems, Inc.
3 : : *
4 : : * SPDX-License-Identifier: Apache-2.0
5 : : */
6 : :
7 : : /**
8 : : * @file
9 : : * @brief Initialize system clock driver
10 : : *
11 : : * Initializing the timer driver is done in this module to reduce code
12 : : * duplication.
13 : : */
14 : :
15 : : #include <zephyr/kernel.h>
16 : : #include <zephyr/init.h>
17 : : #include <zephyr/drivers/timer/system_timer.h>
18 : :
19 : : /* Weak-linked noop defaults for optional driver interfaces*/
20 : :
21 : 0 : void __weak sys_clock_set_timeout(uint32_t ticks, bool idle)
22 : : {
23 : 0 : ARG_UNUSED(ticks);
24 : 0 : ARG_UNUSED(idle);
25 : 0 : }
26 : :
27 : 0 : void __weak sys_clock_idle_exit(void)
28 : : {
29 : 0 : }
30 : :
31 : 0 : void __weak sys_clock_no_timeout(void)
32 : : {
33 : : /* Ask for the longest wait the interface can express. UINT32_MAX is
34 : : * numerically what K_TICKS_FOREVER was here, so a driver that has not
35 : : * migrated and still keys on that value stops its clock as it always
36 : : * did. It carries no special meaning otherwise.
37 : : */
38 : 0 : sys_clock_set_timeout(UINT32_MAX, false);
39 : 0 : }
40 : :
41 : 0 : void __weak sys_clock_idle_enter(uint32_t ticks)
42 : : {
43 : : /* A driver that does not implement this hook may still key its
44 : : * low-power handling on sys_clock_set_timeout()'s idle argument, so
45 : : * pass true here. That argument is deprecated in favour of
46 : : * implementing this hook, and carries no information for a driver
47 : : * that does.
48 : : */
49 : 0 : sys_clock_set_timeout(ticks, true);
50 : 0 : }
|