From mboxrd@z Thu Jan 1 00:00:00 1970 References: <3d2f5bbd-598c-19f2-6451-a72d5da47b8a@abaxor.de> From: Philippe Gerum Subject: Re: EVL Interrupt Date: Mon, 16 May 2022 17:09:32 +0200 In-reply-to: <3d2f5bbd-598c-19f2-6451-a72d5da47b8a@abaxor.de> Message-ID: <87tu9ph5cp.fsf@xenomai.org> MIME-Version: 1.0 Content-Type: text/plain List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sebastian Blaesing Cc: xenomai@xenomai.org Sebastian Blaesing via Xenomai 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.