[bsp/gd32] 更新GD32 SPI驱动 #10657

This commit is contained in:
WangShun
2025-09-02 12:13:44 +08:00
committed by GitHub
parent 32c8bb7109
commit f8a37bc42e
4 changed files with 211 additions and 42 deletions
+16 -7
View File
@@ -258,19 +258,28 @@ menu "On-chip Peripheral Drivers"
default n
select RT_USING_SPI
if BSP_USING_SPI
config BSP_USING_SPI0
bool "Enable SPI0 BUS"
default n
config BSP_USING_SPI1
bool "Enable SPI1 BUS"
default n
config BSP_SPI1_TX_USING_DMA
bool "Enable SPI1 TX DMA"
depends on BSP_USING_SPI1
config BSP_USING_SPI2
bool "Enable SPI2 BUS"
default n
config BSP_SPI1_RX_USING_DMA
bool "Enable SPI1 RX DMA"
depends on BSP_USING_SPI1
select BSP_SPI1_TX_USING_DMA
config BSP_USING_SPI3
bool "Enable SPI3 BUS"
default n
config BSP_USING_SPI4
bool "Enable SPI4 BUS"
default n
config BSP_USING_SPI5
bool "Enable SPI5 BUS"
default n
endif
+25
View File
@@ -99,6 +99,31 @@ menu "On-chip Peripheral Drivers"
endif
endif
menuconfig BSP_USING_SPI
bool "Enable SPI BUS"
default n
select RT_USING_SPI
if BSP_USING_SPI
config BSP_USING_SPI0
bool "Enable SPI0 BUS"
default n
config BSP_USING_SPI1
bool "Enable SPI1 BUS"
default n
config BSP_USING_SPI2
bool "Enable SPI2 BUS"
default n
config BSP_USING_SPI3
bool "Enable SPI3 BUS"
default n
config BSP_USING_SPI4
bool "Enable SPI4 BUS"
default n
config BSP_USING_SPI5
bool "Enable SPI5 BUS"
default n
endif
source "$(BSP_DIR)/../libraries/gd32_drivers/Kconfig"
endmenu
File diff suppressed because it is too large Load Diff
@@ -13,6 +13,7 @@
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#ifdef __cplusplus
@@ -31,10 +32,14 @@ struct gd32_spi
uint32_t spi_periph;
char *bus_name;
rcu_periph_enum spi_clk;
rcu_periph_enum gpio_clk;
rcu_periph_enum sck_gpio_clk;
rcu_periph_enum miso_gpio_clk;
rcu_periph_enum mosi_gpio_clk;
struct rt_spi_bus *spi_bus;
uint32_t spi_port;
#if defined SOC_SERIES_GD32F4xx || defined SOC_SERIES_GD32E23x
uint32_t sck_spi_port;
uint32_t miso_spi_port;
uint32_t mosi_spi_port;
#if defined SOC_SERIES_GD32F4xx || defined SOC_SERIES_GD32E23x || defined SOC_SERIES_GD32H7xx || defined SOC_SERIES_GD32F5xx
uint32_t alt_func_num;
#endif
uint16_t sck_pin;