1

Linux ドライバーは初めてで、ハードウェア用の char ドライバーを作成しています。

ドライバー機能 (例: ioctl) の実行中に割り込み (ソフトウェア/ハードウェア) の妨害を防ぐ正確な方法は何ですか?

ありがとう、

プイ

4

1 に答える 1

2

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.

于 2010-09-18T16:00:35.430 に答える