ChibiOS-Contrib/os/hal/ports/GD/GD32VF103/gd32_rcu.h

990 lines
22 KiB
C
Raw Normal View History

/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
2021-03-31 02:24:51 -07:00
* @file STM32F1xx/gd32_rcu.h
* @brief RCU helper driver header.
* @note This file requires definitions from the ST header file
* @p stm32f10x.h.
*
2021-03-31 02:24:51 -07:00
* @addtogroup STM32F1xx_RCU
* @{
*/
2021-03-31 02:24:51 -07:00
#ifndef GD32_RCU_H
#define GD32_RCU_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/**
2021-03-31 02:24:51 -07:00
* @name Generic RCU operations
* @{
*/
/**
* @brief Enables the clock of one or more peripheral on the APB1 bus.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] mask APB1 peripherals mask
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableAPB1(mask, lp) { \
2021-03-31 02:34:30 -07:00
RCU->APB1EN |= (mask); \
(void)RCU->APB1EN; \
}
/**
* @brief Disables the clock of one or more peripheral on the APB1 bus.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] mask APB1 peripherals mask
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableAPB1(mask) { \
2021-03-31 02:34:30 -07:00
RCU->APB1EN &= ~(mask); \
(void)RCU->APB1EN; \
}
/**
* @brief Resets one or more peripheral on the APB1 bus.
*
* @param[in] mask APB1 peripherals mask
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetAPB1(mask) { \
2021-03-31 02:34:30 -07:00
RCU->APB1RST |= (mask); \
RCU->APB1RST &= ~(mask); \
(void)RCU->APB1RST; \
}
/**
* @brief Enables the clock of one or more peripheral on the APB2 bus.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] mask APB2 peripherals mask
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableAPB2(mask, lp) { \
2021-03-31 02:34:30 -07:00
RCU->APB2EN |= (mask); \
(void)RCU->APB2EN; \
}
/**
* @brief Disables the clock of one or more peripheral on the APB2 bus.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] mask APB2 peripherals mask
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableAPB2(mask) { \
2021-03-31 02:34:30 -07:00
RCU->APB2EN &= ~(mask); \
(void)RCU->APB2EN; \
}
/**
* @brief Resets one or more peripheral on the APB2 bus.
*
* @param[in] mask APB2 peripherals mask
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetAPB2(mask) { \
2021-03-31 02:34:30 -07:00
RCU->APB2RST |= (mask); \
RCU->APB2RST &= ~(mask); \
(void)RCU->APB2RST; \
}
/**
* @brief Enables the clock of one or more peripheral on the AHB bus.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] mask AHB peripherals mask
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableAHB(mask, lp) { \
2021-03-31 02:34:30 -07:00
RCU->AHBEN |= (mask); \
(void)RCU->AHBEN; \
}
/**
* @brief Disables the clock of one or more peripheral on the AHB bus.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] mask AHB peripherals mask
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableAHB(mask) { \
2021-03-31 02:34:30 -07:00
RCU->AHBEN &= ~(mask); \
(void)RCU->AHBEN; \
}
/**
* @brief Resets one or more peripheral on the AHB bus.
*
* @param[in] mask AHB peripherals mask
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetAHB(mask) { \
2021-03-31 02:34:30 -07:00
RCU->AHBRST |= (mask); \
RCU->AHBRST &= ~(mask); \
(void)RCU->AHBRST; \
}
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name ADC peripherals specific RCU operations
* @{
*/
/**
* @brief Enables the ADC1 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableADC1(lp) rcuEnableAPB2(RCU_APB2ENR_ADC1EN, lp)
/**
* @brief Disables the ADC1 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableADC1() rcuDisableAPB2(RCU_APB2ENR_ADC1EN)
/**
* @brief Resets the ADC1 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetADC1() rcuResetAPB2(RCU_APB2RSTR_ADC1RST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name DAC peripheral specific RCU operations
* @{
*/
/**
* @brief Enables the DAC1 peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableDAC1(lp) rcuEnableAPB1(RCU_APB1ENR_DACEN, lp)
/**
* @brief Disables the DAC1 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableDAC1() rcuDisableAPB1(RCU_APB1ENR_DACEN)
/**
* @brief Resets the DAC1 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetDAC1() rcuResetAPB1(RCU_APB1RSTR_DACRST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name Backup domain interface specific RCU operations
* @{
*/
/**
* @brief Enables the BKP interface clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableBKPInterface(lp) rcuEnableAPB1((RCU_APB1ENR_BKPEN), lp)
/**
* @brief Disables BKP interface clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableBKPInterface() rcuDisableAPB1(RCU_APB1ENR_BKPEN)
/**
* @brief Resets the Backup Domain interface.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetBKPInterface() rcuResetAPB1(RCU_APB1ENR_BKPRST)
/**
* @brief Resets the entire Backup Domain.
*
* @api
*/
2021-03-31 02:34:30 -07:00
#define rcuResetBKP() (RCU->BDCTL |= RCU_BDCR_BDRST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name PWR interface specific RCU operations
* @{
*/
/**
* @brief Enables the PWR interface clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnablePWRInterface(lp) rcuEnableAPB1(RCU_APB1ENR_PWREN, lp)
/**
* @brief Disables PWR interface clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisablePWRInterface() rcuDisableAPB1(RCU_APB1ENR_PWREN)
/**
* @brief Resets the PWR interface.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetPWRInterface() rcuResetAPB1(RCU_APB1RSTR_PWRRST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name CAN peripherals specific RCU operations
* @{
*/
/**
* @brief Enables the CAN1 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableCAN1(lp) rcuEnableAPB1(RCU_APB1ENR_CAN1EN, lp)
/**
* @brief Disables the CAN1 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableCAN1() rcuDisableAPB1(RCU_APB1ENR_CAN1EN)
/**
* @brief Resets the CAN1 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetCAN1() rcuResetAPB1(RCU_APB1RSTR_CAN1RST)
/**
* @brief Enables the CAN2 peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableCAN2(lp) rcuEnableAPB1(RCU_APB1ENR_CAN2EN, lp)
/**
* @brief Disables the CAN2 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableCAN2() rcuDisableAPB1(RCU_APB1ENR_CAN2EN)
/**
* @brief Resets the CAN2 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetCAN2() rcuResetAPB1(RCU_APB1RSTR_CAN2RST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name DMA peripherals specific RCU operations
* @{
*/
/**
* @brief Enables the DMA0 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableDMA0(lp) rcuEnableAHB(RCU_AHBENR_DMA0EN, lp)
/**
* @brief Disables the DMA0 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableDMA0() rcuDisableAHB(RCU_AHBENR_DMA0EN)
/**
* @brief Resets the DMA0 peripheral.
* @note Not supported in this family, does nothing.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetDMA0()
/**
* @brief Enables the DMA1 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableDMA1(lp) rcuEnableAHB(RCU_AHBENR_DMA1EN, lp)
/**
* @brief Disables the DMA1 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableDMA1() rcuDisableAHB(RCU_AHBENR_DMA1EN)
/**
* @brief Resets the DMA0 peripheral.
* @note Not supported in this family, does nothing.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetDMA1()
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name ETH peripheral specific RCU operations
* @{
*/
/**
* @brief Enables the ETH peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableETH(lp) rcuEnableAHB(RCU_AHBENR_ETHMACEN | \
RCU_AHBENR_ETHMACTXEN | \
RCU_AHBENR_ETHMACRXEN, lp)
/**
* @brief Disables the ETH peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableETH() rcuDisableAHB(RCU_AHBENR_ETHMACEN | \
RCU_AHBENR_ETHMACTXEN | \
RCU_AHBENR_ETHMACRXEN)
/**
* @brief Resets the ETH peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetETH() rcuResetAHB(RCU_AHBRSTR_ETHMACRST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name I2C peripherals specific RCU operations
* @{
*/
/**
2021-03-25 10:57:11 -07:00
* @brief Enables the I2C0 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableI2C0(lp) rcuEnableAPB1(RCU_APB1ENR_I2C0EN, lp)
/**
2021-03-25 10:57:11 -07:00
* @brief Disables the I2C0 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableI2C0() rcuDisableAPB1(RCU_APB1ENR_I2C0EN)
/**
2021-03-25 10:57:11 -07:00
* @brief Resets the I2C0 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetI2C0() rcuResetAPB1(RCU_APB1RSTR_I2C0RST)
/**
2021-03-25 10:57:46 -07:00
* @brief Enables the I2C1 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableI2C1(lp) rcuEnableAPB1(RCU_APB1ENR_I2C1EN, lp)
/**
2021-03-25 10:57:46 -07:00
* @brief Disables the I2C1 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableI2C1() rcuDisableAPB1(RCU_APB1ENR_I2C1EN)
/**
2021-03-25 10:57:46 -07:00
* @brief Resets the I2C1 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetI2C1() rcuResetAPB1(RCU_APB1RSTR_I2C1RST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name OTG peripherals specific RCU operations
* @{
*/
/**
2021-03-23 03:57:43 -07:00
* @brief Enables the USBFS peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableUSBFS(lp) rcuEnableAHB(RCU_AHBENR_OTGFSEN, lp)
/**
2021-03-23 03:57:43 -07:00
* @brief Disables the USBFS peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableUSBFS() rcuDisableAHB(RCU_AHBENR_OTGFSEN)
/**
2021-03-23 03:57:43 -07:00
* @brief Resets the USBFS peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetUSBFS() rcuResetAHB(RCU_AHBRSTR_OTGFSRST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name SDIO peripheral specific RCU operations
* @{
*/
/**
* @brief Enables the SDIO peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableSDIO(lp) rcuEnableAHB(RCU_AHBENR_SDIOEN, lp)
/**
* @brief Disables the SDIO peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableSDIO() rcuDisableAHB(RCU_AHBENR_SDIOEN)
/**
* @brief Resets the SDIO peripheral.
* @note Not supported in this family, does nothing.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetSDIO()
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name SPI peripherals specific RCU operations
* @{
*/
/**
* @brief Enables the SPI1 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableSPI1(lp) rcuEnableAPB2(RCU_APB2ENR_SPI1EN, lp)
/**
* @brief Disables the SPI1 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableSPI1() rcuDisableAPB2(RCU_APB2ENR_SPI1EN)
/**
* @brief Resets the SPI1 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetSPI1() rcuResetAPB2(RCU_APB2RSTR_SPI1RST)
/**
* @brief Enables the SPI2 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableSPI2(lp) rcuEnableAPB1(RCU_APB1ENR_SPI2EN, lp)
/**
* @brief Disables the SPI2 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableSPI2() rcuDisableAPB1(RCU_APB1ENR_SPI2EN)
/**
* @brief Resets the SPI2 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetSPI2() rcuResetAPB1(RCU_APB1RSTR_SPI2RST)
/**
* @brief Enables the SPI3 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableSPI3(lp) rcuEnableAPB1(RCU_APB1ENR_SPI3EN, lp)
/**
* @brief Disables the SPI3 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableSPI3() rcuDisableAPB1(RCU_APB1ENR_SPI3EN)
/**
* @brief Resets the SPI3 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetSPI3() rcuResetAPB1(RCU_APB1RSTR_SPI3RST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name TIM peripherals specific RCU operations
* @{
*/
2021-03-30 09:39:36 -07:00
/**
* @brief Enables the TIM0 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableTIM0(lp) rcuEnableAPB2(RCU_APB2ENR_TIM0EN, lp)
2021-03-30 09:39:36 -07:00
/**
* @brief Disables the TIM0 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableTIM0() rcuDisableAPB2(RCU_APB2ENR_TIM0EN)
2021-03-30 09:39:36 -07:00
/**
* @brief Resets the TIM0 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetTIM0() rcuResetAPB2(RCU_APB2RSTR_TIM0RST)
2021-03-30 09:39:36 -07:00
/**
* @brief Enables the TIM1 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableTIM1(lp) rcuEnableAPB1(RCU_APB1ENR_TIM1EN, lp)
/**
* @brief Disables the TIM1 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableTIM1() rcuDisableAPB1(RCU_APB1ENR_TIM1EN)
/**
* @brief Resets the TIM1 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetTIM1() rcuResetAPB1(RCU_APB1RSTR_TIM1RST)
/**
* @brief Enables the TIM2 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableTIM2(lp) rcuEnableAPB1(RCU_APB1ENR_TIM2EN, lp)
/**
* @brief Disables the TIM2 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableTIM2() rcuDisableAPB1(RCU_APB1ENR_TIM2EN)
/**
* @brief Resets the TIM2 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetTIM2() rcuResetAPB1(RCU_APB1RSTR_TIM2RST)
/**
* @brief Enables the TIM3 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableTIM3(lp) rcuEnableAPB1(RCU_APB1ENR_TIM3EN, lp)
/**
* @brief Disables the TIM3 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableTIM3() rcuDisableAPB1(RCU_APB1ENR_TIM3EN)
/**
* @brief Resets the TIM3 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetTIM3() rcuResetAPB1(RCU_APB1RSTR_TIM3RST)
/**
* @brief Enables the TIM4 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableTIM4(lp) rcuEnableAPB1(RCU_APB1ENR_TIM4EN, lp)
/**
* @brief Disables the TIM4 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableTIM4() rcuDisableAPB1(RCU_APB1ENR_TIM4EN)
/**
* @brief Resets the TIM4 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetTIM4() rcuResetAPB1(RCU_APB1RSTR_TIM4RST)
/**
* @brief Enables the TIM5 peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableTIM5(lp) rcuEnableAPB1(RCU_APB1ENR_TIM5EN, lp)
/**
* @brief Disables the TIM5 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableTIM5() rcuDisableAPB1(RCU_APB1ENR_TIM5EN)
/**
* @brief Resets the TIM5 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetTIM5() rcuResetAPB1(RCU_APB1RSTR_TIM5RST)
/**
* @brief Enables the TIM6 peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableTIM6(lp) rcuEnableAPB1(RCU_APB1ENR_TIM6EN, lp)
/**
* @brief Disables the TIM6 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableTIM6() rcuDisableAPB1(RCU_APB1ENR_TIM6EN)
/**
* @brief Resets the TIM6 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetTIM6() rcuResetAPB1(RCU_APB1RSTR_TIM6RST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name USART/UART peripherals specific RCU operations
* @{
*/
/**
2021-03-25 13:56:29 -07:00
* @brief Enables the USART0 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableUSART0(lp) rcuEnableAPB2(RCU_APB2ENR_USART0EN, lp)
/**
2021-03-25 13:56:29 -07:00
* @brief Disables the USART0 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableUSART0() rcuDisableAPB2(RCU_APB2ENR_USART0EN)
/**
2021-03-25 13:56:29 -07:00
* @brief Resets the USART0 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetUSART0() rcuResetAPB2(RCU_APB2RSTR_USART0RST)
/**
2021-03-25 13:56:29 -07:00
* @brief Enables the USART1 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableUSART1(lp) rcuEnableAPB1(RCU_APB1ENR_USART1EN, lp)
/**
2021-03-25 13:56:29 -07:00
* @brief Disables the USART1 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableUSART1() rcuDisableAPB1(RCU_APB1ENR_USART1EN)
/**
2021-03-25 13:56:29 -07:00
* @brief Resets the USART1 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetUSART1() rcuResetAPB1(RCU_APB1RSTR_USART1RST)
/**
2021-03-25 13:56:29 -07:00
* @brief Enables the USART2 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableUSART2(lp) rcuEnableAPB1(RCU_APB1ENR_USART2EN, lp)
/**
2021-03-25 13:56:29 -07:00
* @brief Disables the USART2 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableUSART2() rcuDisableAPB1(RCU_APB1ENR_USART2EN)
/**
2021-03-25 13:56:29 -07:00
* @brief Resets the USART2 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetUSART2() rcuResetAPB1(RCU_APB1RSTR_USART2RST)
/**
2021-03-25 13:58:13 -07:00
* @brief Enables the UART3 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableUART3(lp) rcuEnableAPB1(RCU_APB1ENR_UART3EN, lp)
/**
2021-03-25 13:58:13 -07:00
* @brief Disables the UART3 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableUART3() rcuDisableAPB1(RCU_APB1ENR_UART3EN)
/**
2021-03-25 13:58:13 -07:00
* @brief Resets the UART3 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetUART3() rcuResetAPB1(RCU_APB1RSTR_UART3RST)
/**
2021-03-25 13:58:13 -07:00
* @brief Enables the UART4 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableUART4(lp) rcuEnableAPB1(RCU_APB1ENR_UART4EN, lp)
/**
2021-03-25 13:58:13 -07:00
* @brief Disables the UART4 peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableUART4() rcuDisableAPB1(RCU_APB1ENR_UART4EN)
/**
2021-03-25 13:58:13 -07:00
* @brief Resets the UART4 peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetUART4() rcuResetAPB1(RCU_APB1RSTR_UART4RST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name USB peripheral specific RCU operations
* @{
*/
/**
* @brief Enables the USB peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableUSB(lp) rcuEnableAPB1(RCU_APB1ENR_USBEN, lp)
/**
* @brief Disables the USB peripheral clock
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableUSB() rcuDisableAPB1(RCU_APB1ENR_USBEN)
/**
* @brief Resets the USB peripheral.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuResetUSB() rcuResetAPB1(RCU_APB1RSTR_USBRST)
/** @} */
/**
2021-03-31 02:24:51 -07:00
* @name FSMC peripherals specific RCU operations
* @{
*/
/**
* @brief Enables the FSMC peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuEnableFSMC(lp) rcuEnableAHB(RCU_AHBENR_FSMCEN, lp)
/**
* @brief Disables the FSMC peripheral clock.
*
* @api
*/
2021-03-31 02:24:51 -07:00
#define rcuDisableFSMC() rcuDisableAHB(RCU_AHBENR_FSMCEN)
/** @} */
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
2021-03-31 02:24:51 -07:00
#endif /* GD32_RCU_H */
/** @} */