作者westron (魏斯通)
看板C_and_CPP
標題[問題] 中斷服務程式
時間Mon Feb 2 22:30:16 2015
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux
kernel version 2.6
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
NO
問題(Question):
如何啟動 interrupt
餵入的資料(Input):
static irqreturn_t interrupt_fn(int irq, void* dev_id)
{
printk("Hello\n");
}
QQ = request_irq(unsigned int irq, interrupt_fn, IRQF_SHARD, \
"Apple", interrupt_fn);
irq = 0b (mouse interrupt 的位置)
QQ = 0
預期的正確結果(Expected Output):
當觸發中斷時
可以在 kernel下使用 dmesg 看到 Hello
錯誤結果(Wrong Output):
當中斷產生
使用dmesg 看不到 Hello
程式碼(Code):(請善用置底文網頁, 記得排版)
如上
補充說明(Supplement):
希望有強者能幫忙
感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.235.192.164
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1422887419.A.C47.html
推 kingofsdtw: Q_Q 02/04 22:22
→ lf5471: 如果是 share irq, 只能在 fops->open 裡呼叫 02/06 00:38
→ lf5471: request_irq() 02/06 00:38