[Linux drivers] [Linux Interrupt]--Interrupt processing

Source: Internet
Author: User

One, interrupt handler function
The interrupt handler function runs in the interrupt context and cannot be preempted or dispatched.
There are a few things to note about interrupt context programming:
Cannot sleep or call schedule to abandon CPU
You cannot call any function that may sleep, for example: to get the semaphore
The user spatial data cannot be accessed, for example: Copy_from_user, because it is not executed in the context of the process.
Execution time as short as possible

int REQUEST_IRQ (unsigned int IRQ, irq_handler_t handler, unsigned long flags, const char *name, void *dev_id)
Request interrupted, return 0 indicates success, negative number indicates error code
IRQ: Interrupt Number
Handler: Interrupt handler function
Flags: Interrupt Flag
Name: Interrupt name, displayed in/proc/interrupts
DEV_ID: Used as a shared interrupt pointer to identify different shared interrupt int

void Free_irq (unigned int IRQ, void *dev_id)
Release interrupts
Interrupt handler function is generally installed when the driver is initialized or when the device is first opened, and the interrupt line is limited on the system, so it is wasteful to install the interrupt handler when the driver is initialized, which is usually installed when the device is opened for the first time. Using FREE_IRQ is usually the last time the device is closed.

[Linux drivers] [Linux Interrupt]--Interrupt processing

Related Article

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.