-
Notifications
You must be signed in to change notification settings - Fork 5.3k
bsp: k230: add spi driver #10917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
bsp: k230: add spi driver #10917
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-11 11:31 CST)
📝 Review Instructions
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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 <fjchuanil@gmail.com>
51d89ea to
948810e
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