feat[driver][gd32]: Improve the RTC driver and support alarm interrupts

This commit is contained in:
Yuqiang Wang
2025-10-10 10:54:53 +08:00
committed by R b b666
parent 273185b45a
commit 4f7bc8c4c0
20 changed files with 610 additions and 266 deletions
+14 -8
View File
@@ -140,16 +140,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -136,16 +136,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -144,16 +144,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -136,16 +136,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -140,16 +140,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -170,16 +170,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -140,16 +140,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -136,16 +136,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -137,16 +137,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -314,16 +314,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -294,16 +294,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -362,16 +362,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -355,16 +355,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -377,16 +377,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -324,16 +324,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+15 -8
View File
@@ -176,6 +176,7 @@ menu "On-chip Peripheral Drivers"
Fast mode: 400000 (400KHz)
Fast mode plus: 1000000 (1MHz)
endif
endmenu
menuconfig BSP_USING_ADC
bool "Enable ADC"
@@ -206,16 +207,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select RTC clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC using LSE (External Crystal)"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC using LSI (Internal RC)"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
+14 -8
View File
@@ -157,16 +157,22 @@ menu "On-chip Peripheral Drivers"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LSE
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_RTC_USING_LSE
bool "RTC USING LSE"
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_RTC_USING_LSI
bool "RTC USING LSI"
endchoice
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
config BSP_USING_WDT
@@ -69,6 +69,29 @@ menu "On-chip Peripheral Drivers"
endif
menuconfig BSP_USING_ONCHIP_RTC
bool "Enable RTC"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
config BSP_USING_ALARM
bool "Enable RTC alarm"
select RT_USING_ALARM
default n
if BSP_USING_ALARM
choice
prompt "Select rtc alarm device"
default BSP_USING_ALARM0
config BSP_USING_ALARM0
bool "Enable RTC Alarm0"
config BSP_USING_ALARM1
bool "Enable RTC Alarm1"
endchoice
endif
endif
source "$(BSP_DIR)/../libraries/gd32_drivers/Kconfig"
endmenu
@@ -18,8 +18,8 @@ if GetDepend(['RT_USING_SERIAL']):
src += ['drv_usart_v2.c']
else:
src += ['drv_usart.c']
# add i2c hard drivers.
# add i2c hard drivers.
if GetDepend(['RT_USING_I2C']):
if GetDepend('BSP_USING_HARD_I2C0') or GetDepend('BSP_USING_HARD_I2C1') or GetDepend('BSP_USING_HARD_I2C2') or GetDepend('BSP_USING_HARD_I2C3') or GetDepend('BSP_USING_HARD_I2C4') or GetDepend('BSP_USING_HARD_I2C5'):
src += ['drv_hard_i2c.c']
File diff suppressed because it is too large Load Diff