Skip to contentSkip to conversation

rpmsg: driver which exposes channels through char devices

PATCH New Matteo Sartori 1 participant 1 message Aug 30, 2016 Remote processor messaging (rpmsg)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpmsg: driver which exposes channels through char devices

Define a new rpmsg driver that matches rpmsg devices named "rpmsg-char-dev". For each probed channel the driver spawns a char device with the naming scheme "rpmsgX", where X is the minor number. It creates a new class named "rpmsg_chardev".
Data received from the bus is put in a per-device kfifo which is RPMSG_BUF_SIZE * 4 large. If the kfifo is found full the message is dropped. The driver also supports three ioctls for giving the user the possibility to examine the state of the underlying buffer.

This patch is based on the code found in OpemAMP repository
https://github.com/OpenAMP/open-amp
at the location
obsolete/system/linux/kernelspace/rpmsg_user_dev_driver/rpmsg_user_dev_driver.c

---
 drivers/rpmsg/Kconfig         |   7 +
 drivers/rpmsg/Makefile        |   1 +
 drivers/rpmsg/rpmsg_chardev.c | 335 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 343 insertions(+)
 create mode 100644 drivers/rpmsg/rpmsg_chardev.c
drivers/rpmsg/Kconfig +7 -0
index 69a2193..6119c1e 100644
@@ -6,4 +6,11 @@ config RPMSG
 	select VIRTIO
 	select VIRTUALIZATION
 
+config RPMSG_CHARDEV
+	tristate "rpmsg char device driver"
+	select RPMSG
+	help
+	  This driver permits userspace programs to access rpmsg channels
+	  through char devices.
+
 endmenu
drivers/rpmsg/Makefile +1 -0
index 7617fcb..b45f1eb 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_RPMSG)	+= virtio_rpmsg_bus.o
+obj-$(CONFIG_RPMSG_CHARDEV) += rpmsg_chardev.o
drivers/rpmsg/rpmsg_chardev.c new file +335 -0

335 lines not on this page · raw message

Signature · 1 line
2.7.4