Hi,
I am new to linux driver and writing a char driver for hardware.
What is the exact way to prevent interrupt(software/hardware) jamming in while the driver functions (eg. ioctl) is executing?
Thanks,
Pui
Hi,
I am new to linux driver and writing a char driver for hardware.
What is the exact way to prevent interrupt(software/hardware) jamming in while the driver functions (eg. ioctl) is executing?
Thanks,
Pui
Did you mean disabling all interrupts in the system ? That is not actually not a good idea.
If you have a section of code and you want to make sure that an unexpected interrupt doesn't come in the way, have a look at spin_lock_irqsave(). This will disable interrupts locally. When you are done, you can then use spin_lock_irqrestore().
If you are concerned about only updating a variable, you might consider making it atomic(atomic_t).
Lastly, if you are only thinking of disabling interrupts from your char hardware when the driver is executing a certain kind of function, that will be hardware dependent. For example, for the LSI 1068E, you have to write 0xFFFFFFFF to the IntMask register. You can also ask the kernel to disable an interrupt line by using disable_irq() on that interrupt line but that is not probably what you want.