1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-19 19:43:52 +01:00
RIOT/boards/common/gd32v/include/periph_common_conf.h
2025-07-18 14:23:37 +02:00

62 lines
1.7 KiB
C

/*
* SPDX-FileCopyrightText: 2020 Koen Zandberg <koen@bergzand.net>
* SPDX-FileCopyrightText: 2023 Gunar Schorcht <gunar@schorcht.net>
* SPDX-License-Identifier: LGPL-2.1-only
*/
#pragma once
/**
* @ingroup boards_common_gd32v
* @{
*
* @file
* @brief Common peripheral configuration for GD32VF103 boards
*
* @author Koen Zandberg <koen@bergzand.net>
* @author Gunar Schorcht <gunar@schorcht.net>
*/
#include "macros/units.h"
#include "periph_cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(MODULE_USBDEV_SYNOPSYS_DWC2) || defined(MODULE_TINYUSB_DEVICE)
/* If the USB OTG peripheral is used, the USB clock of 48 MHz is derived by
* dividing the PLL clock by 1, 1.5, 2, or 2.5. That is the maximum core clock
* frequency can be 96 MHz. */
#define CLOCK_CORECLOCK MHZ(96) /**< CPU clock frequency in Hz */
#else
#define CLOCK_CORECLOCK MHZ(108) /**< CPU clock frequency in Hz */
#endif
#define CLOCK_AHB CLOCK_CORECLOCK /**< Equal to the CPU clock */
#define CLOCK_APB1 CLOCK_AHB/2 /**< Half AHB clock */
#define CLOCK_APB2 CLOCK_AHB /**< Equal to the AHB clock */
/**
* @name RTT/RTC configuration
* @{
*/
#if CONFIG_BOARD_HAS_LXTAL
#define RTT_CLOCK_FREQUENCY (32768U) /**< Low frequency XTAL is used as clock source */
#else
#define RTT_CLOCK_FREQUENCY (40000U) /**< IRC40K is used as clock source */
#endif
#define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* maximum RTT frequency in Hz */
#ifndef RTT_FREQUENCY
#define RTT_FREQUENCY (RTT_MAX_FREQUENCY) /* RTT frequency in Hz */
#endif
/** @} */
#ifdef __cplusplus
}
#endif
/** @} */