Files
rt-thread/components/drivers
Chen Moushun 37d8b8d1d0 drivers/spi: QEMU virtual SPI loopback bus for utest (#11972) (#11979)
* drivers/spi: add QEMU virtual SPI loopback bus for utest (#11972)

Register a pure-software SPI bus (default name spi2) with memcpy
loopback xfer so components.drivers.spi.loopback passes on
qemu-vexpress-a9 without a PL022 model. Fix utest include/CPPPATH
and align Kconfig/rtconfig bus name.

Verified: scons + qemu utest_run components.drivers.spi.loopback PASSED.

Fixes #11972 (SPI/QEMU checklist item).

* drivers/spi: fix clang-format violations in spi_virt_bus.c

Fix the 'Check File Format and License' CI job failure:

- put the spi_virt_ops initializer brace on the assignment line
- add the missing newline at end of file

No functional change.

* drivers/spi: separate virt bus Kconfig from loopback utest (#11972)

Add a dedicated, default-off RT_UTEST_SPI_VIRT_BUS switch (default name
spi_virt) so enabling RT_UTEST_SPI_LOOPBACK no longer compiles or
registers a software SPI bus. Hardware loopback now always runs on the
real controller named by RT_UTEST_SPI_LOOPBACK_BUS_NAME, while QEMU/CI
targets opt in to the virtual bus explicitly.

Also move the utest enablement out of the qemu-vexpress-a9 BSP defaults
and into ci.attachconfig as peripheral.SPI_VIRT_LOOPBACK.

* cla: empty commit to retrigger license/cla check (#11979)

* ci(utest): add A9 SPI loopback virt bus config (#11979)

* [drivers][spi] gate virtual SPI bus utest on !RT_USING_DM

RT_UTEST_SPI_VIRT_BUS compiles spi_virt_bus.c, which registers a software
loopback bus with rt_spi_bus_register(). That path needs no device tree
node, so on a BSP that enables RT_USING_DM and RT_USING_OFW the
registration fails with -RT_EINVAL when no matching DT node exists.

Add "depends on !RT_USING_DM" to the option and document in help that it
is only available without the device model and must stay disabled on DM
based BSPs. spi_virt_bus.c is already fully wrapped in
#ifdef RT_UTEST_SPI_VIRT_BUS, so no C change is needed.

The A9 utest config (bsp/qemu-vexpress-a9) has RT_USING_DM disabled, and
.github/utest/configs/components/spi.cfg still enables both the virt bus
and the loopback test with bus name "spi_virt", so CI coverage is kept.

Refs #11972
2026-11-08 14:48:35 +08:00
..
…
2026-08-07 09:25:45 +08:00
2026-10-17 09:44:26 +08:00
…
…
2026-10-17 09:44:26 +08:00
2026-10-17 09:44:26 +08:00
…
…
…