Loading...
Searching...
No Matches
cfg_clock_common_lx_u5_wx.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
11#pragma once
12
24
25#include "kernel_defines.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
35/* Select the desired system clock source between PLL, HSE or HSI */
36#ifndef CONFIG_USE_CLOCK_PLL
37#if IS_ACTIVE(CONFIG_USE_CLOCK_HSE) || IS_ACTIVE(CONFIG_USE_CLOCK_HSI) || \
38 IS_ACTIVE(CONFIG_USE_CLOCK_MSI)
39#define CONFIG_USE_CLOCK_PLL 0
40#else
41#define CONFIG_USE_CLOCK_PLL 1 /* Use PLL by default */
42#endif
43#endif /* CONFIG_USE_CLOCK_PLL */
45
46#if IS_ACTIVE(CONFIG_USE_CLOCK_PLL) && \
47 (IS_ACTIVE(CONFIG_USE_CLOCK_MSI) || IS_ACTIVE(CONFIG_USE_CLOCK_HSE) || \
48 IS_ACTIVE(CONFIG_USE_CLOCK_HSI))
49#error "Cannot use PLL as clock source with other clock configurations"
50#endif
51
52#if IS_ACTIVE(CONFIG_USE_CLOCK_MSI) && \
53 (IS_ACTIVE(CONFIG_USE_CLOCK_PLL) || IS_ACTIVE(CONFIG_USE_CLOCK_HSE) || \
54 IS_ACTIVE(CONFIG_USE_CLOCK_HSI))
55#error "Cannot use MSI as clock source with other clock configurations"
56#endif
57
58#if IS_ACTIVE(CONFIG_USE_CLOCK_HSE) && \
59 (IS_ACTIVE(CONFIG_USE_CLOCK_PLL) || IS_ACTIVE(CONFIG_USE_CLOCK_MSI) || \
60 IS_ACTIVE(CONFIG_USE_CLOCK_HSI))
61#error "Cannot use HSE as clock source with other clock configurations"
62#endif
63
64#if IS_ACTIVE(CONFIG_USE_CLOCK_HSI) && \
65 (IS_ACTIVE(CONFIG_USE_CLOCK_PLL) || IS_ACTIVE(CONFIG_USE_CLOCK_MSI) || \
66 IS_ACTIVE(CONFIG_USE_CLOCK_HSE))
67#error "Cannot use HSI as clock source with other clock configurations"
68#endif
69
70#ifndef CONFIG_CLOCK_HSE
71#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
72#define CONFIG_CLOCK_HSE MHZ(24)
73#else
74#define CONFIG_CLOCK_HSE MHZ(8)
75#endif
76#endif
77
78#ifndef CONFIG_CLOCK_HSI
79#define CONFIG_CLOCK_HSI MHZ(16)
80#endif
81
82#ifndef CONFIG_CLOCK_MSI
83#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
84#define CONFIG_CLOCK_MSI KHZ(4194)
85#else
86#define CONFIG_CLOCK_MSI MHZ(48)
87#endif
88#endif
89
90#ifdef __cplusplus
91}
92#endif
93
Common macros and compiler attributes/pragmas configuration.