Loading...
Searching...
No Matches
cfg_clock_default_120.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#include "macros/units.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36/* The following parameters configure a 120MHz system clock with HSE (8MHz or
37 16MHz) or HSI (16MHz) as PLL input clock */
38#ifndef CONFIG_CLOCK_PLL_M
39#define CONFIG_CLOCK_PLL_M (4)
40#endif
41#ifndef CONFIG_CLOCK_PLL_N
42#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(8))
43#define CONFIG_CLOCK_PLL_N (120)
44#else
45#define CONFIG_CLOCK_PLL_N (60)
46#endif
47#endif
48#ifndef CONFIG_CLOCK_PLL_P
49#define CONFIG_CLOCK_PLL_P (2)
50#endif
51#ifndef CONFIG_CLOCK_PLL_Q
52#define CONFIG_CLOCK_PLL_Q (5)
53#endif
55
60#ifndef CONFIG_CLOCK_APB1_DIV
61#define CONFIG_CLOCK_APB1_DIV (4) /* max 30MHz */
62#endif
63#ifndef CONFIG_CLOCK_APB2_DIV
64#define CONFIG_CLOCK_APB2_DIV (2) /* max 60MHz */
65#endif
67
68#if CLOCK_CORECLOCK > MHZ(120)
69#error "SYSCLK cannot exceed 120MHz"
70#endif
71
72#ifdef __cplusplus
73}
74#endif
75
Common macros and compiler attributes/pragmas configuration.
Unit helper macros.