How to disable interrupts from JNI code?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to disable interrupts from JNI code?

Dave McLaughlin
I need to disable interrupts for no more than 5 to 10us in a JNI library as I need to be sure that the GPIO high pulse gets extended by any other tasks.

I found these Linux functions in another driver but I can't seem to find the header file for it in the NDK.

local_irq_save(flags);
local_irq_restore(flags);

Does anyone know the correct functions and header files to disable interrupts?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/3874d894-d5ad-4943-a2cc-950dfbb3863co%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to disable interrupts from JNI code?

Glenn Kasten
Android native code, including JNI, runs in user mode and has no more permissions or capabilities than managed code (Java, Kotlin).
You'll need to write a device driver that runs in kernel mode.

On Thursday, June 18, 2020 at 1:27:40 AM UTC-7, Dave McLaughlin wrote:
I need to disable interrupts for no more than 5 to 10us in a JNI library as I need to be sure that the GPIO high pulse gets extended by any other tasks.

I found these Linux functions in another driver but I can't seem to find the header file for it in the NDK.

local_irq_save(flags);
local_irq_restore(flags);

Does anyone know the correct functions and header files to disable interrupts?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/6478e9b7-db5b-477f-bd97-37cedb485bc0o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to disable interrupts from JNI code?

Dave McLaughlin
Thanks Glenn, 

I came across an HX711 driver in one of the Linux github sources so I was able to build this into the Android kernel this morning. I now just need to figure out how to use this and read the data from it.


On Thursday, 18 June 2020 21:03:41 UTC+7, Glenn Kasten wrote:
Android native code, including JNI, runs in user mode and has no more permissions or capabilities than managed code (Java, Kotlin).
You'll need to write a device driver that runs in kernel mode.

On Thursday, June 18, 2020 at 1:27:40 AM UTC-7, Dave McLaughlin wrote:
I need to disable interrupts for no more than 5 to 10us in a JNI library as I need to be sure that the GPIO high pulse gets extended by any other tasks.

I found these Linux functions in another driver but I can't seem to find the header file for it in the NDK.

local_irq_save(flags);
local_irq_restore(flags);

Does anyone know the correct functions and header files to disable interrupts?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/6a3905c5-e0bf-45fe-8a1e-11e62d6950ado%40googlegroups.com.