Skip to content

Commit 948810e

Browse files
committed
bsp: k230: add spi driver
Requirement: The BSP for the k230 platform in the RT-Thread repository does not yet have an spi driver. Solution: Provide spi driver for the k230 platform in the RT-Thread repository. -Supports SPI0(OSPI) controller with 1/2/4/8 data lines. -Supports SPI1(QSPI0) and SPI2(QSPI1) controllers with 1/2/4 data lines. -Implements DMA-based transfers for OSPI, QSPI, and DSPI modes. -Falls back to standard IRQ-driven transfers for legacy SPI mode (single line). —Driver support for input SPI-related structures and QSPI-related structures. Signed-off-by: ChuanN-sudo <[email protected]>
1 parent 925eab7 commit 948810e

File tree

9 files changed

+1338
-0
lines changed

9 files changed

+1338
-0
lines changed

bsp/k230/.ci/attachconfig/ci.attachconfig.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
scons.args: &scons
22
scons_arg:
33
- '--strict'
4+
devices.spi:
5+
<<: *scons
6+
kconfig:
7+
- CONFIG_RT_USING_SPI=y
8+
- CONFIG_BSP_USING_SPI=y
9+
- CONFIG_BSP_USING_SPI0=y
410
devices.i2c:
511
<<: *scons
612
kconfig:

bsp/k230/.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,7 @@ CONFIG_RT_USING_VDSO=y
943943
# CONFIG_PKG_USING_R_RHEALSTONE is not set
944944
# CONFIG_PKG_USING_HEARTBEAT is not set
945945
# CONFIG_PKG_USING_MICRO_ROS_RTTHREAD_PACKAGE is not set
946+
# CONFIG_PKG_USING_CHERRYECAT is not set
946947
# end of system packages
947948

948949
#
@@ -1100,6 +1101,12 @@ CONFIG_RT_USING_VDSO=y
11001101
# CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set
11011102
# CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set
11021103
# end of GD32 Drivers
1104+
1105+
#
1106+
# HPMicro SDK
1107+
#
1108+
# CONFIG_PKG_USING_HPM_SDK is not set
1109+
# end of HPMicro SDK
11031110
# end of HAL & SDK Drivers
11041111

11051112
#
@@ -1619,6 +1626,7 @@ CONFIG_PKG_ZLIB_VER="latest"
16191626
#
16201627
# Drivers Configuration
16211628
#
1629+
# CONFIG_BSP_USING_SPI is not set
16221630
# CONFIG_BSP_USING_I2C is not set
16231631
# CONFIG_BSP_USING_RTC is not set
16241632
# CONFIG_BSP_USING_ADC is not set

bsp/k230/board/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
menu "Drivers Configuration"
2+
3+
menuconfig BSP_USING_SPI
4+
bool "Enable SPI"
5+
select RT_USING_SPI
6+
default n
7+
8+
if BSP_USING_SPI
9+
config RT_USING_SPI0
10+
bool "Enable SPI0(OSPI controller support 1, 2, 4 and 8 lines, Max clock frequency is 200Mhz)"
11+
default n
12+
13+
config RT_USING_SPI1
14+
bool "Enable SPI1(QSPI0 controller support 1, 2 and 4 lines, Max clock frequency is 100Mhz)"
15+
default n
16+
17+
config RT_USING_SPI2
18+
bool "Enable SPI2(QSPI1 controller support 1, 2 and 4 lines, Max clock frequency is 100Mhz)"
19+
default n
20+
endif
21+
222
menuconfig BSP_USING_I2C
323
bool "Enable I2C"
424
select RT_USING_I2C
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RT-Thread building script for SPI component
2+
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
src = Glob('*.c')
7+
CPPPATH = [cwd]
8+
9+
group = DefineGroup('SPI', src, depend = ['BSP_USING_SPI'], CPPPATH = CPPPATH)
10+
11+
Return('group')

0 commit comments

Comments
 (0)