periph_common_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 Koen Zandberg <koen@bergzand.net>
3  * SPDX-FileCopyrightText: 2023 Gunar Schorcht <gunar@schorcht.net>
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
20 #include "macros/units.h"
21 #include "periph_cpu.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #if defined(MODULE_USBDEV_SYNOPSYS_DWC2) || defined(MODULE_TINYUSB_DEVICE)
28 /* If the USB OTG peripheral is used, the USB clock of 48 MHz is derived by
29  * dividing the PLL clock by 1, 1.5, 2, or 2.5. That is the maximum core clock
30  * frequency can be 96 MHz. */
31 #define CLOCK_CORECLOCK MHZ(96)
32 #else
33 #define CLOCK_CORECLOCK MHZ(108)
34 #endif
35 
36 #define CLOCK_AHB CLOCK_CORECLOCK
37 #define CLOCK_APB1 CLOCK_AHB/2
38 #define CLOCK_APB2 CLOCK_AHB
44 #if CONFIG_BOARD_HAS_LXTAL
45 #define RTT_CLOCK_FREQUENCY (32768U)
46 #else
47 #define RTT_CLOCK_FREQUENCY (40000U)
48 #endif
49 
50 #define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* maximum RTT frequency in Hz */
51 
52 #ifndef RTT_FREQUENCY
53 #define RTT_FREQUENCY (RTT_MAX_FREQUENCY) /* RTT frequency in Hz */
54 #endif
57 #ifdef __cplusplus
58 }
59 #endif
60 
Unit helper macros.