From nobody Fri Dec 19 16:05:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1515961415977818.0890901342847; Sun, 14 Jan 2018 12:23:35 -0800 (PST) Received: from localhost ([::1]:33969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eaooY-00046H-VQ for importer@patchew.org; Sun, 14 Jan 2018 15:23:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eaogs-0007V1-66 for qemu-devel@nongnu.org; Sun, 14 Jan 2018 15:15:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eaogp-0005rK-11 for qemu-devel@nongnu.org; Sun, 14 Jan 2018 15:15:38 -0500 Received: from smtp8.web4u.cz ([81.91.87.88]:45560 helo=mx-8.mail.web4u.cz) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eaogo-0005qQ-EF for qemu-devel@nongnu.org; Sun, 14 Jan 2018 15:15:34 -0500 Received: from mx-8.mail.web4u.cz (localhost [127.0.0.1]) by mx-8.mail.web4u.cz (Postfix) with ESMTP id 8430F1FF69C; Sun, 14 Jan 2018 21:15:31 +0100 (CET) Received: from baree.pikron.com (unknown [89.102.4.32]) (Authenticated sender: ppisa@pikron.com) by mx-8.mail.web4u.cz (Postfix) with ESMTPA id 44FB71FF62C; Sun, 14 Jan 2018 21:15:31 +0100 (CET) From: pisa@cmp.felk.cvut.cz To: qemu-devel@nongnu.org Date: Sun, 14 Jan 2018 21:14:11 +0100 Message-Id: <3aa888748c9d7e636e08e7d1c1dbe13e3e8e0e6c.1515960078.git.pisa@cmp.felk.cvut.cz> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-W4U-Auth: a8ac4e6e3a71c8195f61751ed511d9acd76c741a X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 81.91.87.88 Subject: [Qemu-devel] [PATCH V4 5/7] QEMU CAN bus emulation documentation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Oliver Hartkopp , Stefan Hajnoczi , Deniz Eren , Oleksij Rempel , Konrad Frederic , Jan Kiszka , Pavel Pisa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Pisa Signed-off-by: Pavel Pisa --- docs/can.txt | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 78 insertions(+) create mode 100644 docs/can.txt diff --git a/docs/can.txt b/docs/can.txt new file mode 100644 index 0000000000..ac3170e947 --- /dev/null +++ b/docs/can.txt @@ -0,0 +1,78 @@ +QEMU CAN bus emulation support +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D + +The CAN bus emulation provides mechanism to connect multiple +emulated CAN controller chips together by one or multiple CAN busses +(the controller device "canbus" parameter). The individual busses +can be connected to host system CAN API (at this time only Linux +SocketCAN is supported). + +The concept of busses is generic and different CAN controllers +can be implemented for it but at this time only SJA1000 chip +controller is implemented. + +The PCI addon card hardware has been selected as the first CAN +interface to implement because such device can be easily connected +to systems with different CPU architectures (x86, PowerPC, ARM, etc.). + +The project has been initially started in frame of RTEMS GSoC 2013 +slot by Jin Yang under our mentoring The initial idea was to provide gene= ric +CAN subsystem for RTEMS. But lack of common environment for code and RTEMS +testing lead to goal change to provide environment which provides complete +emulated environment for testing and RTEMS GSoC slot has been donated +to work on CAN hardware emulation on QEMU. + +Examples how to use CAN emulation +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D + +When QEMU with CAN PCI support is compiled then one of the next +CAN boards can be selected + + (1) CAN bus Kvaser PCI CAN-S (single SJA1000 channel) boad. QEMU startup = options + -device kvaser_pci,canbus=3Dcanbus0 + Add "host" parameter to connect device to host system CAN bus + -device kvaser_pci,canbus=3Dcanbus0,host=3Dcan0 + + (2) CAN bus PCM-3680I PCI (dual SJA1000 channel) emulation + -device pcm3680_pci,canbus=3Dcanbus0,host=3Dcan0 + + (3) CAN bus MIOe-3680 PCI (dual SJA1000 channel) emulation + -device mioe3680_pci,canbus=3Dcanbus0,host=3Dcan0 + + +The ''kvaser_pci'' board/device model is compatible with and has been test= ed with +''kvaser_pci'' driver included in mainline Linux kernel. +The tested setup was Linux 4.9 kernel on the host and guest side. + +Next parameters has been used for qemu-system-x86_64 + + qemu-system-x86_64 -enable-kvm -kernel /boot/vmlinuz-4.9.0-4-amd64 \ + -initrd ramdisk.cpio \ + -virtfs local,path=3Dshareddir,security_model=3Dnone,mount_tag=3Dsha= reddir \ + -vga cirrus \ + -device kvaser_pci,canbus=3Dcanbus0,host=3Dcan0 \ + -nographic -append "console=3DttyS0" + +The list of parameters for qemu-system-arm + + qemu-system-arm -cpu arm1176 -m 256 -M versatilepb \ + -kernel kernel-qemu-arm1176-versatilepb \ + -hda rpi-wheezy-overlay \ + -append "console=3DttyAMA0 root=3D/dev/sda2 ro init=3D/sbin/init-ove= rlay" \ + -nographic \ + -virtfs local,path=3Dshareddir,security_model=3Dnone,mount_tag=3Dsha= reddir \ + -device kvaser_pci,canbus=3Dcanbus0,host=3Dcan0 \ + +Links to other resources +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + + (1) Repository with development branch can-pci at Czech Technical Univers= ity + https://gitlab.fel.cvut.cz/canbus/qemu-canbus + (2) GitHub repository with can-pci and our other changes included + https://gitlab.fel.cvut.cz/canbus/qemu-canbus + (3) RTEMS page describing project + https://devel.rtems.org/wiki/Developer/Simulators/QEMU/CANEmulation + (4) RTLWS 2015 article about the projevt and its use with CANopen emulati= on + http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can.pdf + Slides + http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can-slid= es.pdf --=20 2.11.0