From: "Leopold Palomo-Avellaneda" Date: Mon, 20 Jan 2014 17:39:27 +0100 References: <201401141315.38870.leo@alaxarxa.net> <201401201718.28484.leo@alaxarxa.net> <52DD4F00.4020703@xenomai.org> In-Reply-To: <52DD4F00.4020703@xenomai.org> MIME-Version: 1.0 Message-Id: <201401201739.28209.leo@alaxarxa.net> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: [Xenomai] xddp port questions List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Philippe Gerum Cc: xenomai@xenomai.org A Dilluns, 20 de gener de 2014, Philippe Gerum va escriure: > On 01/20/2014 05:18 PM, Leopold Palomo-Avellaneda wrote: > > A Dimarts, 14 de gener de 2014, Philippe Gerum va escriure: > >> On 01/14/2014 01:15 PM, Leopold Palomo-Avellaneda wrote: > >>> Hi, > >>> > >>> in the example xddp-label a two realtime task are connected with a no= n- > >>> realtime time. They share the same port where one rt task receive fro= m = the > >>> non-rt task and the other send to rt-task. > >>> > >>> The regular thread read and write in the same devname > >>> (/proc/xenomai/registry/rtipc/xddp/XDDP_PORT_LABEL). One rt thread = listen > > from > >>> that port. > >>> > >>> I don't understand how is possible that both (non-rt and rt threads) > > listen > >>> from the same port and could not have collisions if two threads (non= -rt > > and > >>> rt) try to write in the same port. > >>> > >>> Could not be better to separate it? > >>> > >> > >> No, that would defeat the purpose of the illustration. > >> > >> XDDP is a wrapper over Xenomai's message pipe support, offering a > >> socket-based interface to applications. Each XDDP port is mapped to a > >> given /dev/rtp device minor, but the communication endpoints between RT > >> and NRT are different internally. > >> > >> [XDDP-port] <---> xnpipe # > >> ^ > >> | > >> | * input queue: /dev/rtp -> xnpipe > >> | * output queue: xnpipe -> /dev/rtp > >> | > >> v > >> /dev/rtp > >> > >> So, when NRT reads from /dev/rtp, it does not actually listen to > >> the same endpoint/queue than RT, because message pipes are > >> bi-directional. Likewise, NRT and RT never write to the same queue, > >> since the purpose of message pipes is to cross the RT/NRT domain = boundary. > > > > Ok, > > > > in the example the same thread open a device for write and read from th= e = same > > device. From your answer about the endpoints, I understand that when th= e = NRT > > open for read, read from the RT world, and when the NRT writes to the RT > > world. > > > > So, could I have a NRT function (thread) that open the device to just r= ead > > from the RT world and _another_ that send to the RT world? > > > > Because I have to one the same device, and I don't know that I could do= it = at > > the same time. > > > = > You can both send-receive data to/from the same socket descriptor = > RT-wise, and read-write from/to the same /dev/rtp* descriptor NRT-wise. = > Message pipes are bi-directional by design, on both ends. In the XDDP = > case, traffic is routed as follows: > = > - RT-writes -> NRT-reads > - RT-reads <- NRT-writes > = > So, fd =3D open("/dev/rtpX", ...) =3D> read(fd, and write(fd, are allowed > s =3D socket(AF_RTIPC, ...) =3D> sendmsg(s, and recv(s, are allowed. > = Sorry if I have not been clear or I don't understand you. For design I woul= d = like to make a thread that: fd =3D open("/dev/rtpX", ...) =3D> read(fd, ... to read and another thread to fd =3D open("/dev/rtpX", ...) =3D> write(fd, ... so I open TWO times the /dev/rtpX, one for read and another for write, beca= use = I would like to use it in two different parts, and I don't know if it's = allowed. I understand that the RT part and the NRT part open the same /dev/rtp*, but= I = don't know if several NRT (or RT) could open the same open descriptor at th= e = same time. Regards, Leopold -- = -- Linux User 152692 Catalonia -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: