Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: bsp_k230Reviewers: unicornx Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-11-16 11:22 CST)
📝 Review Instructions
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds SPI driver support for the K230 platform, providing the capability to use SPI0 (OSPI), SPI1 (QSPI0), and SPI2 (QSPI1) controllers. The driver supports both standard SPI and QSPI modes with 1/2/4/8 data lines, implements DMA-based transfers for multi-line modes, and falls back to IRQ-driven transfers for legacy single-line SPI mode.
Key Changes:
- New SPI driver implementation supporting multiple data line configurations (1/2/4/8 lines)
- DMA-based transfer support for high-speed multi-line modes
- IRQ-driven transfer fallback for standard SPI mode
- Support for both
rt_spi_deviceandrt_qspi_devicestructures
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| bsp/k230/drivers/interdrv/spi/drv_spi.c | Core SPI driver implementation with configure, transfer, and IRQ handling functions |
| bsp/k230/drivers/interdrv/spi/drv_spi.h | SPI register definitions and hardware configuration macros |
| bsp/k230/drivers/utest/test_spi.c | Unit tests demonstrating both SPI and QSPI device usage |
| bsp/k230/board/Kconfig | Configuration options for enabling SPI0/SPI1/SPI2 controllers |
| bsp/k230/drivers/utest/SConscript | Build script integration for SPI test cases |
| bsp/k230/.ci/attachconfig/ci.attachconfig.yml | CI configuration for SPI testing |
| bsp/k230/.config | Updated configuration file with new package options |
| bsp/k230/rtconfig.h | Added HPMicro SDK section |
51d89ea to
948810e
Compare
607ea32 to
f3820f1
Compare
bsp/k230/board/Kconfig
Outdated
|
|
||
| if BSP_USING_SPI | ||
| config BSP_USING_SPI0 | ||
| bool "Enable SPI0(OSPI controller support 1, 2, 4 and 8 lines, Max clock frequency is 200Mhz)" |
There was a problem hiding this comment.
菜单项的 TEXT 部分太长了,大量的解释可以放到 Kconfig 的 help 中
另外,避免 OSPI 和 QSPI0, QSPI1 这些说法,这个不是标准的描述
综上,以 SPI0 为例可以写成:
bool “Enable SPI0”
help
Support 1, 2, 4 and 8 lines. Max clock frequency is 200Mhz.
| /* Transfer Done Clear Interrupt Clear Register (0x134)*/ | ||
| volatile uint32_t donecr; | ||
| #endif | ||
| /* resv (0x138 ~ 0x13c)*/ |
f3820f1 to
e483cf2
Compare
|
@Rbb666 please have a review, thanks. |
e483cf2 to
b0cc531
Compare
|
您那边ci的编译报错我这边显示是warning,现已修改。copilot找到的问题也修改了 |
好的,等待CI通过后就可以合并了 |
| } | ||
| if (qspi_cfg_parent->data_width < 4 || qspi_cfg_parent->data_width > 32) | ||
| { | ||
| return RT_EINVAL; |
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). - Updates documentation in bsp/README.md Signed-off-by: ChuanN-sudo <fjchuanil@gmail.com>
b0cc531 to
972daa9
Compare


Continue from #10885
增加了对于spi和qspi两种调用方式的支持,在utest里增加了相关测试demo;
kconfig中从qspi改为spi,增添了对于时钟速度和支持模式的说明;
按照 #10885的comment提到的改动建议进行了修改
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.
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
为K230添加spi驱动
你的解决方案是什么 (what is your solution)
添加spi驱动
请提供验证的bsp和config (provide the config and bsp)
BSP:/bsp/k230/drivers/interdrv/spi
.config:
action:
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up