config.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 Inria
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #include "board.h"
20 #include "periph_conf.h"
21 
22 #include "ztimer.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /*
29  * @brief Use periph_timer as the base timer for ZTIMER_USEC
30  */
31 #define CONFIG_ZTIMER_USEC_TYPE_PERIPH_TIMER (1)
32 
33 /* for ZTIMER_USEC, use xtimer configuration if available and no ztimer
34  * specific configuration is set. */
35 #if CONFIG_ZTIMER_USEC_TYPE_PERIPH_TIMER
36 # ifndef CONFIG_ZTIMER_USEC_DEV
37 # ifdef XTIMER_DEV
38 # define CONFIG_ZTIMER_USEC_DEV XTIMER_DEV
39 # endif
40 # endif
41 # ifndef CONFIG_ZTIMER_USEC_BASE_FREQ
42 # ifdef XTIMER_HZ
43 # define CONFIG_ZTIMER_USEC_BASE_FREQ XTIMER_HZ
44 # endif
45 # endif
46 # ifndef CONFIG_ZTIMER_USEC_WIDTH
47 # ifdef XTIMER_WIDTH
48 # define CONFIG_ZTIMER_USEC_WIDTH XTIMER_WIDTH
49 # endif
50 # endif
51 #endif
52 
56 #ifndef CONFIG_ZTIMER_USEC_DEV
57 #define CONFIG_ZTIMER_USEC_DEV (TIMER_DEV(0))
58 #endif
59 
63 #ifndef CONFIG_ZTIMER_LPTIMER_WIDTH
64 #define CONFIG_ZTIMER_LPTIMER_WIDTH (32)
65 #endif
66 
76 #ifndef CONFIG_ZTIMER_USEC_MIN
77 #define CONFIG_ZTIMER_USEC_MIN (10)
78 #endif
79 
83 #ifndef CONFIG_ZTIMER_USEC_WIDTH
84 # if (TIMER_0_MAX_VALUE) == 0xffff
85 # define CONFIG_ZTIMER_USEC_WIDTH (16)
86 # elif (TIMER_0_MAX_VALUE) == 0xffffffUL
87 # define CONFIG_ZTIMER_USEC_WIDTH (24)
88 # else
89 # define CONFIG_ZTIMER_USEC_WIDTH (32)
90 # endif
91 #endif
92 
96 #ifndef CONFIG_ZTIMER_USEC_BASE_FREQ
97 #define CONFIG_ZTIMER_USEC_BASE_FREQ (1000000LU)
98 #endif
99 
103 #ifdef MODULE_ZTIMER_PERIPH_RTT
104 # define CONFIG_ZTIMER_MSEC_BASE_FREQ (RTT_FREQUENCY)
105 # else
106 # define CONFIG_ZTIMER_MSEC_BASE_FREQ (CONFIG_ZTIMER_USEC_BASE_FREQ)
107 #endif /* MODULE_ZTIMER_PERIPH_RTT */
108 
112 #ifndef CONFIG_ZTIMER_TIMER_BLOCK_PM_MODE
113 # ifdef CONFIG_ZTIMER_USEC_REQUIRED_PM_MODE
114 # define CONFIG_ZTIMER_TIMER_BLOCK_PM_MODE CONFIG_ZTIMER_USEC_REQUIRED_PM_MODE
115 # else
116 # define CONFIG_ZTIMER_TIMER_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
117 # endif
118 #endif
119 
123 #ifndef CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE
124 # define CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
125 #endif
126 
130 #ifndef CONFIG_ZTIMER_RTT_BLOCK_PM_MODE
131 # ifdef CONFIG_ZTIMER_MSEC_REQUIRED_PM_MODE
132 # define CONFIG_ZTIMER_RTT_BLOCK_PM_MODE CONFIG_ZTIMER_MSEC_REQUIRED_PM_MODE
133 # else
134 # define CONFIG_ZTIMER_RTT_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
135 # endif
136 #endif
137 
141 #ifndef CONFIG_ZTIMER_RTC_BLOCK_PM_MODE
142 # ifdef CONFIG_ZTIMER_SEC_REQUIRED_PM_MODE
143 # define CONFIG_ZTIMER_RTC_BLOCK_PM_MODE CONFIG_ZTIMER_SEC_REQUIRED_PM_MODE
144 # else
145 # define CONFIG_ZTIMER_RTC_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
146 # endif
147 #endif
148 
158 #ifndef CONFIG_ZTIMER_USEC_ADJUST_CLOCK_START
159 #define CONFIG_ZTIMER_USEC_ADJUST_CLOCK_START 0
160 #endif
161 
169 #ifndef CONFIG_ZTIMER_USEC_ADJUST_SET
170 #define CONFIG_ZTIMER_USEC_ADJUST_SET 0
171 #endif
172 
183 #ifndef CONFIG_ZTIMER_USEC_ADJUST_SLEEP
184 #define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 0
185 #endif
186 
194 #ifndef CONFIG_ZTIMER_AUTO_ADJUST_SETTLE
195 #define CONFIG_ZTIMER_AUTO_ADJUST_SETTLE 0
196 #endif
197 
198 #ifdef __cplusplus
199 }
200 #endif
201 
ztimer API