linux - How can I know which interrupt line is shared or not, and which interrupt line is free? -


i going write pcie base serial i/o card driver in linux.

as per knowledge through configuration space, provides interrupt line, , through irqf_shared flag able share interrupt handler corresponding irq line.

but confusion how can know line shared or not shared?

kernel-assisted probing

the linux kernel offers low-level facility probing interrupt number. works nonshared interrupts, hardware capable of working in shared interrupt mode provides better ways of finding configured interrupt num- ber anyway. facility consists of 2 functions, declared in (which describes probing machinery):

unsigned long probe_irq_on(void);

this function returns bit mask of unassigned interrupts. driver must pre- serve returned bit mask, , pass probe_irq_off later. after call, driver should arrange device generate @ least 1 interrupt. int probe_irq_off(unsigned long);

after device has requested interrupt, driver calls function, passing argument bit mask returned probe_irq_on. probe_irq_off returns number of interrupt issued after “probe_on.” if no inter- rupts occurred, 0 returned (therefore, irq 0 can’t probed for, no cus- tom device can use on of supported architectures anyway). if more 1 interrupt occurred (ambiguous detection), probe_irq_off returns negative value.

the programmer should careful enable interrupts on device after call probe_irq_on , disable them before calling probe_irq_off. additionally, must remember service pending interrupt in device after probe_irq_off.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -