简体   繁体   中英

linux disable_irq() and local_irq_save()

I have a piece of code where there is:

disable_irq(irq_clk);
local_irq_save(flags);

I found that the disable_irq() disables a specific interrupt, on the other hand local_irq_save() disables all the interrupt.

So I wonder the meaning of the above code.

This makes sense, because interrupts are disabled at different levels.

disable_irq(irq_clk);

This code disables (masks) interrupt in interrupt controller . If you have disabled interrupt at this level, the interrupt wouldn't be passed to internal interrupt controller pipeline. It would not be prioritized, it would not be routed to the destination CPU.

local_irq_save(flags);

This code disables all interrupts at the level of CPU IRQ interface. Interrupts are passed to CPU IRQ interface after they have passed priority & routing pipeline of the interrupt controller and have been asserted to the CPU.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM