LinuxÒÁµéÔ°ÂÛ̳'s Archiver

ó«òë123 ·¢±íÓÚ 2008-3-10 17:03

Öжϴ¦Àí³ÌÐòÖеÄstatusµÄÖµµÄÎÊÌâ

[size=7][/size] ÔÚÖжϴ¦Àí³ÌÐòirq.cÖеÄ
asmlinkage unsigned int do_IRQ(struct pt_regs regs)

{      

        /*  º¯Êý·µ»Ø0ÔòÒâζ×ÅÕâ¸öirqÕýÔÚÓÉÁíÒ»¸öCPU½øÐд¦Àí£¬

»òÕâÌõÖжÏÏß±»½ûÓÃ*/

      

        int irq = regs.orig_eax & 0xff;     /* »¹Ô­ÖжϺŠ*/

        int cpu = smp_processor_id();    £¯*»ñµÃCPUºÅ*/

        irq_desc_t *desc = irq_desc + irq;  £¯*ÔÚirq_desc[]Êý×éÖлñµÃirq µÄÃèÊö·û*£¯

        struct irqaction * action;

        unsigned int status;



        kstat.irqs[cpu][irq]++;

        spin_lock(&desc->lock);  £¯£ªÕë¶Ô¶à´¦Àí»ú¼ÓËø£ª£¯   

        desc->handler->ack(irq);  £¯£ªCPU¶ÔÖжÏÇëÇó¸øÓèÈ·ÈÏ£ª£¯

      

        status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
   [color=Red][size=7]ÔÚÕâÀïÓÉÓÚÖжϳõʼ»¯µÄʱºòdesc->status  = IRQ_DISABLED,
      ÄÇôÏÖÔÚµÄstatus  = (0000 0010)&~(0010 1000 );
   ËùÒÔstatus »¹ÊÇΪ IRQ_DISABLED
[/size][/color]

        status |= IRQ_PENDING; /* we _want_ to handle it */
[color=Red][size=7]ÔÚÕâÀïstatus  = 0000 0110 [/size][/color]
         

               

        action = NULL;
     [color=Red][size=7]¶øÕâ¶ùµÄÅжÏstatus ÓÀԶΪ·Ç 0 ËùÒÔ if ½«²»»á±»Ö´ÐÐ ÎÒµÄÀí½âÊÇÕâÑùµÄµ«ÊÇ
ÎÒÖªµÀÊÇÓдíµÄ¾ÍÊDz»ÖªµÀ´íÔÚÄĶù,Íû¸÷λ¸ßÊÖÖ¸µãÒ»ÏÂ[/size][/color]
        if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {

                action = desc->action;

                status &= ~IRQ_PENDING; /* we commit to handling */

                status |= IRQ_INPROGRESS; /* we are handling it */

        }

ó«òë123 ·¢±íÓÚ 2008-3-10 17:05

ÔÚÏߵȺò
:lol лл

ó«òë123 ·¢±íÓÚ 2008-3-10 17:18

Ŷ»ÐÈ»´óÎæ
Ô­À´ÔÚÖжÏÉêÇ뺯Êýint request_irq(unsigned int irq,
                void (*handler)(int, void *, struct pt_regs *),
                unsigned long irqflags,
                const char * devname,
                void *dev_id)
Öе÷ÓÃint setup_irq(unsigned int irq, struct irqaction * new)µÄº¯ÊýÖиıäÁËdesc->statusµÄÖµ
        if (!shared) {
                desc->depth = 0;
                desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING);
                desc->handler->startup(irq);
        }

Ò³: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.