cfg_clock_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Freie Universität Berlin
3  * 2017 OTA keys S.A.
4  * 2018-2020 Inria
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
23 #ifndef CLK_F2F4F7_CFG_CLOCK_COMMON_H
24 #define CLK_F2F4F7_CFG_CLOCK_COMMON_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 /* Select the desired system clock source between PLL, HSE or HSI */
35 #ifndef CONFIG_USE_CLOCK_PLL
36 #if IS_ACTIVE(CONFIG_USE_CLOCK_HSE) || IS_ACTIVE(CONFIG_USE_CLOCK_HSI)
37 #define CONFIG_USE_CLOCK_PLL 0
38 #else
39 #define CONFIG_USE_CLOCK_PLL 1 /* Use PLL by default */
40 #endif
41 #endif /* CONFIG_USE_CLOCK_PLL */
42 
43 #ifndef CONFIG_USE_CLOCK_HSE
44 #define CONFIG_USE_CLOCK_HSE 0
45 #endif /* CONFIG_USE_CLOCK_HSE */
46 
47 #ifndef CONFIG_USE_CLOCK_HSI
48 #define CONFIG_USE_CLOCK_HSI 0
49 #endif /* CONFIG_USE_CLOCK_HSI */
50 
51 #if IS_ACTIVE(CONFIG_USE_CLOCK_PLL) && \
52  (IS_ACTIVE(CONFIG_USE_CLOCK_HSE) || IS_ACTIVE(CONFIG_USE_CLOCK_HSI))
53 #error "Cannot use PLL as clock source with other clock configurations"
54 #endif
55 
56 #if IS_ACTIVE(CONFIG_USE_CLOCK_HSE) && \
57  (IS_ACTIVE(CONFIG_USE_CLOCK_PLL) || IS_ACTIVE(CONFIG_USE_CLOCK_HSI))
58 #error "Cannot use HSE as clock source with other clock configurations"
59 #endif
60 
61 #if IS_ACTIVE(CONFIG_USE_CLOCK_HSI) && \
62  (IS_ACTIVE(CONFIG_USE_CLOCK_PLL) || IS_ACTIVE(CONFIG_USE_CLOCK_HSE))
63 #error "Cannot use HSI as clock source with other clock configurations"
64 #endif
65 
66 #ifndef CONFIG_BOARD_HAS_HSE
67 #define CONFIG_BOARD_HAS_HSE 0
68 #endif
69 
70 #ifndef CLOCK_HSE
71 #define CLOCK_HSE MHZ(8)
72 #endif
73 
74 #ifndef CONFIG_BOARD_HAS_LSE
75 #define CONFIG_BOARD_HAS_LSE 0
76 #endif
77 
78 #define CLOCK_HSI MHZ(16)
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* CLK_F2F4F7_CFG_CLOCK_COMMON_H */
85