Java Hardware Interrupt Handling

I would like to know if it is possible to automatically call the Java method when a hardware interrupt fails.

+4
source share
6 answers

There may be an alternative.

I am doing something similar: in the application I track 4 mice for clicks. These clicks generate interrupts, but I am pleased enough not to directly access them with Java.

On Linux, it turns out that there are device files ( /dev/input/mouse# ) that tear out a bunch of characters when something happens to the mouse. I have Thread for each of them with a FileReader lock when reading. After the characters arrive, the opening stream is unlocked, and I can do any processing that I like.

So the idea is this: if possible, find a way to make the device driver make the data available to you in the form of a file / device, then you can access it from Java using only I / O calls from the Java library, without a weird bit-torsion code and C required between them.

+4
source

In principle, yes, but in order to associate this with Java, you need some C and JNI code. If you're lucky, maybe someone has already created the right library for your palm of interest.

Bottom line: if you can do this in C, you can connect it to Java.

+3
source

If you want to directly respond to an interrupt from Java, then the virtual machine will have to run in kernel space (or on some systems with user space drivers in the driver context). JamaicaVM works in this mode on some RTOS, such as Thread-X or VxWorks, like DKM. The next release of RTSJ will support Java interrupt functions.

RTSJ can be used to run second-level interrupt handlers even in user space. This requires a small device driver that either sends a POSIX signal to the virtual machine, or provides a personal device interface where one thread in the blocks of the virtual machine is blocked while reading the device. In the first case, AsyncEventHandler may be associated with a POSIX signal. In the second case, protectors that block when the device is reading can start AsyncEvent every time a byte is read from the device. Any AsyncEventHandler attached to AsyncEvebt will then be released.

If you want to try this under Linux, you can download the personal version of JamaicaVM: "http://www.aicas.com/jamaica-pe.html". JamaicaVM has a real-time garbage collector, and the code can be statically compiled to provide real-time performance. This is a different deployment model than the regular JVM.

+2
source

Here is a paper that handles the same topic. And you can take a look at SWT , I think they also deal with hardware interrupts, although they can rely on API operating systems.

+1
source

It is standard for a real-time embedded Java application. go to www.ajile.com or systrmonx.com and buy an evaluation fee.

Embedded java is not standard on a PC. you can get java in real time on pc but not embedded bit.

0
source

Take a look at Swig . the Java implementation has Directors , which allows you to call Java from C / C ++.

I used this technology to handle interrupts calling in C # and it worked great. Should not be very different from Java.

0
source

All Articles