当前位置: 代码迷 >> 驱动开发 >> request_irq函数中 flags参数的疑问
  详细解决方案

request_irq函数中 flags参数的疑问

热度:34   发布时间:2016-04-28 10:29:52.0
求助 request_irq函数中 flags参数的疑问
request_irq 中flags设为0表示什么意思
在spi_s3c24xx.c中 err = request_irq(IRQ_SPI1, s3c24xx_spi_irq, 0, pdev->name, hw);这句话什么意思

------解决方案--------------------
中断的属性标志,你搜一下IRQF_SHARED这个宏,相邻的一些值都是针对flags进行设置的。具体怎么设看自己需要了。
request_irq主要是向系统申请一个中断,并将中断号IRQ_SPI1和中断处理函数s3c24xx_spi_irq关联起来,pdev->name是传入的名字——随便起。hw是传入到处理函数中的的一个结构体指针,这个主要是在处理中断的时候获取hw里面的一些信息。

在后面发送或者接收数据时,等你是能中断后,s3c24xx_spi_irq里面就可以处理数据了。


------解决方案--------------------

/*
 * These flags used only by the kernel as part of the
 * irq handling routines.
 *
 * IRQF_DISABLED - keep irqs disabled when calling the action handler
 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
 * IRQF_SHARED - allow sharing the irq among several devices
 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
 * IRQF_PERCPU - Interrupt is per cpu
 * IRQF_NOBALANCING - Flag to exclude this interrupt from irq balancing
 * IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
 *                registered first in an shared interrupt is considered for
 *                performance reasons)
 */
#define IRQF_DISABLED 0x00000020
#define IRQF_SAMPLE_RANDOM 0x00000040
#define IRQF_SHARED 0x00000080
#define IRQF_PROBE_SHARED 0x00000100
#define IRQF_TIMER 0x00000200
#define IRQF_PERCPU 0x00000400
#define IRQF_NOBALANCING 0x00000800
#define IRQF_IRQPOLL 0x00001000
  相关解决方案