简体   繁体   English

linux disable_irq() 和 local_irq_save()

[英]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.我发现 disable_irq() 禁用特定中断,另一方面 local_irq_save() 禁用所有中断。

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 .此代码禁用(屏蔽) interrupt controller中的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.它不会被优先处理,也不会被路由到目标 CPU。

local_irq_save(flags);

This code disables all interrupts at the level of CPU IRQ interface.此代码禁用 CPU IRQ 接口级别的所有中断。 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.中断在通过中断控制器的优先级和路由管道并已被断言给 CPU 后被传递到 CPU IRQ 接口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 似乎disable_irq无法真正掩盖中断 - it seems disable_irq can't really mask the interrupt disable_local_irq 和 kernel 定时器 - disable_local_irq and kernel timers preempt_disable / enable和raw_local_irq_save / restore在基准测试中的作用 - Role of preempt_disable/enable and raw_local_irq_save/restore in benchmarking 在STM32上禁用IRQ - Disable IRQ on STM32 Linux 内核:自旋锁 SMP:为什么在 spin_lock_irq SMP 版本中有一个 preempt_disable()? - Linux Kernel: Spinlock SMP: Why there is a preempt_disable() in spin_lock_irq SMP version? linux内核源2.6.34:为什么会存在两个结构irq_desc * irq_to_desc(unsigned int irq)的函数声明? - linux kernel source 2.6.34 : why could two function declarations of struct irq_desc *irq_to_desc(unsigned int irq) exist? 如何在内核 Linux 中工作内核 irq 线程? - How to work kernel irq thread in kernel Linux? 为什么 Linux kernel 不会在返回 IRQ_HANDLED 的共享 IRQ 的第一个处理程序处停止? - Why does the Linux kernel not stop at the first handler for a shared IRQ that returns IRQ_HANDLED? 如何从C / C ++在Linux中设置IRQ优先级? - How to set IRQ priority in Linux from C/C++? 调用 spin_lock_irqsave,而不是 local_irq_disable 后跟 spin_lock,对于每个处理器的结构是否相同? - Is calling spin_lock_irqsave, instead of local_irq_disable followed by spin_lock, the same for a per-prorcessor struct?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM