All of lore.kernel.org
 help / color / mirror / Atom feed
From: ayaida marwane <ayaida_marwane@yahoo.fr>
To: xenomai@xenomai.org
Subject: RTDM Kernel Driver exchanging with Linux Application via /dev/rtp0/ using RTIPC Protocol and XDDP socket
Date: Wed, 29 Apr 2020 23:21:53 +0200	[thread overview]
Message-ID: <94C4E050-9732-4A9D-B358-7F93BB36E96D@yahoo.fr> (raw)
In-Reply-To: 94C4E050-9732-4A9D-B358-7F93BB36E96D.ref@yahoo.fr

Dear all,

I am trying to develop a simple example of a RTDM driver running from Xenomai Kernel, that exchanges a string ("Hello world!") with a Linux Application using /dev/rtp0.

I already succeeded doing this with Xenomai 2 using RT_PIPE. However, as I understand, this using RT_PIPE from the Kernel depreciated in Xenomai 3 and it is recommended to use RTIPC Protocol and a XDDP socket.

In the documentation, there are some examples (xddp-echo.c, xddp-label.c and xddp-stream.c), that worked well in my Xenomai 3.0.7 installed on a Raspberry Pi3.

However, these examples are using a simple socket Protocol (socket(), bind(), sendto() and recvfrom()) using the POSIX Skin. So, using this in a RTDM module, will surely not work.

Therefore, as I understand, I have to use the Real-time IPC defined in the RTDM Skin  (socket__AF_RTIPC(), bind__AF_RTIPC(), sendmsg__AF_RTIPC() and recvmsg__AF_RTIPC()).

I started with a simple example (inspired from xddp-echo.c):

---------------------------------------------------------------------------------------------------------------------------------------

#include <rtdm/driver.h>
#include <rtdm/ipc.h>

#define XDDP_PORT 0
static const char *msg = "Hello world!";

static int __init my_module_init (void)
{
        int s;

        rtdm_printk(KERN_INFO "%s.%s()\n", THIS_MODULE->name, __FUNCTION__);

        s = socket__AF_RTIPC(AF_RTIPC, SOCK_DGRAM, IPCPROTO_XDDP);
        if (s < 0) {
                rtdm_printk(KERN_INFO "socket error\n");
        }
}

static void __exit my_module_exit (void)
{
        rtdm_printk(KERN_INFO "%s.%s()\n", THIS_MODULE->name, __FUNCTION__);
}

module_init(my_module_init);
module_exit(my_module_exit);
MODULE_LICENSE("GPL »);

---------------------------------------------------------------------------------------------------------------------------------------

The Makefile used to compile is this one:

---------------------------------------------------------------------------------------------------------------------------------------

obj-m += rtdm-xddp.o

        KERNEL_DIR ?= /usr/src/linux
        MODULE_DIR := $(shell pwd)

modules:
        $(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(MODULE_DIR) modules

clean::
        rm -f  *.o  .*.o  .*.o.* *.ko  .*.ko  *.mod.* .*.mod.* .*.cmd *~
        rm -f Module.symvers Module.markers modules.order
        rm -rf .tmp_versions

---------------------------------------------------------------------------------------------------------------------------------------

The error that I have is:

---------------------------------------------------------------------------------------------------------------------------------------

root@raspberrypi:/home/pi/TD3/xddp-noyau# make
make -C /usr/src/linux SUBDIRS=/home/pi/TD3/xddp-noyau modules
make[1] : on entre dans le répertoire « /usr/src/linux »
  CC [M]  /home/pi/TD3/xddp-noyau/rtdm-xddp.o
/home/pi/TD3/xddp-noyau/rtdm-xddp.c: In function ‘my_module_init’:
/home/pi/TD3/xddp-noyau/rtdm-xddp.c:35:13: error: implicit declaration of function ‘socket__AF_RTIPC’; did you mean ‘socket_seq_show’? [-Werror=implicit-function-declaration]
         s = socket__AF_RTIPC(AF_RTIPC, SOCK_DGRAM, IPCPROTO_XDDP);
             ^~~~~~~~~~~~~~~~
             socket_seq_show
At top level:
/home/pi/TD3/xddp-noyau/rtdm-xddp.c:16:20: warning: ‘msg’ defined but not used [-Wunused-variable]
 static const char *msg = "Hello world!";
                    ^~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:335: /home/pi/TD3/xddp-noyau/rtdm-xddp.o] Error 1
make[1]: *** [Makefile:1528: _module_/home/pi/TD3/xddp-noyau] Error 2
make[1] : on quitte le répertoire « /usr/src/linux »
make: *** [Makefile:8: modules] Error 2

---------------------------------------------------------------------------------------------------------------------------------------

I verified that socket__AF_RTIPC is  well defined in rtdm/uapi/ipc.h, which is included on rtdm/ipc.h. So with #include <rtdm/ipc.h>, I must have resolved this issue and socket__AF_RTIPC must be already declared.

I did not even add for now the other RTIPC socket's methods (bind__AF_RTIPC(), sendmsg__AF_RTIPC() and recvmsg__AF_RTIPC()).

Am I understanding well or I missed something? Could you please clarify if I am wrong. Perhaps, this is not possible?

Otherwise, did you have such an example using RTIPC Protocol to communicate with a Linux application, It could inspire me to fix my error. I did not found any example on the net...

Thank you for your support.

Best regards,
Marwane Ayaida.








       reply	other threads:[~2020-04-29 21:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <94C4E050-9732-4A9D-B358-7F93BB36E96D.ref@yahoo.fr>
2020-04-29 21:21 ` ayaida marwane [this message]
2020-05-05 19:22   ` RTDM Kernel Driver exchanging with Linux Application via /dev/rtp0/ using RTIPC Protocol and XDDP socket Jan Kiszka
2020-05-09  0:59     ` ayaida marwane
2020-05-11  6:44       ` Jan Kiszka
2022-05-23 22:16       ` ayaida marwane

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=94C4E050-9732-4A9D-B358-7F93BB36E96D@yahoo.fr \
    --to=ayaida_marwane@yahoo.fr \
    --cc=xenomai@xenomai.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.