[stm32][drivers] Add BDMA support for SPI - #11689
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: bsp_stm32Reviewers: @Liang1795 @hamburger-os @wdfk-prog Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-08-09 16:30 CST)
📝 Review Instructions
|
|
现在还是草稿阶段...稍后整理一下BSP部分,开启一个BSP的PR再推上来吧 |
struct stm32_bdma_config
{
void *Instance; /**< BDMA channel instance pointer. */
rt_uint32_t dma_rcc; /**< RCC enable bit for the BDMA controller. */
IRQn_Type dma_irq; /**< NVIC IRQ number for the BDMA channel. */
rt_uint32_t priority; /**< BDMA transfer priority. */
rt_uint8_t preempt_priority; /**< NVIC preempt priority for the BDMA IRQ. */
rt_uint8_t sub_priority; /**< NVIC sub priority for the BDMA IRQ. */
rt_uint32_t request; /**< BDMA request selector. */
rt_uint32_t direction; /**< BDMA transfer direction. */
rt_uint32_t periph_inc; /**< Peripheral address increment mode. */
rt_uint32_t mem_inc; /**< Memory address increment mode. */
rt_uint32_t periph_data_alignment; /**< Peripheral data alignment. */
rt_uint32_t mem_data_alignment; /**< Memory data alignment. */
rt_uint32_t mode; /**< BDMA transfer mode. */
};
/**
* @brief Static DMA endpoint description used by board-level config headers.
*
* This descriptor stores one complete DMA endpoint configuration so peripheral
* drivers can initialize DMA directly from the board-level config tables.
*/
struct stm32_dma_config
{
DMA_INSTANCE_TYPE *Instance; /**< DMA controller instance pointer. */
rt_uint32_t dma_rcc; /**< RCC enable bit for the DMA controller. */
IRQn_Type dma_irq; /**< DMA global IRQ number. */
rt_uint32_t priority; /**< DMA transfer priority. */
rt_uint8_t preempt_priority; /**< NVIC preempt priority for the DMA IRQ. */
rt_uint8_t sub_priority; /**< NVIC sub priority for the DMA IRQ. */
#if defined(STM32_DMA_USES_GPDMA)
rt_uint32_t request; /**< DMA request selector for the GPDMA channel. */
rt_uint32_t blk_hw_request; /**< GPDMA block hardware request mode. */
rt_uint32_t direction; /**< DMA transfer direction. */
rt_uint32_t src_inc; /**< GPDMA source increment mode. */
rt_uint32_t dest_inc; /**< GPDMA destination increment mode. */
rt_uint32_t src_data_width; /**< GPDMA source data width. */
rt_uint32_t dest_data_width; /**< GPDMA destination data width. */
rt_uint32_t src_burst_length; /**< GPDMA source burst length. */
rt_uint32_t dest_burst_length; /**< GPDMA destination burst length. */
rt_uint32_t transfer_allocated_port;/**< GPDMA allocated port selection. */
rt_uint32_t transfer_event_mode; /**< GPDMA transfer event mode. */
rt_uint32_t mode; /**< DMA transfer mode. */
#else
#ifdef STM32_DMA_USES_CHANNEL
rt_uint32_t channel; /**< DMA channel selector for stream-based DMA. */
#endif /* STM32_DMA_USES_CHANNEL */
#ifdef STM32_DMA_USES_REQUEST
rt_uint32_t request; /**< DMA request selector for DMAMUX/request-based DMA. */
#endif /* STM32_DMA_USES_REQUEST */
rt_uint32_t direction; /**< DMA transfer direction. */
rt_uint32_t periph_inc; /**< Peripheral address increment mode. */
rt_uint32_t mem_inc; /**< Memory address increment mode. */
rt_uint32_t periph_data_alignment; /**< Peripheral data alignment. */
rt_uint32_t mem_data_alignment; /**< Memory data alignment. */
rt_uint32_t mode; /**< DMA transfer mode. */
#if defined(STM32_DMA_SUPPORTS_FIFO)
rt_uint32_t fifo_mode; /**< FIFO enable state. */
rt_uint32_t fifo_threshold; /**< FIFO threshold selection. */
rt_uint32_t mem_burst; /**< Memory burst transfer mode. */
rt_uint32_t periph_burst; /**< Peripheral burst transfer mode. */
#endif /* defined(STM32_DMA_SUPPORTS_FIFO) */
#endif /* defined(STM32_DMA_USES_GPDMA) */
};
|
|
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
对于H7系列的SPI,其缺失BDMA驱动,因此制作了相关驱动使其正常工作
你的解决方案是什么 (what is your solution)
仿照drv_dma的设计,在驱动层单独设计了一套bdma驱动,而上层spi处基本复用dma逻辑。
请提供验证的bsp和config (provide the config and bsp)
已在DM-MC02 上完成验证工作,验证使用自行编写的WS2812驱动软件包,测试正常点亮,效果与阻塞一致,且不影响串口等其他外设。该BSP以及相关软件包会稍后进行格式清理等后推送。此外进行了scons -j8等编译均通过。
]
当前拉取/合并请求的状态 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