drivers: can: add support for configuring CAN emulation in QEMU
Add support for configuring CAN emulation support in QEMU. For now, the only supported CAN controller is the single-channel Kvaser PCIcan PCI card. Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
This commit is contained in:
parent
58e12726bf
commit
abf82013ac
2 changed files with 25 additions and 0 deletions
|
@ -269,6 +269,22 @@ elseif(QEMU_NET_STACK)
|
||||||
endif()
|
endif()
|
||||||
endif(QEMU_PIPE_STACK)
|
endif(QEMU_PIPE_STACK)
|
||||||
|
|
||||||
|
if(CONFIG_CAN)
|
||||||
|
# Add CAN bus 0
|
||||||
|
list(APPEND QEMU_FLAGS -object can-bus,id=canbus0)
|
||||||
|
|
||||||
|
if(NOT "${CONFIG_CAN_QEMU_IFACE_NAME}" STREQUAL "")
|
||||||
|
# Connect CAN bus 0 to host SocketCAN interface
|
||||||
|
list(APPEND QEMU_FLAGS
|
||||||
|
-object can-host-socketcan,id=canhost0,if=${CONFIG_CAN_QEMU_IFACE_NAME},canbus=canbus0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_CAN_KVASER_PCI)
|
||||||
|
# Emulate a single-channel Kvaser PCIcan card connected to CAN bus 0
|
||||||
|
list(APPEND QEMU_FLAGS -device kvaser_pci,canbus=canbus0)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_X86_64 AND NOT CONFIG_QEMU_UEFI_BOOT)
|
if(CONFIG_X86_64 AND NOT CONFIG_QEMU_UEFI_BOOT)
|
||||||
# QEMU doesn't like 64-bit ELF files. Since we don't use any >4GB
|
# QEMU doesn't like 64-bit ELF files. Since we don't use any >4GB
|
||||||
# addresses, converting it to 32-bit is safe enough for emulation.
|
# addresses, converting it to 32-bit is safe enough for emulation.
|
||||||
|
|
|
@ -89,6 +89,15 @@ config CAN_AUTO_BUS_OFF_RECOVERY
|
||||||
recessive bits). When this option is enabled, the recovery API is not
|
recessive bits). When this option is enabled, the recovery API is not
|
||||||
available.
|
available.
|
||||||
|
|
||||||
|
config CAN_QEMU_IFACE_NAME
|
||||||
|
string "SocketCAN interface name for QEMU"
|
||||||
|
default ""
|
||||||
|
depends on QEMU_TARGET
|
||||||
|
help
|
||||||
|
The SocketCAN interface name for QEMU. This value, if set, is given as "if" parameter to
|
||||||
|
the "-object can-host-socketcan" qemu command line option. The CAN interface must be
|
||||||
|
configured before starting QEMU.
|
||||||
|
|
||||||
source "drivers/can/Kconfig.sam"
|
source "drivers/can/Kconfig.sam"
|
||||||
source "drivers/can/Kconfig.stm32"
|
source "drivers/can/Kconfig.stm32"
|
||||||
source "drivers/can/Kconfig.stm32fd"
|
source "drivers/can/Kconfig.stm32fd"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue