Linux Kernel
3.7.1
|
#include <linux/irq.h>
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/random.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/task_work.h>
#include "internals.h"
Go to the source code of this file.
Macros | |
#define | pr_fmt(fmt) "genirq: " fmt |
disable_irq - disable an irq and wait for completion : Interrupt to disable
Disable the selected interrupt line. Enables and Disables are nested. This function waits for any pending IRQ handlers for this interrupt to complete before returning. If you use this function while holding a resource the IRQ handler may need you will deadlock.
This function may be called - with care - from IRQ context.
disable_irq_nosync - disable an irq without waiting : Interrupt to disable
Disable the selected interrupt line. Disables and Enables are nested. Unlike disable_irq(), this function does not ensure existing instances of the IRQ handler have completed before returning.
This function may be called from IRQ context.
enable_irq - enable handling of an irq : Interrupt to enable
Undoes the effect of one call to disable_irq(). If this matches the last disable, processing of interrupts on this IRQ line is re-enabled.
This function may be called from IRQ context only when desc->irq_data.chip->bus_lock and desc->chip->bus_sync_unlock are NULL !
EXPORT_SYMBOL | ( | synchronize_irq | ) |
EXPORT_SYMBOL | ( | disable_irq_nosync | ) |
EXPORT_SYMBOL | ( | disable_irq | ) |
EXPORT_SYMBOL | ( | enable_irq | ) |
EXPORT_SYMBOL | ( | irq_set_irq_wake | ) |
EXPORT_SYMBOL | ( | free_irq | ) |
EXPORT_SYMBOL | ( | request_threaded_irq | ) |
EXPORT_SYMBOL_GPL | ( | setup_irq | ) |
EXPORT_SYMBOL_GPL | ( | remove_irq | ) |
EXPORT_SYMBOL_GPL | ( | request_any_context_irq | ) |
free_irq - free an interrupt allocated with request_irq : Interrupt line to free : Device identity to free
Remove an interrupt handler. The handler is removed and if the interrupt line is no longer in use by any driver it is disabled. On a shared IRQ the caller must ensure the interrupt is disabled on the card it drives before calling this function. The function does not return until any executing interrupts for this IRQ have completed.
This function must not be called from interrupt context.
free_percpu_irq - free an interrupt allocated with request_percpu_irq : Interrupt line to free : Device identity to free
Remove a percpu interrupt handler. The handler is removed, but the interrupt line is not disabled. This must be done on each CPU before calling this function. The function does not return until any executing interrupts for this IRQ have completed.
This function must not be called from interrupt context.
irq_set_irq_wake - control irq power management wakeup : interrupt to control : enable/disable power management wakeup
Enable/disable power management wakeup mode, which is disabled by default. Enables and disables must match, just as they match for non-wakeup mode support.
Wakeup mode lets this IRQ wake the system from sleep states like "suspend to RAM".
int request_percpu_irq | ( | unsigned int | irq, |
irq_handler_t | handler, | ||
const char * | devname, | ||
void __percpu * | dev_id | ||
) |
request_percpu_irq - allocate a percpu interrupt line : Interrupt line to allocate : Function to be called when the IRQ occurs. : An ascii name for the claiming device : A percpu cookie passed back to the handler function
This call allocates interrupt resources, but doesn't automatically enable the interrupt. It has to be done on each CPU using enable_percpu_irq().
Dev_id must be globally unique. It is a per-cpu variable, and the handler gets called with the interrupted CPU's instance of that variable.
int request_threaded_irq | ( | unsigned int | irq, |
irq_handler_t | handler, | ||
irq_handler_t | thread_fn, | ||
unsigned long | irqflags, | ||
const char * | devname, | ||
void * | dev_id | ||
) |
request_threaded_irq - allocate an interrupt line : Interrupt line to allocate : Function to be called when the IRQ occurs. Primary handler for threaded interrupts If NULL and thread_fn != NULL the default primary handler is installed : Function called from the irq handler thread If NULL, no irq thread is created : Interrupt type flags : An ascii name for the claiming device : A cookie passed back to the handler function
This call allocates interrupt resources and enables the interrupt line and IRQ handling. From the point this call is made your handler function may be invoked. Since your handler function must clear any interrupt the board raises, you must take care both to initialise your hardware and to set up the interrupt handler in the right order.
If you want to set up a threaded irq handler for your device then you need to supply and . is still called in hard interrupt context and has to check whether the interrupt originates from the device. If yes it needs to disable the interrupt on the device and return IRQ_WAKE_THREAD which will wake up the handler thread and run . This split handler design is necessary to support shared interrupts.
Dev_id must be globally unique. Normally the address of the device data structure is used as the cookie. Since the handler receives this value it makes sense to use it.
If your interrupt is shared you must pass a non NULL dev_id as this is required when freeing the interrupt.
Flags:
IRQF_SHARED Interrupt is shared IRQF_TRIGGER_* Specify active edge(s) or level
synchronize_irq - wait for pending IRQ handlers (on other CPUs) : interrupt number to wait for
This function waits for any pending IRQ handlers for this interrupt to complete before returning. If you use this function while holding a resource the IRQ handler may need you will deadlock.
This function may be called - with care - from IRQ context.