Can I achieve functionality similar to interrupts in Linux userspace?

If I understand your question this articled sounds like what you're looking for. The article is titled: Device drivers in user space.

excerpt

UIO drivers

Linux provides a standard UIO (User I/O) framework for developing user-space-based device drivers. The UIO framework defines a small kernel-space component that performs two key tasks:

  • a. Indicate device memory regions to user space.
  • b. Register for device interrupts and provide interrupt indication to user space.

The kernel-space UIO component then exposes the device via a set of sysfs entries like /dev/uioXX. The user-space component searches for these entries, reads the device address ranges and maps them to user space memory.

The user-space component can perform all device-management tasks including I/O from the device. For interrupts however, it needs to perform a blocking read() on the device entry, which results in the kernel component putting the user-space application to sleep and waking it up once an interrupt is received.

I've never done this before so I can not offer you much more guidance than this, but thought it might be helpful towards your quest.


Thinking along the same lines as @RBerteig, the BeagleBone Black contains Programmable Real-Time Unit (PRU) 32 bit microcontrollers.

It doesn't look like there's a huge community using these things to full capability. I'm not even sure there's a good compiler for this. The advantages over an assembly of an SBC and a microcontroller or microcontroller board are that the PRU code can come from the main ARM, and shared memory is pretty convenient.

Can't say I've used this, or even that I've run more than some examples on my BeagleBone Blacks yet, but the needs expressed in this question might be one of those things that can nudge a developer with these needs towards the Black and away from the Pi.

Tags:

Linux

Embedded