qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: pisa@cmp.felk.cvut.cz
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	Konrad Frederic <frederic.konrad@adacore.com>,
	Deniz Eren <deniz.eren@icloud.com>,
	Oliver Hartkopp <socketcan@hartkopp.net>,
	Marek Vasut <marex@denx.de>, Jan Kiszka <jan.kiszka@siemens.com>,
	Pavel Pisa <pisa@cmp.felk.cvut.cz>
Subject: [Qemu-devel] [PATCH 0/5 v2] CAN bus support for QEMU (SJA1000 PCI so far)
Date: Thu,  2 Nov 2017 02:00:55 +0100	[thread overview]
Message-ID: <cover.1509583771.git.pisa@cmp.felk.cvut.cz> (raw)

From: Pavel Pisa <pisa@cmp.felk.cvut.cz>

Basic emulation of CAN bus controller and interconnection for QEMU.

Patches version 2:
The bus emulation and the SJA1000 chip emulation introduced
by individual patches as suggested by Frederic Konrad.
Simple example board to test SJA1000 as single memory-mapped BAR
has been omitted in a new series because emulation of real
existing boards can provide same functions now.
Conditionalized debug printfs changed to be exposed to compiler
syntax check as suggested in review.

The work has been started by Jin Yang in the frame of GSoC 2013 slot
contributed by RTEMS project which has been looking for environment
to allow develop and test CAN drivers for multiple CPU architectures.

I have menthored the project and then done substantial code cleanup
and update to QOM. Deniz Eren then used emulation for SJA1000 base card
driver development for other operating system and contributed
PCM-3680I and MIOe-3680 support.

Some page about the project

  https://gitlab.fel.cvut.cz/canbus/qemu-canbus/wikis/home

FEE CTU GitLab repository with can-pci branch for 2.3, 2.4, 2.7, 2.8 and 2.10
version if QEMU is available there

  https://gitlab.fel.cvut.cz/canbus/qemu-canbus/tree/can-pci

mirror at GitHub

  https://github.com/CTU-IIG/qemu

There are many areas for improvement and extension of the code still
(for example freeze and migration is not implemented. CAN controllers
use proper QOM model but bus/interconnection emulation uses simple broadcast
connection which is required for CAN, but it is not based on QEMU bus model).
I have tried to look into QEMU VLANs implementation but it
does not map straightforward to CAN and I would need some help/opinion
from more advanced developers to decide what is their right
mapping to CAN.

CAN-FD support would be interesting requires other developers/
companies contributions or setup of some project to allow invite
some students and colleagues from my university into project.

But I believe that (even in its actual state) provided solution
is great help for embedded systems developers when they can connect
SocketCAN from one or more embedded systems running in virtual
environment together or with Linux host SocketCAN virtual
or real bus interfaces.

We have even tested our generic CANopen device configured
for CANopen 401 profile for generic I/O running in the virtual
system which can control GPIO inputs/outputs through virtual
industrial I/O card.

Generally QEMU can be interesting setup which allows
to test complete industrial applications in virtual
environment even before real hardware is availabe.

Pavel

Deniz Eren (2):
  CAN bus PCM-3680I PCI (dual SJA1000 channel) emulation added.
  CAN bus MIOe-3680 PCI (dual SJA1000 channel) emulation added.

Pavel Pisa (3):
  CAN bus simple messages transport implementation for QEMU
  CAN bus SJA1000 chip register level emulation for QEMU
  CAN bus Kvaser PCI CAN-S (single SJA1000 channel) emulation added.

 default-configs/pci.mak   |   3 +
 hw/Makefile.objs          |   1 +
 hw/can/Makefile.objs      |   7 +
 hw/can/can_core.c         | 374 ++++++++++++++++++
 hw/can/can_kvaser_pci.c   | 376 ++++++++++++++++++
 hw/can/can_mioe3680_pci.c | 335 ++++++++++++++++
 hw/can/can_pcm3680_pci.c  | 335 ++++++++++++++++
 hw/can/can_sja1000.c      | 973 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/can/can_sja1000.h      | 176 +++++++++
 include/can/can_emu.h     | 133 +++++++
 10 files changed, 2713 insertions(+)
 create mode 100644 hw/can/Makefile.objs
 create mode 100644 hw/can/can_core.c
 create mode 100644 hw/can/can_kvaser_pci.c
 create mode 100644 hw/can/can_mioe3680_pci.c
 create mode 100644 hw/can/can_pcm3680_pci.c
 create mode 100644 hw/can/can_sja1000.c
 create mode 100644 hw/can/can_sja1000.h
 create mode 100644 include/can/can_emu.h

-- 
2.11.0

             reply	other threads:[~2017-11-02  1:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02  1:00 pisa [this message]
2017-11-02  1:00 ` [Qemu-devel] [PATCH 1/5] CAN bus simple messages transport implementation for QEMU pisa
2017-11-02  1:53   ` Philippe Mathieu-Daudé
2017-11-02  2:06   ` Philippe Mathieu-Daudé
2017-11-02  1:00 ` [Qemu-devel] [PATCH 2/5] CAN bus SJA1000 chip register level emulation " pisa
2017-11-02  2:40   ` Philippe Mathieu-Daudé
2017-11-02  1:00 ` [Qemu-devel] [PATCH 3/5] CAN bus Kvaser PCI CAN-S (single SJA1000 channel) emulation added pisa
2017-11-02  2:46   ` Philippe Mathieu-Daudé
2017-11-02  1:00 ` [Qemu-devel] [PATCH 4/5] CAN bus PCM-3680I PCI (dual " pisa
2017-11-02  1:01 ` [Qemu-devel] [PATCH 5/5] CAN bus MIOe-3680 " pisa
2017-11-02  1:21 ` [Qemu-devel] [PATCH 0/5 v2] CAN bus support for QEMU (SJA1000 PCI so far) no-reply
2017-11-02  1:27 ` Philippe Mathieu-Daudé
2017-11-02  2:10   ` Pavel Pisa
2017-11-02  3:17     ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1509583771.git.pisa@cmp.felk.cvut.cz \
    --to=pisa@cmp.felk.cvut.cz \
    --cc=deniz.eren@icloud.com \
    --cc=frederic.konrad@adacore.com \
    --cc=jan.kiszka@siemens.com \
    --cc=marex@denx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=socketcan@hartkopp.net \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).