Loading...
Searching...
No Matches
cfg_clock_common_lx_u5_wx.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Freie Universität Berlin
3 * SPDX-FileCopyrightText: 2017 OTA keys S.A.
4 * SPDX-FileCopyrightText: 2018-2020 Inria
5 * SPDX-License-Identifier: LGPL-2.1-only
6 */
7
8#pragma once
9
21
22#include "kernel_defines.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
32/* Select the desired system clock source between PLL, HSE or HSI */
33#ifndef CONFIG_USE_CLOCK_PLL
34#if IS_ACTIVE(CONFIG_USE_CLOCK_HSE) || IS_ACTIVE(CONFIG_USE_CLOCK_HSI) || \
35 IS_ACTIVE(CONFIG_USE_CLOCK_MSI)
36#define CONFIG_USE_CLOCK_PLL 0
37#else
38#define CONFIG_USE_CLOCK_PLL 1 /* Use PLL by default */
39#endif
40#endif /* CONFIG_USE_CLOCK_PLL */
42
43#if IS_ACTIVE(CONFIG_USE_CLOCK_PLL) && \
44 (IS_ACTIVE(CONFIG_USE_CLOCK_MSI) || IS_ACTIVE(CONFIG_USE_CLOCK_HSE) || \
45 IS_ACTIVE(CONFIG_USE_CLOCK_HSI))
46#error "Cannot use PLL as clock source with other clock configurations"
47#endif
48
49#if IS_ACTIVE(CONFIG_USE_CLOCK_MSI) && \
50 (IS_ACTIVE(CONFIG_USE_CLOCK_PLL) || IS_ACTIVE(CONFIG_USE_CLOCK_HSE) || \
51 IS_ACTIVE(CONFIG_USE_CLOCK_HSI))
52#error "Cannot use MSI as clock source with other clock configurations"
53#endif
54
55#if IS_ACTIVE(CONFIG_USE_CLOCK_HSE) && \
56 (IS_ACTIVE(CONFIG_USE_CLOCK_PLL) || IS_ACTIVE(CONFIG_USE_CLOCK_MSI) || \
57 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_MSI) || \
63 IS_ACTIVE(CONFIG_USE_CLOCK_HSE))
64#error "Cannot use HSI as clock source with other clock configurations"
65#endif
66
67#ifndef CONFIG_CLOCK_HSE
68#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
69#define CONFIG_CLOCK_HSE MHZ(24)
70#else
71#define CONFIG_CLOCK_HSE MHZ(8)
72#endif
73#endif
74
75#ifndef CONFIG_CLOCK_HSI
76#define CONFIG_CLOCK_HSI MHZ(16)
77#endif
78
79#ifndef CONFIG_CLOCK_MSI
80#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
81#define CONFIG_CLOCK_MSI KHZ(4194)
82#else
83#define CONFIG_CLOCK_MSI MHZ(48)
84#endif
85#endif
86
87#ifdef __cplusplus
88}
89#endif
90
Common macros and compiler attributes/pragmas configuration.