{"id":4164,"date":"2022-12-20T17:39:35","date_gmt":"2022-12-20T20:39:35","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/probe_irq_on-man9\/"},"modified":"2022-12-20T17:39:35","modified_gmt":"2022-12-20T20:39:35","slug":"probe_irq_on-man9","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/probe_irq_on-man9\/","title":{"rendered":"PROBE_IRQ_ON (man9)"},"content":{"rendered":"<h1 align=\"center\">PROBE_IRQ_ON<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#AVAILABILITY\">AVAILABILITY<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#BUGS\">BUGS<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">probe_irq_on, probe_irq_off \u2212 safe probing for IRQs<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <linux\/interrupt.h><\/b><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"58%\">\n<p style=\"margin-top: 1em\"><b>unsigned\u00a0long\u00a0probe_irq_on(void)<\/b><\/p>\n<\/td>\n<td width=\"31%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"58%\">\n<p><b>int\u00a0probe_irq_off(unsigned\u00a0long<\/b> <i>irqs<\/i><b>);<\/b><\/p>\n<\/td>\n<td width=\"31%\"> <\/td>\n<\/tr>\n<\/table>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Usage <br \/> probe_irq_on()<\/b> turns on IRQ detection. It operates by enabling all interrupts which have no handlers, while keeping the handlers for those interrupts NULL. The kernel\u2019s generic interrupt handling routine will disable these IRQs when an interrupt is received on them. <b>probe_irq_on()<\/b> adds each of these IRQ numbers to a vector which it will return. It waits approximately 100ms for any spurious interrupts that may occur, and masks these from its vector; it then returns this vector to its caller.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>probe_irq_off()<\/b> tests an internal list of enabled IRQs against its <i>irqs<\/i> parameter, which should be the value returned by the last <b>probe_irq_on()<\/b>. This function basically detects which IRQs have been switched off, and thus which ones have received interrupts.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Example<\/b> <br \/> This explanation may seem a bit confusing, so here is an example of code the mythical FUBAR 2000 driver could use to probe for IRQs:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">unsigned long irqs; <br \/> int irq;<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">irqs = probe_irq_on();<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">outb(FB2K_GIVE_ME_AN_INTERRUPT_OR_GIVE_ME_DEATH, <br \/> FB2K_CONTROL_PORT); <br \/> \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var the interrupt could take a while to occur bodies\/ usr\/ <br \/> udelay(1000);<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">irq = probe_irq_off(irqs);<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">if (irq == 0) {<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>printk(&#8220;fb2k: could not detect IRQ.n&#8221;);<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>printk(&#8220;fb2k: Installation failed.n&#8221;);<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\">} else if (irq == -1) {<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>printk(&#8220;fb2k: multiple IRQs detected.n&#8221;);<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>printk(&#8220;fb2k: Installation failed.n&#8221;);<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\">} else {<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>fb2k_dev->irq = irq;<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>printk(&#8220;fb2k: using probed IRQ %d.n&#8221;, irq);<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\">}<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>probe_irq_on()<\/b> returns a bitmap of all unhandled IRQs (except those which are receiving spurious interrupts). This value should only be used as a parameter to the next call to <b>probe_irq_off()<\/b>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>probe_irq_off()<\/b> returns the IRQ number of whichever unhandled interrupt has occurred since the last <b>probe_irq_on()<\/b>. If no interrupts have occurred on any of the marked IRQs, 0 is returned; if interrupts have occurred on more than one of these IRQs, -1 is returned.<\/p>\n<h2>AVAILABILITY <a name=\"AVAILABILITY\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Linux 1.2+. These functions are not available on m68k-based machines.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>request_irq<\/b>(9)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>arch\/*\/kernel\/irq.c<\/i><\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Neil Moore <<i>amethyst@maxwell.ml.org<\/i>><\/p>\n<h2>BUGS <a name=\"BUGS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">As mentioned above, these functions are not available on m68k-based machines.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This manpage is way too confusing.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  probe_irq_on, probe_irq_off \u2212 safe probing for IRQs <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1222],"tags":[1226,1223,1225,1244],"class_list":["post-4164","post","type-post","status-publish","format-standard","hentry","category-9-rutinas-del-nucleo","tag-1226","tag-kernel","tag-man9","tag-probe_irq_on"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4164"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4164\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}