Skip to contentSkip to conversation

EVL Interrupt

DISCUSSION Sebastian Blaesing 2 participants 2 messages May 16, 2022

lore
Share & tools
lore
#0 lore raw

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?

----
Sebastian

#1 lore raw
Quoted 7 lines · Sebastian Blaesing via Xenomai

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.