Loading...
Searching...
No Matches
cfg_clock_default.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for more
6 * details.
7 */
8
19#ifndef CLK_F2F4F7_CFG_CLOCK_DEFAULT_H
20#define CLK_F2F4F7_CFG_CLOCK_DEFAULT_H
21
23#include "kernel_defines.h"
24
25#if defined(CPU_FAM_STM32F2)
27#elif defined(CPU_FAM_STM32F4)
28#if defined(CPU_LINE_STM32F401xC) || defined(CPU_LINE_STM32F401xE)
30#elif defined(CPU_LINE_STM32F410Cx) || defined(CPU_LINE_STM32F410Rx) || \
31 defined(CPU_LINE_STM32F410Tx) || defined(CPU_LINE_STM32F411xE) || \
32 defined(CPU_LINE_STM32F412Cx) || defined(CPU_LINE_STM32F412Rx) || \
33 defined(CPU_LINE_STM32F412Vx) || defined(CPU_LINE_STM32F412Zx) || \
34 defined(CPU_LINE_STM32F413xx) || defined(CPU_LINE_STM32F423xx)
36#elif defined(CPU_LINE_STM32F405xx) || defined(CPU_LINE_STM32F407xx) || \
37 defined(CPU_LINE_STM32F415xx) || defined(CPU_LINE_STM32F417xx) || \
38 defined(CPU_LINE_STM32F427xx) || defined(CPU_LINE_STM32F437xx) || \
39 defined(CPU_LINE_STM32F429xx) || defined(CPU_LINE_STM32F439xx) || \
40 defined(CPU_LINE_STM32F446xx) || defined(CPU_LINE_STM32F469xx) || \
41 defined(CPU_LINE_STM32F479xx)
43#else
44#error "No clock configuration available for this F4 line"
45#endif
46#elif defined(CPU_FAM_STM32F7)
48#else
49#error "No clock configuration available for this family"
50#endif
51
56#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE)
57#define CLOCK_PLL_SRC (CONFIG_CLOCK_HSE)
58#else /* CONFIG_CLOCK_HSI */
59#define CLOCK_PLL_SRC (CONFIG_CLOCK_HSI)
60#endif
61
62#if IS_ACTIVE(CONFIG_USE_CLOCK_HSI)
63#define CLOCK_CORECLOCK (CONFIG_CLOCK_HSI)
64
65#elif IS_ACTIVE(CONFIG_USE_CLOCK_HSE)
66#if !IS_ACTIVE(CONFIG_BOARD_HAS_HSE)
67#error "The board doesn't provide an HSE oscillator"
68#endif
69#define CLOCK_CORECLOCK (CONFIG_CLOCK_HSE)
70
71#elif IS_ACTIVE(CONFIG_USE_CLOCK_PLL)
72#define CLOCK_CORECLOCK (((CLOCK_PLL_SRC / CONFIG_CLOCK_PLL_M) * CONFIG_CLOCK_PLL_N) / CONFIG_CLOCK_PLL_P)
73#endif /* CONFIG_USE_CLOCK_PLL */
74
75#define CLOCK_PLLQ (((CLOCK_PLL_SRC / CONFIG_CLOCK_PLL_M) * CONFIG_CLOCK_PLL_N) / CONFIG_CLOCK_PLL_Q)
76
77#define CLOCK_AHB CLOCK_CORECLOCK
78#define CLOCK_APB1 (CLOCK_CORECLOCK / CONFIG_CLOCK_APB1_DIV)
79#define CLOCK_APB2 (CLOCK_CORECLOCK / CONFIG_CLOCK_APB2_DIV)
82#ifdef __cplusplus
83extern "C" {
84#endif
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif /* CLK_F2F4F7_CFG_CLOCK_DEFAULT_H */
Base STM32Fx/Gx/MP1/C0 clock configuration.
Default STM32F4 clock configuration for 100MHz boards.
Default STM32F2/4/7 clock configuration for 120MHz boards.
Default STM32F4 clock configuration for 180MHz boards.
Default STM32F7 clock configuration for 216MHz boards.
Default STM32F4 clock configuration for 84MHz boards.
Common macros and compiler attributes/pragmas configuration.