"Turn" 14.5.6 disable and activate the disconnection

Source: Internet
Author: User

Original URL: http://book.51cto.com/art/201311/418637.htm

14.5.6 disable and activate the disconnection

Several macros discussed in the previous section can only disable and activate all interrupts on the processor. In some cases, however, you only need to disable or activate a specific medium break. This requires the use of some of the functions discussed in this section. The functions for prohibiting and activating specific interrupt lines are as follows:

    1. void Disable_irq (unsigned int IRQ);
    2. void Disable_irq_nosync (unsigned int IRQ);
    3. void Enable_irq (unsigned int IRQ);
    4. void Synchronize_irq (unsigned int IRQ);

The DISABLE_IRQ and Disable_irq_nosync functions are used to prohibit interrupts specified on the controller, which means that the specified interrupt (IRQ) is forbidden to pass to all processors in the system. The difference between these two functions is that the DISABLE_IRQ function returns only after all the handlers that are currently executing are completed, and the Disable_irq_nosync function returns immediately (regardless of whether or not a handler is currently running out).

The ENABLE_IRQ function is used to activate a specified medium break on the interrupt controller. The SYNCHRONIZE_IRQ function is used to wait for all handlers on a particular interrupt line to finish executing. If a handler on a particular interrupt line has not finished executing, the SYNCHRONIZE_IRQ function will always block. In fact, the DISABLE_IRQ function is implemented by Disable_irq_nosync and SYNCHRONIZE_IRQ functions together. The Disable_irq_nosync function is called first to prohibit a particular medium line break. Then according to irqdesc.action determine whether there are handlers on the interrupt line executing. Irqdesc.action is a pointer to the first item in the linked list that points to the handler pointer on the interrupt line. If Irqdesc.action is 0, indicating that the list is empty, it also indicates that the handlers on the interrupt line have been executed. The code for the DISABLE_IRQ function is as follows:

      1. void Disable_irq (unsigned int IRQ)
      2. {
      3. struct Irqdesc *desc = Irq_desc + IRQ;
      4. Disable_irq_nosync (IRQ);
      5. if (desc->action)
      6. SYNCHRONIZE_IRQ (IRQ);
      7. }

"Turn" 14.5.6 disable and activate the disconnection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.