Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5361

Advanced users • Re: "Realtime" GPIO with bcm2835 (AirSpayce)library, how to turn scheduling back on

$
0
0
preempt_disable() and preempt_enable() give me implicit declaration errors, which library must I #include to get them?
I think you need to be using a PREEMPT_RT kernel, and then, you need to write your code as a kernel module.
Surely there should be a way for user land C code to take absolute control (and yes I run with sudo rights) of the Pi for a mere 2ms, before relinquishing and letting everything and anything else go ahead and do their things?
I suspect that would be bad in a multi-user operating system like Linux, so there is no API for it.

You may need to write your procedure as a kernel module instead of a user program. Theoretically, you could then expose a /sys/ interface for it, and kick it off from your user program by writing to a file there (i.e. `echo 1 > /sys/my_realtime_module/initiate`). Inside the kernel module, you could then disable interrupts with `local_irq_disable()`, run your short-lived realtime procedure, and then enable interrupts with `local_irq_enable()`.

If I can find the time in the next couple of days, I may give it a try, but I'm a bit preoccupied right now with other things.

Statistics: Posted by JinShil — Fri Jan 26, 2024 4:08 am



Viewing all articles
Browse latest Browse all 5361

Trending Articles