b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

系统的概念 GIC代码分析(18)

电脑杂谈  发布时间:2018-02-14 06:28:57  来源:网络整理

u32 confoff = (gicirq / 16) * 4;

bool enabled = false;

u32 val;

/* Interrupt configuration for SGIs can't be changed */

if (gicirq < 16)

return -EINVAL;

if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)

return -EINVAL;

raw_spin_lock(&irq_controller_lock);

if (gic_arch_extn.irq_set_type)

gic_arch_extn.irq_set_type(d, type);

val = readl_relaxed(base + GIC_DIST_CONFIG + confoff);

if (type == IRQ_TYPE_LEVEL_HIGH)

val &= ~confmask;

else if (type == IRQ_TYPE_EDGE_RISING)

val |= confmask;

/*

* As recommended by the spec, disable the interrupt before changing

* the configuration

*/

if (readl_relaxed(base + GIC_DIST_ENABLE_SET + enableoff) & enablemask) {

writel_relaxed(enablemask, base + GIC_DIST_ENABLE_CLEAR + enableoff);

enabled = true;

}

writel_relaxed(val, base + GIC_DIST_CONFIG + confoff);

if (enabled)

writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);

raw_spin_unlock(&irq_controller_lock);

return 0;

}

对于SGI类型的interrupt,是不能修改其type的,因为GIC中SGI固定就是edge-triggered。对于GIC,其type只支持高电平触发(IRQ_TYPE_LEVEL_HIGH)和上升沿触发(IRQ_TYPE_EDGE_RISING)的中断。另外需要注意的是,在更改其type的时候,先disable,然后修改type,然后再enable。

(5)gic_retrigger

这个接口用来resend一个IRQ到CPU。

static int gic_retrigger(struct irq_data *d)

{

if (gic_arch_extn.irq_retrigger)

return gic_arch_extn.irq_retrigger(d);

/* the genirq layer expects 0 if we can't retrigger in hardware */

return 0;

}

看起来这是功能不是通用GIC拥有的功能,各个厂家在集成GIC的时候,有可能进行功能扩展。

(6)gic_set_affinity

在多处理器的环境下,外部设备产生了一个中断就需要送到一个或者多个处理器去,这个设定是通过设定处理器的affinity进行的。具体代码如下:


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/shumachanpin/article-76887-18.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 李静乐
      李静乐

      这好比日本车与纯国产车

    • 边吉豫
      边吉豫

      没办法三哥平均智商只有82

    每日福利
    热点图片
    拼命载入中...