Loading...
Searching...
No Matches
cfg_clock_default_100.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_DEFAULT_100_H
24#define CLK_F2F4F7_CFG_CLOCK_DEFAULT_100_H
25
26#include "kernel_defines.h"
27#include "macros/units.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
37/* The following parameters configure a 100MHz system clock with HSE (8MHz, 16MHz or
38 25MHz) or HSI (16MHz) as PLL input clock.
39 If USB is used and no alternative 48MHz is available, the clock frequency is
40 decreased to 96MHZ so the PLLQ can output 48MHz.
41 */
42#ifndef CONFIG_CLOCK_PLL_M
43#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(25))
44#define CONFIG_CLOCK_PLL_M (25)
45#else
46#define CONFIG_CLOCK_PLL_M (4)
47#endif
48#endif
49#ifndef CONFIG_CLOCK_PLL_N
50#if (IS_USED(MODULE_PERIPH_USBDEV_CLK) || IS_USED(MODULE_PERIPH_SDMMC_CLK)) && \
51 defined(CPU_LINE_STM32F411xE)
52#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(8))
53#define CONFIG_CLOCK_PLL_N (96)
54#elif IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(25))
55#define CONFIG_CLOCK_PLL_N (192)
56#else
57#define CONFIG_CLOCK_PLL_N (48)
58#endif
59#else
60#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(8))
61#define CONFIG_CLOCK_PLL_N (100)
62#elif IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(25))
63#define CONFIG_CLOCK_PLL_N (200)
64#else
65#define CONFIG_CLOCK_PLL_N (50)
66#endif
67#endif /* MODULE_PERIPH_USBDEV_CLK || MODULE_PERIPH_SDMMC_CLK */
68#endif
69#ifndef CONFIG_CLOCK_PLL_P
70#define CONFIG_CLOCK_PLL_P (2)
71#endif
72#ifndef CONFIG_CLOCK_PLL_Q
73#define CONFIG_CLOCK_PLL_Q (4)
74#endif
75#ifndef CONFIG_CLOCK_PLL_R
76#define CONFIG_CLOCK_PLL_R (4)
77#endif
84#ifndef CONFIG_CLOCK_APB1_DIV
85#define CONFIG_CLOCK_APB1_DIV (2) /* max 50MHz */
86#endif
87#ifndef CONFIG_CLOCK_APB2_DIV
88#define CONFIG_CLOCK_APB2_DIV (1) /* max 100MHz */
89#endif
92#if CLOCK_CORECLOCK > MHZ(100)
93#error "SYSCLK cannot exceed 100MHz"
94#endif
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* CLK_F2F4F7_CFG_CLOCK_DEFAULT_100_H */
Common macros and compiler attributes/pragmas configuration.
Unit helper macros.