編寫Linux中斷驅動時,由於頭文件缺失引起的編譯錯誤


內核版本:2.6.32.2

錯誤:

  error:implicit declaration of function 'request_irq'

  error:implicit declaration of function 'free_irq'

解決方法:

  #include <linux/interrupt.h>

 

錯誤:

  error: 'IRQT_BOTHEDGE' undeclared (first use in this function)

解決方法:

  #define __IRQT_FALEDGE IRQ_TYPE_EDGE_FALLING
  #define __IRQT_RISEDGE IRQ_TYPE_EDGE_RISING
  #define __IRQT_LOWLVL IRQ_TYPE_LEVEL_LOW
  #define __IRQT_HIGHLVL IRQ_TYPE_LEVEL_HIGH
  #define IRQT_NOEDGE (0)
  #define IRQT_RISING (__IRQT_RISEDGE)
  #define IRQT_FALLING (__IRQT_FALEDGE)
  #define IRQT_BOTHEDGE (__IRQT_RISEDGE|__IRQT_FALEDGE)
  #define IRQT_LOW (__IRQT_LOWLVL)
  #define IRQT_HIGH (__IRQT_HIGHLVL)
  #define IRQT_PROBE IRQ_TYPE_PROBE

 

錯誤:

  error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
  error: implicit declaration of function 'signal_pending'
  error: implicit declaration of function 'schedule'

解決方法:

  #include <linux/sched.h>

 

錯誤:

  error:implicit declaration of function 's3c2410_gpio_getpin'

解決方法:

  #include <linux/gpio.h>

 

另外還有其他的一些問題解決方法可以參考:

asm/arch/regs-gpio.h: No such file or directory:

http://www.armbbs.net/forum.php?mod=viewthread&tid=11269

class_create報錯:

http://hi.baidu.com/pleasehyj/item/cf1ad5334c3ac0b8623affcd


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM