Loading...
Searching...
No Matches
cfg_clock_default.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Technische Universität Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
20
22#include "kernel_defines.h"
23#include "macros/units.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
34#ifndef CONFIG_USE_CLOCK_PLL
35# define CONFIG_USE_CLOCK_PLL 0
36#endif
37
39#ifndef CONFIG_USE_CLOCK_HSI
40# define CONFIG_USE_CLOCK_HSI 1
41#endif
42
44#ifndef CONFIG_CLOCK_HSI
45# define CONFIG_CLOCK_HSI MHZ(16)
46#endif
47
49#ifndef CONFIG_CLOCK_HSE
50# define CONFIG_CLOCK_HSE MHZ(8)
51#endif
52
54#ifndef CONFIG_CLOCK_MSI
55# define CONFIG_CLOCK_MSI MHZ(12)
56#endif
57
58#if IS_ACTIVE(CONFIG_USE_CLOCK_HSE)
59# define CLOCK_CORECLOCK CONFIG_CLOCK_HSE
60#elif IS_ACTIVE(CONFIG_USE_CLOCK_MSI)
61# define CLOCK_CORECLOCK CONFIG_CLOCK_MSI
62#else
63# define CLOCK_CORECLOCK CONFIG_CLOCK_HSI
64#endif
65
67#define CLOCK_CORECLOCK_MAX MHZ(96)
68
69#if CLOCK_CORECLOCK > CLOCK_CORECLOCK_MAX
70# error "SYSCLK cannot exceed 96MHz on STM32U3"
71#endif
72
73#define CLOCK_AHB CLOCK_CORECLOCK
74
75#ifndef CONFIG_CLOCK_APB1_DIV
76# define CONFIG_CLOCK_APB1_DIV (1)
77#endif
78
79#ifndef CONFIG_CLOCK_APB2_DIV
80# define CONFIG_CLOCK_APB2_DIV (1)
81#endif
82
83#ifndef CONFIG_CLOCK_APB3_DIV
84# define CONFIG_CLOCK_APB3_DIV (1)
85#endif
86
87#define CLOCK_APB1 (CLOCK_AHB / CONFIG_CLOCK_APB1_DIV)
88#define CLOCK_APB2 (CLOCK_AHB / CONFIG_CLOCK_APB2_DIV)
90#define CLOCK_APB3 (CLOCK_AHB / CONFIG_CLOCK_APB3_DIV)
92
93#ifdef __cplusplus
94}
95#endif
96
Base STM32Lx/U5/Wx clock configuration.
Common macros and compiler attributes/pragmas configuration.
Unit helper macros.