I have a couple of functions that do async communication over SPI using ioctl calls.
These functions are very quick to execute because the data payloads are only a few bytes – however – it is imperative that the timing isn’t interrupted.
I noticed that these functions are sometimes interrupted as the CPU services other threads – this ends up breaking the async communication; it changes the timing.
For these two functions how can I specify that they may not be interrupted ?
I don’t think you can do that with a regular program on most normal OS’s ( like windows, OsX, linux). If you could, then malware could lock up your machine by simply declaring an infinite loop to be un-interruptible. It might be possible to do something like this in a device driver. If you really need this level of control there are real-time OSs for that.
I think you can do this in Linux in a Kernel module.