/** ****************************************************************************** * @brief CMSIS Cortex-M3 Device Peripheral Access Layer Header File.. ****************************************************************************** */ /** @addtogroup CMSIS * @{ */ /** @addtogroup GD32f10X * @{ */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __GD32F10X_H #define __GD32F10X_H #ifdef __cplusplus extern "C" { #endif /** @addtogroup Library_configuration_section * @{ */ /* Uncomment the line below according to the target gd32f10x device used in your application */ #if !defined (GD32F10X_MD)&&!defined (GD32F10X_HD)&&!defined (GD32F10X_XD)&&!defined (GD32F10X_CL) /* #define GD32F10X_MD */ /*!< GD32F10X_MD: GD32 Medium density devices */ #define GD32F10X_HD /*!< GD32F10X_HD: GD32 High density Value Line devices */ /* #define GD32F10X_XD */ /*!< GD32F10X_XD: GD32 Extra density devices */ /* #define GD32F10X_CL */ /*!< GD32F10X_CL: GD32 Connectivity line devices */ #endif #if !defined (GD32F10X_MD)&&!defined (GD32F10X_HD)&&!defined (GD32F10X_XD)&&!defined (GD32F10X_CL) #error "Please select first the target gd32f10x device used in your application (in gd32f10x.h file)" #endif /* GD32F10X */ #if !defined USE_STDPERIPH_DRIVER /** * @brief Comment the line below if you will not use the peripherals drivers. In this case, these drivers will not be included and the application code will be based on direct access to peripherals registers */ /*#define USE_STDPERIPH_DRIVER*/ #endif /* USE_STDPERIPH_DRIVER */ /** * @brief In the following line adjust the value of External High Speed oscillator (HSE) used in your application Tip: To avoid modifying this file each time you need to use different HSE, you can define the HSE value in your toolchain compiler preprocessor. */ #if !defined HSE_VALUE #ifdef GD32F10X_CL #define HSE_VALUE ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */ #else #define HSE_VALUE ((uint32_t)8000000) /* !< From 4M to 16M *!< Value of the External oscillator in Hz*/ #endif /* HSE_VALUE */ #endif #define HSE_STARTUP_TIMEOUT ((uint16_t)0xFFFF) /*!< Time out for HSI start up */ /* define value of high speed crystal oscillator (HXTAL) in Hz */ #if !defined HXTAL_VALUE #define HXTAL_VALUE ((uint32_t)8000000) /* !< from 4M to 16M *!< value of the external oscillator in Hz*/ #endif /* high speed crystal oscillator value */ /* define startup timeout value of high speed crystal oscillator (HXTAL) */ #if !defined (HXTAL_STARTUP_TIMEOUT) #define HXTAL_STARTUP_TIMEOUT ((uint16_t)0x0800) #endif /* high speed crystal oscillator startup timeout */ /* define startup timeout value of internal 8MHz RC oscillator (IRC8M) */ #if !defined (IRC8M_STARTUP_TIMEOUT) #define IRC8M_STARTUP_TIMEOUT ((uint16_t)0x0500) #endif /* internal 8MHz RC oscillator startup timeout */ #if !defined (HSI_VALUE) #define HSI_VALUE ((uint32_t)8000000) /*!< Value of the Internal High Speed oscillator in Hz. The real value may vary depending on the variations in voltage and temperature. */ #endif /* HSI_VALUE */ /* define value of internal 48MHz RC oscillator (IRC48M) in Hz */ #if !defined (IRC48M_VALUE) #define IRC48M_VALUE ((uint32_t)48000000) #endif /* internal 48MHz RC oscillator value */ /* define value of internal 8MHz RC oscillator (IRC8M) in Hz */ #if !defined (IRC8M_VALUE) #define IRC8M_VALUE ((uint32_t)8000000) #endif /* internal 8MHz RC oscillator value */ #if !defined (LSI_VALUE) #define LSI_VALUE ((uint32_t)40000) /*!< Value of the Internal Low Speed oscillator in Hz The real value may vary depending on the variations in voltage and temperature. */ #endif /* LSI_VALUE */ #if !defined (LSE_VALUE) #define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */ #endif /* LSE_VALUE */ /** * @brief GD32F10X Firmware Library version number V1.0 */ #define __GD32F10X_STDPERIPH_VERSION_MAIN (0x01) /*!< [31:24] main version */ #define __GD32F10X_STDPERIPH_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */ #define __GD32F10X_STDPERIPH_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */ #define __GD32F10X_STDPERIPH_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __GD32F10X_STDPERIPH_VERSION ((__GD32F10X_STDPERIPH_VERSION_MAIN << 24)\ |(__GD32F10X_STDPERIPH_VERSION_SUB1 << 16)\ |(__GD32F10X_STDPERIPH_VERSION_SUB2 << 8)\ |(__GD32F10X_STDPERIPH_VERSION_RC)) /** * @} */ /** @addtogroup Configuration_section_for_CMSIS * @{ */ /** * @brief Configuration of the Cortex-M3 Processor and Core Peripherals */ #define __MPU_PRESENT 0 /*!< GD32 devices does not provide an MPU */ #define __NVIC_PRIO_BITS 4 /*!< GD32F10X uses 4 Bits for the Priority Levels */ #define __VENDOR_SYSTICKCONFIG 0 /*!< Set to 1 if different SysTick Config is used */ /*!< Interrupt Number Definition */ typedef enum IRQn { /****** Cortex-M3 Processor Exceptions Numbers ***************************************************/ NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */ BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */ UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */ SVCall_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */ DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */ PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */ SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */ /****** GD32 specific Interrupt Numbers *********************************************************/ WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */ LVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */ TAMPER_IRQn = 2, /*!< Tamper Interrupt */ RTC_IRQn = 3, /*!< RTC global Interrupt */ FLASH_IRQn = 4, /*!< FLASH global Interrupt */ RCC_IRQn = 5, /*!< RCC global Interrupt */ EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */ EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */ EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */ EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */ EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */ DMA1_Channel1_IRQn = 11, /*!< DMA1 Channel 1 global Interrupt */ DMA1_Channel2_IRQn = 12, /*!< DMA1 Channel 2 global Interrupt */ DMA1_Channel3_IRQn = 13, /*!< DMA1 Channel 3 global Interrupt */ DMA1_Channel4_IRQn = 14, /*!< DMA1 Channel 4 global Interrupt */ DMA1_Channel5_IRQn = 15, /*!< DMA1 Channel 5 global Interrupt */ DMA1_Channel6_IRQn = 16, /*!< DMA1 Channel 6 global Interrupt */ DMA1_Channel7_IRQn = 17, /*!< DMA1 Channel 7 global Interrupt */ #ifdef GD32F10X_MD ADC0_1_IRQn = 18, /*!< ADC0 and ADC1 global Interrupt */ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */ TIMER0_BRK_IRQn = 24, /*!< TIMER0 Break Interrupt */ TIMER0_UP_IRQn = 25, /*!< TIMER0 Update Interrupt */ TIMER0_TRG_COM_IRQn = 26, /*!< TIMER0 Trigger and Commutation Interrupt */ TIMER0_CC_IRQn = 27, /*!< TIMER0 Capture Compare Interrupt */ TIMER1_IRQn = 28, /*!< TIMER1 global Interrupt */ TIMER2_IRQn = 29, /*!< TIMER2 global Interrupt */ TIMER3_IRQn = 30, /*!< TIMER3 global Interrupt */ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */ USART1_IRQn = 37, /*!< USART1 global Interrupt */ USART2_IRQn = 38, /*!< USART2 global Interrupt */ USART3_IRQn = 39, /*!< USART3 global Interrupt */ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */ EXMC_IRQn = 48 /*!< EXMC global Interrupt */ #endif /* GD32F10X_MD */ #ifdef GD32F10X_HD ADC0_1_IRQn = 18, /*!< ADC0 and ADC1 global Interrupt */ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */ TIMER0_BRK_IRQn = 24, /*!< TIMER0 Break Interrupt */ TIMER0_UP_IRQn = 25, /*!< TIMER0 Update Interrupt */ TIMER0_TRG_COM_IRQn = 26, /*!< TIMER0 Trigger and Commutation Interrupt */ TIMER0_CC_IRQn = 27, /*!< TIMER0 Capture Compare Interrupt */ TIMER1_IRQn = 28, /*!< TIMER1 global Interrupt */ TIMER2_IRQn = 29, /*!< TIMER2 global Interrupt */ TIMER3_IRQn = 30, /*!< TIMER3 global Interrupt */ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */ USART0_IRQn = 37, /*!< USART1 global Interrupt */ USART1_IRQn = 38, /*!< USART2 global Interrupt */ USART2_IRQn = 39, /*!< USART3 global Interrupt */ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */ TIMER7_BRK_IRQn = 43, /*!< TIMER7 Break Interrupt */ TIMER7_UP_IRQn = 44, /*!< TIMER7 Update Interrupt */ TIMER7_TRG_COM_IRQn = 45, /*!< TIMER7 Trigger and Commutation Interrupt */ TIMER7_CC_IRQn = 46, /*!< TIMER7 Capture Compare Interrupt */ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */ EXMC_IRQn = 48, /*!< EXMC global Interrupt */ SDIO_IRQn = 49, /*!< SDIO global Interrupt */ TIMER4_IRQn = 50, /*!< TIMER4 global Interrupt */ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */ UART3_IRQn = 52, /*!< UART4 global Interrupt */ UART4_IRQn = 53, /*!< UART5 global Interrupt */ TIMER5_IRQn = 54, /*!< TIMER5 global Interrupt */ TIMER6_IRQn = 55, /*!< TIMER6 global Interrupt */ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */ DMA2_Channel4_5_IRQn = 59 /*!< DMA2 Channel 4 and Channel 5 global Interrupt */ #endif /* GD32F10X_HD */ #ifdef GD32F10X_XD ADC0_1_IRQn = 18, /*!< ADC0 and ADC1 global Interrupt */ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */ TIMER0_BRK_TIMER8_IRQn = 24, /*!< TIMER0 Break Interrupt and TIMER8 global Interrupt */ TIMER0_UP_TIMER9_IRQn = 25, /*!< TIMER0 Update Interrupt and TIMER9 global Interrupt */ TIMER0_TRG_COM_TIMER10_IRQn = 26, /*!< TIMER0 Trigger and Commutation Interrupt and TIMER10 global interrupt */ TIMER0_CC_IRQn = 27, /*!< TIMER0 Capture Compare Interrupt */ TIMER1_IRQn = 28, /*!< TIMER1 global Interrupt */ TIMER2_IRQn = 29, /*!< TIMER2 global Interrupt */ TIMER3_IRQn = 30, /*!< TIMER3 global Interrupt */ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */ USART1_IRQn = 37, /*!< USART1 global Interrupt */ USART2_IRQn = 38, /*!< USART2 global Interrupt */ USART3_IRQn = 39, /*!< USART3 global Interrupt */ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */ TIMER7_BRK_TIMER11_IRQn = 43, /*!< TIMER7 Break Interrupt and TIMER11 global Interrupt */ TIMER7_UP_TIMER12_IRQn = 44, /*!< TIMER7 Update Interrupt and TIMER12 global Interrupt */ TIMER7_TRG_COM_TIMER13_IRQn = 45, /*!< TIMER7 Trigger and Commutation Interrupt and TIMER13 global interrupt */ TIMER7_CC_IRQn = 46, /*!< TIMER7 Capture Compare Interrupt */ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */ EXMC_IRQn = 48, /*!< EXMC global Interrupt */ SDIO_IRQn = 49, /*!< SDIO global Interrupt */ TIMER4_IRQn = 50, /*!< TIMER4 global Interrupt */ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */ UART4_IRQn = 52, /*!< UART4 global Interrupt */ UART5_IRQn = 53, /*!< UART5 global Interrupt */ TIMER5_IRQn = 54, /*!< TIMER5 global Interrupt */ TIMER6_IRQn = 55, /*!< TIMER6 global Interrupt */ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */ DMA2_Channel4_5_IRQn = 59 /*!< DMA2 Channel 4 and Channel 5 global Interrupt */ #endif /* GD32F10X_XD */ #ifdef GD32F10X_CL ADC0_1_IRQn = 18, /*!< ADC0 and ADC1 global Interrupt */ CAN1_TX_IRQn = 19, /*!< CAN1 TX Interrupts */ CAN1_RX0_IRQn = 20, /*!< CAN1 RX0 Interrupts */ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */ TIMER0_BRK_TIMER8_IRQn = 24, /*!< TIMER0 Break Interrupt and TIMER8 global Interrupt */ TIMER0_UP_TIMER9_IRQn = 25, /*!< TIMER0 Update Interrupt and TIMER9 global Interrupt */ TIMER0_TRG_COM_TIMER10_IRQn = 26, /*!< TIMER0 Trigger and Commutation Interrupt and TIMER10 global interrupt */ TIMER0_CC_IRQn = 27, /*!< TIMER0 Capture Compare Interrupt */ TIMER1_IRQn = 28, /*!< TIMER1 global Interrupt */ TIMER2_IRQn = 29, /*!< TIMER2 global Interrupt */ TIMER3_IRQn = 30, /*!< TIMER3 global Interrupt */ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */ USART1_IRQn = 37, /*!< USART1 global Interrupt */ USART2_IRQn = 38, /*!< USART2 global Interrupt */ USART3_IRQn = 39, /*!< USART3 global Interrupt */ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */ OTG_FS_WKUP_IRQn = 42, /*!< USB OTG FS WakeUp from suspend through EXTI Line Interrupt */ TIMER7_BRK_TIMER11_IRQn = 43, /*!< TIMER7 Break Interrupt and TIMER11 global Interrupt */ TIMER7_UP_TIMER12_IRQn = 44, /*!< TIMER7 Update Interrupt and TIMER12 global Interrupt */ TIMER7_TRG_COM_TIMER13_IRQn = 45, /*!< TIMER7 Trigger and Commutation Interrupt and TIMER13 global interrupt */ TIMER7_CC_IRQn = 46, /*!< TIMER7 Capture Compare Interrupt */ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */ EXMC_IRQn = 48, /*!< EXMC global Interrupt */ TIMER4_IRQn = 50, /*!< TIMER4 global Interrupt */ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */ UART4_IRQn = 52, /*!< UART4 global Interrupt */ UART5_IRQn = 53, /*!< UART5 global Interrupt */ TIMER5_IRQn = 54, /*!< TIMER5 global Interrupt */ TIMER6_IRQn = 55, /*!< TIMER6 global Interrupt */ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */ DMA2_Channel4_IRQn = 59, /*!< DMA2 Channel 4 global Interrupt */ DMA2_Channel5_IRQn = 60, /*!< DMA2 Channel 5 global Interrupt */ ETH_IRQn = 61, /*!< Ethernet global Interrupt */ ETH_WKUP_IRQn = 62, /*!< Ethernet Wakeup through EXTI line Interrupt */ CAN2_TX_IRQn = 63, /*!< CAN2 TX Interrupt */ CAN2_RX0_IRQn = 64, /*!< CAN2 RX0 Interrupt */ CAN2_RX1_IRQn = 65, /*!< CAN2 RX1 Interrupt */ CAN2_SCE_IRQn = 66, /*!< CAN2 SCE Interrupt */ OTG_FS_IRQn = 67 /*!< USB OTG FS global Interrupt */ #endif /* GD32F10X_CL */ } IRQn_Type; /** * @} */ /* Includes ------------------------------------------------------------------*/ #include "core_cm3.h" #include "system_gd32f10x.h" #include /** @addtogroup Exported_types * @{ */ typedef enum {ERROR = 0, SUCCESS = !ERROR, RESET = 0, SET = !RESET, DISABLE = 0, ENABLE = !DISABLE} TypeState, EventStatus, ControlStatus, FlagStatus, ErrStatus; #define REG32(addr) (*(volatile uint32_t *)(uint32_t)(addr)) #define REG16(addr) (*(volatile uint16_t *)(uint32_t)(addr)) #define REG8(addr) (*(volatile uint8_t *)(uint32_t)(addr)) #define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x))) #define BITS(start, end) ((0xFFFFFFFFUL << (start)) & (0xFFFFFFFFUL >> (31U - (uint32_t)(end)))) #define GET_BITS(regval, start, end) (((regval) & BITS((start),(end))) >> (start)) typedef int32_t s32; typedef int16_t s16; typedef int8_t s8; typedef const int32_t sc32; /*!< Read Only */ typedef const int16_t sc16; /*!< Read Only */ typedef const int8_t sc8; /*!< Read Only */ typedef __IO int32_t vs32; typedef __IO int16_t vs16; typedef __IO int8_t vs8; typedef __I int32_t vsc32; /*!< Read Only */ typedef __I int16_t vsc16; /*!< Read Only */ typedef __I int8_t vsc8; /*!< Read Only */ typedef uint32_t u32; typedef uint16_t u16; typedef uint8_t u8; typedef const uint32_t uc32; /*!< Read Only */ typedef const uint16_t uc16; /*!< Read Only */ typedef const uint8_t uc8; /*!< Read Only */ typedef __IO uint32_t vu32; typedef __IO uint16_t vu16; typedef __IO uint8_t vu8; typedef __I uint32_t vuc32; /*!< Read Only */ typedef __I uint16_t vuc16; /*!< Read Only */ typedef __I uint8_t vuc8; /*!< Read Only */ /** @addtogroup Peripheral_registers_structures * @{ */ /** * @brief Analog to Digital Converter */ typedef struct { __IO uint32_t STR; __IO uint32_t CTLR1; __IO uint32_t CTLR2; __IO uint32_t SPT1; __IO uint32_t SPT2; __IO uint32_t ICOS1; __IO uint32_t ICOS2; __IO uint32_t ICOS3; __IO uint32_t ICOS4; __IO uint32_t AWHT; __IO uint32_t AWLT; __IO uint32_t RSQ1; __IO uint32_t RSQ2; __IO uint32_t RSQ3; __IO uint32_t ISQ; __IO uint32_t IDTR1; __IO uint32_t IDTR2; __IO uint32_t IDTR3; __IO uint32_t IDTR4; __IO uint32_t RDTR; } ADC_TypeDef; /** * @brief Backup Registers */ typedef struct { uint32_t RESERVED0; __IO uint16_t DR1; uint16_t RESERVED1; __IO uint16_t DR2; uint16_t RESERVED2; __IO uint16_t DR3; uint16_t RESERVED3; __IO uint16_t DR4; uint16_t RESERVED4; __IO uint16_t DR5; uint16_t RESERVED5; __IO uint16_t DR6; uint16_t RESERVED6; __IO uint16_t DR7; uint16_t RESERVED7; __IO uint16_t DR8; uint16_t RESERVED8; __IO uint16_t DR9; uint16_t RESERVED9; __IO uint16_t DR10; uint16_t RESERVED10; __IO uint16_t RCCR; uint16_t RESERVED11; __IO uint16_t TPCR; uint16_t RESERVED12; __IO uint16_t TIER; uint16_t RESERVED13[5]; __IO uint16_t DR11; uint16_t RESERVED14; __IO uint16_t DR12; uint16_t RESERVED15; __IO uint16_t DR13; uint16_t RESERVED16; __IO uint16_t DR14; uint16_t RESERVED17; __IO uint16_t DR15; uint16_t RESERVED18; __IO uint16_t DR16; uint16_t RESERVED19; __IO uint16_t DR17; uint16_t RESERVED20; __IO uint16_t DR18; uint16_t RESERVED21; __IO uint16_t DR19; uint16_t RESERVED22; __IO uint16_t DR20; uint16_t RESERVED23; __IO uint16_t DR21; uint16_t RESERVED24; __IO uint16_t DR22; uint16_t RESERVED25; __IO uint16_t DR23; uint16_t RESERVED26; __IO uint16_t DR24; uint16_t RESERVED27; __IO uint16_t DR25; uint16_t RESERVED28; __IO uint16_t DR26; uint16_t RESERVED29; __IO uint16_t DR27; uint16_t RESERVED30; __IO uint16_t DR28; uint16_t RESERVED31; __IO uint16_t DR29; uint16_t RESERVED32; __IO uint16_t DR30; uint16_t RESERVED33; __IO uint16_t DR31; uint16_t RESERVED34; __IO uint16_t DR32; uint16_t RESERVED35; __IO uint16_t DR33; uint16_t RESERVED36; __IO uint16_t DR34; uint16_t RESERVED37; __IO uint16_t DR35; uint16_t RESERVED38; __IO uint16_t DR36; uint16_t RESERVED39; __IO uint16_t DR37; uint16_t RESERVED40; __IO uint16_t DR38; uint16_t RESERVED41; __IO uint16_t DR39; uint16_t RESERVED42; __IO uint16_t DR40; uint16_t RESERVED43; __IO uint16_t DR41; uint16_t RESERVED44; __IO uint16_t DR42; uint16_t RESERVED45; } BKP_TypeDef; /** * @brief Controller Area Network TxMailBox */ typedef struct { __IO uint32_t TMIR; /*!< CAN transmit mailbox identifier register, Address offset: 0x180, 0x190, 0x1A0 */ __IO uint32_t TMPR; /*!< CAN transmit mailbox property register, Address offset: 0x184, 0x194, 0x1A4 */ __IO uint32_t TMD0R; /*!< CAN transmit mailbox data0 register, Address offset: 0x188, 0x198, 0x1A8 */ __IO uint32_t TMD1R; /*!< CAN transmit mailbox data1 register, Address offset: 0x18C, 0x19C, 0x1AC */ } CAN_TxMailBox_TypeDef; /** * @brief Controller Area Network FIFOMailBox */ typedef struct { __IO uint32_t RFMIR; /*!< CAN receive FIFO mailbox identifier register, Address offset: 0x1B0, 0x1C0 */ __IO uint32_t RFMPR; /*!< CAN receive FIFO mailbox property register, Address offset: 0x1B4, 0x1C4 */ __IO uint32_t RFMD0R; /*!< CAN receive FIFO mailbox data0 register, Address offset: 0x1B8, 0x1C8 */ __IO uint32_t RFMD1R; /*!< CAN receive FIFO mailbox data1 register, Address offset: 0x1BC, 0x1CC */ } CAN_FIFOMailBox_TypeDef; /** * @brief Controller Area Network FilterRegister */ typedef struct { __IO uint32_t FD0R; /*!< CAN filter x data 0 register */ __IO uint32_t FD1R; /*!< CAN filter x data 1 register */ } CAN_FilterRegister_TypeDef; /** * @brief Controller Area Network */ typedef struct { __IO uint32_t CTLR; /*!< CAN control register, Address offset: 0x00 */ __IO uint32_t STR; /*!< CAN status register, Address offset: 0x04 */ __IO uint32_t TSTR; /*!< CAN transmit status register, Address offset: 0x08 */ __IO uint32_t RFR0; /*!< CAN receive FIFO0 register, Address offset: 0x0C */ __IO uint32_t RFR1; /*!< CAN receive FIFO0 register, Address offset: 0x10 */ __IO uint32_t IER; /*!< CAN interrupt enable register, Address offset: 0x14 */ __IO uint32_t ER; /*!< CAN error register, Address offset: 0x18 */ __IO uint32_t BTR; /*!< CAN bit timing register, Address offset: 0x1C */ uint32_t RESERVED0[88]; CAN_TxMailBox_TypeDef TxMailBox[3]; CAN_FIFOMailBox_TypeDef FIFOMailBox[2]; uint32_t RESERVED1[12]; __IO uint32_t FCTLR; /*!< CAN filter control register, Address offset: 0x200 */ __IO uint32_t FMR; /*!< CAN filter mode register, Address offset: 0x204 */ uint32_t RESERVED2; __IO uint32_t FSR; /*!< CAN filter scale register, Address offset: 0x20C */ uint32_t RESERVED3; __IO uint32_t FAFR; /*!< CAN filter associated FIFO register, Address offset: 0x214 */ uint32_t RESERVED4; __IO uint32_t FWR; /*!< CAN filter working register, Address offset: 0x21C */ uint32_t RESERVED5[8]; #ifndef GD32F10X_CL CAN_FilterRegister_TypeDef FilterRegister[14]; #else CAN_FilterRegister_TypeDef FilterRegister[28]; #endif /* GD32F10X_CL */ } CAN_TypeDef; /** * @brief CRC calculation unit */ typedef struct { __IO uint32_t DTR; /*!< CRC Data register, Address offset: 0x00 */ __IO uint8_t FDTR; /*!< CRC Independent data register, Address offset: 0x04 */ uint8_t RESERVED0; /*!< Reserved, 0x05 */ uint16_t RESERVED1; /*!< Reserved, 0x06 */ __IO uint32_t CTLR; /*!< CRC Control register, Address offset: 0x08 */ } CRC_TypeDef; /** * @brief Digital to Analog Converter */ typedef struct { __IO uint32_t CTLR; __IO uint32_t SWTR; __IO uint32_t C1R12DHR; __IO uint32_t C1L12DHR; __IO uint32_t C1R8DHR; __IO uint32_t C2R12DHR; __IO uint32_t C2L12DHR; __IO uint32_t C2R8DHR; __IO uint32_t DCR12DHR; __IO uint32_t DCL12DHR; __IO uint32_t DCR8RD; __IO uint32_t C1ODR; __IO uint32_t C2ODR; } DAC_TypeDef; /** * @brief Debug MCU */ typedef struct { __IO uint32_t IDR; /*!< MCU device ID code, Address offset: 0x00 */ __IO uint32_t CTLR; /*!< Debug MCU CTLR freeze register, Address offset: 0x04 */ } MCUDBG_TypeDef; /** * @brief DMA Controller */ typedef struct { __IO uint32_t CTLR; /*!< DMA channel x configuration register */ __IO uint32_t RCNT; /*!< DMA channel x number of data register */ __IO uint32_t PBAR; /*!< DMA channel x peripheral address register */ __IO uint32_t MBAR; /*!< DMA channel x memory address register */ } DMA_Channel_TypeDef; typedef struct { __IO uint32_t IFR; /*!< DMA interrupt status register, Address offset: 0x00 */ __IO uint32_t ICR; /*!< DMA interrupt flag clear register,Address offset: 0x04 */ } DMA_TypeDef; typedef struct { __IO uint32_t CFR; /*!< Ethernet MAC configuration register, Address offset: 0x00 */ __IO uint32_t FRMFR; /*!< Ethernet MAC frame filter register, Address offset: 0x04 */ __IO uint32_t HLHR; /*!< Ethernet MAC hash list high register, Address offset: 0x08 */ __IO uint32_t HLLR; /*!< Ethernet MAC hash list low register, Address offset: 0x0C */ __IO uint32_t PHYAR; /*!< Ethernet MAC PHY address register, Address offset: 0x10 */ __IO uint32_t PHYDR; /*!< Ethernet MAC PHY data register, Address offset: 0x14 */ __IO uint32_t FCTLR; /*!< Ethernet MAC flow control register, Address offset: 0x18 */ __IO uint32_t VLTR; /*!< Ethernet MAC VLAN tag register, Address offset: 0x1C */ uint32_t RESERVED0[2]; /*!< Reserved, 0x24 */ __IO uint32_t RWFFR; /*!< Ethernet MAC remote wakeup frame filter register, Address offset: 0x28 */ __IO uint32_t WUMR; /*!< Ethernet MAC wake up management register, Address offset: 0x2C */ uint32_t RESERVED1[2]; /*!< Reserved, 0x34 */ __IO uint32_t ISR; /*!< Ethernet MAC interrupt status register, Address offset: 0x38 */ __IO uint32_t IMR; /*!< Ethernet MAC interrupt mask register, Address offset: 0x3C */ __IO uint32_t ADDR0HR; /*!< Ethernet MAC address 0 high register, Address offset: 0x40 */ __IO uint32_t ADDR0LR; /*!< Ethernet MAC address 0 low register, Address offset: 0x44 */ __IO uint32_t ADDR1HR; /*!< Ethernet MAC address 1 high register, Address offset: 0x48 */ __IO uint32_t ADDR1LR; /*!< Ethernet MAC address 1 low register, Address offset: 0x4C */ __IO uint32_t ADDR2HR; /*!< Ethernet MAC address 2 high register, Address offset: 0x50 */ __IO uint32_t ADDR2LR; /*!< Ethernet MAC address 2 low register, Address offset: 0x54 */ __IO uint32_t ADDR3HR; /*!< Ethernet MAC address 3 high register, Address offset: 0x58 */ __IO uint32_t ADDR3LR; /*!< Ethernet MAC address 3 low register, Address offset: 0x5C */ uint32_t RESERVED2[1032]; /*!< Reserved, 0x107C */ __IO uint32_t FCTHR; /*!< Ethernet MAC flow control threshold register, Address offset: 0x1080 */ } ETH_MAC_TypeDef; typedef struct { __IO uint32_t CTLR; /*!< Ethernet MSC control register, Address offset: 0x100 */ __IO uint32_t RISR; /*!< Ethernet MSC receive interrupt status register, Address offset: 0x104 */ __IO uint32_t TISR; /*!< Ethernet MSC transmit interrupt status register, Address offset: 0x108 */ __IO uint32_t RIMR; /*!< Ethernet MSC receive interrupt mask register, Address offset: 0x10C */ __IO uint32_t TIMR; /*!< Ethernet MSC transmit interrupt mask register, Address offset: 0x110 */ uint32_t RESERVED3[14]; /*!< Reserved, 0x148 */ __IO uint32_t SCCNT; /*!< Ethernet MSC transmitted good frames after a single collision counterregister, Address offset: 0x14C */ __IO uint32_t MSCCNT; /*!< Ethernet MSC transmitted good frames after more than a single collision counterregister, Address offset: 0x150 */ uint32_t RESERVED4[5]; /*!< Reserved, 0x164 */ __IO uint32_t TGFCNT; /*!< Ethernet MSC transmitted good frames counter register, Address offset: 0x168 */ uint32_t RESERVED5[10]; /*!< Reserved, 0x190 */ __IO uint32_t RFCECNT; /*!< Ethernet MSC received frames with CRC error counter register, Address offset: 0x194 */ __IO uint32_t RFAECNT; /*!< Ethernet MSC received frames with alignment error counter register, Address offset: 0x198 */ uint32_t RESERVED6[10]; /*!< Reserved, 0x1C0 */ __IO uint32_t RGUFCNT; /*!< Ethernet MSC received good unicast frames counter register, Address offset: 0x1C4 */ } ETH_MSC_TypeDef; typedef struct { __IO uint32_t TSCTLR; /*!< Ethernet PTP time stamp control register, Address offset: 0x700 */ __IO uint32_t SSINCR; /*!< Ethernet PTP subsecond increment register, Address offset: 0x704 */ __IO uint32_t TMSHR; /*!< Ethernet PTP time stamp high register, Address offset: 0x708 */ __IO uint32_t TMSLR; /*!< Ethernet PTP time stamp low register, Address offset: 0x70C */ __IO uint32_t TMSHUR; /*!< Ethernet PTP time stamp high update register, Address offset: 0x710 */ __IO uint32_t TMSLUR; /*!< Ethernet PTP time stamp low update register, Address offset: 0x714 */ __IO uint32_t TSACNT; /*!< Ethernet PTP time stamp addend register, Address offset: 0x718 */ __IO uint32_t ETHR; /*!< Ethernet PTP expected time high register, Address offset: 0x71C */ __IO uint32_t ETLR; /*!< Ethernet PTP expected time low register, Address offset: 0x720 */ } ETH_PTP_TypeDef; typedef struct { __IO uint32_t BCR; /*!< Ethernet DMA bus control register, Address offset: 0x1000 */ __IO uint32_t TPER; /*!< Ethernet DMA transmit poll enable register, Address offset: 0x1004 */ __IO uint32_t RPER; /*!< Ethernet DMA receive poll enable register, Address offset: 0x1008 */ __IO uint32_t RDTAR; /*!< Ethernet DMA receive descriptor tab address register, Address offset: 0x100C */ __IO uint32_t TDTAR; /*!< Ethernet DMA transmit descriptor tab address register, Address offset: 0x1010 */ __IO uint32_t STR; /*!< Ethernet DMA status register, Address offset: 0x1014 */ __IO uint32_t CTLR; /*!< Ethernet DMA control register, Address offset: 0x1018 */ __IO uint32_t IER; /*!< Ethernet DMA interrupt enable register, Address offset: 0x1018 */ __IO uint32_t MFBOCNT; /*!< Ethernet DMA missed frame and buffer overflow counter register, Address offset: 0x101C */ uint32_t RESERVED7[9]; /*!< Reserved, 0x1044 */ __IO uint32_t CTDAR; /*!< Ethernet DMA current transmit descriptor address register, Address offset: 0x1048 */ __IO uint32_t CRDAR; /*!< Ethernet DMA current receive descriptor address register, Address offset: 0x104C */ __IO uint32_t CTBAR; /*!< Ethernet DMA current transmit buffer address register, Address offset: 0x1050 */ __IO uint32_t CRBAR; /*!< Ethernet DMA current receive buffer address register, Address offset: 0x1054 */ } ETH_DMA_Typedef; /** * @brief External Interrupt/Event Controller */ typedef struct { __IO uint32_t IER; /*!