periph_common_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Koen Zandberg <koen@bergzand.net>
3  * 2023 Gunar Schorcht <gunar@schorcht.net>
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
21 #ifndef PERIPH_COMMON_CONF_H
22 #define PERIPH_COMMON_CONF_H
23 
24 #include "macros/units.h"
25 #include "periph_cpu.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #if defined(MODULE_USBDEV_SYNOPSYS_DWC2) || defined(MODULE_TINYUSB_DEVICE)
32 /* If the USB OTG peripheral is used, the USB clock of 48 MHz is derived by
33  * dividing the PLL clock by 1, 1.5, 2, or 2.5. That is the maximum core clock
34  * frequency can be 96 MHz. */
35 #define CLOCK_CORECLOCK MHZ(96)
36 #else
37 #define CLOCK_CORECLOCK MHZ(108)
38 #endif
39 
40 #define CLOCK_AHB CLOCK_CORECLOCK
41 #define CLOCK_APB1 CLOCK_AHB/2
42 #define CLOCK_APB2 CLOCK_AHB
48 #if CONFIG_BOARD_HAS_LXTAL
49 #define RTT_CLOCK_FREQUENCY (32768U)
50 #else
51 #define RTT_CLOCK_FREQUENCY (40000U)
52 #endif
53 
54 #define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* maximum RTT frequency in Hz */
55 
56 #ifndef RTT_FREQUENCY
57 #define RTT_FREQUENCY (RTT_MAX_FREQUENCY) /* RTT frequency in Hz */
58 #endif
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif /* PERIPH_COMMON_CONF_H */
Unit helper macros.