Skip to content

Commit f5554ca

Browse files
swift-tknashif
authored andcommitted
emul: mspi: Add the mspi controller emulator
Add bus emulator support for MSPI and the MSPI controller emulator. The mspi_emul.c not only serves as an emulator but also provides an example implementation of the MSPI API. It does not actually do anything other than validating parameters and forwarding transceive request back to the device driver emulators. Signed-off-by: Swift Tian <swift.tian@ambiq.com>
1 parent 99175e1 commit f5554ca

File tree

7 files changed

+1075
-8
lines changed

7 files changed

+1075
-8
lines changed

drivers/mspi/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/mspi.h)
44

55
zephyr_library()
6+
zephyr_library_sources_ifdef(CONFIG_MSPI_EMUL mspi_emul.c)

drivers/mspi/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ module = MSPI
5959
module-str = mspi
6060
source "subsys/logging/Kconfig.template.log_config"
6161

62+
source "drivers/mspi/Kconfig.mspi_emul"
63+
6264
endif # MSPI

drivers/mspi/Kconfig.mspi_emul

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2024, Ambiq Micro Inc. <www.ambiq.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config MSPI_EMUL
5+
bool "MSPI emulator"
6+
default y
7+
depends on DT_HAS_ZEPHYR_MSPI_EMUL_CONTROLLER_ENABLED
8+
depends on EMUL
9+
select MSPI_XIP
10+
select MSPI_SCRAMBLE
11+
select MSPI_TIMING
12+
select GPIO
13+
help
14+
Enable the MSPI emulator driver. This is a fake driver in that it
15+
does not talk to real hardware. Instead it talks to emulation
16+
drivers that pretend to be devices on the emulated MSPI bus. It is
17+
used for testing drivers for MSPI devices.

0 commit comments

Comments
 (0)