how do I block all IRQ's during short (5ms) frame data transfer
I am an old hand with hard开发者_StackOverflow中文版ware and device drivers and used much earlier Linux versions for hardware control. I am recently back in the game of Linux and device control using embedded processing and have discovered a lot has changed in the Linux world (for the better). However, I am struggling with a hardware control issue involving a very fast SPI-based frame data transfer kernel module that needs to turn of all interrupts for a short time-frame (5msec) to insure proper data transfer timing for the data frame. In the 'old days' of Linux one would use a save_flags - cli() - sti() framework to disable interrupts for the critical section. What is the simplest way to accomplish this within the new (2.6.33 and newer) Linux IRQ control framework.
Scott
The modern equivalents are local_irq_disable()
, local_irq_enable()
, local_irq_save()
and local_irq_restore()
. However, doing so for such a long time period (and make no mistake, at modern CPU speeds 5 ms is a long time) is considered pretty antisocial.
Be aware also that modern machines have SMIs (System Management Interrupts) which can't be masked and which can take over the CPU for a distressing length of time, so your code might need to handle that case.
The kernel these days is preemptable and has high-resolution timers for kernel code - your code may be able to use these instead (see include/linux/hrtimer.h
).
精彩评论