All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Sebastian Blaesing <sebastian.blaesing@abaxor.de>
Cc: xenomai@xenomai.org
Subject: Re: EVL Interrupt
Date: Mon, 16 May 2022 17:09:32 +0200	[thread overview]
Message-ID: <87tu9ph5cp.fsf@xenomai.org> (raw)
In-Reply-To: <3d2f5bbd-598c-19f2-6451-a72d5da47b8a@abaxor.de>


Sebastian Blaesing via Xenomai <xenomai@xenomai.org> writes:

> Hi all,
>
> what is the best and fastest way to pass critical hardware Irq signal
> to control a semaphore in user space application?
>
> Is it possible that kernel and user space share a semaphore?
>

You do this indirectly: in the kernel driver which implements the IRQ
handler, you create an EVL sema4, and an oob_ioctl() or oob_read()
handler which waits on it. The IRQ handler posts the sema4 which the
user-space application pends on via a call to oob_{ioctl|read}().

The driver which talks to the 'latmus' application implements the same
pattern, using an EVL flag instead of a sema4, but the logic is
otherwise the same. Some handler triggered by some event (here a timer,
yours would be triggered by an IRQ) raises a flag [1], which is awaited
by a function [2] which is called by the application via the oob_ioctl()
syscall [3].

HTH,

[1] https://source.denx.de/Xenomai/xenomai4/linux-evl/-/blob/v5.15.y-evl-rebase/drivers/evl/latmus.c#L561
[2] https://source.denx.de/Xenomai/xenomai4/linux-evl/-/blob/v5.15.y-evl-rebase/drivers/evl/latmus.c#L627
[3]
https://source.denx.de/Xenomai/xenomai4/linux-evl/-/blob/v5.15.y-evl-rebase/drivers/evl/latmus.c#L1130

--
Philippe.


      reply	other threads:[~2022-05-16 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 11:10 EVL Interrupt Sebastian Blaesing
2022-05-16 15:09 ` Philippe Gerum [this message]

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=87tu9ph5cp.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=sebastian.blaesing@abaxor.de \
    --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.